@firestitch/form 18.0.9 → 18.0.11
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/app/components/confirm-unsaved/confirm-unsaved.component.d.ts +1 -1
- package/app/directives/button.directive.d.ts +9 -14
- package/app/directives/form/form.directive.d.ts +12 -22
- package/app/directives/form-base/form-base.directive.d.ts +32 -0
- package/app/directives/form-base/index.d.ts +1 -0
- package/app/directives/form-group/form-group.directive.d.ts +15 -0
- package/app/directives/form-group/index.d.ts +1 -0
- package/app/directives/index.d.ts +3 -2
- package/app/fs-form.module.d.ts +2 -2
- package/app/interfaces/submit-event.d.ts +2 -2
- package/app/interfaces/submitted-event.d.ts +2 -5
- package/app/services/fsform.service.d.ts +3 -8
- package/esm2022/app/components/confirm-unsaved/confirm-unsaved.component.mjs +11 -6
- package/esm2022/app/components/form-dialog-actions/form-dialog-actions.component.mjs +1 -1
- package/esm2022/app/directives/button.directive.mjs +24 -52
- package/esm2022/app/directives/form/form.directive.mjs +96 -160
- package/esm2022/app/directives/form-base/form-base.directive.mjs +104 -0
- package/esm2022/app/directives/form-base/index.mjs +2 -0
- package/esm2022/app/directives/form-group/form-group.directive.mjs +34 -0
- package/esm2022/app/directives/form-group/index.mjs +2 -0
- package/esm2022/app/directives/index.mjs +4 -3
- package/esm2022/app/fs-form.module.mjs +8 -5
- package/esm2022/app/guards/form-deactivate.guard.mjs +2 -2
- package/esm2022/app/interfaces/submit-event.mjs +1 -1
- package/esm2022/app/interfaces/submitted-event.mjs +1 -1
- package/esm2022/app/services/fsform.service.mjs +12 -30
- package/esm2022/public_api.mjs +2 -1
- package/fesm2022/firestitch-form.mjs +306 -281
- package/fesm2022/firestitch-form.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/styles.scss +28 -29
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import * as i2$
|
|
1
|
+
import * as i2$3 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Component, ChangeDetectionStrategy, Inject,
|
|
5
|
-
import * as i1$
|
|
4
|
+
import { Component, ChangeDetectionStrategy, Inject, inject, Injectable, QueryList, Directive, Input, ContentChildren, EventEmitter, Optional, Output, HostBinding, HostListener, ElementRef, ChangeDetectorRef, ViewChild, InjectionToken, Self, ViewChildren, NgModule } from '@angular/core';
|
|
5
|
+
import * as i1$1 from '@angular/forms';
|
|
6
6
|
import { UntypedFormGroup, NgForm, NgModel, Validators, FormsModule } from '@angular/forms';
|
|
7
|
-
import * as
|
|
8
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
7
|
+
import * as i3 from '@angular/material/button';
|
|
8
|
+
import { MatButton, MatButtonModule } from '@angular/material/button';
|
|
9
9
|
import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core';
|
|
10
10
|
import * as i1 from '@angular/material/dialog';
|
|
11
|
-
import { MAT_DIALOG_DATA,
|
|
12
|
-
import * as
|
|
11
|
+
import { MAT_DIALOG_DATA, MatDialogModule, MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
12
|
+
import * as i2 from '@firestitch/dialog';
|
|
13
13
|
import { FsDialogModule } from '@firestitch/dialog';
|
|
14
|
-
import { Subject, of,
|
|
15
|
-
import {
|
|
16
|
-
import * as i2 from '@angular/router';
|
|
17
|
-
import { MatTabGroup } from '@angular/material/tabs';
|
|
14
|
+
import { Subject, of, filter, BehaviorSubject, throwError, fromEvent, iif, defer, from, isObservable } from 'rxjs';
|
|
15
|
+
import { switchMap, map, catchError, takeUntil, tap, take, mergeMap, filter as filter$1, delay, first, startWith, mapTo } from 'rxjs/operators';
|
|
16
|
+
import * as i2$1 from '@angular/router';
|
|
18
17
|
import { guid, email, isEmpty, isNumeric, phone, url } from '@firestitch/common';
|
|
19
|
-
import * as
|
|
18
|
+
import * as i7 from '@firestitch/drawer';
|
|
20
19
|
import { DrawerRef } from '@firestitch/drawer';
|
|
21
|
-
import * as i2$
|
|
20
|
+
import * as i2$2 from '@firestitch/message';
|
|
22
21
|
import { MessageMode } from '@firestitch/message';
|
|
22
|
+
import { MatTabGroup } from '@angular/material/tabs';
|
|
23
23
|
import { values, keys, isObject } from 'lodash-es';
|
|
24
24
|
import { isValid } from 'date-fns';
|
|
25
25
|
|
|
@@ -57,11 +57,15 @@ class ConfirmUnsavedComponent {
|
|
|
57
57
|
this._destroy$.complete();
|
|
58
58
|
}
|
|
59
59
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ConfirmUnsavedComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
60
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", type: ConfirmUnsavedComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title
|
|
60
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", type: ConfirmUnsavedComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>\n {{ title }}\n </h1>\n <mat-dialog-content>\n {{ message }}\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n mat-button>\n {{ saveLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n mat-button>\n {{ discardLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"cancel()\"\n mat-button>\n {{ cancelLabel }}\n </button>\n </mat-dialog-actions>\n</fs-dialog>", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: FsDialogModule }, { kind: "component", type: i2.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
61
61
|
}
|
|
62
62
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ConfirmUnsavedComponent, decorators: [{
|
|
63
63
|
type: Component,
|
|
64
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush,
|
|
64
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
65
|
+
MatDialogModule,
|
|
66
|
+
MatButton,
|
|
67
|
+
FsDialogModule,
|
|
68
|
+
], template: "<fs-dialog>\n <h1 mat-dialog-title>\n {{ title }}\n </h1>\n <mat-dialog-content>\n {{ message }}\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n mat-button>\n {{ saveLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n mat-button>\n {{ discardLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"cancel()\"\n mat-button>\n {{ cancelLabel }}\n </button>\n </mat-dialog-actions>\n</fs-dialog>", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
65
69
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
66
70
|
type: Inject,
|
|
67
71
|
args: [MAT_DIALOG_DATA]
|
|
@@ -100,23 +104,9 @@ var FormStatus;
|
|
|
100
104
|
})(FormStatus || (FormStatus = {}));
|
|
101
105
|
|
|
102
106
|
class FsForm {
|
|
103
|
-
_dialog;
|
|
104
107
|
// value is array for future possibilities of extension
|
|
105
108
|
_formDirectiveStore = new WeakMap();
|
|
106
|
-
|
|
107
|
-
constructor(_dialog) {
|
|
108
|
-
this._dialog = _dialog;
|
|
109
|
-
this._eventBus = new Subject();
|
|
110
|
-
}
|
|
111
|
-
// @deprecated
|
|
112
|
-
broadcast(key, data) {
|
|
113
|
-
this._eventBus.next({ key, data });
|
|
114
|
-
}
|
|
115
|
-
// @deprecated
|
|
116
|
-
on(key) {
|
|
117
|
-
return this._eventBus.asObservable()
|
|
118
|
-
.pipe(filter((event) => event.key === key), map((event) => event.data));
|
|
119
|
-
}
|
|
109
|
+
_dialog = inject(MatDialog);
|
|
120
110
|
registerFormDirective(routeComponent, directive) {
|
|
121
111
|
const directives = this.getFormDirectives(routeComponent) || [];
|
|
122
112
|
directives.push(directive);
|
|
@@ -128,9 +118,7 @@ class FsForm {
|
|
|
128
118
|
removeFormDirective(routeComponent) {
|
|
129
119
|
this._formDirectiveStore.delete(routeComponent);
|
|
130
120
|
}
|
|
131
|
-
confirmUnsaved(
|
|
132
|
-
// TODO support for multiple directives per page
|
|
133
|
-
const form = directives[0];
|
|
121
|
+
confirmUnsaved(form) {
|
|
134
122
|
if (!form.confirm || !form.ngForm.dirty) {
|
|
135
123
|
return of(ConfirmResult.Pristine);
|
|
136
124
|
}
|
|
@@ -167,15 +155,14 @@ class FsForm {
|
|
|
167
155
|
}
|
|
168
156
|
if (result === 'save') {
|
|
169
157
|
form.ngForm.control.markAsPristine();
|
|
170
|
-
form.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
.pipe(take(1));
|
|
158
|
+
return form.submit$({ confirmed: true })
|
|
159
|
+
.pipe(map(() => ConfirmResult.Save), catchError(() => {
|
|
160
|
+
return of(ConfirmResult.Invalid);
|
|
161
|
+
}));
|
|
175
162
|
}
|
|
176
163
|
}));
|
|
177
164
|
}
|
|
178
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsForm, deps: [
|
|
165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsForm, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
179
166
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsForm, providedIn: 'root' });
|
|
180
167
|
}
|
|
181
168
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsForm, decorators: [{
|
|
@@ -183,7 +170,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
183
170
|
args: [{
|
|
184
171
|
providedIn: 'root',
|
|
185
172
|
}]
|
|
186
|
-
}]
|
|
173
|
+
}] });
|
|
187
174
|
|
|
188
175
|
class FormDeactivateGuard {
|
|
189
176
|
_form;
|
|
@@ -204,12 +191,12 @@ class FormDeactivateGuard {
|
|
|
204
191
|
console.error('Can not find a valid FsFormDirective');
|
|
205
192
|
return of(true);
|
|
206
193
|
}
|
|
207
|
-
return this._form.confirmUnsaved(directives)
|
|
194
|
+
return this._form.confirmUnsaved(directives[0])
|
|
208
195
|
.pipe(map((result) => {
|
|
209
196
|
return confirmResultContinue(result);
|
|
210
197
|
}));
|
|
211
198
|
}
|
|
212
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FormDeactivateGuard, deps: [{ token: FsForm }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FormDeactivateGuard, deps: [{ token: FsForm }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
213
200
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FormDeactivateGuard, providedIn: 'root' });
|
|
214
201
|
}
|
|
215
202
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FormDeactivateGuard, decorators: [{
|
|
@@ -217,7 +204,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
217
204
|
args: [{
|
|
218
205
|
providedIn: 'root',
|
|
219
206
|
}]
|
|
220
|
-
}], ctorParameters: () => [{ type: FsForm }, { type: i2.ActivatedRoute }] });
|
|
207
|
+
}], ctorParameters: () => [{ type: FsForm }, { type: i2$1.ActivatedRoute }] });
|
|
221
208
|
|
|
222
209
|
function getFormErrors(control, key) {
|
|
223
210
|
let errors = null;
|
|
@@ -243,13 +230,143 @@ function getFormErrors(control, key) {
|
|
|
243
230
|
return errors;
|
|
244
231
|
}
|
|
245
232
|
|
|
246
|
-
class
|
|
233
|
+
class FsFormBaseDirective {
|
|
234
|
+
confirmTabs = true;
|
|
235
|
+
tabGroup;
|
|
236
|
+
_destroy$ = new Subject();
|
|
237
|
+
_tabGroups = new QueryList();
|
|
238
|
+
_buttons = new QueryList();
|
|
239
|
+
_activeSubmitButton;
|
|
240
|
+
ngAfterContentInit() {
|
|
241
|
+
this._registerConfirmTabs();
|
|
242
|
+
}
|
|
243
|
+
get destroy$() {
|
|
244
|
+
return this._destroy$.asObservable();
|
|
245
|
+
}
|
|
246
|
+
ngOnDestroy() {
|
|
247
|
+
this._destroy$.next(null);
|
|
248
|
+
this._destroy$.complete();
|
|
249
|
+
}
|
|
250
|
+
get buttons() {
|
|
251
|
+
return this._buttons;
|
|
252
|
+
}
|
|
253
|
+
get activeSubmitButton() {
|
|
254
|
+
return this._activeSubmitButton;
|
|
255
|
+
}
|
|
256
|
+
set activeSubmitButton(button) {
|
|
257
|
+
this._activeSubmitButton = button;
|
|
258
|
+
}
|
|
259
|
+
addButton(button) {
|
|
260
|
+
this._buttons
|
|
261
|
+
.reset([
|
|
262
|
+
...this._buttons.toArray(),
|
|
263
|
+
button,
|
|
264
|
+
]);
|
|
265
|
+
}
|
|
266
|
+
removeButton(button) {
|
|
267
|
+
if (this._activeSubmitButton === button) {
|
|
268
|
+
this._activeSubmitButton = null;
|
|
269
|
+
}
|
|
270
|
+
this._buttons.reset([
|
|
271
|
+
...this._buttons.toArray()
|
|
272
|
+
.filter((item) => (button !== item)),
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
275
|
+
_registerConfirmTabs() {
|
|
276
|
+
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
277
|
+
this._tabGroups.changes
|
|
278
|
+
.pipe(takeUntil(this._destroy$))
|
|
279
|
+
.subscribe(() => {
|
|
280
|
+
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
_registerConfirmTabGroups(tabGroups) {
|
|
284
|
+
tabGroups.forEach((tabGroup) => {
|
|
285
|
+
this._registerConfirmTabGroup(tabGroup);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
_registerConfirmTabGroup(tabGroup) {
|
|
289
|
+
const confirmTabGroup = tabGroup;
|
|
290
|
+
if (!confirmTabGroup._originalHandleClick) {
|
|
291
|
+
confirmTabGroup._originalHandleClick = tabGroup._handleClick;
|
|
292
|
+
confirmTabGroup._handlClick$ = new Subject();
|
|
293
|
+
confirmTabGroup._handleClick = (tab, tabHeader, idx) => {
|
|
294
|
+
if (confirmTabGroup._handlClick$.observers.length) {
|
|
295
|
+
confirmTabGroup._handlClick$.next({ tab, tabHeader, idx });
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
confirmTabGroup._handlClick$
|
|
303
|
+
.pipe(filter(() => !this.submitting), switchMap((event) => {
|
|
304
|
+
if (this.confirm && this.confirmTabs) {
|
|
305
|
+
return this.triggerConfirm()
|
|
306
|
+
.pipe(tap((result) => {
|
|
307
|
+
if (confirmResultContinue(result)) {
|
|
308
|
+
confirmTabGroup.selectedIndex = event.idx;
|
|
309
|
+
}
|
|
310
|
+
}));
|
|
311
|
+
}
|
|
312
|
+
confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
|
|
313
|
+
return of(null);
|
|
314
|
+
}), takeUntil(this._destroy$))
|
|
315
|
+
.subscribe();
|
|
316
|
+
}
|
|
317
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
318
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormBaseDirective, inputs: { confirmTabs: "confirmTabs", tabGroup: "tabGroup" }, queries: [{ propertyName: "_tabGroups", predicate: MatTabGroup, descendants: true }], ngImport: i0 });
|
|
319
|
+
}
|
|
320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormBaseDirective, decorators: [{
|
|
321
|
+
type: Directive
|
|
322
|
+
}], propDecorators: { confirmTabs: [{
|
|
323
|
+
type: Input
|
|
324
|
+
}], tabGroup: [{
|
|
325
|
+
type: Input
|
|
326
|
+
}], _tabGroups: [{
|
|
327
|
+
type: ContentChildren,
|
|
328
|
+
args: [MatTabGroup, { descendants: true }]
|
|
329
|
+
}] } });
|
|
330
|
+
|
|
331
|
+
class FsFormGroupDirective extends FsFormBaseDirective {
|
|
332
|
+
_formDirective;
|
|
333
|
+
triggerSubmit() {
|
|
334
|
+
return this._formDirective?.triggerSubmit();
|
|
335
|
+
}
|
|
336
|
+
triggerConfirm() {
|
|
337
|
+
return this._formDirective?.triggerConfirm();
|
|
338
|
+
}
|
|
339
|
+
get submitting() {
|
|
340
|
+
return this._formDirective?.submitting;
|
|
341
|
+
}
|
|
342
|
+
get confirm() {
|
|
343
|
+
return this._formDirective?.confirm;
|
|
344
|
+
}
|
|
345
|
+
registerForm(formDirective) {
|
|
346
|
+
this._formDirective = formDirective;
|
|
347
|
+
}
|
|
348
|
+
deregisterForm() {
|
|
349
|
+
this._formDirective = null;
|
|
350
|
+
}
|
|
351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormGroupDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
352
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormGroupDirective, selector: "[fsFormGroup]", exportAs: ["fsFormGroup"], usesInheritance: true, ngImport: i0 });
|
|
353
|
+
}
|
|
354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormGroupDirective, decorators: [{
|
|
355
|
+
type: Directive,
|
|
356
|
+
args: [{
|
|
357
|
+
selector: '[fsFormGroup]',
|
|
358
|
+
exportAs: 'fsFormGroup',
|
|
359
|
+
}]
|
|
360
|
+
}] });
|
|
361
|
+
|
|
362
|
+
class FsFormDirective extends FsFormBaseDirective {
|
|
247
363
|
ngForm;
|
|
248
364
|
_form;
|
|
249
365
|
_element;
|
|
250
366
|
_message;
|
|
251
367
|
_ngZone;
|
|
252
368
|
_cdRef;
|
|
369
|
+
_formGroup;
|
|
253
370
|
_dialogRef;
|
|
254
371
|
_drawerRef;
|
|
255
372
|
_route;
|
|
@@ -263,7 +380,6 @@ class FsFormDirective {
|
|
|
263
380
|
confirmDialog = true;
|
|
264
381
|
confirmDrawer = true;
|
|
265
382
|
confirmBrowser = true;
|
|
266
|
-
confirmTabs = true;
|
|
267
383
|
dirtySubmitButton = true;
|
|
268
384
|
set submit(submit$) {
|
|
269
385
|
this._submit$ = submit$;
|
|
@@ -273,7 +389,6 @@ class FsFormDirective {
|
|
|
273
389
|
}
|
|
274
390
|
successDelay = 0;
|
|
275
391
|
errorDelay = 1000;
|
|
276
|
-
tabGroup;
|
|
277
392
|
deactivationGuard = true;
|
|
278
393
|
submitEvent = new EventEmitter();
|
|
279
394
|
invalid = new EventEmitter();
|
|
@@ -282,24 +397,21 @@ class FsFormDirective {
|
|
|
282
397
|
reseted = new EventEmitter();
|
|
283
398
|
cleared = new EventEmitter();
|
|
284
399
|
fsFormClass = true;
|
|
285
|
-
_tabGroups = new QueryList();
|
|
286
|
-
_buttons = new QueryList();
|
|
287
400
|
_registerControl;
|
|
288
|
-
_activeSubmitButton;
|
|
289
401
|
_dialogBackdropEscape = false;
|
|
290
402
|
_snapshot = {};
|
|
291
403
|
_activatedRouteConfig;
|
|
292
404
|
_status$ = new BehaviorSubject(FormStatus.Valid);
|
|
293
|
-
_destroy$ = new Subject();
|
|
294
|
-
_confirmed = false;
|
|
295
405
|
_submit$ = null;
|
|
296
|
-
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
|
|
406
|
+
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _formGroup, _dialogRef, _drawerRef, _route) {
|
|
407
|
+
super();
|
|
297
408
|
this.ngForm = ngForm;
|
|
298
409
|
this._form = _form;
|
|
299
410
|
this._element = _element;
|
|
300
411
|
this._message = _message;
|
|
301
412
|
this._ngZone = _ngZone;
|
|
302
413
|
this._cdRef = _cdRef;
|
|
414
|
+
this._formGroup = _formGroup;
|
|
303
415
|
this._dialogRef = _dialogRef;
|
|
304
416
|
this._drawerRef = _drawerRef;
|
|
305
417
|
this._route = _route;
|
|
@@ -320,7 +432,6 @@ class FsFormDirective {
|
|
|
320
432
|
};
|
|
321
433
|
}
|
|
322
434
|
get _formValidState$() {
|
|
323
|
-
this._form.broadcast('valid', this._submitEvent);
|
|
324
435
|
this.submitEvent.emit(this._submitEvent);
|
|
325
436
|
this.valid.emit(this._submitEvent);
|
|
326
437
|
const submittedEvent = {
|
|
@@ -334,10 +445,9 @@ class FsFormDirective {
|
|
|
334
445
|
.pipe(map((response) => {
|
|
335
446
|
submittedEvent.response = response;
|
|
336
447
|
return submittedEvent;
|
|
337
|
-
}), takeUntil(this.
|
|
448
|
+
}), takeUntil(this.destroy$));
|
|
338
449
|
}
|
|
339
450
|
get _formInvalidState$() {
|
|
340
|
-
this._form.broadcast('invalid', this._submitEvent);
|
|
341
451
|
if (this.invalid) {
|
|
342
452
|
this.invalid.emit(this._submitEvent);
|
|
343
453
|
}
|
|
@@ -347,14 +457,13 @@ class FsFormDirective {
|
|
|
347
457
|
if (el) {
|
|
348
458
|
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
349
459
|
}
|
|
350
|
-
return throwError('Form validation error');
|
|
460
|
+
return throwError(() => new Error('Form validation error'));
|
|
351
461
|
}
|
|
352
462
|
get _submitter() {
|
|
353
|
-
return this.
|
|
354
|
-
? this._activeSubmitButton.name
|
|
355
|
-
: null;
|
|
463
|
+
return this._getFormGroup().activeSubmitButton?.name;
|
|
356
464
|
}
|
|
357
465
|
ngOnInit() {
|
|
466
|
+
this._formGroup?.deregisterForm();
|
|
358
467
|
if (this.deactivationGuard) {
|
|
359
468
|
this._registerCanDeactivateGuard();
|
|
360
469
|
}
|
|
@@ -387,16 +496,16 @@ class FsFormDirective {
|
|
|
387
496
|
});
|
|
388
497
|
}
|
|
389
498
|
ngAfterContentInit() {
|
|
499
|
+
super.ngAfterContentInit();
|
|
390
500
|
this._registerConfirm();
|
|
391
501
|
this._registerConfirmDrawerClose();
|
|
392
|
-
this._registerConfirmTabs();
|
|
393
502
|
this._registerDrawerClose();
|
|
394
503
|
this._registerDirtySubmitButton();
|
|
395
504
|
}
|
|
396
505
|
ngOnDestroy() {
|
|
506
|
+
this._formGroup?.registerForm(null);
|
|
507
|
+
super.ngOnDestroy();
|
|
397
508
|
this._cleanupCanDeactivate();
|
|
398
|
-
this._destroy$.next(null);
|
|
399
|
-
this._destroy$.complete();
|
|
400
509
|
}
|
|
401
510
|
createSnapshot() {
|
|
402
511
|
this._snapshot = this.ngForm.value;
|
|
@@ -426,13 +535,12 @@ class FsFormDirective {
|
|
|
426
535
|
this._updateDirtySubmitButtons();
|
|
427
536
|
}
|
|
428
537
|
triggerSubmit(options) {
|
|
429
|
-
this._confirmed = options?.confirmed;
|
|
430
538
|
this.ngForm.ngSubmit.emit();
|
|
431
539
|
}
|
|
432
540
|
triggerConfirm() {
|
|
433
541
|
const submitted = this.submitting ? this.submitted.asObservable() : of({});
|
|
434
542
|
return submitted
|
|
435
|
-
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved(
|
|
543
|
+
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved(this)));
|
|
436
544
|
}
|
|
437
545
|
enable() {
|
|
438
546
|
this.ngForm.control.enable();
|
|
@@ -440,22 +548,11 @@ class FsFormDirective {
|
|
|
440
548
|
}
|
|
441
549
|
disable() {
|
|
442
550
|
this.ngForm.control.disable();
|
|
443
|
-
this.
|
|
551
|
+
this._getFormGroup()
|
|
552
|
+
.buttons.forEach((button) => {
|
|
444
553
|
button.disable();
|
|
445
554
|
});
|
|
446
555
|
}
|
|
447
|
-
addButton(button) {
|
|
448
|
-
this._buttons.reset([
|
|
449
|
-
...this._buttons.toArray(),
|
|
450
|
-
button,
|
|
451
|
-
]);
|
|
452
|
-
}
|
|
453
|
-
removeButton(button) {
|
|
454
|
-
this._buttons.reset([
|
|
455
|
-
...this._buttons.toArray()
|
|
456
|
-
.filter((item) => (button !== item)),
|
|
457
|
-
]);
|
|
458
|
-
}
|
|
459
556
|
validate() {
|
|
460
557
|
Object.values(this.ngForm.controls)
|
|
461
558
|
.forEach((control) => {
|
|
@@ -464,37 +561,38 @@ class FsFormDirective {
|
|
|
464
561
|
control.updateValueAndValidity();
|
|
465
562
|
});
|
|
466
563
|
}
|
|
564
|
+
submit$(submitEvent) {
|
|
565
|
+
return of(submitEvent)
|
|
566
|
+
.pipe(tap(() => this._statusValidating()), tap(() => this.validate()), tap(() => this._statusSubmitting()), tap(() => this._setupActiveSubmitButton()), tap(() => this._disableButtons()), switchMap((data) => this._waitUntilStatusPending()
|
|
567
|
+
.pipe(map(() => data))), mergeMap(() => {
|
|
568
|
+
if (this.ngForm.status === 'INVALID') {
|
|
569
|
+
return this._formInvalidState$;
|
|
570
|
+
}
|
|
571
|
+
return this._formValidState$;
|
|
572
|
+
}), catchError((e) => {
|
|
573
|
+
this._handleError(e);
|
|
574
|
+
return of(null);
|
|
575
|
+
}), tap((submittedEvent) => {
|
|
576
|
+
if (submittedEvent) {
|
|
577
|
+
this._completeSubmit(true, submittedEvent);
|
|
578
|
+
}
|
|
579
|
+
}));
|
|
580
|
+
}
|
|
467
581
|
_listenSubmit() {
|
|
468
|
-
this
|
|
582
|
+
this
|
|
583
|
+
.ngForm
|
|
469
584
|
.ngSubmit
|
|
470
585
|
.pipe(tap((event) => {
|
|
471
586
|
event?.preventDefault();
|
|
472
|
-
}),
|
|
473
|
-
return { event, confirmed: this._confirmed };
|
|
474
|
-
}), tap(() => this._confirmed = false), filter(() => {
|
|
587
|
+
}), filter$1(() => {
|
|
475
588
|
return [FormStatus.Valid, FormStatus.Invalid]
|
|
476
589
|
.includes(this._status$.getValue());
|
|
477
|
-
}),
|
|
478
|
-
.pipe(mapTo(data))), mergeMap((data) => {
|
|
479
|
-
if (this.ngForm.status === 'INVALID') {
|
|
480
|
-
return this._formInvalidState$;
|
|
481
|
-
}
|
|
482
|
-
return this._formValidState$
|
|
483
|
-
.pipe(map((submitEvent) => ({
|
|
484
|
-
...submitEvent,
|
|
485
|
-
confirmed: data.confirmed,
|
|
486
|
-
})));
|
|
487
|
-
}), catchError((e, source$) => {
|
|
488
|
-
this._handleError(e);
|
|
489
|
-
return source$;
|
|
490
|
-
}), tap((submittedEvent) => {
|
|
491
|
-
this._completeSubmit(true, submittedEvent);
|
|
492
|
-
}), takeUntil(this._destroy$))
|
|
590
|
+
}), switchMap(() => this.submit$(this._submitEvent)), takeUntil(this.destroy$))
|
|
493
591
|
.subscribe();
|
|
494
592
|
}
|
|
495
593
|
_listenFormStatus() {
|
|
496
594
|
this._status$
|
|
497
|
-
.pipe(takeUntil(this.
|
|
595
|
+
.pipe(takeUntil(this.destroy$))
|
|
498
596
|
.subscribe((formStatus) => {
|
|
499
597
|
const cls = [FormStatus.Submitting, FormStatus.Validating];
|
|
500
598
|
const classList = this._element.nativeElement.classList;
|
|
@@ -506,7 +604,7 @@ class FsFormDirective {
|
|
|
506
604
|
}
|
|
507
605
|
_listenWindowClose() {
|
|
508
606
|
fromEvent(window, 'beforeunload')
|
|
509
|
-
.pipe(takeUntil(this.
|
|
607
|
+
.pipe(takeUntil(this.destroy$))
|
|
510
608
|
.subscribe((event) => {
|
|
511
609
|
if (this.confirm && this.confirmBrowser && this.ngForm.dirty) {
|
|
512
610
|
event.returnValue = false;
|
|
@@ -525,7 +623,7 @@ class FsFormDirective {
|
|
|
525
623
|
_listenHotKeys() {
|
|
526
624
|
this._ngZone.runOutsideAngular(() => {
|
|
527
625
|
fromEvent(document, 'keydown')
|
|
528
|
-
.pipe(takeUntil(this.
|
|
626
|
+
.pipe(takeUntil(this.destroy$))
|
|
529
627
|
.subscribe((event) => {
|
|
530
628
|
if (this._dialogBackdropEscape && event.code === 'Escape') {
|
|
531
629
|
const cdkOverlayPane = Array
|
|
@@ -552,11 +650,11 @@ class FsFormDirective {
|
|
|
552
650
|
_formClose() {
|
|
553
651
|
if (this.confirm && this.confirmDialog) {
|
|
554
652
|
this.triggerConfirm()
|
|
555
|
-
.pipe(filter((result) => confirmResultContinue(result)), switchMap((result) => {
|
|
653
|
+
.pipe(filter$1((result) => confirmResultContinue(result)), switchMap((result) => {
|
|
556
654
|
return result === ConfirmResult.Pristine || result === ConfirmResult.Discard
|
|
557
655
|
? of(null)
|
|
558
656
|
: this.submitted.asObservable();
|
|
559
|
-
}), takeUntil(this.
|
|
657
|
+
}), takeUntil(this.destroy$))
|
|
560
658
|
.subscribe((result) => {
|
|
561
659
|
this._dialogRef.close(result?.response);
|
|
562
660
|
});
|
|
@@ -566,13 +664,12 @@ class FsFormDirective {
|
|
|
566
664
|
}
|
|
567
665
|
}
|
|
568
666
|
_getActiveSubmitButton() {
|
|
569
|
-
|
|
570
|
-
.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return activeButton ? activeButton : submitButtons[0];
|
|
667
|
+
if (this._getFormGroup().activeSubmitButton) {
|
|
668
|
+
return this._getFormGroup().activeSubmitButton;
|
|
669
|
+
}
|
|
670
|
+
return this._getFormGroup()
|
|
671
|
+
.buttons
|
|
672
|
+
.filter((button) => button.submit)[0];
|
|
576
673
|
}
|
|
577
674
|
_elementInForm(el) {
|
|
578
675
|
if (el.isSameNode(this._element.nativeElement)) {
|
|
@@ -592,12 +689,12 @@ class FsFormDirective {
|
|
|
592
689
|
else {
|
|
593
690
|
this._resetButtons();
|
|
594
691
|
}
|
|
595
|
-
if (this.
|
|
692
|
+
if (this._getFormGroup().activeSubmitButton) {
|
|
596
693
|
if (success) {
|
|
597
|
-
this.
|
|
694
|
+
this._getFormGroup().activeSubmitButton.success();
|
|
598
695
|
}
|
|
599
696
|
else {
|
|
600
|
-
this.
|
|
697
|
+
this._getFormGroup().activeSubmitButton.error();
|
|
601
698
|
}
|
|
602
699
|
}
|
|
603
700
|
this._status$.next(FormStatus.Submitted);
|
|
@@ -610,7 +707,8 @@ class FsFormDirective {
|
|
|
610
707
|
this._status$.next(FormStatus.Completing);
|
|
611
708
|
const resetDelay = success ? this.successDelay : this.errorDelay;
|
|
612
709
|
of(true)
|
|
613
|
-
.pipe(delay(resetDelay), first(), takeUntil(this.
|
|
710
|
+
.pipe(delay(resetDelay), first(), takeUntil(this.destroy$))
|
|
711
|
+
.subscribe(() => {
|
|
614
712
|
if (this.ngForm.form.status === 'VALID') {
|
|
615
713
|
this._status$.next(FormStatus.Valid);
|
|
616
714
|
}
|
|
@@ -618,23 +716,22 @@ class FsFormDirective {
|
|
|
618
716
|
this._status$.next(FormStatus.Invalid);
|
|
619
717
|
}
|
|
620
718
|
this._resetButtons();
|
|
621
|
-
this.
|
|
719
|
+
this._getFormGroup().activeSubmitButton = null;
|
|
622
720
|
this._updateDirtySubmitButtons();
|
|
623
721
|
});
|
|
624
722
|
}
|
|
723
|
+
_getFormGroup() {
|
|
724
|
+
return this._formGroup || this;
|
|
725
|
+
}
|
|
625
726
|
_resetButtons() {
|
|
626
|
-
this.
|
|
727
|
+
this._getFormGroup()
|
|
728
|
+
.buttons.forEach((button) => {
|
|
627
729
|
button.reset();
|
|
628
730
|
});
|
|
629
731
|
}
|
|
630
|
-
_resetActiveButtons() {
|
|
631
|
-
this._buttons.forEach((button) => {
|
|
632
|
-
button.resetActive();
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
732
|
_registerConfirm() {
|
|
636
733
|
this.ngForm.form.valueChanges
|
|
637
|
-
.pipe(takeUntil(this.
|
|
734
|
+
.pipe(takeUntil(this.destroy$))
|
|
638
735
|
.subscribe((changes) => {
|
|
639
736
|
if (this._dialogBackdropEscape && this._dialogRef) {
|
|
640
737
|
this._dialogRef.disableClose = true;
|
|
@@ -653,11 +750,11 @@ class FsFormDirective {
|
|
|
653
750
|
_registerDrawerClose() {
|
|
654
751
|
if (this._drawerRef) {
|
|
655
752
|
this._drawerRef.closeStart$
|
|
656
|
-
.pipe(takeUntil(this.
|
|
753
|
+
.pipe(takeUntil(this.destroy$))
|
|
657
754
|
.subscribe((subscriber) => {
|
|
658
755
|
if (this.submitting) {
|
|
659
756
|
this._status$
|
|
660
|
-
.pipe(filter((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this.
|
|
757
|
+
.pipe(filter$1((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this.destroy$))
|
|
661
758
|
.subscribe((status) => {
|
|
662
759
|
if (status === FormStatus.Success) {
|
|
663
760
|
subscriber.next(null);
|
|
@@ -690,65 +787,20 @@ class FsFormDirective {
|
|
|
690
787
|
subscriber.complete();
|
|
691
788
|
return of(null);
|
|
692
789
|
}));
|
|
693
|
-
}), takeUntil(this.
|
|
790
|
+
}), takeUntil(this.destroy$))
|
|
694
791
|
.subscribe();
|
|
695
792
|
}
|
|
696
793
|
}
|
|
697
|
-
_registerConfirmTabs() {
|
|
698
|
-
if (this.tabGroup) {
|
|
699
|
-
this._registerConfirmTabGroup(this.tabGroup);
|
|
700
|
-
}
|
|
701
|
-
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
702
|
-
this._tabGroups.changes
|
|
703
|
-
.pipe(takeUntil(this._destroy$))
|
|
704
|
-
.subscribe(() => {
|
|
705
|
-
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
_registerConfirmTabGroups(tabGroups) {
|
|
709
|
-
tabGroups.forEach((tabGroup) => {
|
|
710
|
-
this._registerConfirmTabGroup(tabGroup);
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
_registerConfirmTabGroup(tabGroup) {
|
|
714
|
-
const confirmTabGroup = tabGroup;
|
|
715
|
-
if (!confirmTabGroup._originalHandleClick) {
|
|
716
|
-
confirmTabGroup._originalHandleClick = tabGroup._handleClick;
|
|
717
|
-
confirmTabGroup._handlClick$ = new Subject();
|
|
718
|
-
confirmTabGroup._handleClick = (tab, tabHeader, idx) => {
|
|
719
|
-
if (confirmTabGroup._handlClick$.observers.length) {
|
|
720
|
-
confirmTabGroup._handlClick$.next({ tab, tabHeader, idx });
|
|
721
|
-
}
|
|
722
|
-
else {
|
|
723
|
-
confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
|
|
724
|
-
}
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
confirmTabGroup._handlClick$
|
|
728
|
-
.pipe(filter(() => !this.submitting), switchMap((event) => {
|
|
729
|
-
if (this.confirm && this.confirmTabs) {
|
|
730
|
-
return this.triggerConfirm()
|
|
731
|
-
.pipe(tap((result) => {
|
|
732
|
-
if (confirmResultContinue(result)) {
|
|
733
|
-
confirmTabGroup.selectedIndex = event.idx;
|
|
734
|
-
}
|
|
735
|
-
}));
|
|
736
|
-
}
|
|
737
|
-
confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
|
|
738
|
-
return of(null);
|
|
739
|
-
}), takeUntil(this._destroy$))
|
|
740
|
-
.subscribe();
|
|
741
|
-
}
|
|
742
794
|
_registerConfirmDialogBackdropEscape() {
|
|
743
795
|
if (this._dialogRef) {
|
|
744
796
|
this._dialogBackdropEscape = !this._dialogRef?.disableClose;
|
|
745
797
|
if (this._dialogBackdropEscape) {
|
|
746
798
|
this._dialogRef.backdropClick()
|
|
747
|
-
.pipe(takeUntil(this.
|
|
799
|
+
.pipe(takeUntil(this.destroy$))
|
|
748
800
|
.subscribe(() => {
|
|
749
801
|
this._formClose();
|
|
750
802
|
});
|
|
751
|
-
this.
|
|
803
|
+
this.destroy$
|
|
752
804
|
.subscribe(() => {
|
|
753
805
|
this._dialogRef.disableClose = false;
|
|
754
806
|
});
|
|
@@ -773,18 +825,20 @@ class FsFormDirective {
|
|
|
773
825
|
return;
|
|
774
826
|
}
|
|
775
827
|
this.ngForm.form.valueChanges
|
|
776
|
-
.pipe(takeUntil(this.
|
|
828
|
+
.pipe(takeUntil(this.destroy$))
|
|
777
829
|
.subscribe(() => {
|
|
778
830
|
this._updateDirtySubmitButtons();
|
|
779
831
|
});
|
|
780
|
-
this.
|
|
781
|
-
.
|
|
832
|
+
this._getFormGroup()
|
|
833
|
+
.buttons.changes
|
|
834
|
+
.pipe(takeUntil(this.destroy$))
|
|
782
835
|
.subscribe(() => {
|
|
783
836
|
this._updateDirtySubmitButtons();
|
|
784
837
|
});
|
|
785
838
|
}
|
|
786
839
|
_updateDirtySubmitButtons() {
|
|
787
|
-
this.
|
|
840
|
+
this._getFormGroup()
|
|
841
|
+
.buttons
|
|
788
842
|
.filter((button) => button.submit)
|
|
789
843
|
.forEach((submitButton) => {
|
|
790
844
|
if (!this.confirm || !this.dirtySubmitButton || this.ngForm.dirty || !submitButton.dirtySubmit) {
|
|
@@ -795,22 +849,23 @@ class FsFormDirective {
|
|
|
795
849
|
}
|
|
796
850
|
});
|
|
797
851
|
}
|
|
798
|
-
|
|
852
|
+
_statusSubmitting() {
|
|
799
853
|
this._status$.next(FormStatus.Submitting);
|
|
800
|
-
this._form.broadcast('submit', this.ngForm);
|
|
801
854
|
}
|
|
802
|
-
|
|
855
|
+
_statusValidating() {
|
|
803
856
|
this._status$.next(FormStatus.Validating);
|
|
804
857
|
}
|
|
805
858
|
_setupActiveSubmitButton() {
|
|
806
|
-
this.
|
|
859
|
+
this._getFormGroup()
|
|
860
|
+
.activeSubmitButton = this._getActiveSubmitButton();
|
|
807
861
|
this._resetButtons();
|
|
808
|
-
if (this.
|
|
809
|
-
this.
|
|
862
|
+
if (this._getFormGroup().activeSubmitButton) {
|
|
863
|
+
this._getFormGroup().activeSubmitButton.process();
|
|
810
864
|
}
|
|
811
865
|
}
|
|
812
866
|
_disableButtons() {
|
|
813
|
-
this.
|
|
867
|
+
this._getFormGroup()
|
|
868
|
+
.buttons.forEach((button) => {
|
|
814
869
|
button.disable();
|
|
815
870
|
});
|
|
816
871
|
}
|
|
@@ -851,8 +906,8 @@ class FsFormDirective {
|
|
|
851
906
|
this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
|
|
852
907
|
this._form.removeFormDirective(this._activatedRouteConfig.component);
|
|
853
908
|
}
|
|
854
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2$
|
|
855
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser",
|
|
909
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2$2.FsMessage }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: FsFormGroupDirective, optional: true }, { token: MatDialogRef, optional: true }, { token: DrawerRef, optional: true }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
|
|
910
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, exportAs: ["fsForm"], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
856
911
|
}
|
|
857
912
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDirective, decorators: [{
|
|
858
913
|
type: Directive,
|
|
@@ -860,20 +915,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
860
915
|
selector: '[fsForm]',
|
|
861
916
|
exportAs: 'fsForm',
|
|
862
917
|
}]
|
|
863
|
-
}], ctorParameters: () => [{ type: i1$
|
|
918
|
+
}], ctorParameters: () => [{ type: i1$1.NgForm, decorators: [{
|
|
864
919
|
type: Inject,
|
|
865
920
|
args: [NgForm]
|
|
866
|
-
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$
|
|
921
|
+
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$2.FsMessage }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: FsFormGroupDirective, decorators: [{
|
|
922
|
+
type: Optional
|
|
923
|
+
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
867
924
|
type: Optional
|
|
868
925
|
}, {
|
|
869
926
|
type: Inject,
|
|
870
927
|
args: [MatDialogRef]
|
|
871
|
-
}] }, { type:
|
|
928
|
+
}] }, { type: i7.DrawerRef, decorators: [{
|
|
872
929
|
type: Optional
|
|
873
930
|
}, {
|
|
874
931
|
type: Inject,
|
|
875
932
|
args: [DrawerRef]
|
|
876
|
-
}] }, { type: i2.ActivatedRoute }], propDecorators: { wrapperSelector: [{
|
|
933
|
+
}] }, { type: i2$1.ActivatedRoute }], propDecorators: { wrapperSelector: [{
|
|
877
934
|
type: Input
|
|
878
935
|
}], messageSelector: [{
|
|
879
936
|
type: Input
|
|
@@ -893,8 +950,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
893
950
|
type: Input
|
|
894
951
|
}], confirmBrowser: [{
|
|
895
952
|
type: Input
|
|
896
|
-
}], confirmTabs: [{
|
|
897
|
-
type: Input
|
|
898
953
|
}], dirtySubmitButton: [{
|
|
899
954
|
type: Input
|
|
900
955
|
}], submit: [{
|
|
@@ -903,8 +958,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
903
958
|
type: Input
|
|
904
959
|
}], errorDelay: [{
|
|
905
960
|
type: Input
|
|
906
|
-
}], tabGroup: [{
|
|
907
|
-
type: Input
|
|
908
961
|
}], deactivationGuard: [{
|
|
909
962
|
type: Input
|
|
910
963
|
}], submitEvent: [{
|
|
@@ -923,9 +976,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
923
976
|
}], fsFormClass: [{
|
|
924
977
|
type: HostBinding,
|
|
925
978
|
args: ['class.fs-form']
|
|
926
|
-
}], _tabGroups: [{
|
|
927
|
-
type: ContentChildren,
|
|
928
|
-
args: [MatTabGroup, { descendants: true }]
|
|
929
979
|
}] } });
|
|
930
980
|
|
|
931
981
|
class FsFormDialogCloseDirective {
|
|
@@ -941,7 +991,7 @@ class FsFormDialogCloseDirective {
|
|
|
941
991
|
closeClick() {
|
|
942
992
|
if (this._form) {
|
|
943
993
|
this._form.triggerConfirm()
|
|
944
|
-
.pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
994
|
+
.pipe(filter$1((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
945
995
|
.subscribe(() => {
|
|
946
996
|
this._dialogRef.close(this.closeData);
|
|
947
997
|
});
|
|
@@ -977,42 +1027,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
977
1027
|
}] } });
|
|
978
1028
|
|
|
979
1029
|
class FsButtonDirective {
|
|
980
|
-
_matButton;
|
|
981
|
-
_form;
|
|
982
|
-
_elementRef;
|
|
983
|
-
_cdRef;
|
|
984
1030
|
name;
|
|
985
1031
|
dirtySubmit = true;
|
|
986
|
-
form;
|
|
987
1032
|
transitionStyle = null;
|
|
988
|
-
active = false;
|
|
989
1033
|
submit = false;
|
|
990
1034
|
_previousDisabled = false;
|
|
991
1035
|
_destroy$ = new Subject();
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1036
|
+
_formGroup = inject(FsFormGroupDirective, { optional: true });
|
|
1037
|
+
_form = inject(FsFormDirective, { optional: true });
|
|
1038
|
+
_matButton = inject(MatButton, { optional: true, host: true });
|
|
1039
|
+
_elementRef = inject(ElementRef);
|
|
1040
|
+
_cdRef = inject(ChangeDetectorRef);
|
|
1041
|
+
_formBase;
|
|
998
1042
|
ngOnInit() {
|
|
999
1043
|
this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
|
|
1000
|
-
this.
|
|
1001
|
-
if (this.
|
|
1002
|
-
this.
|
|
1044
|
+
this._formBase = this._form || this._formGroup;
|
|
1045
|
+
if (this._formBase) {
|
|
1046
|
+
this._formBase.addButton(this);
|
|
1003
1047
|
if (this.submit) {
|
|
1004
1048
|
fromEvent(this.element, 'click')
|
|
1005
1049
|
.pipe(takeUntil(this._destroy$))
|
|
1006
1050
|
.subscribe(() => {
|
|
1007
|
-
this.
|
|
1051
|
+
this._formBase.activeSubmitButton = this;
|
|
1052
|
+
this._formBase.triggerSubmit();
|
|
1008
1053
|
});
|
|
1009
|
-
if (this.dirtySubmit) {
|
|
1010
|
-
if (this.form.dirtySubmitButton) {
|
|
1011
|
-
if (!this.form.ngForm.dirty) {
|
|
1012
|
-
this.disable();
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
1054
|
this.transitionStyle = 'none';
|
|
1017
1055
|
setTimeout(() => {
|
|
1018
1056
|
this.transitionStyle = null;
|
|
@@ -1021,7 +1059,7 @@ class FsButtonDirective {
|
|
|
1021
1059
|
}
|
|
1022
1060
|
}
|
|
1023
1061
|
disable() {
|
|
1024
|
-
if (this._matButton && !this.
|
|
1062
|
+
if (this._matButton && !this._formBase.activeSubmitButton) {
|
|
1025
1063
|
this._previousDisabled = this._matButton.disabled;
|
|
1026
1064
|
this._matButton.disabled = true;
|
|
1027
1065
|
this._matButton.disableRipple = true;
|
|
@@ -1056,16 +1094,12 @@ class FsButtonDirective {
|
|
|
1056
1094
|
setClass(cls) {
|
|
1057
1095
|
const svg = this._getSvg(cls);
|
|
1058
1096
|
this._resetClass();
|
|
1059
|
-
this.
|
|
1060
|
-
this.element.classList.add(`submit-${cls}`);
|
|
1097
|
+
this.element.classList.add(`fs-form-submit-button-${cls}`);
|
|
1061
1098
|
this.element.append(svg);
|
|
1062
1099
|
}
|
|
1063
1100
|
get element() {
|
|
1064
1101
|
return this._elementRef.nativeElement;
|
|
1065
1102
|
}
|
|
1066
|
-
resetActive() {
|
|
1067
|
-
this.active = false;
|
|
1068
|
-
}
|
|
1069
1103
|
reset() {
|
|
1070
1104
|
if (!this._previousDisabled) {
|
|
1071
1105
|
this.enable();
|
|
@@ -1082,14 +1116,11 @@ class FsButtonDirective {
|
|
|
1082
1116
|
ngOnDestroy() {
|
|
1083
1117
|
this._destroy$.next(null);
|
|
1084
1118
|
this._destroy$.complete();
|
|
1085
|
-
this.
|
|
1086
|
-
}
|
|
1087
|
-
_disableShadowAnimation() {
|
|
1088
|
-
// .mat-elevation-z2 removes the click shadow animation
|
|
1089
|
-
//this.element.classList.add('mat-elevation-z2');
|
|
1119
|
+
this._formBase?.removeButton(this);
|
|
1090
1120
|
}
|
|
1091
1121
|
_resetClass() {
|
|
1092
|
-
this.element.classList
|
|
1122
|
+
this.element.classList
|
|
1123
|
+
.remove('fs-form-submit-button-success', 'fs-form-submit-button-error', 'fs-form-submit-button-process');
|
|
1093
1124
|
}
|
|
1094
1125
|
_getSvg(type) {
|
|
1095
1126
|
if (type === 'success') {
|
|
@@ -1116,26 +1147,18 @@ class FsButtonDirective {
|
|
|
1116
1147
|
return new DOMParser().parseFromString('<svg class="svg-icon svg-icon-error" xmlns="http://www.w3.org/2000/svg" width="38px" height="38px" viewBox="0 0 16 16"><g><path d="M8 1c3.9 0 7 3.1 7 7s-3.1 7-7 7-7-3.1-7-7 3.1-7 7-7zM8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8v0z" data-original="#444444" data-old_color="#444444"/><path d="M12.2 10.8l-2.8-2.8 2.8-2.8-1.4-1.4-2.8 2.8-2.8-2.8-1.4 1.4 2.8 2.8-2.8 2.8 1.4 1.4 2.8-2.8 2.8 2.8z"/></g> </svg>', 'text/xml').firstChild;
|
|
1117
1148
|
}
|
|
1118
1149
|
}
|
|
1119
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsButtonDirective, deps: [
|
|
1120
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsButtonDirective, selector: "[mat-raised-button]
|
|
1150
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1151
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: { name: "name", dirtySubmit: "dirtySubmit" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0 });
|
|
1121
1152
|
}
|
|
1122
1153
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsButtonDirective, decorators: [{
|
|
1123
1154
|
type: Directive,
|
|
1124
1155
|
args: [{
|
|
1125
|
-
selector: '[mat-raised-button]
|
|
1156
|
+
selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
|
|
1126
1157
|
}]
|
|
1127
|
-
}],
|
|
1128
|
-
type: Optional
|
|
1129
|
-
}, {
|
|
1130
|
-
type: Host
|
|
1131
|
-
}] }, { type: FsFormDirective, decorators: [{
|
|
1132
|
-
type: Optional
|
|
1133
|
-
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { name: [{
|
|
1158
|
+
}], propDecorators: { name: [{
|
|
1134
1159
|
type: Input
|
|
1135
1160
|
}], dirtySubmit: [{
|
|
1136
1161
|
type: Input
|
|
1137
|
-
}], form: [{
|
|
1138
|
-
type: Input
|
|
1139
1162
|
}], transitionStyle: [{
|
|
1140
1163
|
type: HostBinding,
|
|
1141
1164
|
args: ['style.transition']
|
|
@@ -1159,7 +1182,7 @@ class FsFormDialogActionsComponent {
|
|
|
1159
1182
|
ngOnInit() {
|
|
1160
1183
|
if (this._form) {
|
|
1161
1184
|
this._form.ngForm.valueChanges
|
|
1162
|
-
.pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1185
|
+
.pipe(filter$1(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1163
1186
|
.subscribe(() => {
|
|
1164
1187
|
this.dirty = this._form.ngForm.dirty;
|
|
1165
1188
|
this._cdRef.markForCheck();
|
|
@@ -1183,7 +1206,7 @@ class FsFormDialogActionsComponent {
|
|
|
1183
1206
|
this._destroy$.complete();
|
|
1184
1207
|
}
|
|
1185
1208
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDialogActionsComponent, deps: [{ token: FsFormDirective, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1186
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", done: "done", closeData: "closeData", name: "name" }, ngImport: i0, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], dependencies: [{ kind: "directive", type: i2$
|
|
1209
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", done: "done", closeData: "closeData", name: "name" }, ngImport: i0, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], dependencies: [{ kind: "directive", type: i2$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: ["closeData"] }, { kind: "directive", type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1187
1210
|
}
|
|
1188
1211
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
|
|
1189
1212
|
type: Component,
|
|
@@ -1250,7 +1273,7 @@ class FsFormTemplateOutletComponent {
|
|
|
1250
1273
|
}
|
|
1251
1274
|
constructor() { }
|
|
1252
1275
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1253
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", type: FsFormTemplateOutletComponent, selector: "fs-form-template-outlet", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>", dependencies: [{ kind: "directive", type: i2$
|
|
1276
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.7", type: FsFormTemplateOutletComponent, selector: "fs-form-template-outlet", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>", dependencies: [{ kind: "directive", type: i2$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i2$3.JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1254
1277
|
}
|
|
1255
1278
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateOutletComponent, decorators: [{
|
|
1256
1279
|
type: Component,
|
|
@@ -1262,35 +1285,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
1262
1285
|
args: [NgModel, { descendants: true }]
|
|
1263
1286
|
}] } });
|
|
1264
1287
|
|
|
1265
|
-
class FsFormTemplateDirective {
|
|
1266
|
-
constructor() { }
|
|
1267
|
-
models;
|
|
1268
|
-
ngAfterContentInit() {
|
|
1269
|
-
}
|
|
1270
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1271
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
|
|
1272
|
-
}
|
|
1273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
|
|
1274
|
-
type: Directive,
|
|
1275
|
-
args: [{
|
|
1276
|
-
selector: '[fsFormTemplate]',
|
|
1277
|
-
}]
|
|
1278
|
-
}], ctorParameters: () => [], propDecorators: { models: [{
|
|
1279
|
-
type: ViewChildren,
|
|
1280
|
-
args: [NgModel]
|
|
1281
|
-
}] } });
|
|
1282
|
-
|
|
1283
|
-
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
1284
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1285
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
|
|
1286
|
-
}
|
|
1287
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
|
|
1288
|
-
type: Directive,
|
|
1289
|
-
args: [{
|
|
1290
|
-
selector: 'dummy-selector',
|
|
1291
|
-
}]
|
|
1292
|
-
}] });
|
|
1293
|
-
|
|
1294
1288
|
const ERROR_MESSAGES = {
|
|
1295
1289
|
required: 'This field is required',
|
|
1296
1290
|
email: 'This is not a valid email address',
|
|
@@ -1538,7 +1532,7 @@ class FsControlDirective {
|
|
|
1538
1532
|
}
|
|
1539
1533
|
control.updateValueAndValidity();
|
|
1540
1534
|
}
|
|
1541
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsControlDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1$
|
|
1535
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsControlDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1$1.NgControl, optional: true }, { token: FsFormDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1542
1536
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsControlDirective, selector: "[fsFormControl]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", appendMessageClass: "appendMessageClass", appendLabelClass: "appendLabelClass", appendErrorClass: "appendErrorClass", appendHintClass: "appendHintClass", validateMessages: "validateMessages" }, providers: [
|
|
1543
1537
|
VALIDATE_MESSAGE_PROVIDER,
|
|
1544
1538
|
], ngImport: i0 });
|
|
@@ -1556,7 +1550,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
1556
1550
|
}, {
|
|
1557
1551
|
type: Inject,
|
|
1558
1552
|
args: [VALIDATE_MESSAGES]
|
|
1559
|
-
}] }, { type: i1$
|
|
1553
|
+
}] }, { type: i1$1.NgControl, decorators: [{
|
|
1560
1554
|
type: Optional
|
|
1561
1555
|
}] }, { type: FsFormDirective, decorators: [{
|
|
1562
1556
|
type: Optional
|
|
@@ -2448,6 +2442,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2448
2442
|
type: Input
|
|
2449
2443
|
}] } });
|
|
2450
2444
|
|
|
2445
|
+
class FsFormTemplateDirective {
|
|
2446
|
+
constructor() { }
|
|
2447
|
+
models;
|
|
2448
|
+
ngAfterContentInit() {
|
|
2449
|
+
}
|
|
2450
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2451
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
|
|
2452
|
+
}
|
|
2453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
|
|
2454
|
+
type: Directive,
|
|
2455
|
+
args: [{
|
|
2456
|
+
selector: '[fsFormTemplate]',
|
|
2457
|
+
}]
|
|
2458
|
+
}], ctorParameters: () => [], propDecorators: { models: [{
|
|
2459
|
+
type: ViewChildren,
|
|
2460
|
+
args: [NgModel]
|
|
2461
|
+
}] } });
|
|
2462
|
+
|
|
2463
|
+
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
2464
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2465
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
|
|
2466
|
+
}
|
|
2467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
|
|
2468
|
+
type: Directive,
|
|
2469
|
+
args: [{
|
|
2470
|
+
selector: 'dummy-selector',
|
|
2471
|
+
}]
|
|
2472
|
+
}] });
|
|
2473
|
+
|
|
2451
2474
|
class FsFormModule {
|
|
2452
2475
|
static forRoot() {
|
|
2453
2476
|
/**
|
|
@@ -2492,7 +2515,7 @@ class FsFormModule {
|
|
|
2492
2515
|
FsFormTemplateComponent,
|
|
2493
2516
|
FsFormTemplateDirective,
|
|
2494
2517
|
FsFormTemplateOutletComponent,
|
|
2495
|
-
|
|
2518
|
+
FsFormGroupDirective], imports: [CommonModule,
|
|
2496
2519
|
FormsModule,
|
|
2497
2520
|
MatButtonModule,
|
|
2498
2521
|
MatDialogModule,
|
|
@@ -2526,7 +2549,8 @@ class FsFormModule {
|
|
|
2526
2549
|
FsSubmitButtonDirective,
|
|
2527
2550
|
FsFormTemplateComponent,
|
|
2528
2551
|
FsFormTemplateDirective,
|
|
2529
|
-
FsFormTemplateOutletComponent
|
|
2552
|
+
FsFormTemplateOutletComponent,
|
|
2553
|
+
FsFormGroupDirective] });
|
|
2530
2554
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormModule, providers: [
|
|
2531
2555
|
{
|
|
2532
2556
|
provide: ErrorStateMatcher,
|
|
@@ -2581,7 +2605,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2581
2605
|
FsFormTemplateComponent,
|
|
2582
2606
|
FsFormTemplateDirective,
|
|
2583
2607
|
FsFormTemplateOutletComponent,
|
|
2584
|
-
|
|
2608
|
+
FsFormGroupDirective,
|
|
2585
2609
|
],
|
|
2586
2610
|
exports: [
|
|
2587
2611
|
FsFormDirective,
|
|
@@ -2614,6 +2638,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2614
2638
|
FsFormTemplateComponent,
|
|
2615
2639
|
FsFormTemplateDirective,
|
|
2616
2640
|
FsFormTemplateOutletComponent,
|
|
2641
|
+
FsFormGroupDirective,
|
|
2617
2642
|
],
|
|
2618
2643
|
providers: [
|
|
2619
2644
|
{
|
|
@@ -2630,5 +2655,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2630
2655
|
* Generated bundle index. Do not edit.
|
|
2631
2656
|
*/
|
|
2632
2657
|
|
|
2633
|
-
export { ConfirmResult, FormDeactivateGuard, FormStatus, FsButtonDirective, FsControlDirective, FsForm, FsFormCompareDirective, FsFormDateRangeDirective, FsFormDialogActionsComponent, FsFormDialogCloseDirective, FsFormDirective, FsFormEmailDirective, FsFormEmailsDirective, FsFormFunctionDirective, FsFormGreaterDirective, FsFormGreaterEqualDirective, FsFormIntegerDirective, FsFormLesserDirective, FsFormLesserEqualDirective, FsFormMaxDirective, FsFormMaxLengthDirective, FsFormMinDirective, FsFormMinLengthDirective, FsFormModule, FsFormNoFsValidatorsDirective, FsFormNumericDirective, FsFormPatternDirective, FsFormPhoneDirective, FsFormRequiredDirective, FsFormTemplateComponent, FsFormTemplateDirective, FsFormTemplateOutletComponent, FsFormUrlDirective, FsFormValidateDirective, FsSubmitButtonDirective, FsValidators };
|
|
2658
|
+
export { ConfirmResult, FormDeactivateGuard, FormStatus, FsButtonDirective, FsControlDirective, FsForm, FsFormCompareDirective, FsFormDateRangeDirective, FsFormDialogActionsComponent, FsFormDialogCloseDirective, FsFormDirective, FsFormEmailDirective, FsFormEmailsDirective, FsFormFunctionDirective, FsFormGreaterDirective, FsFormGreaterEqualDirective, FsFormGroupDirective, FsFormIntegerDirective, FsFormLesserDirective, FsFormLesserEqualDirective, FsFormMaxDirective, FsFormMaxLengthDirective, FsFormMinDirective, FsFormMinLengthDirective, FsFormModule, FsFormNoFsValidatorsDirective, FsFormNumericDirective, FsFormPatternDirective, FsFormPhoneDirective, FsFormRequiredDirective, FsFormTemplateComponent, FsFormTemplateDirective, FsFormTemplateOutletComponent, FsFormUrlDirective, FsFormValidateDirective, FsSubmitButtonDirective, FsValidators };
|
|
2634
2659
|
//# sourceMappingURL=firestitch-form.mjs.map
|