@rxap/form-window-system 16.0.3-dev.0 → 17.0.1-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,116 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectFlags, INJECTOR, Optional, Injector, Injectable, Inject, InjectionToken, EventEmitter, isDevMode, Directive, HostBinding, Input, Output, TemplateRef, ViewContainerRef, HostListener } from '@angular/core';
2
+ import { Directive, Inject, TemplateRef, ViewContainerRef, InjectFlags, INJECTOR, Optional, Injector, Injectable, EventEmitter, Input, Output, HostListener, InjectionToken, isDevMode, HostBinding } from '@angular/core';
3
+ import * as i1 from '@rxap/forms';
4
+ import { FormSubmitDirective, FormDirective, RxapFormBuilder, RXAP_FORM_DEFINITION_BUILDER, RXAP_FORM_DEFINITION, RXAP_FORM_INITIAL_STATE, RXAP_FORM_SUBMIT_METHOD, RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD, RXAP_FORM_LOAD_METHOD, RXAP_FORM_CONTEXT, ToFormMethod } from '@rxap/forms';
5
+ import { tap } from 'rxjs/operators';
6
+ import * as i2 from '@rxap/window-system';
7
+ import { RXAP_WINDOW_REF, WindowRef, WindowService } from '@rxap/window-system';
8
+ import { TemplatePortal } from '@angular/cdk/portal';
9
+ import { __decorate, __param, __metadata } from 'tslib';
3
10
  import { FormSystemMetadataKeys } from '@rxap/form-system';
4
- import * as i1$1 from '@rxap/forms';
5
- import { RxapFormBuilder, RXAP_FORM_DEFINITION_BUILDER, RXAP_FORM_DEFINITION, RXAP_FORM_INITIAL_STATE, RXAP_FORM_SUBMIT_METHOD, RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD, RXAP_FORM_LOAD_METHOD, RXAP_FORM_CONTEXT, ToFormMethod, FormDirective } from '@rxap/forms';
6
11
  import { getMetadata } from '@rxap/reflect-metadata';
7
12
  import { DeleteUndefinedProperties, coerceBoolean } from '@rxap/utilities';
8
- import * as i1 from '@rxap/window-system';
9
- import { WindowService, WindowRef, RXAP_WINDOW_REF } from '@rxap/window-system';
10
- import { __decorate, __param, __metadata } from 'tslib';
11
- import { ConfirmClick } from '@rxap/directives';
12
- import { TemplatePortal } from '@angular/cdk/portal';
13
13
  import { CounterSubject } from '@rxap/rxjs';
14
+ import { ConfirmClick } from '@rxap/directives';
15
+
16
+ class CloseWindowAfterSubmitDirective {
17
+ constructor(formSubmit, windowRef) {
18
+ this.formSubmit = formSubmit;
19
+ this.windowRef = windowRef;
20
+ }
21
+ ngOnInit() {
22
+ this._subscription = this.formSubmit.afterSubmit
23
+ .pipe(tap(() => this.windowRef.complete()))
24
+ .subscribe();
25
+ }
26
+ ngOnDestroy() {
27
+ this._subscription?.unsubscribe();
28
+ }
29
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: CloseWindowAfterSubmitDirective, deps: [{ token: FormSubmitDirective }, { token: RXAP_WINDOW_REF }], target: i0.ɵɵFactoryTarget.Directive }); }
30
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: CloseWindowAfterSubmitDirective, isStandalone: true, selector: "[rxapFormSubmit][rxapCloseWindowAfterSubmit]", ngImport: i0 }); }
31
+ }
32
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: CloseWindowAfterSubmitDirective, decorators: [{
33
+ type: Directive,
34
+ args: [{
35
+ selector: '[rxapFormSubmit][rxapCloseWindowAfterSubmit]',
36
+ standalone: true,
37
+ }]
38
+ }], ctorParameters: () => [{ type: i1.FormSubmitDirective, decorators: [{
39
+ type: Inject,
40
+ args: [FormSubmitDirective]
41
+ }] }, { type: undefined, decorators: [{
42
+ type: Inject,
43
+ args: [RXAP_WINDOW_REF]
44
+ }] }] });
45
+
46
+ class FormWindowFooterDirective {
47
+ constructor(formDirective, windowRef, template, viewContainerRef) {
48
+ this.formDirective = formDirective;
49
+ this.windowRef = windowRef;
50
+ this.template = template;
51
+ this.viewContainerRef = viewContainerRef;
52
+ }
53
+ /**
54
+ * Asserts the correct type of the context for the template that `NgForOf` will render.
55
+ *
56
+ * The presence of this method is a signal to the Ivy template type-check compiler that the
57
+ * `NgForOf` structural directive renders its template with a specific context type.
58
+ */
59
+ static ngTemplateContextGuard(dir, ctx) {
60
+ return true;
61
+ }
62
+ ngOnInit() {
63
+ this.windowRef.setFooterPortal(new TemplatePortal(this.template, this.viewContainerRef, {
64
+ $implicit: this.windowRef,
65
+ formDefinition: this.formDirective.formDefinition,
66
+ formDirective: this.formDirective,
67
+ }));
68
+ }
69
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: FormWindowFooterDirective, deps: [{ token: FormDirective }, { token: RXAP_WINDOW_REF }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
70
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: FormWindowFooterDirective, isStandalone: true, selector: "[rxapFormWindowFooter]", ngImport: i0 }); }
71
+ }
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: FormWindowFooterDirective, decorators: [{
73
+ type: Directive,
74
+ args: [{
75
+ selector: '[rxapFormWindowFooter]',
76
+ standalone: true,
77
+ }]
78
+ }], ctorParameters: () => [{ type: i1.FormDirective, decorators: [{
79
+ type: Inject,
80
+ args: [FormDirective]
81
+ }] }, { type: i2.WindowRef, decorators: [{
82
+ type: Inject,
83
+ args: [RXAP_WINDOW_REF]
84
+ }] }, { type: i0.TemplateRef, decorators: [{
85
+ type: Inject,
86
+ args: [TemplateRef]
87
+ }] }, { type: i0.ViewContainerRef, decorators: [{
88
+ type: Inject,
89
+ args: [ViewContainerRef]
90
+ }] }] });
91
+
92
+ /**
93
+ * @deprecated removed
94
+ */
95
+ let FormWindowRef = class FormWindowRef {
96
+ constructor(formDefinition, windowRef) {
97
+ this.formDefinition = formDefinition;
98
+ this.windowRef = windowRef;
99
+ }
100
+ submit() {
101
+ throw new Error('Not yet implemented!');
102
+ }
103
+ reset() {
104
+ throw new Error('Not yet implemented!');
105
+ }
106
+ close(result) {
107
+ this.windowRef.close(result);
108
+ }
109
+ };
110
+ FormWindowRef = __decorate([
111
+ __param(1, Inject(WindowRef)),
112
+ __metadata("design:paramtypes", [Object, WindowRef])
113
+ ], FormWindowRef);
14
114
 
15
115
  class FormWindowService {
16
116
  constructor(windowService, injector) {
@@ -106,44 +206,170 @@ class FormWindowService {
106
206
  }
107
207
  return component;
108
208
  }
109
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormWindowService, deps: [{ token: WindowService }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Injectable }); }
110
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormWindowService, providedIn: 'root' }); }
209
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: FormWindowService, deps: [{ token: WindowService }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Injectable }); }
210
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: FormWindowService, providedIn: 'root' }); }
111
211
  }
112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormWindowService, decorators: [{
212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: FormWindowService, decorators: [{
113
213
  type: Injectable,
114
214
  args: [{
115
215
  providedIn: 'root',
116
216
  }]
117
- }], ctorParameters: function () { return [{ type: i1.WindowService, decorators: [{
217
+ }], ctorParameters: () => [{ type: i2.WindowService, decorators: [{
118
218
  type: Inject,
119
219
  args: [WindowService]
120
220
  }] }, { type: i0.Injector, decorators: [{
121
221
  type: Inject,
122
222
  args: [INJECTOR]
123
- }] }]; } });
223
+ }] }] });
124
224
 
125
- /**
126
- * @deprecated removed
127
- */
128
- let FormWindowRef = class FormWindowRef {
129
- constructor(formDefinition, windowRef) {
130
- this.formDefinition = formDefinition;
131
- this.windowRef = windowRef;
225
+ class OpenFormWindowMethodDirective {
226
+ constructor(injector = null) {
227
+ this.injector = injector;
228
+ // eslint-disable-next-line @angular-eslint/no-output-rename
229
+ this.failure$ = new EventEmitter();
230
+ // eslint-disable-next-line @angular-eslint/no-output-rename
231
+ this.completed$ = new EventEmitter();
232
+ // eslint-disable-next-line @angular-eslint/no-output-rename
233
+ this.submitted$ = new EventEmitter();
234
+ /**
235
+ * true - a remote method call is in progress
236
+ */
237
+ this.executing$ = new CounterSubject(0);
238
+ /**
239
+ * Set of all active window ref instances.
240
+ *
241
+ * Used to distory all windows of the directive is
242
+ * destroyed
243
+ * @protected
244
+ */
245
+ this._windowRefInstance = new Set();
246
+ this._hasConfirmDirective = false;
132
247
  }
133
- submit() {
134
- throw new Error('Not yet implemented!');
248
+ // eslint-disable-next-line @angular-eslint/no-input-rename
249
+ set hasConfirmDirective(value) {
250
+ this._hasConfirmDirective = coerceBoolean(value);
135
251
  }
136
- reset() {
137
- throw new Error('Not yet implemented!');
252
+ ngOnDestroy() {
253
+ this._windowRefInstance.forEach(windowRef => windowRef.complete());
138
254
  }
139
- close(result) {
140
- this.windowRef.close(result);
255
+ onConfirmed() {
256
+ this.execute();
141
257
  }
142
- };
143
- FormWindowRef = __decorate([
144
- __param(1, Inject(WindowRef)),
145
- __metadata("design:paramtypes", [Object, WindowRef])
146
- ], FormWindowRef);
258
+ onClick() {
259
+ if (!this._hasConfirmDirective) {
260
+ this.execute();
261
+ }
262
+ else {
263
+ console.debug('skip remote method call. Wait for confirmation.');
264
+ }
265
+ }
266
+ execute() {
267
+ this.executing$.increase();
268
+ const windowRef = this.method.call(this.initial, {
269
+ providers: this.providers,
270
+ injector: this.injector,
271
+ });
272
+ windowRef.subscribe((value) => this.submitted(value), (error) => this.failure(error), () => {
273
+ this.completed();
274
+ this.executing$.decrease();
275
+ this._windowRefInstance.delete(windowRef);
276
+ });
277
+ }
278
+ submitted(value) {
279
+ this.submitted$.emit(value);
280
+ }
281
+ failure(error) {
282
+ this.failure$.emit(error);
283
+ }
284
+ completed() {
285
+ this.completed$.emit();
286
+ }
287
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormWindowMethodDirective, deps: [{ token: INJECTOR, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
288
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: OpenFormWindowMethodDirective, isStandalone: true, selector: "[rxapOpenFormWindowMethod]", inputs: { method: ["rxapOpenFormWindowMethod", "method"], initial: "initial", providers: "providers", hasConfirmDirective: ["rxapConfirm", "hasConfirmDirective"] }, outputs: { failure$: "failure", completed$: "completed", submitted$: "submitted" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick()" } }, ngImport: i0 }); }
289
+ }
290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormWindowMethodDirective, decorators: [{
291
+ type: Directive,
292
+ args: [{
293
+ selector: '[rxapOpenFormWindowMethod]',
294
+ standalone: true,
295
+ }]
296
+ }], ctorParameters: () => [{ type: i0.Injector, decorators: [{
297
+ type: Optional
298
+ }, {
299
+ type: Inject,
300
+ args: [INJECTOR]
301
+ }] }], propDecorators: { method: [{
302
+ type: Input,
303
+ args: ['rxapOpenFormWindowMethod']
304
+ }], initial: [{
305
+ type: Input
306
+ }], failure$: [{
307
+ type: Output,
308
+ args: ['failure']
309
+ }], completed$: [{
310
+ type: Output,
311
+ args: ['completed']
312
+ }], submitted$: [{
313
+ type: Output,
314
+ args: ['submitted']
315
+ }], providers: [{
316
+ type: Input
317
+ }], hasConfirmDirective: [{
318
+ type: Input,
319
+ args: ['rxapConfirm']
320
+ }], onConfirmed: [{
321
+ type: HostListener,
322
+ args: ['confirmed']
323
+ }], onClick: [{
324
+ type: HostListener,
325
+ args: ['click']
326
+ }] } });
327
+
328
+ const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR = new InjectionToken('rxap/form-window-system/open-form/definition-constructor');
329
+ const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS = new InjectionToken('rxap/form-window-system/open-form/default-options');
330
+ const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT = new InjectionToken('rxap/form-window-system/open-form/component');
331
+ class OpenFormWindowMethod {
332
+ constructor(formWindowService, formDefinitionConstructor, injector, formComponent = null, defaultOptions = null) {
333
+ this.formWindowService = formWindowService;
334
+ this.formDefinitionConstructor = formDefinitionConstructor;
335
+ this.injector = injector;
336
+ this.formComponent = formComponent;
337
+ this.defaultOptions = defaultOptions;
338
+ }
339
+ call(initial, options) {
340
+ return this.formWindowService.open(this.formDefinitionConstructor, {
341
+ ...(this.defaultOptions ?? {}),
342
+ injector: this.injector,
343
+ ...(options ?? {}),
344
+ initial: initial ?? this.defaultOptions?.initial,
345
+ component: this.formComponent ?? this.defaultOptions?.component ?? undefined,
346
+ });
347
+ }
348
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormWindowMethod, deps: [{ token: FormWindowService }, { token: RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR }, { token: INJECTOR }, { token: RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT, optional: true }, { token: RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
349
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormWindowMethod }); }
350
+ }
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormWindowMethod, decorators: [{
352
+ type: Injectable
353
+ }], ctorParameters: () => [{ type: FormWindowService, decorators: [{
354
+ type: Inject,
355
+ args: [FormWindowService]
356
+ }] }, { type: undefined, decorators: [{
357
+ type: Inject,
358
+ args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR]
359
+ }] }, { type: i0.Injector, decorators: [{
360
+ type: Inject,
361
+ args: [INJECTOR]
362
+ }] }, { type: undefined, decorators: [{
363
+ type: Optional
364
+ }, {
365
+ type: Inject,
366
+ args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT]
367
+ }] }, { type: undefined, decorators: [{
368
+ type: Optional
369
+ }, {
370
+ type: Inject,
371
+ args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS]
372
+ }] }] });
147
373
 
148
374
  /**
149
375
  * @deprecated
@@ -195,10 +421,10 @@ class OpenFormDirective extends ConfirmClick {
195
421
  panelClass: this.panelClass,
196
422
  });
197
423
  }
198
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormDirective, deps: [{ token: RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR, optional: true }, { token: FormWindowService }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive }); }
199
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: OpenFormDirective, isStandalone: true, selector: "[rxapOpenForm]", inputs: { type: "type", initial: "initial", title: "title", icon: "icon", width: "width", height: "height", resizeable: "resizeable", draggable: "draggable", panelClass: "panelClass", formDefinitionConstructor: ["rxapOpenForm", "formDefinitionConstructor"], onSubmit: "onSubmit" }, outputs: { submitted: "submitted" }, host: { listeners: { "click": "onClick()", "confirmed": "onConfirm()" }, properties: { "attr.type": "this.type" } }, usesInheritance: true, ngImport: i0 }); }
424
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormDirective, deps: [{ token: RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR, optional: true }, { token: FormWindowService }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive }); }
425
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: OpenFormDirective, isStandalone: true, selector: "[rxapOpenForm]", inputs: { type: "type", initial: "initial", title: "title", icon: "icon", width: "width", height: "height", resizeable: "resizeable", draggable: "draggable", panelClass: "panelClass", formDefinitionConstructor: ["rxapOpenForm", "formDefinitionConstructor"], onSubmit: "onSubmit" }, outputs: { submitted: "submitted" }, host: { listeners: { "click": "onClick()", "confirmed": "onConfirm()" }, properties: { "attr.type": "this.type" } }, usesInheritance: true, ngImport: i0 }); }
200
426
  }
201
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormDirective, decorators: [{
427
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: OpenFormDirective, decorators: [{
202
428
  type: Directive,
203
429
  args: [{
204
430
  selector: '[rxapOpenForm]',
@@ -209,7 +435,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
209
435
  },
210
436
  standalone: true,
211
437
  }]
212
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
438
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
213
439
  type: Optional
214
440
  }, {
215
441
  type: Inject,
@@ -220,7 +446,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
220
446
  }] }, { type: i0.Injector, decorators: [{
221
447
  type: Inject,
222
448
  args: [INJECTOR]
223
- }] }]; }, propDecorators: { type: [{
449
+ }] }], propDecorators: { type: [{
224
450
  type: HostBinding,
225
451
  args: ['attr.type']
226
452
  }, {
@@ -250,204 +476,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
250
476
  type: Input
251
477
  }] } });
252
478
 
253
- class FormWindowFooterDirective {
254
- constructor(formDirective, windowRef, template, viewContainerRef) {
255
- this.formDirective = formDirective;
256
- this.windowRef = windowRef;
257
- this.template = template;
258
- this.viewContainerRef = viewContainerRef;
259
- }
260
- /**
261
- * Asserts the correct type of the context for the template that `NgForOf` will render.
262
- *
263
- * The presence of this method is a signal to the Ivy template type-check compiler that the
264
- * `NgForOf` structural directive renders its template with a specific context type.
265
- */
266
- static ngTemplateContextGuard(dir, ctx) {
267
- return true;
268
- }
269
- ngOnInit() {
270
- this.windowRef.setFooterPortal(new TemplatePortal(this.template, this.viewContainerRef, {
271
- $implicit: this.windowRef,
272
- formDefinition: this.formDirective.formDefinition,
273
- formDirective: this.formDirective,
274
- }));
275
- }
276
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormWindowFooterDirective, deps: [{ token: FormDirective }, { token: RXAP_WINDOW_REF }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
277
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: FormWindowFooterDirective, isStandalone: true, selector: "[rxapFormWindowFooter]", ngImport: i0 }); }
278
- }
279
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormWindowFooterDirective, decorators: [{
280
- type: Directive,
281
- args: [{
282
- selector: '[rxapFormWindowFooter]',
283
- standalone: true,
284
- }]
285
- }], ctorParameters: function () { return [{ type: i1$1.FormDirective, decorators: [{
286
- type: Inject,
287
- args: [FormDirective]
288
- }] }, { type: i1.WindowRef, decorators: [{
289
- type: Inject,
290
- args: [RXAP_WINDOW_REF]
291
- }] }, { type: i0.TemplateRef, decorators: [{
292
- type: Inject,
293
- args: [TemplateRef]
294
- }] }, { type: i0.ViewContainerRef, decorators: [{
295
- type: Inject,
296
- args: [ViewContainerRef]
297
- }] }]; } });
298
-
299
- const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR = new InjectionToken('rxap/form-window-system/open-form/definition-constructor');
300
- const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS = new InjectionToken('rxap/form-window-system/open-form/default-options');
301
- const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT = new InjectionToken('rxap/form-window-system/open-form/component');
302
- class OpenFormWindowMethod {
303
- constructor(formWindowService, formDefinitionConstructor, injector, formComponent = null, defaultOptions = null) {
304
- this.formWindowService = formWindowService;
305
- this.formDefinitionConstructor = formDefinitionConstructor;
306
- this.injector = injector;
307
- this.formComponent = formComponent;
308
- this.defaultOptions = defaultOptions;
309
- }
310
- call(initial, options) {
311
- return this.formWindowService.open(this.formDefinitionConstructor, {
312
- ...(this.defaultOptions ?? {}),
313
- injector: this.injector,
314
- ...(options ?? {}),
315
- initial: initial ?? this.defaultOptions?.initial,
316
- component: this.formComponent ?? this.defaultOptions?.component ?? undefined,
317
- });
318
- }
319
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormWindowMethod, deps: [{ token: FormWindowService }, { token: RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR }, { token: INJECTOR }, { token: RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT, optional: true }, { token: RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
320
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormWindowMethod }); }
321
- }
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormWindowMethod, decorators: [{
323
- type: Injectable
324
- }], ctorParameters: function () { return [{ type: FormWindowService, decorators: [{
325
- type: Inject,
326
- args: [FormWindowService]
327
- }] }, { type: undefined, decorators: [{
328
- type: Inject,
329
- args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR]
330
- }] }, { type: i0.Injector, decorators: [{
331
- type: Inject,
332
- args: [INJECTOR]
333
- }] }, { type: undefined, decorators: [{
334
- type: Optional
335
- }, {
336
- type: Inject,
337
- args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT]
338
- }] }, { type: undefined, decorators: [{
339
- type: Optional
340
- }, {
341
- type: Inject,
342
- args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS]
343
- }] }]; } });
344
-
345
- class OpenFormWindowMethodDirective {
346
- constructor(injector = null) {
347
- this.injector = injector;
348
- // eslint-disable-next-line @angular-eslint/no-output-rename
349
- this.failure$ = new EventEmitter();
350
- // eslint-disable-next-line @angular-eslint/no-output-rename
351
- this.completed$ = new EventEmitter();
352
- // eslint-disable-next-line @angular-eslint/no-output-rename
353
- this.submitted$ = new EventEmitter();
354
- /**
355
- * true - a remote method call is in progress
356
- */
357
- this.executing$ = new CounterSubject(0);
358
- /**
359
- * Set of all active window ref instances.
360
- *
361
- * Used to distory all windows of the directive is
362
- * destroyed
363
- * @protected
364
- */
365
- this._windowRefInstance = new Set();
366
- this._hasConfirmDirective = false;
367
- }
368
- // eslint-disable-next-line @angular-eslint/no-input-rename
369
- set hasConfirmDirective(value) {
370
- this._hasConfirmDirective = coerceBoolean(value);
371
- }
372
- ngOnDestroy() {
373
- this._windowRefInstance.forEach(windowRef => windowRef.complete());
374
- }
375
- onConfirmed() {
376
- this.execute();
377
- }
378
- onClick() {
379
- if (!this._hasConfirmDirective) {
380
- this.execute();
381
- }
382
- else {
383
- console.debug('skip remote method call. Wait for confirmation.');
384
- }
385
- }
386
- execute() {
387
- this.executing$.increase();
388
- const windowRef = this.method.call(this.initial, {
389
- providers: this.providers,
390
- injector: this.injector,
391
- });
392
- windowRef.subscribe((value) => this.submitted(value), (error) => this.failure(error), () => {
393
- this.completed();
394
- this.executing$.decrease();
395
- this._windowRefInstance.delete(windowRef);
396
- });
397
- }
398
- submitted(value) {
399
- this.submitted$.emit(value);
400
- }
401
- failure(error) {
402
- this.failure$.emit(error);
403
- }
404
- completed() {
405
- this.completed$.emit();
406
- }
407
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormWindowMethodDirective, deps: [{ token: INJECTOR, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
408
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: OpenFormWindowMethodDirective, isStandalone: true, selector: "[rxapOpenFormWindowMethod]", inputs: { method: ["rxapOpenFormWindowMethod", "method"], initial: "initial", providers: "providers", hasConfirmDirective: ["rxapConfirm", "hasConfirmDirective"] }, outputs: { failure$: "failure", completed$: "completed", submitted$: "submitted" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick()" } }, ngImport: i0 }); }
409
- }
410
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OpenFormWindowMethodDirective, decorators: [{
411
- type: Directive,
412
- args: [{
413
- selector: '[rxapOpenFormWindowMethod]',
414
- standalone: true,
415
- }]
416
- }], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
417
- type: Optional
418
- }, {
419
- type: Inject,
420
- args: [INJECTOR]
421
- }] }]; }, propDecorators: { method: [{
422
- type: Input,
423
- args: ['rxapOpenFormWindowMethod']
424
- }], initial: [{
425
- type: Input
426
- }], failure$: [{
427
- type: Output,
428
- args: ['failure']
429
- }], completed$: [{
430
- type: Output,
431
- args: ['completed']
432
- }], submitted$: [{
433
- type: Output,
434
- args: ['submitted']
435
- }], providers: [{
436
- type: Input
437
- }], hasConfirmDirective: [{
438
- type: Input,
439
- args: ['rxapConfirm']
440
- }], onConfirmed: [{
441
- type: HostListener,
442
- args: ['confirmed']
443
- }], onClick: [{
444
- type: HostListener,
445
- args: ['click']
446
- }] } });
479
+ // region
480
+ // endregion
447
481
 
448
482
  /**
449
483
  * Generated bundle index. Do not edit.
450
484
  */
451
485
 
452
- export { FormWindowFooterDirective, FormWindowRef, FormWindowService, OpenFormDirective, OpenFormWindowMethod, OpenFormWindowMethodDirective, RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT, RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS, RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR, RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR };
486
+ export { CloseWindowAfterSubmitDirective, FormWindowFooterDirective, FormWindowRef, FormWindowService, OpenFormDirective, OpenFormWindowMethod, OpenFormWindowMethodDirective, RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT, RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS, RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR, RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR };
453
487
  //# sourceMappingURL=rxap-form-window-system.mjs.map