@rxap/form-window-system 15.0.0 → 16.0.0-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.
- package/esm2022/lib/form-window-footer.directive.mjs +66 -0
- package/{esm2020 → esm2022}/lib/form-window-ref.mjs +1 -1
- package/esm2022/lib/form-window.service.mjs +119 -0
- package/esm2022/lib/open-form-window-method.directive.mjs +116 -0
- package/esm2022/lib/open-form-window.method.mjs +51 -0
- package/esm2022/lib/open-form.directive.mjs +132 -0
- package/{fesm2020 → fesm2022}/rxap-form-window-system.mjs +41 -42
- package/fesm2022/rxap-form-window-system.mjs.map +1 -0
- package/lib/open-form-window-method.directive.d.ts +1 -1
- package/lib/open-form.directive.d.ts +1 -1
- package/package.json +28 -34
- package/esm2020/lib/form-window-footer.directive.mjs +0 -64
- package/esm2020/lib/form-window.service.mjs +0 -118
- package/esm2020/lib/open-form-window-method.directive.mjs +0 -114
- package/esm2020/lib/open-form-window.method.mjs +0 -50
- package/esm2020/lib/open-form.directive.mjs +0 -130
- package/fesm2015/rxap-form-window-system.mjs +0 -497
- package/fesm2015/rxap-form-window-system.mjs.map +0 -1
- package/fesm2020/rxap-form-window-system.mjs.map +0 -1
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/rxap-form-window-system.mjs +0 -0
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectFlags, INJECTOR, Optional, Injector, Injectable, Inject, InjectionToken, EventEmitter, isDevMode, Directive, HostBinding, Input, Output, NgModule, TemplateRef, ViewContainerRef, HostListener } from '@angular/core';
|
|
3
|
-
import * as i1 from '@rxap/window-system';
|
|
4
|
-
import { WindowService, WindowRef, RXAP_WINDOW_REF } from '@rxap/window-system';
|
|
5
|
-
import * as i1$1 from '@rxap/forms';
|
|
6
|
-
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';
|
|
7
|
-
import { DeleteUndefinedProperties, Required, coerceBoolean } from '@rxap/utilities';
|
|
8
|
-
import { FormSystemMetadataKeys } from '@rxap/form-system';
|
|
9
|
-
import { getMetadata } from '@rxap/utilities/reflect-metadata';
|
|
10
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
11
|
-
import { ConfirmClick } from '@rxap/directives';
|
|
12
|
-
import { TemplatePortal } from '@angular/cdk/portal';
|
|
13
|
-
import { CounterSubject } from '@rxap/utilities/rxjs';
|
|
14
|
-
|
|
15
|
-
class FormWindowService {
|
|
16
|
-
constructor(windowService, injector) {
|
|
17
|
-
this.windowService = windowService;
|
|
18
|
-
this.injector = injector;
|
|
19
|
-
}
|
|
20
|
-
open(formDefinitionConstructor, options) {
|
|
21
|
-
var _a, _b, _c, _d, _e;
|
|
22
|
-
function FormDefinitionFactory(formBuilder, initial) {
|
|
23
|
-
return formBuilder.build(initial);
|
|
24
|
-
}
|
|
25
|
-
function FormDefinitionBuilderFactory(_injector) {
|
|
26
|
-
return new RxapFormBuilder(formDefinitionConstructor, _injector);
|
|
27
|
-
}
|
|
28
|
-
const providers = (_a = options === null || options === void 0 ? void 0 : options.providers) !== null && _a !== void 0 ? _a : [];
|
|
29
|
-
if (((_b = options === null || options === void 0 ? void 0 : options.injector) !== null && _b !== void 0 ? _b : this.injector).get(formDefinitionConstructor, null, InjectFlags.Optional)) {
|
|
30
|
-
providers.push({
|
|
31
|
-
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
32
|
-
useFactory: FormDefinitionBuilderFactory,
|
|
33
|
-
deps: [INJECTOR]
|
|
34
|
-
}, {
|
|
35
|
-
provide: RXAP_FORM_DEFINITION,
|
|
36
|
-
useFactory: FormDefinitionFactory,
|
|
37
|
-
deps: [
|
|
38
|
-
RXAP_FORM_DEFINITION_BUILDER,
|
|
39
|
-
[new Optional(), RXAP_FORM_INITIAL_STATE]
|
|
40
|
-
]
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
if (options) {
|
|
44
|
-
if (options.initial) {
|
|
45
|
-
providers.push({
|
|
46
|
-
provide: RXAP_FORM_INITIAL_STATE,
|
|
47
|
-
useValue: options.initial
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (options.submitMethod) {
|
|
51
|
-
providers.push({
|
|
52
|
-
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
53
|
-
useValue: options.submitMethod,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (options.submitSuccessfulMethod) {
|
|
57
|
-
providers.push({
|
|
58
|
-
provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
|
|
59
|
-
useValue: options.submitSuccessfulMethod,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (options.resetSubmit) {
|
|
63
|
-
providers.push({
|
|
64
|
-
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
65
|
-
useValue: null,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (options.resetLoad && !options.loadMethod) {
|
|
69
|
-
providers.push({
|
|
70
|
-
provide: RXAP_FORM_LOAD_METHOD,
|
|
71
|
-
useValue: null,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (options.loadMethod) {
|
|
75
|
-
providers.push({
|
|
76
|
-
provide: RXAP_FORM_LOAD_METHOD,
|
|
77
|
-
useValue: options.loadMethod,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (options.context) {
|
|
81
|
-
providers.push({
|
|
82
|
-
provide: RXAP_FORM_CONTEXT,
|
|
83
|
-
useValue: options.context,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const injector = Injector.create({
|
|
88
|
-
parent: (_c = options === null || options === void 0 ? void 0 : options.injector) !== null && _c !== void 0 ? _c : this.injector,
|
|
89
|
-
providers,
|
|
90
|
-
name: (_d = options === null || options === void 0 ? void 0 : options.injectorName) !== null && _d !== void 0 ? _d : 'FormWindowService',
|
|
91
|
-
});
|
|
92
|
-
const component = (_e = options === null || options === void 0 ? void 0 : options.component) !== null && _e !== void 0 ? _e : this.extractFormComponent(formDefinitionConstructor);
|
|
93
|
-
let windowConfig = {
|
|
94
|
-
component,
|
|
95
|
-
injector,
|
|
96
|
-
};
|
|
97
|
-
if (options) {
|
|
98
|
-
windowConfig = Object.assign(DeleteUndefinedProperties(options), windowConfig);
|
|
99
|
-
}
|
|
100
|
-
return this.windowService.open(windowConfig);
|
|
101
|
-
}
|
|
102
|
-
extractFormComponent(formDefinitionConstructor) {
|
|
103
|
-
var _a;
|
|
104
|
-
const component = (_a = getMetadata(FormSystemMetadataKeys.FORM_COMPONENT, formDefinitionConstructor)) !== null && _a !== void 0 ? _a : null;
|
|
105
|
-
if (!component) {
|
|
106
|
-
throw new Error('Could not extract form component constructor');
|
|
107
|
-
}
|
|
108
|
-
return component;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
FormWindowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowService, deps: [{ token: WindowService }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
112
|
-
FormWindowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowService, providedIn: 'root' });
|
|
113
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowService, decorators: [{
|
|
114
|
-
type: Injectable,
|
|
115
|
-
args: [{
|
|
116
|
-
providedIn: 'root',
|
|
117
|
-
}]
|
|
118
|
-
}], ctorParameters: function () {
|
|
119
|
-
return [{ type: i1.WindowService, decorators: [{
|
|
120
|
-
type: Inject,
|
|
121
|
-
args: [WindowService]
|
|
122
|
-
}] }, { type: i0.Injector, decorators: [{
|
|
123
|
-
type: Inject,
|
|
124
|
-
args: [INJECTOR]
|
|
125
|
-
}] }];
|
|
126
|
-
} });
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @deprecated removed
|
|
130
|
-
*/
|
|
131
|
-
let FormWindowRef = class FormWindowRef {
|
|
132
|
-
constructor(formDefinition, windowRef) {
|
|
133
|
-
this.formDefinition = formDefinition;
|
|
134
|
-
this.windowRef = windowRef;
|
|
135
|
-
}
|
|
136
|
-
submit() {
|
|
137
|
-
throw new Error('Not yet implemented!');
|
|
138
|
-
}
|
|
139
|
-
reset() {
|
|
140
|
-
throw new Error('Not yet implemented!');
|
|
141
|
-
}
|
|
142
|
-
close(result) {
|
|
143
|
-
this.windowRef.close(result);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
FormWindowRef = __decorate([
|
|
147
|
-
__param(1, Inject(WindowRef)),
|
|
148
|
-
__metadata("design:paramtypes", [Object, WindowRef])
|
|
149
|
-
], FormWindowRef);
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @deprecated
|
|
153
|
-
*/
|
|
154
|
-
const RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR = new InjectionToken('rxap/window-form-system/open-form-constructor');
|
|
155
|
-
/**
|
|
156
|
-
* @deprecated
|
|
157
|
-
*/
|
|
158
|
-
class OpenFormDirective extends ConfirmClick {
|
|
159
|
-
constructor(formDefinitionConstructor, formWindowService, injector) {
|
|
160
|
-
super();
|
|
161
|
-
this.formWindowService = formWindowService;
|
|
162
|
-
this.injector = injector;
|
|
163
|
-
this.type = 'button';
|
|
164
|
-
this.submitted = new EventEmitter();
|
|
165
|
-
if (formDefinitionConstructor) {
|
|
166
|
-
this._formDefinitionConstructor = formDefinitionConstructor;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
set formDefinitionConstructor(value) {
|
|
170
|
-
if (value) {
|
|
171
|
-
this._formDefinitionConstructor = value;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
onSubmit(value) {
|
|
175
|
-
if (isDevMode()) {
|
|
176
|
-
console.warn('[rxapOpenForm] No "onSubmit" method is provided!');
|
|
177
|
-
}
|
|
178
|
-
return value;
|
|
179
|
-
}
|
|
180
|
-
execute() {
|
|
181
|
-
this._formWindowRef = this.formWindowService.open(this._formDefinitionConstructor, {
|
|
182
|
-
injector: this.injector,
|
|
183
|
-
submitSuccessfulMethod: ToFormMethod(this.onSubmitSuccessful.bind(this)),
|
|
184
|
-
initial: this.initial,
|
|
185
|
-
injectorName: 'OpenFormDirective',
|
|
186
|
-
title: this.title,
|
|
187
|
-
icon: this.icon,
|
|
188
|
-
width: this.width,
|
|
189
|
-
resizeable: this.resizeable,
|
|
190
|
-
draggable: this.draggable,
|
|
191
|
-
panelClass: this.panelClass,
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
onSubmitSuccessful(result) {
|
|
195
|
-
var _a;
|
|
196
|
-
this.submitted.emit(result);
|
|
197
|
-
(_a = this._formWindowRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
198
|
-
}
|
|
199
|
-
ngOnDestroy() {
|
|
200
|
-
var _a;
|
|
201
|
-
(_a = this._formWindowRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
OpenFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormDirective, deps: [{ token: RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR, optional: true }, { token: FormWindowService }, { token: INJECTOR }], target: i0.ɵɵFactoryTarget.Directive });
|
|
205
|
-
OpenFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: OpenFormDirective, selector: "[rxapOpenForm]", inputs: { type: "type", formDefinitionConstructor: ["rxapOpenForm", "formDefinitionConstructor"], initial: "initial", title: "title", icon: "icon", width: "width", height: "height", resizeable: "resizeable", draggable: "draggable", panelClass: "panelClass", onSubmit: "onSubmit" }, outputs: { submitted: "submitted" }, host: { listeners: { "click": "onClick()", "confirmed": "onConfirm()" }, properties: { "attr.type": "this.type" } }, usesInheritance: true, ngImport: i0 });
|
|
206
|
-
__decorate([
|
|
207
|
-
Required,
|
|
208
|
-
__metadata("design:type", Object)
|
|
209
|
-
], OpenFormDirective.prototype, "_formDefinitionConstructor", void 0);
|
|
210
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormDirective, decorators: [{
|
|
211
|
-
type: Directive,
|
|
212
|
-
args: [{
|
|
213
|
-
selector: '[rxapOpenForm]',
|
|
214
|
-
host: {
|
|
215
|
-
'(click)': 'onClick()',
|
|
216
|
-
'(confirmed)': 'onConfirm()',
|
|
217
|
-
},
|
|
218
|
-
}]
|
|
219
|
-
}], ctorParameters: function () {
|
|
220
|
-
return [{ type: undefined, decorators: [{
|
|
221
|
-
type: Optional
|
|
222
|
-
}, {
|
|
223
|
-
type: Inject,
|
|
224
|
-
args: [RXAP_WINDOW_FORM_SYSTEM_OPEN_FORM_CONSTRUCTOR]
|
|
225
|
-
}] }, { type: FormWindowService, decorators: [{
|
|
226
|
-
type: Inject,
|
|
227
|
-
args: [FormWindowService]
|
|
228
|
-
}] }, { type: i0.Injector, decorators: [{
|
|
229
|
-
type: Inject,
|
|
230
|
-
args: [INJECTOR]
|
|
231
|
-
}] }];
|
|
232
|
-
}, propDecorators: { type: [{
|
|
233
|
-
type: HostBinding,
|
|
234
|
-
args: ['attr.type']
|
|
235
|
-
}, {
|
|
236
|
-
type: Input
|
|
237
|
-
}], submitted: [{
|
|
238
|
-
type: Output
|
|
239
|
-
}], formDefinitionConstructor: [{
|
|
240
|
-
type: Input,
|
|
241
|
-
args: ['rxapOpenForm']
|
|
242
|
-
}], initial: [{
|
|
243
|
-
type: Input
|
|
244
|
-
}], _formDefinitionConstructor: [], title: [{
|
|
245
|
-
type: Input
|
|
246
|
-
}], icon: [{
|
|
247
|
-
type: Input
|
|
248
|
-
}], width: [{
|
|
249
|
-
type: Input
|
|
250
|
-
}], height: [{
|
|
251
|
-
type: Input
|
|
252
|
-
}], resizeable: [{
|
|
253
|
-
type: Input
|
|
254
|
-
}], draggable: [{
|
|
255
|
-
type: Input
|
|
256
|
-
}], panelClass: [{
|
|
257
|
-
type: Input
|
|
258
|
-
}], onSubmit: [{
|
|
259
|
-
type: Input
|
|
260
|
-
}] } });
|
|
261
|
-
/**
|
|
262
|
-
* @deprecated
|
|
263
|
-
*/
|
|
264
|
-
class OpenFormDirectiveModule {
|
|
265
|
-
}
|
|
266
|
-
OpenFormDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
267
|
-
OpenFormDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: OpenFormDirectiveModule, declarations: [OpenFormDirective], exports: [OpenFormDirective] });
|
|
268
|
-
OpenFormDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormDirectiveModule });
|
|
269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormDirectiveModule, decorators: [{
|
|
270
|
-
type: NgModule,
|
|
271
|
-
args: [{
|
|
272
|
-
exports: [OpenFormDirective],
|
|
273
|
-
declarations: [OpenFormDirective],
|
|
274
|
-
}]
|
|
275
|
-
}] });
|
|
276
|
-
|
|
277
|
-
class FormWindowFooterDirective {
|
|
278
|
-
constructor(formDirective, windowRef, template, viewContainerRef) {
|
|
279
|
-
this.formDirective = formDirective;
|
|
280
|
-
this.windowRef = windowRef;
|
|
281
|
-
this.template = template;
|
|
282
|
-
this.viewContainerRef = viewContainerRef;
|
|
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
|
-
}
|
|
293
|
-
ngOnInit() {
|
|
294
|
-
this.windowRef.setFooterPortal(new TemplatePortal(this.template, this.viewContainerRef, {
|
|
295
|
-
$implicit: this.windowRef,
|
|
296
|
-
formDefinition: this.formDirective.formDefinition,
|
|
297
|
-
formDirective: this.formDirective,
|
|
298
|
-
}));
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
FormWindowFooterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowFooterDirective, deps: [{ token: FormDirective }, { token: RXAP_WINDOW_REF }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
302
|
-
FormWindowFooterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: FormWindowFooterDirective, selector: "[rxapFormWindowFooter]", ngImport: i0 });
|
|
303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowFooterDirective, decorators: [{
|
|
304
|
-
type: Directive,
|
|
305
|
-
args: [{
|
|
306
|
-
selector: '[rxapFormWindowFooter]'
|
|
307
|
-
}]
|
|
308
|
-
}], ctorParameters: function () {
|
|
309
|
-
return [{ type: i1$1.FormDirective, decorators: [{
|
|
310
|
-
type: Inject,
|
|
311
|
-
args: [FormDirective]
|
|
312
|
-
}] }, { type: i1.WindowRef, decorators: [{
|
|
313
|
-
type: Inject,
|
|
314
|
-
args: [RXAP_WINDOW_REF]
|
|
315
|
-
}] }, { type: i0.TemplateRef, decorators: [{
|
|
316
|
-
type: Inject,
|
|
317
|
-
args: [TemplateRef]
|
|
318
|
-
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
319
|
-
type: Inject,
|
|
320
|
-
args: [ViewContainerRef]
|
|
321
|
-
}] }];
|
|
322
|
-
} });
|
|
323
|
-
class FormWindowFooterDirectiveModule {
|
|
324
|
-
}
|
|
325
|
-
FormWindowFooterDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowFooterDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
326
|
-
FormWindowFooterDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: FormWindowFooterDirectiveModule, declarations: [FormWindowFooterDirective], exports: [FormWindowFooterDirective] });
|
|
327
|
-
FormWindowFooterDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowFooterDirectiveModule });
|
|
328
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: FormWindowFooterDirectiveModule, decorators: [{
|
|
329
|
-
type: NgModule,
|
|
330
|
-
args: [{
|
|
331
|
-
exports: [FormWindowFooterDirective],
|
|
332
|
-
declarations: [FormWindowFooterDirective]
|
|
333
|
-
}]
|
|
334
|
-
}] });
|
|
335
|
-
|
|
336
|
-
const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR = new InjectionToken('rxap/form-window-system/open-form/definition-constructor');
|
|
337
|
-
const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS = new InjectionToken('rxap/form-window-system/open-form/default-options');
|
|
338
|
-
const RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT = new InjectionToken('rxap/form-window-system/open-form/component');
|
|
339
|
-
class OpenFormWindowMethod {
|
|
340
|
-
constructor(formWindowService, formDefinitionConstructor, injector, formComponent = null, defaultOptions = null) {
|
|
341
|
-
this.formWindowService = formWindowService;
|
|
342
|
-
this.formDefinitionConstructor = formDefinitionConstructor;
|
|
343
|
-
this.injector = injector;
|
|
344
|
-
this.formComponent = formComponent;
|
|
345
|
-
this.defaultOptions = defaultOptions;
|
|
346
|
-
}
|
|
347
|
-
call(initial, options) {
|
|
348
|
-
var _a, _b, _c, _d, _e;
|
|
349
|
-
return this.formWindowService.open(this.formDefinitionConstructor, Object.assign(Object.assign(Object.assign(Object.assign({}, ((_a = this.defaultOptions) !== null && _a !== void 0 ? _a : {})), { injector: this.injector }), (options !== null && options !== void 0 ? options : {})), { initial: initial !== null && initial !== void 0 ? initial : (_b = this.defaultOptions) === null || _b === void 0 ? void 0 : _b.initial, component: (_e = (_c = this.formComponent) !== null && _c !== void 0 ? _c : (_d = this.defaultOptions) === null || _d === void 0 ? void 0 : _d.component) !== null && _e !== void 0 ? _e : undefined }));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
OpenFormWindowMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.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 });
|
|
353
|
-
OpenFormWindowMethod.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethod });
|
|
354
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethod, decorators: [{
|
|
355
|
-
type: Injectable
|
|
356
|
-
}], ctorParameters: function () {
|
|
357
|
-
return [{ type: FormWindowService, decorators: [{
|
|
358
|
-
type: Inject,
|
|
359
|
-
args: [FormWindowService]
|
|
360
|
-
}] }, { type: undefined, decorators: [{
|
|
361
|
-
type: Inject,
|
|
362
|
-
args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFINITION_CONSTRUCTOR]
|
|
363
|
-
}] }, { type: i0.Injector, decorators: [{
|
|
364
|
-
type: Inject,
|
|
365
|
-
args: [INJECTOR]
|
|
366
|
-
}] }, { type: undefined, decorators: [{
|
|
367
|
-
type: Optional
|
|
368
|
-
}, {
|
|
369
|
-
type: Inject,
|
|
370
|
-
args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_COMPONENT]
|
|
371
|
-
}] }, { type: undefined, decorators: [{
|
|
372
|
-
type: Optional
|
|
373
|
-
}, {
|
|
374
|
-
type: Inject,
|
|
375
|
-
args: [RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS]
|
|
376
|
-
}] }];
|
|
377
|
-
} });
|
|
378
|
-
|
|
379
|
-
class OpenFormWindowMethodDirective {
|
|
380
|
-
constructor(injector = null) {
|
|
381
|
-
this.injector = injector;
|
|
382
|
-
this.failure$ = new EventEmitter();
|
|
383
|
-
this.completed$ = new EventEmitter();
|
|
384
|
-
this.submitted$ = new EventEmitter();
|
|
385
|
-
/**
|
|
386
|
-
* true - a remote method call is in progress
|
|
387
|
-
*/
|
|
388
|
-
this.executing$ = new CounterSubject(0);
|
|
389
|
-
this._hasConfirmDirective = false;
|
|
390
|
-
/**
|
|
391
|
-
* Set of all active window ref instances.
|
|
392
|
-
*
|
|
393
|
-
* Used to distory all windows of the directive is
|
|
394
|
-
* destroyed
|
|
395
|
-
* @protected
|
|
396
|
-
*/
|
|
397
|
-
this._windowRefInstance = new Set();
|
|
398
|
-
}
|
|
399
|
-
set hasConfirmDirective(value) {
|
|
400
|
-
this._hasConfirmDirective = coerceBoolean(value);
|
|
401
|
-
}
|
|
402
|
-
ngOnDestroy() {
|
|
403
|
-
this._windowRefInstance.forEach(windowRef => windowRef.complete());
|
|
404
|
-
}
|
|
405
|
-
onConfirmed() {
|
|
406
|
-
this.execute();
|
|
407
|
-
}
|
|
408
|
-
onClick() {
|
|
409
|
-
if (!this._hasConfirmDirective) {
|
|
410
|
-
this.execute();
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
console.debug('skip remote method call. Wait for confirmation.');
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
execute() {
|
|
417
|
-
this.executing$.increase();
|
|
418
|
-
const windowRef = this.method.call(this.initial, {
|
|
419
|
-
providers: this.providers,
|
|
420
|
-
injector: this.injector
|
|
421
|
-
});
|
|
422
|
-
windowRef.subscribe((value) => this.submitted(value), (error) => this.failure(error), () => {
|
|
423
|
-
this.completed();
|
|
424
|
-
this.executing$.decrease();
|
|
425
|
-
this._windowRefInstance.delete(windowRef);
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
submitted(value) {
|
|
429
|
-
this.submitted$.emit(value);
|
|
430
|
-
}
|
|
431
|
-
failure(error) {
|
|
432
|
-
this.failure$.emit(error);
|
|
433
|
-
}
|
|
434
|
-
completed() {
|
|
435
|
-
this.completed$.emit();
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
OpenFormWindowMethodDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethodDirective, deps: [{ token: INJECTOR, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
439
|
-
OpenFormWindowMethodDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: OpenFormWindowMethodDirective, selector: "[rxapOpenFormWindowMethod]", inputs: { method: ["rxapOpenFormWindowMethod", "method"], initial: "initial", hasConfirmDirective: ["rxapConfirm", "hasConfirmDirective"], providers: "providers" }, outputs: { failure$: "failure", completed$: "completed", submitted$: "submitted" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick()" } }, ngImport: i0 });
|
|
440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethodDirective, decorators: [{
|
|
441
|
-
type: Directive,
|
|
442
|
-
args: [{
|
|
443
|
-
selector: '[rxapOpenFormWindowMethod]'
|
|
444
|
-
}]
|
|
445
|
-
}], ctorParameters: function () {
|
|
446
|
-
return [{ type: i0.Injector, decorators: [{
|
|
447
|
-
type: Optional
|
|
448
|
-
}, {
|
|
449
|
-
type: Inject,
|
|
450
|
-
args: [INJECTOR]
|
|
451
|
-
}] }];
|
|
452
|
-
}, propDecorators: { method: [{
|
|
453
|
-
type: Input,
|
|
454
|
-
args: ['rxapOpenFormWindowMethod']
|
|
455
|
-
}], initial: [{
|
|
456
|
-
type: Input
|
|
457
|
-
}], failure$: [{
|
|
458
|
-
type: Output,
|
|
459
|
-
args: ['failure']
|
|
460
|
-
}], completed$: [{
|
|
461
|
-
type: Output,
|
|
462
|
-
args: ['completed']
|
|
463
|
-
}], submitted$: [{
|
|
464
|
-
type: Output,
|
|
465
|
-
args: ['submitted']
|
|
466
|
-
}], hasConfirmDirective: [{
|
|
467
|
-
type: Input,
|
|
468
|
-
args: ['rxapConfirm']
|
|
469
|
-
}], providers: [{
|
|
470
|
-
type: Input
|
|
471
|
-
}], onConfirmed: [{
|
|
472
|
-
type: HostListener,
|
|
473
|
-
args: ['confirmed']
|
|
474
|
-
}], onClick: [{
|
|
475
|
-
type: HostListener,
|
|
476
|
-
args: ['click']
|
|
477
|
-
}] } });
|
|
478
|
-
class OpenFormWindowMethodDirectiveModule {
|
|
479
|
-
}
|
|
480
|
-
OpenFormWindowMethodDirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethodDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
481
|
-
OpenFormWindowMethodDirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethodDirectiveModule, declarations: [OpenFormWindowMethodDirective], exports: [OpenFormWindowMethodDirective] });
|
|
482
|
-
OpenFormWindowMethodDirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethodDirectiveModule });
|
|
483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OpenFormWindowMethodDirectiveModule, decorators: [{
|
|
484
|
-
type: NgModule,
|
|
485
|
-
args: [{
|
|
486
|
-
exports: [OpenFormWindowMethodDirective],
|
|
487
|
-
declarations: [OpenFormWindowMethodDirective]
|
|
488
|
-
}]
|
|
489
|
-
}] });
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Generated bundle index. Do not edit.
|
|
493
|
-
*/
|
|
494
|
-
|
|
495
|
-
export { FormWindowFooterDirective, FormWindowFooterDirectiveModule, FormWindowRef, FormWindowService, OpenFormDirective, OpenFormDirectiveModule, OpenFormWindowMethod, OpenFormWindowMethodDirective, OpenFormWindowMethodDirectiveModule, 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 };
|
|
496
|
-
//# sourceMappingURL=rxap-form-window-system.mjs.map
|
|
497
|
-
//# sourceMappingURL=rxap-form-window-system.mjs.map
|