@firestitch/form 18.0.9 → 18.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +12 -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 +94 -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 +32 -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 +301 -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, ContentChild, 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,140 @@ 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
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormGroupDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
346
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsFormGroupDirective, selector: "[fsFormGroup]", queries: [{ propertyName: "_formDirective", first: true, predicate: FsFormDirective, descendants: true }], exportAs: ["fsFormGroup"], usesInheritance: true, ngImport: i0 });
|
|
347
|
+
}
|
|
348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormGroupDirective, decorators: [{
|
|
349
|
+
type: Directive,
|
|
350
|
+
args: [{
|
|
351
|
+
selector: '[fsFormGroup]',
|
|
352
|
+
exportAs: 'fsFormGroup',
|
|
353
|
+
}]
|
|
354
|
+
}], propDecorators: { _formDirective: [{
|
|
355
|
+
type: ContentChild,
|
|
356
|
+
args: [FsFormDirective]
|
|
357
|
+
}] } });
|
|
358
|
+
|
|
359
|
+
class FsFormDirective extends FsFormBaseDirective {
|
|
247
360
|
ngForm;
|
|
248
361
|
_form;
|
|
249
362
|
_element;
|
|
250
363
|
_message;
|
|
251
364
|
_ngZone;
|
|
252
365
|
_cdRef;
|
|
366
|
+
_formGroup;
|
|
253
367
|
_dialogRef;
|
|
254
368
|
_drawerRef;
|
|
255
369
|
_route;
|
|
@@ -263,7 +377,6 @@ class FsFormDirective {
|
|
|
263
377
|
confirmDialog = true;
|
|
264
378
|
confirmDrawer = true;
|
|
265
379
|
confirmBrowser = true;
|
|
266
|
-
confirmTabs = true;
|
|
267
380
|
dirtySubmitButton = true;
|
|
268
381
|
set submit(submit$) {
|
|
269
382
|
this._submit$ = submit$;
|
|
@@ -273,7 +386,6 @@ class FsFormDirective {
|
|
|
273
386
|
}
|
|
274
387
|
successDelay = 0;
|
|
275
388
|
errorDelay = 1000;
|
|
276
|
-
tabGroup;
|
|
277
389
|
deactivationGuard = true;
|
|
278
390
|
submitEvent = new EventEmitter();
|
|
279
391
|
invalid = new EventEmitter();
|
|
@@ -282,24 +394,21 @@ class FsFormDirective {
|
|
|
282
394
|
reseted = new EventEmitter();
|
|
283
395
|
cleared = new EventEmitter();
|
|
284
396
|
fsFormClass = true;
|
|
285
|
-
_tabGroups = new QueryList();
|
|
286
|
-
_buttons = new QueryList();
|
|
287
397
|
_registerControl;
|
|
288
|
-
_activeSubmitButton;
|
|
289
398
|
_dialogBackdropEscape = false;
|
|
290
399
|
_snapshot = {};
|
|
291
400
|
_activatedRouteConfig;
|
|
292
401
|
_status$ = new BehaviorSubject(FormStatus.Valid);
|
|
293
|
-
_destroy$ = new Subject();
|
|
294
|
-
_confirmed = false;
|
|
295
402
|
_submit$ = null;
|
|
296
|
-
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
|
|
403
|
+
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _formGroup, _dialogRef, _drawerRef, _route) {
|
|
404
|
+
super();
|
|
297
405
|
this.ngForm = ngForm;
|
|
298
406
|
this._form = _form;
|
|
299
407
|
this._element = _element;
|
|
300
408
|
this._message = _message;
|
|
301
409
|
this._ngZone = _ngZone;
|
|
302
410
|
this._cdRef = _cdRef;
|
|
411
|
+
this._formGroup = _formGroup;
|
|
303
412
|
this._dialogRef = _dialogRef;
|
|
304
413
|
this._drawerRef = _drawerRef;
|
|
305
414
|
this._route = _route;
|
|
@@ -320,7 +429,6 @@ class FsFormDirective {
|
|
|
320
429
|
};
|
|
321
430
|
}
|
|
322
431
|
get _formValidState$() {
|
|
323
|
-
this._form.broadcast('valid', this._submitEvent);
|
|
324
432
|
this.submitEvent.emit(this._submitEvent);
|
|
325
433
|
this.valid.emit(this._submitEvent);
|
|
326
434
|
const submittedEvent = {
|
|
@@ -334,10 +442,9 @@ class FsFormDirective {
|
|
|
334
442
|
.pipe(map((response) => {
|
|
335
443
|
submittedEvent.response = response;
|
|
336
444
|
return submittedEvent;
|
|
337
|
-
}), takeUntil(this.
|
|
445
|
+
}), takeUntil(this.destroy$));
|
|
338
446
|
}
|
|
339
447
|
get _formInvalidState$() {
|
|
340
|
-
this._form.broadcast('invalid', this._submitEvent);
|
|
341
448
|
if (this.invalid) {
|
|
342
449
|
this.invalid.emit(this._submitEvent);
|
|
343
450
|
}
|
|
@@ -347,12 +454,10 @@ class FsFormDirective {
|
|
|
347
454
|
if (el) {
|
|
348
455
|
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
349
456
|
}
|
|
350
|
-
return throwError('Form validation error');
|
|
457
|
+
return throwError(() => new Error('Form validation error'));
|
|
351
458
|
}
|
|
352
459
|
get _submitter() {
|
|
353
|
-
return this.
|
|
354
|
-
? this._activeSubmitButton.name
|
|
355
|
-
: null;
|
|
460
|
+
return this._getFormGroup().activeSubmitButton?.name;
|
|
356
461
|
}
|
|
357
462
|
ngOnInit() {
|
|
358
463
|
if (this.deactivationGuard) {
|
|
@@ -387,16 +492,15 @@ class FsFormDirective {
|
|
|
387
492
|
});
|
|
388
493
|
}
|
|
389
494
|
ngAfterContentInit() {
|
|
495
|
+
super.ngAfterContentInit();
|
|
390
496
|
this._registerConfirm();
|
|
391
497
|
this._registerConfirmDrawerClose();
|
|
392
|
-
this._registerConfirmTabs();
|
|
393
498
|
this._registerDrawerClose();
|
|
394
499
|
this._registerDirtySubmitButton();
|
|
395
500
|
}
|
|
396
501
|
ngOnDestroy() {
|
|
502
|
+
super.ngOnDestroy();
|
|
397
503
|
this._cleanupCanDeactivate();
|
|
398
|
-
this._destroy$.next(null);
|
|
399
|
-
this._destroy$.complete();
|
|
400
504
|
}
|
|
401
505
|
createSnapshot() {
|
|
402
506
|
this._snapshot = this.ngForm.value;
|
|
@@ -426,13 +530,12 @@ class FsFormDirective {
|
|
|
426
530
|
this._updateDirtySubmitButtons();
|
|
427
531
|
}
|
|
428
532
|
triggerSubmit(options) {
|
|
429
|
-
this._confirmed = options?.confirmed;
|
|
430
533
|
this.ngForm.ngSubmit.emit();
|
|
431
534
|
}
|
|
432
535
|
triggerConfirm() {
|
|
433
536
|
const submitted = this.submitting ? this.submitted.asObservable() : of({});
|
|
434
537
|
return submitted
|
|
435
|
-
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved(
|
|
538
|
+
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved(this)));
|
|
436
539
|
}
|
|
437
540
|
enable() {
|
|
438
541
|
this.ngForm.control.enable();
|
|
@@ -440,22 +543,11 @@ class FsFormDirective {
|
|
|
440
543
|
}
|
|
441
544
|
disable() {
|
|
442
545
|
this.ngForm.control.disable();
|
|
443
|
-
this.
|
|
546
|
+
this._getFormGroup()
|
|
547
|
+
.buttons.forEach((button) => {
|
|
444
548
|
button.disable();
|
|
445
549
|
});
|
|
446
550
|
}
|
|
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
551
|
validate() {
|
|
460
552
|
Object.values(this.ngForm.controls)
|
|
461
553
|
.forEach((control) => {
|
|
@@ -464,37 +556,38 @@ class FsFormDirective {
|
|
|
464
556
|
control.updateValueAndValidity();
|
|
465
557
|
});
|
|
466
558
|
}
|
|
559
|
+
submit$(submitEvent) {
|
|
560
|
+
return of(submitEvent)
|
|
561
|
+
.pipe(tap(() => this._statusValidating()), tap(() => this.validate()), tap(() => this._statusSubmitting()), tap(() => this._setupActiveSubmitButton()), tap(() => this._disableButtons()), switchMap((data) => this._waitUntilStatusPending()
|
|
562
|
+
.pipe(map(() => data))), mergeMap(() => {
|
|
563
|
+
if (this.ngForm.status === 'INVALID') {
|
|
564
|
+
return this._formInvalidState$;
|
|
565
|
+
}
|
|
566
|
+
return this._formValidState$;
|
|
567
|
+
}), catchError((e) => {
|
|
568
|
+
this._handleError(e);
|
|
569
|
+
return of(null);
|
|
570
|
+
}), tap((submittedEvent) => {
|
|
571
|
+
if (submittedEvent) {
|
|
572
|
+
this._completeSubmit(true, submittedEvent);
|
|
573
|
+
}
|
|
574
|
+
}));
|
|
575
|
+
}
|
|
467
576
|
_listenSubmit() {
|
|
468
|
-
this
|
|
577
|
+
this
|
|
578
|
+
.ngForm
|
|
469
579
|
.ngSubmit
|
|
470
580
|
.pipe(tap((event) => {
|
|
471
581
|
event?.preventDefault();
|
|
472
|
-
}),
|
|
473
|
-
return { event, confirmed: this._confirmed };
|
|
474
|
-
}), tap(() => this._confirmed = false), filter(() => {
|
|
582
|
+
}), filter$1(() => {
|
|
475
583
|
return [FormStatus.Valid, FormStatus.Invalid]
|
|
476
584
|
.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$))
|
|
585
|
+
}), switchMap(() => this.submit$(this._submitEvent)), takeUntil(this.destroy$))
|
|
493
586
|
.subscribe();
|
|
494
587
|
}
|
|
495
588
|
_listenFormStatus() {
|
|
496
589
|
this._status$
|
|
497
|
-
.pipe(takeUntil(this.
|
|
590
|
+
.pipe(takeUntil(this.destroy$))
|
|
498
591
|
.subscribe((formStatus) => {
|
|
499
592
|
const cls = [FormStatus.Submitting, FormStatus.Validating];
|
|
500
593
|
const classList = this._element.nativeElement.classList;
|
|
@@ -506,7 +599,7 @@ class FsFormDirective {
|
|
|
506
599
|
}
|
|
507
600
|
_listenWindowClose() {
|
|
508
601
|
fromEvent(window, 'beforeunload')
|
|
509
|
-
.pipe(takeUntil(this.
|
|
602
|
+
.pipe(takeUntil(this.destroy$))
|
|
510
603
|
.subscribe((event) => {
|
|
511
604
|
if (this.confirm && this.confirmBrowser && this.ngForm.dirty) {
|
|
512
605
|
event.returnValue = false;
|
|
@@ -525,7 +618,7 @@ class FsFormDirective {
|
|
|
525
618
|
_listenHotKeys() {
|
|
526
619
|
this._ngZone.runOutsideAngular(() => {
|
|
527
620
|
fromEvent(document, 'keydown')
|
|
528
|
-
.pipe(takeUntil(this.
|
|
621
|
+
.pipe(takeUntil(this.destroy$))
|
|
529
622
|
.subscribe((event) => {
|
|
530
623
|
if (this._dialogBackdropEscape && event.code === 'Escape') {
|
|
531
624
|
const cdkOverlayPane = Array
|
|
@@ -552,11 +645,11 @@ class FsFormDirective {
|
|
|
552
645
|
_formClose() {
|
|
553
646
|
if (this.confirm && this.confirmDialog) {
|
|
554
647
|
this.triggerConfirm()
|
|
555
|
-
.pipe(filter((result) => confirmResultContinue(result)), switchMap((result) => {
|
|
648
|
+
.pipe(filter$1((result) => confirmResultContinue(result)), switchMap((result) => {
|
|
556
649
|
return result === ConfirmResult.Pristine || result === ConfirmResult.Discard
|
|
557
650
|
? of(null)
|
|
558
651
|
: this.submitted.asObservable();
|
|
559
|
-
}), takeUntil(this.
|
|
652
|
+
}), takeUntil(this.destroy$))
|
|
560
653
|
.subscribe((result) => {
|
|
561
654
|
this._dialogRef.close(result?.response);
|
|
562
655
|
});
|
|
@@ -566,13 +659,12 @@ class FsFormDirective {
|
|
|
566
659
|
}
|
|
567
660
|
}
|
|
568
661
|
_getActiveSubmitButton() {
|
|
569
|
-
|
|
570
|
-
.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return activeButton ? activeButton : submitButtons[0];
|
|
662
|
+
if (this._getFormGroup().activeSubmitButton) {
|
|
663
|
+
return this._getFormGroup().activeSubmitButton;
|
|
664
|
+
}
|
|
665
|
+
return this._getFormGroup()
|
|
666
|
+
.buttons
|
|
667
|
+
.filter((button) => button.submit)[0];
|
|
576
668
|
}
|
|
577
669
|
_elementInForm(el) {
|
|
578
670
|
if (el.isSameNode(this._element.nativeElement)) {
|
|
@@ -592,12 +684,12 @@ class FsFormDirective {
|
|
|
592
684
|
else {
|
|
593
685
|
this._resetButtons();
|
|
594
686
|
}
|
|
595
|
-
if (this.
|
|
687
|
+
if (this._getFormGroup().activeSubmitButton) {
|
|
596
688
|
if (success) {
|
|
597
|
-
this.
|
|
689
|
+
this._getFormGroup().activeSubmitButton.success();
|
|
598
690
|
}
|
|
599
691
|
else {
|
|
600
|
-
this.
|
|
692
|
+
this._getFormGroup().activeSubmitButton.error();
|
|
601
693
|
}
|
|
602
694
|
}
|
|
603
695
|
this._status$.next(FormStatus.Submitted);
|
|
@@ -610,7 +702,8 @@ class FsFormDirective {
|
|
|
610
702
|
this._status$.next(FormStatus.Completing);
|
|
611
703
|
const resetDelay = success ? this.successDelay : this.errorDelay;
|
|
612
704
|
of(true)
|
|
613
|
-
.pipe(delay(resetDelay), first(), takeUntil(this.
|
|
705
|
+
.pipe(delay(resetDelay), first(), takeUntil(this.destroy$))
|
|
706
|
+
.subscribe(() => {
|
|
614
707
|
if (this.ngForm.form.status === 'VALID') {
|
|
615
708
|
this._status$.next(FormStatus.Valid);
|
|
616
709
|
}
|
|
@@ -618,23 +711,22 @@ class FsFormDirective {
|
|
|
618
711
|
this._status$.next(FormStatus.Invalid);
|
|
619
712
|
}
|
|
620
713
|
this._resetButtons();
|
|
621
|
-
this.
|
|
714
|
+
this._getFormGroup().activeSubmitButton = null;
|
|
622
715
|
this._updateDirtySubmitButtons();
|
|
623
716
|
});
|
|
624
717
|
}
|
|
718
|
+
_getFormGroup() {
|
|
719
|
+
return this._formGroup || this;
|
|
720
|
+
}
|
|
625
721
|
_resetButtons() {
|
|
626
|
-
this.
|
|
722
|
+
this._getFormGroup()
|
|
723
|
+
.buttons.forEach((button) => {
|
|
627
724
|
button.reset();
|
|
628
725
|
});
|
|
629
726
|
}
|
|
630
|
-
_resetActiveButtons() {
|
|
631
|
-
this._buttons.forEach((button) => {
|
|
632
|
-
button.resetActive();
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
727
|
_registerConfirm() {
|
|
636
728
|
this.ngForm.form.valueChanges
|
|
637
|
-
.pipe(takeUntil(this.
|
|
729
|
+
.pipe(takeUntil(this.destroy$))
|
|
638
730
|
.subscribe((changes) => {
|
|
639
731
|
if (this._dialogBackdropEscape && this._dialogRef) {
|
|
640
732
|
this._dialogRef.disableClose = true;
|
|
@@ -653,11 +745,11 @@ class FsFormDirective {
|
|
|
653
745
|
_registerDrawerClose() {
|
|
654
746
|
if (this._drawerRef) {
|
|
655
747
|
this._drawerRef.closeStart$
|
|
656
|
-
.pipe(takeUntil(this.
|
|
748
|
+
.pipe(takeUntil(this.destroy$))
|
|
657
749
|
.subscribe((subscriber) => {
|
|
658
750
|
if (this.submitting) {
|
|
659
751
|
this._status$
|
|
660
|
-
.pipe(filter((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this.
|
|
752
|
+
.pipe(filter$1((status) => status === FormStatus.Success || status === FormStatus.Error), takeUntil(this.destroy$))
|
|
661
753
|
.subscribe((status) => {
|
|
662
754
|
if (status === FormStatus.Success) {
|
|
663
755
|
subscriber.next(null);
|
|
@@ -690,65 +782,20 @@ class FsFormDirective {
|
|
|
690
782
|
subscriber.complete();
|
|
691
783
|
return of(null);
|
|
692
784
|
}));
|
|
693
|
-
}), takeUntil(this.
|
|
785
|
+
}), takeUntil(this.destroy$))
|
|
694
786
|
.subscribe();
|
|
695
787
|
}
|
|
696
788
|
}
|
|
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
789
|
_registerConfirmDialogBackdropEscape() {
|
|
743
790
|
if (this._dialogRef) {
|
|
744
791
|
this._dialogBackdropEscape = !this._dialogRef?.disableClose;
|
|
745
792
|
if (this._dialogBackdropEscape) {
|
|
746
793
|
this._dialogRef.backdropClick()
|
|
747
|
-
.pipe(takeUntil(this.
|
|
794
|
+
.pipe(takeUntil(this.destroy$))
|
|
748
795
|
.subscribe(() => {
|
|
749
796
|
this._formClose();
|
|
750
797
|
});
|
|
751
|
-
this.
|
|
798
|
+
this.destroy$
|
|
752
799
|
.subscribe(() => {
|
|
753
800
|
this._dialogRef.disableClose = false;
|
|
754
801
|
});
|
|
@@ -773,18 +820,20 @@ class FsFormDirective {
|
|
|
773
820
|
return;
|
|
774
821
|
}
|
|
775
822
|
this.ngForm.form.valueChanges
|
|
776
|
-
.pipe(takeUntil(this.
|
|
823
|
+
.pipe(takeUntil(this.destroy$))
|
|
777
824
|
.subscribe(() => {
|
|
778
825
|
this._updateDirtySubmitButtons();
|
|
779
826
|
});
|
|
780
|
-
this.
|
|
781
|
-
.
|
|
827
|
+
this._getFormGroup()
|
|
828
|
+
.buttons.changes
|
|
829
|
+
.pipe(takeUntil(this.destroy$))
|
|
782
830
|
.subscribe(() => {
|
|
783
831
|
this._updateDirtySubmitButtons();
|
|
784
832
|
});
|
|
785
833
|
}
|
|
786
834
|
_updateDirtySubmitButtons() {
|
|
787
|
-
this.
|
|
835
|
+
this._getFormGroup()
|
|
836
|
+
.buttons
|
|
788
837
|
.filter((button) => button.submit)
|
|
789
838
|
.forEach((submitButton) => {
|
|
790
839
|
if (!this.confirm || !this.dirtySubmitButton || this.ngForm.dirty || !submitButton.dirtySubmit) {
|
|
@@ -795,22 +844,23 @@ class FsFormDirective {
|
|
|
795
844
|
}
|
|
796
845
|
});
|
|
797
846
|
}
|
|
798
|
-
|
|
847
|
+
_statusSubmitting() {
|
|
799
848
|
this._status$.next(FormStatus.Submitting);
|
|
800
|
-
this._form.broadcast('submit', this.ngForm);
|
|
801
849
|
}
|
|
802
|
-
|
|
850
|
+
_statusValidating() {
|
|
803
851
|
this._status$.next(FormStatus.Validating);
|
|
804
852
|
}
|
|
805
853
|
_setupActiveSubmitButton() {
|
|
806
|
-
this.
|
|
854
|
+
this._getFormGroup()
|
|
855
|
+
.activeSubmitButton = this._getActiveSubmitButton();
|
|
807
856
|
this._resetButtons();
|
|
808
|
-
if (this.
|
|
809
|
-
this.
|
|
857
|
+
if (this._getFormGroup().activeSubmitButton) {
|
|
858
|
+
this._getFormGroup().activeSubmitButton.process();
|
|
810
859
|
}
|
|
811
860
|
}
|
|
812
861
|
_disableButtons() {
|
|
813
|
-
this.
|
|
862
|
+
this._getFormGroup()
|
|
863
|
+
.buttons.forEach((button) => {
|
|
814
864
|
button.disable();
|
|
815
865
|
});
|
|
816
866
|
}
|
|
@@ -851,8 +901,8 @@ class FsFormDirective {
|
|
|
851
901
|
this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
|
|
852
902
|
this._form.removeFormDirective(this._activatedRouteConfig.component);
|
|
853
903
|
}
|
|
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",
|
|
904
|
+
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 });
|
|
905
|
+
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
906
|
}
|
|
857
907
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDirective, decorators: [{
|
|
858
908
|
type: Directive,
|
|
@@ -860,20 +910,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
860
910
|
selector: '[fsForm]',
|
|
861
911
|
exportAs: 'fsForm',
|
|
862
912
|
}]
|
|
863
|
-
}], ctorParameters: () => [{ type: i1$
|
|
913
|
+
}], ctorParameters: () => [{ type: i1$1.NgForm, decorators: [{
|
|
864
914
|
type: Inject,
|
|
865
915
|
args: [NgForm]
|
|
866
|
-
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$
|
|
916
|
+
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$2.FsMessage }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: FsFormGroupDirective, decorators: [{
|
|
917
|
+
type: Optional
|
|
918
|
+
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
867
919
|
type: Optional
|
|
868
920
|
}, {
|
|
869
921
|
type: Inject,
|
|
870
922
|
args: [MatDialogRef]
|
|
871
|
-
}] }, { type:
|
|
923
|
+
}] }, { type: i7.DrawerRef, decorators: [{
|
|
872
924
|
type: Optional
|
|
873
925
|
}, {
|
|
874
926
|
type: Inject,
|
|
875
927
|
args: [DrawerRef]
|
|
876
|
-
}] }, { type: i2.ActivatedRoute }], propDecorators: { wrapperSelector: [{
|
|
928
|
+
}] }, { type: i2$1.ActivatedRoute }], propDecorators: { wrapperSelector: [{
|
|
877
929
|
type: Input
|
|
878
930
|
}], messageSelector: [{
|
|
879
931
|
type: Input
|
|
@@ -893,8 +945,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
893
945
|
type: Input
|
|
894
946
|
}], confirmBrowser: [{
|
|
895
947
|
type: Input
|
|
896
|
-
}], confirmTabs: [{
|
|
897
|
-
type: Input
|
|
898
948
|
}], dirtySubmitButton: [{
|
|
899
949
|
type: Input
|
|
900
950
|
}], submit: [{
|
|
@@ -903,8 +953,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
903
953
|
type: Input
|
|
904
954
|
}], errorDelay: [{
|
|
905
955
|
type: Input
|
|
906
|
-
}], tabGroup: [{
|
|
907
|
-
type: Input
|
|
908
956
|
}], deactivationGuard: [{
|
|
909
957
|
type: Input
|
|
910
958
|
}], submitEvent: [{
|
|
@@ -923,9 +971,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
923
971
|
}], fsFormClass: [{
|
|
924
972
|
type: HostBinding,
|
|
925
973
|
args: ['class.fs-form']
|
|
926
|
-
}], _tabGroups: [{
|
|
927
|
-
type: ContentChildren,
|
|
928
|
-
args: [MatTabGroup, { descendants: true }]
|
|
929
974
|
}] } });
|
|
930
975
|
|
|
931
976
|
class FsFormDialogCloseDirective {
|
|
@@ -941,7 +986,7 @@ class FsFormDialogCloseDirective {
|
|
|
941
986
|
closeClick() {
|
|
942
987
|
if (this._form) {
|
|
943
988
|
this._form.triggerConfirm()
|
|
944
|
-
.pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
989
|
+
.pipe(filter$1((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
945
990
|
.subscribe(() => {
|
|
946
991
|
this._dialogRef.close(this.closeData);
|
|
947
992
|
});
|
|
@@ -977,42 +1022,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
977
1022
|
}] } });
|
|
978
1023
|
|
|
979
1024
|
class FsButtonDirective {
|
|
980
|
-
_matButton;
|
|
981
|
-
_form;
|
|
982
|
-
_elementRef;
|
|
983
|
-
_cdRef;
|
|
984
1025
|
name;
|
|
985
1026
|
dirtySubmit = true;
|
|
986
|
-
form;
|
|
987
1027
|
transitionStyle = null;
|
|
988
|
-
active = false;
|
|
989
1028
|
submit = false;
|
|
990
1029
|
_previousDisabled = false;
|
|
991
1030
|
_destroy$ = new Subject();
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1031
|
+
_formGroup = inject(FsFormGroupDirective, { optional: true });
|
|
1032
|
+
_form = inject(FsFormDirective, { optional: true });
|
|
1033
|
+
_matButton = inject(MatButton, { optional: true, host: true });
|
|
1034
|
+
_elementRef = inject(ElementRef);
|
|
1035
|
+
_cdRef = inject(ChangeDetectorRef);
|
|
1036
|
+
_formBase;
|
|
998
1037
|
ngOnInit() {
|
|
999
1038
|
this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
|
|
1000
|
-
this.
|
|
1001
|
-
if (this.
|
|
1002
|
-
this.
|
|
1039
|
+
this._formBase = this._form || this._formGroup;
|
|
1040
|
+
if (this._formBase) {
|
|
1041
|
+
this._formBase.addButton(this);
|
|
1003
1042
|
if (this.submit) {
|
|
1004
1043
|
fromEvent(this.element, 'click')
|
|
1005
1044
|
.pipe(takeUntil(this._destroy$))
|
|
1006
1045
|
.subscribe(() => {
|
|
1007
|
-
this.
|
|
1046
|
+
this._formBase.activeSubmitButton = this;
|
|
1047
|
+
this._formBase.triggerSubmit();
|
|
1008
1048
|
});
|
|
1009
|
-
if (this.dirtySubmit) {
|
|
1010
|
-
if (this.form.dirtySubmitButton) {
|
|
1011
|
-
if (!this.form.ngForm.dirty) {
|
|
1012
|
-
this.disable();
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
1049
|
this.transitionStyle = 'none';
|
|
1017
1050
|
setTimeout(() => {
|
|
1018
1051
|
this.transitionStyle = null;
|
|
@@ -1021,7 +1054,7 @@ class FsButtonDirective {
|
|
|
1021
1054
|
}
|
|
1022
1055
|
}
|
|
1023
1056
|
disable() {
|
|
1024
|
-
if (this._matButton && !this.
|
|
1057
|
+
if (this._matButton && !this._formBase.activeSubmitButton) {
|
|
1025
1058
|
this._previousDisabled = this._matButton.disabled;
|
|
1026
1059
|
this._matButton.disabled = true;
|
|
1027
1060
|
this._matButton.disableRipple = true;
|
|
@@ -1056,16 +1089,12 @@ class FsButtonDirective {
|
|
|
1056
1089
|
setClass(cls) {
|
|
1057
1090
|
const svg = this._getSvg(cls);
|
|
1058
1091
|
this._resetClass();
|
|
1059
|
-
this.
|
|
1060
|
-
this.element.classList.add(`submit-${cls}`);
|
|
1092
|
+
this.element.classList.add(`fs-form-submit-button-${cls}`);
|
|
1061
1093
|
this.element.append(svg);
|
|
1062
1094
|
}
|
|
1063
1095
|
get element() {
|
|
1064
1096
|
return this._elementRef.nativeElement;
|
|
1065
1097
|
}
|
|
1066
|
-
resetActive() {
|
|
1067
|
-
this.active = false;
|
|
1068
|
-
}
|
|
1069
1098
|
reset() {
|
|
1070
1099
|
if (!this._previousDisabled) {
|
|
1071
1100
|
this.enable();
|
|
@@ -1082,14 +1111,11 @@ class FsButtonDirective {
|
|
|
1082
1111
|
ngOnDestroy() {
|
|
1083
1112
|
this._destroy$.next(null);
|
|
1084
1113
|
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');
|
|
1114
|
+
this._formBase?.removeButton(this);
|
|
1090
1115
|
}
|
|
1091
1116
|
_resetClass() {
|
|
1092
|
-
this.element.classList
|
|
1117
|
+
this.element.classList
|
|
1118
|
+
.remove('fs-form-submit-button-success', 'fs-form-submit-button-error', 'fs-form-submit-button-process');
|
|
1093
1119
|
}
|
|
1094
1120
|
_getSvg(type) {
|
|
1095
1121
|
if (type === 'success') {
|
|
@@ -1116,26 +1142,18 @@ class FsButtonDirective {
|
|
|
1116
1142
|
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
1143
|
}
|
|
1118
1144
|
}
|
|
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]
|
|
1145
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1146
|
+
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
1147
|
}
|
|
1122
1148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsButtonDirective, decorators: [{
|
|
1123
1149
|
type: Directive,
|
|
1124
1150
|
args: [{
|
|
1125
|
-
selector: '[mat-raised-button]
|
|
1151
|
+
selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
|
|
1126
1152
|
}]
|
|
1127
|
-
}],
|
|
1128
|
-
type: Optional
|
|
1129
|
-
}, {
|
|
1130
|
-
type: Host
|
|
1131
|
-
}] }, { type: FsFormDirective, decorators: [{
|
|
1132
|
-
type: Optional
|
|
1133
|
-
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { name: [{
|
|
1153
|
+
}], propDecorators: { name: [{
|
|
1134
1154
|
type: Input
|
|
1135
1155
|
}], dirtySubmit: [{
|
|
1136
1156
|
type: Input
|
|
1137
|
-
}], form: [{
|
|
1138
|
-
type: Input
|
|
1139
1157
|
}], transitionStyle: [{
|
|
1140
1158
|
type: HostBinding,
|
|
1141
1159
|
args: ['style.transition']
|
|
@@ -1159,7 +1177,7 @@ class FsFormDialogActionsComponent {
|
|
|
1159
1177
|
ngOnInit() {
|
|
1160
1178
|
if (this._form) {
|
|
1161
1179
|
this._form.ngForm.valueChanges
|
|
1162
|
-
.pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1180
|
+
.pipe(filter$1(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1163
1181
|
.subscribe(() => {
|
|
1164
1182
|
this.dirty = this._form.ngForm.dirty;
|
|
1165
1183
|
this._cdRef.markForCheck();
|
|
@@ -1183,7 +1201,7 @@ class FsFormDialogActionsComponent {
|
|
|
1183
1201
|
this._destroy$.complete();
|
|
1184
1202
|
}
|
|
1185
1203
|
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$
|
|
1204
|
+
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
1205
|
}
|
|
1188
1206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
|
|
1189
1207
|
type: Component,
|
|
@@ -1250,7 +1268,7 @@ class FsFormTemplateOutletComponent {
|
|
|
1250
1268
|
}
|
|
1251
1269
|
constructor() { }
|
|
1252
1270
|
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$
|
|
1271
|
+
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
1272
|
}
|
|
1255
1273
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateOutletComponent, decorators: [{
|
|
1256
1274
|
type: Component,
|
|
@@ -1262,35 +1280,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
1262
1280
|
args: [NgModel, { descendants: true }]
|
|
1263
1281
|
}] } });
|
|
1264
1282
|
|
|
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
1283
|
const ERROR_MESSAGES = {
|
|
1295
1284
|
required: 'This field is required',
|
|
1296
1285
|
email: 'This is not a valid email address',
|
|
@@ -1538,7 +1527,7 @@ class FsControlDirective {
|
|
|
1538
1527
|
}
|
|
1539
1528
|
control.updateValueAndValidity();
|
|
1540
1529
|
}
|
|
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$
|
|
1530
|
+
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
1531
|
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
1532
|
VALIDATE_MESSAGE_PROVIDER,
|
|
1544
1533
|
], ngImport: i0 });
|
|
@@ -1556,7 +1545,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
1556
1545
|
}, {
|
|
1557
1546
|
type: Inject,
|
|
1558
1547
|
args: [VALIDATE_MESSAGES]
|
|
1559
|
-
}] }, { type: i1$
|
|
1548
|
+
}] }, { type: i1$1.NgControl, decorators: [{
|
|
1560
1549
|
type: Optional
|
|
1561
1550
|
}] }, { type: FsFormDirective, decorators: [{
|
|
1562
1551
|
type: Optional
|
|
@@ -2448,6 +2437,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2448
2437
|
type: Input
|
|
2449
2438
|
}] } });
|
|
2450
2439
|
|
|
2440
|
+
class FsFormTemplateDirective {
|
|
2441
|
+
constructor() { }
|
|
2442
|
+
models;
|
|
2443
|
+
ngAfterContentInit() {
|
|
2444
|
+
}
|
|
2445
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2446
|
+
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 });
|
|
2447
|
+
}
|
|
2448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
|
|
2449
|
+
type: Directive,
|
|
2450
|
+
args: [{
|
|
2451
|
+
selector: '[fsFormTemplate]',
|
|
2452
|
+
}]
|
|
2453
|
+
}], ctorParameters: () => [], propDecorators: { models: [{
|
|
2454
|
+
type: ViewChildren,
|
|
2455
|
+
args: [NgModel]
|
|
2456
|
+
}] } });
|
|
2457
|
+
|
|
2458
|
+
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
2459
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2460
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
|
|
2461
|
+
}
|
|
2462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
|
|
2463
|
+
type: Directive,
|
|
2464
|
+
args: [{
|
|
2465
|
+
selector: 'dummy-selector',
|
|
2466
|
+
}]
|
|
2467
|
+
}] });
|
|
2468
|
+
|
|
2451
2469
|
class FsFormModule {
|
|
2452
2470
|
static forRoot() {
|
|
2453
2471
|
/**
|
|
@@ -2492,7 +2510,7 @@ class FsFormModule {
|
|
|
2492
2510
|
FsFormTemplateComponent,
|
|
2493
2511
|
FsFormTemplateDirective,
|
|
2494
2512
|
FsFormTemplateOutletComponent,
|
|
2495
|
-
|
|
2513
|
+
FsFormGroupDirective], imports: [CommonModule,
|
|
2496
2514
|
FormsModule,
|
|
2497
2515
|
MatButtonModule,
|
|
2498
2516
|
MatDialogModule,
|
|
@@ -2526,7 +2544,8 @@ class FsFormModule {
|
|
|
2526
2544
|
FsSubmitButtonDirective,
|
|
2527
2545
|
FsFormTemplateComponent,
|
|
2528
2546
|
FsFormTemplateDirective,
|
|
2529
|
-
FsFormTemplateOutletComponent
|
|
2547
|
+
FsFormTemplateOutletComponent,
|
|
2548
|
+
FsFormGroupDirective] });
|
|
2530
2549
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsFormModule, providers: [
|
|
2531
2550
|
{
|
|
2532
2551
|
provide: ErrorStateMatcher,
|
|
@@ -2581,7 +2600,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2581
2600
|
FsFormTemplateComponent,
|
|
2582
2601
|
FsFormTemplateDirective,
|
|
2583
2602
|
FsFormTemplateOutletComponent,
|
|
2584
|
-
|
|
2603
|
+
FsFormGroupDirective,
|
|
2585
2604
|
],
|
|
2586
2605
|
exports: [
|
|
2587
2606
|
FsFormDirective,
|
|
@@ -2614,6 +2633,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2614
2633
|
FsFormTemplateComponent,
|
|
2615
2634
|
FsFormTemplateDirective,
|
|
2616
2635
|
FsFormTemplateOutletComponent,
|
|
2636
|
+
FsFormGroupDirective,
|
|
2617
2637
|
],
|
|
2618
2638
|
providers: [
|
|
2619
2639
|
{
|
|
@@ -2630,5 +2650,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2630
2650
|
* Generated bundle index. Do not edit.
|
|
2631
2651
|
*/
|
|
2632
2652
|
|
|
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 };
|
|
2653
|
+
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
2654
|
//# sourceMappingURL=firestitch-form.mjs.map
|