@firestitch/form 12.3.5 → 12.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { AfterContentInit, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges } from '@angular/core';
2
2
  import { NgForm } from '@angular/forms';
3
+ import { ActivatedRoute } from '@angular/router';
3
4
  import { MatDialogRef } from '@angular/material/dialog';
4
5
  import { MatTabGroup } from '@angular/material/tabs';
5
6
  import { FsMessage } from '@firestitch/message';
@@ -22,6 +23,7 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
22
23
  private _ngZone;
23
24
  private _dialogRef;
24
25
  private _drawerRef;
26
+ private _route;
25
27
  wrapperSelector: string;
26
28
  messageSelector: string;
27
29
  hintSelector: string;
@@ -38,6 +40,7 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
38
40
  successDelay: number;
39
41
  errorDelay: number;
40
42
  tabGroup: MatTabGroup;
43
+ deactivationGuard: boolean;
41
44
  submitEvent: EventEmitter<SubmitEvent>;
42
45
  invalid: EventEmitter<SubmitEvent>;
43
46
  valid: EventEmitter<SubmitEvent>;
@@ -52,9 +55,10 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
52
55
  private _activeSubmitButton;
53
56
  private _dialogBackdropEscape;
54
57
  private _snapshot;
58
+ private _activatedRouteConfig;
55
59
  private _status$;
56
60
  private _destroy$;
57
- constructor(ngForm: NgForm, _form: FsForm, _element: ElementRef, _message: FsMessage, _prompt: FsPrompt, _ngZone: NgZone, _dialogRef: MatDialogRef<any>, _drawerRef: DrawerRef<any>);
61
+ constructor(ngForm: NgForm, _form: FsForm, _element: ElementRef, _message: FsMessage, _prompt: FsPrompt, _ngZone: NgZone, _dialogRef: MatDialogRef<any>, _drawerRef: DrawerRef<any>, _route: ActivatedRoute);
58
62
  get submitting(): boolean;
59
63
  get validating(): boolean;
60
64
  get completing(): boolean;
@@ -108,6 +112,8 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
108
112
  private _disableButtons;
109
113
  private _waitUntilStatusPending;
110
114
  private _handleError;
111
- static ɵfac: i0.ɵɵFactoryDeclaration<FsFormDirective, [null, null, null, null, null, null, { optional: true; }, { optional: true; }]>;
112
- static ɵdir: i0.ɵɵDirectiveDeclaration<FsFormDirective, "[fsForm]", never, { "wrapperSelector": "wrapperSelector"; "messageSelector": "messageSelector"; "hintSelector": "hintSelector"; "labelSelector": "labelSelector"; "autocomplete": "autocomplete"; "shortcuts": "shortcuts"; "confirm": "confirm"; "confirmDialog": "confirmDialog"; "confirmDrawer": "confirmDrawer"; "confirmBrowser": "confirmBrowser"; "confirmTabs": "confirmTabs"; "dirtySubmitButton": "dirtySubmitButton"; "submit": "submit"; "successDelay": "successDelay"; "errorDelay": "errorDelay"; "tabGroup": "tabGroup"; }, { "submitEvent": "fsForm"; "invalid": "invalid"; "valid": "valid"; "submitted": "submitted"; "reseted": "reseted"; "cleared": "cleared"; }, ["formDialogClose", "_tabGroups"]>;
115
+ private _registerCanDeactivateGuard;
116
+ private _cleanupCanDeactivate;
117
+ static ɵfac: i0.ɵɵFactoryDeclaration<FsFormDirective, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, null]>;
118
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FsFormDirective, "[fsForm]", never, { "wrapperSelector": "wrapperSelector"; "messageSelector": "messageSelector"; "hintSelector": "hintSelector"; "labelSelector": "labelSelector"; "autocomplete": "autocomplete"; "shortcuts": "shortcuts"; "confirm": "confirm"; "confirmDialog": "confirmDialog"; "confirmDrawer": "confirmDrawer"; "confirmBrowser": "confirmBrowser"; "confirmTabs": "confirmTabs"; "dirtySubmitButton": "dirtySubmitButton"; "submit": "submit"; "successDelay": "successDelay"; "errorDelay": "errorDelay"; "tabGroup": "tabGroup"; "deactivationGuard": "deactivationGuard"; }, { "submitEvent": "fsForm"; "invalid": "invalid"; "valid": "valid"; "submitted": "submitted"; "reseted": "reseted"; "cleared": "cleared"; }, ["formDialogClose", "_tabGroups"]>;
113
119
  }
@@ -1,12 +1,14 @@
1
- import { CanDeactivate } from '@angular/router';
1
+ import { ActivatedRoute, CanDeactivate } from '@angular/router';
2
2
  import { FsPrompt } from '@firestitch/prompt';
3
3
  import { Observable } from 'rxjs';
4
- import { FormDeactivate } from '../interfaces/form-deactivate';
4
+ import { FsForm } from '../services/fsform.service';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class FormDeactivateGuard implements CanDeactivate<any> {
7
7
  private _prompt;
8
- constructor(_prompt: FsPrompt);
9
- canDeactivate(directive: FormDeactivate): Observable<boolean>;
8
+ private _fsForm;
9
+ private _route;
10
+ constructor(_prompt: FsPrompt, _fsForm: FsForm, _route: ActivatedRoute);
11
+ canDeactivate(): Observable<boolean>;
10
12
  static ɵfac: i0.ɵɵFactoryDeclaration<FormDeactivateGuard, never>;
11
13
  static ɵprov: i0.ɵɵInjectableDeclaration<FormDeactivateGuard>;
12
14
  }
@@ -2,4 +2,4 @@ import { FsPrompt } from '@firestitch/prompt';
2
2
  import { Observable } from 'rxjs';
3
3
  import { FsFormDirective } from '../directives/form/form.directive';
4
4
  import { ConfirmResult } from '../enums/confirm-result';
5
- export declare function confirmUnsaved(form: FsFormDirective, prompt: FsPrompt): Observable<ConfirmResult>;
5
+ export declare function confirmUnsaved(directives: FsFormDirective[], prompt: FsPrompt): Observable<ConfirmResult>;
@@ -0,0 +1,2 @@
1
+ import { ActivatedRoute } from '@angular/router';
2
+ export declare function getActiveRoute(route: ActivatedRoute): ActivatedRoute;
@@ -1,10 +1,16 @@
1
+ import { Type } from '@angular/core';
1
2
  import { Observable } from 'rxjs';
3
+ import { FsFormDirective } from '../directives/form/form.directive';
2
4
  import * as i0 from "@angular/core";
3
5
  export declare class FsForm {
6
+ private _formDirectiveStore;
4
7
  private _eventBus;
5
8
  constructor();
6
9
  broadcast(key: any, data?: any): void;
7
10
  on<T>(key: any): Observable<T>;
11
+ registerFormDirective(routeComponent: Type<any>, directive: FsFormDirective): void;
12
+ getFormDirectives(routeComponent: any): FsFormDirective[];
13
+ removeFormDirective(routeComponent: any): void;
8
14
  static ɵfac: i0.ɵɵFactoryDeclaration<FsForm, never>;
9
15
  static ɵprov: i0.ɵɵInjectableDeclaration<FsForm>;
10
16
  }
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/button'), require('@angular/material/dialog'), require('@angular/material/core'), require('@angular/material/tabs'), require('@firestitch/message'), require('@firestitch/common'), require('@firestitch/drawer'), require('rxjs'), require('rxjs/operators'), require('@firestitch/prompt'), require('lodash-es'), require('date-fns')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/form', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/button', '@angular/material/dialog', '@angular/material/core', '@angular/material/tabs', '@firestitch/message', '@firestitch/common', '@firestitch/drawer', 'rxjs', 'rxjs/operators', '@firestitch/prompt', 'lodash-es', 'date-fns'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.form = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.material.button, global.ng.material.dialog, global.ng.material.core, global.ng.material.tabs, global.i2, global.common, global.i6, global.rxjs, global.rxjs.operators, global.i3, global.lodashEs, global.dateFns));
5
- })(this, (function (exports, i0, i4, i1, i1$1, i2$1, core, tabs, i2, common, i6, rxjs, operators, i3, lodashEs, dateFns) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/button'), require('@angular/material/dialog'), require('@angular/material/core'), require('@angular/material/tabs'), require('@firestitch/message'), require('@firestitch/common'), require('@firestitch/drawer'), require('rxjs'), require('rxjs/operators'), require('@firestitch/prompt'), require('@angular/router'), require('lodash-es'), require('date-fns')) :
3
+ typeof define === 'function' && define.amd ? define('@firestitch/form', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/button', '@angular/material/dialog', '@angular/material/core', '@angular/material/tabs', '@firestitch/message', '@firestitch/common', '@firestitch/drawer', 'rxjs', 'rxjs/operators', '@firestitch/prompt', '@angular/router', 'lodash-es', 'date-fns'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.form = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.material.button, global.ng.material.dialog, global.ng.material.core, global.ng.material.tabs, global.i2, global.common, global.i7, global.rxjs, global.rxjs.operators, global.i1$1, global.ng.router, global.lodashEs, global.dateFns));
5
+ })(this, (function (exports, i0, i4, i1, i1$2, i2$1, core, tabs, i2, common, i7, rxjs, operators, i1$1, i3, lodashEs, dateFns) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -24,11 +24,12 @@
24
24
 
25
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
26
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
27
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
27
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
28
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
29
29
  var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
30
30
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
31
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
32
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
32
33
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
33
34
 
34
35
  /*! *****************************************************************************
@@ -358,8 +359,10 @@
358
359
  ConfirmResult["Pristine"] = "pristine";
359
360
  })(exports.ConfirmResult || (exports.ConfirmResult = {}));
360
361
 
361
- function confirmUnsaved(form, prompt) {
362
+ function confirmUnsaved(directives, prompt) {
362
363
  return new rxjs.Observable(function (observer) {
364
+ // TODO support for multiple directives per page
365
+ var form = directives[0];
363
366
  if (!form.confirm || !form.ngForm.dirty) {
364
367
  observer.next(exports.ConfirmResult.Pristine);
365
368
  observer.complete();
@@ -496,17 +499,39 @@
496
499
  return errors;
497
500
  }
498
501
 
502
+ function getActiveRoute(route) {
503
+ while (route.firstChild) {
504
+ route = route.firstChild;
505
+ }
506
+ return route;
507
+ }
508
+
499
509
  var FsForm = /** @class */ (function () {
500
510
  function FsForm() {
511
+ // value is array for future possibilities of extension
512
+ this._formDirectiveStore = new WeakMap();
501
513
  this._eventBus = new rxjs.Subject();
502
514
  }
515
+ // @deprecated
503
516
  FsForm.prototype.broadcast = function (key, data) {
504
517
  this._eventBus.next({ key: key, data: data });
505
518
  };
519
+ // @deprecated
506
520
  FsForm.prototype.on = function (key) {
507
521
  return this._eventBus.asObservable()
508
522
  .pipe(operators.filter(function (event) { return event.key === key; }), operators.map(function (event) { return event.data; }));
509
523
  };
524
+ FsForm.prototype.registerFormDirective = function (routeComponent, directive) {
525
+ var directives = this.getFormDirectives(routeComponent) || [];
526
+ directives.push(directive);
527
+ this._formDirectiveStore.set(routeComponent, directives);
528
+ };
529
+ FsForm.prototype.getFormDirectives = function (routeComponent) {
530
+ return this._formDirectiveStore.get(routeComponent);
531
+ };
532
+ FsForm.prototype.removeFormDirective = function (routeComponent) {
533
+ this._formDirectiveStore.delete(routeComponent);
534
+ };
510
535
  return FsForm;
511
536
  }());
512
537
  FsForm.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsForm, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -518,8 +543,41 @@
518
543
  }]
519
544
  }], ctorParameters: function () { return []; } });
520
545
 
546
+ var FormDeactivateGuard = /** @class */ (function () {
547
+ function FormDeactivateGuard(_prompt, _fsForm, _route) {
548
+ this._prompt = _prompt;
549
+ this._fsForm = _fsForm;
550
+ this._route = _route;
551
+ }
552
+ FormDeactivateGuard.prototype.canDeactivate = function () {
553
+ var route = getActiveRoute(this._route);
554
+ if (!route) {
555
+ console.error("Can not find route for FormDeactivateGuard checks");
556
+ return rxjs.of(true);
557
+ }
558
+ var directives = this._fsForm.getFormDirectives(route.routeConfig.component);
559
+ if (!Array.isArray(directives) || directives.length === 0) {
560
+ console.error("Can not find a valid FsFormDirective");
561
+ return rxjs.of(true);
562
+ }
563
+ return confirmUnsaved(directives, this._prompt)
564
+ .pipe(operators.map(function (result) {
565
+ return confirmResultContinue(result);
566
+ }));
567
+ };
568
+ return FormDeactivateGuard;
569
+ }());
570
+ FormDeactivateGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, deps: [{ token: i1__namespace.FsPrompt }, { token: FsForm }, { token: i3__namespace.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
571
+ FormDeactivateGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, providedIn: 'root' });
572
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, decorators: [{
573
+ type: i0.Injectable,
574
+ args: [{
575
+ providedIn: 'root',
576
+ }]
577
+ }], ctorParameters: function () { return [{ type: i1__namespace.FsPrompt }, { type: FsForm }, { type: i3__namespace.ActivatedRoute }]; } });
578
+
521
579
  var FsFormDirective = /** @class */ (function () {
522
- function FsFormDirective(ngForm, _form, _element, _message, _prompt, _ngZone, _dialogRef, _drawerRef) {
580
+ function FsFormDirective(ngForm, _form, _element, _message, _prompt, _ngZone, _dialogRef, _drawerRef, _route) {
523
581
  this.ngForm = ngForm;
524
582
  this._form = _form;
525
583
  this._element = _element;
@@ -528,6 +586,7 @@
528
586
  this._ngZone = _ngZone;
529
587
  this._dialogRef = _dialogRef;
530
588
  this._drawerRef = _drawerRef;
589
+ this._route = _route;
531
590
  this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
532
591
  this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
533
592
  this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
@@ -542,6 +601,7 @@
542
601
  this.dirtySubmitButton = true;
543
602
  this.successDelay = 0;
544
603
  this.errorDelay = 1000;
604
+ this.deactivationGuard = true;
545
605
  this.submitEvent = new i0.EventEmitter();
546
606
  this.invalid = new i0.EventEmitter();
547
607
  this.valid = new i0.EventEmitter();
@@ -640,6 +700,9 @@
640
700
  configurable: true
641
701
  });
642
702
  FsFormDirective.prototype.ngOnInit = function () {
703
+ if (this.deactivationGuard) {
704
+ this._registerCanDeactivateGuard();
705
+ }
643
706
  this._registerConfirmDialogBackdropEscape();
644
707
  this._listenHotKeys();
645
708
  this._listenWindowClose();
@@ -663,6 +726,7 @@
663
726
  this._registerDirtySubmitButton();
664
727
  };
665
728
  FsFormDirective.prototype.ngOnDestroy = function () {
729
+ this._cleanupCanDeactivate();
666
730
  this._destroy$.next();
667
731
  this._destroy$.complete();
668
732
  };
@@ -697,7 +761,7 @@
697
761
  var _this = this;
698
762
  var submitted = this.submitting ? this.submitted.asObservable() : rxjs.of({});
699
763
  return submitted
700
- .pipe(operators.take(1), operators.mergeMap(function () { return confirmUnsaved(_this, _this._prompt); }));
764
+ .pipe(operators.take(1), operators.mergeMap(function () { return confirmUnsaved([_this], _this._prompt); }));
701
765
  };
702
766
  FsFormDirective.prototype.enable = function () {
703
767
  this.ngForm.control.enable();
@@ -1118,30 +1182,49 @@
1118
1182
  console.groupEnd();
1119
1183
  this._completeSubmit(false, null);
1120
1184
  };
1185
+ FsFormDirective.prototype._registerCanDeactivateGuard = function () {
1186
+ this._activatedRouteConfig = getActiveRoute(this._route).routeConfig;
1187
+ if (!this._activatedRouteConfig) {
1188
+ return;
1189
+ }
1190
+ this._form.registerFormDirective(this._activatedRouteConfig.component, this);
1191
+ if (!Array.isArray(this._activatedRouteConfig.canDeactivate)) {
1192
+ this._activatedRouteConfig.canDeactivate = [];
1193
+ }
1194
+ if (this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard) == -1) {
1195
+ this._activatedRouteConfig.canDeactivate.push(FormDeactivateGuard);
1196
+ }
1197
+ };
1198
+ FsFormDirective.prototype._cleanupCanDeactivate = function () {
1199
+ if (!this._activatedRouteConfig) {
1200
+ return;
1201
+ }
1202
+ this._form.removeFormDirective(this._activatedRouteConfig.component);
1203
+ };
1121
1204
  return FsFormDirective;
1122
1205
  }());
1123
- FsFormDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, deps: [{ token: i1.NgForm }, { token: FsForm }, { token: i0__namespace.ElementRef }, { token: i2__namespace.FsMessage }, { token: i3__namespace.FsPrompt }, { token: i0__namespace.NgZone }, { token: i2$1.MatDialogRef, optional: true }, { token: i6.DrawerRef, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1124
- FsFormDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, queries: [{ propertyName: "formDialogClose", predicate: FsFormDialogCloseDirective, descendants: true }, { propertyName: "_tabGroups", predicate: tabs.MatTabGroup, descendants: true }], usesOnChanges: true, ngImport: i0__namespace });
1206
+ FsFormDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, deps: [{ token: i1.NgForm }, { token: FsForm }, { token: i0__namespace.ElementRef }, { token: i2__namespace.FsMessage }, { token: i1__namespace.FsPrompt }, { token: i0__namespace.NgZone }, { token: i2$1.MatDialogRef, optional: true }, { token: i7.DrawerRef, optional: true }, { token: i3__namespace.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1207
+ FsFormDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, queries: [{ propertyName: "formDialogClose", predicate: FsFormDialogCloseDirective, descendants: true }, { propertyName: "_tabGroups", predicate: tabs.MatTabGroup, descendants: true }], usesOnChanges: true, ngImport: i0__namespace });
1125
1208
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, decorators: [{
1126
1209
  type: i0.Directive,
1127
1210
  args: [{
1128
1211
  selector: '[fsForm]',
1129
1212
  }]
1130
1213
  }], ctorParameters: function () {
1131
- return [{ type: i1__namespace.NgForm, decorators: [{
1214
+ return [{ type: i1__namespace$1.NgForm, decorators: [{
1132
1215
  type: i0.Inject,
1133
1216
  args: [i1.NgForm]
1134
- }] }, { type: FsForm }, { type: i0__namespace.ElementRef }, { type: i2__namespace.FsMessage }, { type: i3__namespace.FsPrompt }, { type: i0__namespace.NgZone }, { type: i2__namespace$1.MatDialogRef, decorators: [{
1217
+ }] }, { type: FsForm }, { type: i0__namespace.ElementRef }, { type: i2__namespace.FsMessage }, { type: i1__namespace.FsPrompt }, { type: i0__namespace.NgZone }, { type: i2__namespace$1.MatDialogRef, decorators: [{
1135
1218
  type: i0.Optional
1136
1219
  }, {
1137
1220
  type: i0.Inject,
1138
1221
  args: [i2$1.MatDialogRef]
1139
- }] }, { type: i6__namespace.DrawerRef, decorators: [{
1222
+ }] }, { type: i7__namespace.DrawerRef, decorators: [{
1140
1223
  type: i0.Optional
1141
1224
  }, {
1142
1225
  type: i0.Inject,
1143
- args: [i6.DrawerRef]
1144
- }] }];
1226
+ args: [i7.DrawerRef]
1227
+ }] }, { type: i3__namespace.ActivatedRoute }];
1145
1228
  }, propDecorators: { wrapperSelector: [{
1146
1229
  type: i0.Input
1147
1230
  }], messageSelector: [{
@@ -1174,6 +1257,8 @@
1174
1257
  type: i0.Input
1175
1258
  }], tabGroup: [{
1176
1259
  type: i0.Input
1260
+ }], deactivationGuard: [{
1261
+ type: i0.Input
1177
1262
  }], submitEvent: [{
1178
1263
  type: i0.Output,
1179
1264
  args: ['fsForm']
@@ -1436,7 +1521,7 @@
1436
1521
  };
1437
1522
  return FsControlDirective;
1438
1523
  }());
1439
- FsControlDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsControlDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1__namespace.NgControl, optional: true }, { token: FsFormDirective, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1524
+ FsControlDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsControlDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1__namespace$1.NgControl, optional: true }, { token: FsFormDirective, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1440
1525
  FsControlDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsControlDirective, selector: "[fsFormControl]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", appendMessageClass: "appendMessageClass", appendLabelClass: "appendLabelClass", appendErrorClass: "appendErrorClass", appendHintClass: "appendHintClass", validateMessages: "validateMessages" }, providers: [
1441
1526
  VALIDATE_MESSAGE_PROVIDER
1442
1527
  ], ngImport: i0__namespace });
@@ -1454,7 +1539,7 @@
1454
1539
  }, {
1455
1540
  type: i0.Inject,
1456
1541
  args: [VALIDATE_MESSAGES]
1457
- }] }, { type: i1__namespace.NgControl, decorators: [{
1542
+ }] }, { type: i1__namespace$1.NgControl, decorators: [{
1458
1543
  type: i0.Optional
1459
1544
  }] }, { type: FsFormDirective, decorators: [{
1460
1545
  type: i0.Optional
@@ -2477,7 +2562,7 @@
2477
2562
  };
2478
2563
  return FsButtonDirective;
2479
2564
  }());
2480
- FsButtonDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, deps: [{ token: i1__namespace$1.MatButton, host: true, optional: true }, { token: FsFormDirective, optional: true }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
2565
+ FsButtonDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, deps: [{ token: i1__namespace$2.MatButton, host: true, optional: true }, { token: FsFormDirective, optional: true }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
2481
2566
  FsButtonDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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__namespace });
2482
2567
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, decorators: [{
2483
2568
  type: i0.Directive,
@@ -2485,7 +2570,7 @@
2485
2570
  selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
2486
2571
  }]
2487
2572
  }], ctorParameters: function () {
2488
- return [{ type: i1__namespace$1.MatButton, decorators: [{
2573
+ return [{ type: i1__namespace$2.MatButton, decorators: [{
2489
2574
  type: i0.Optional
2490
2575
  }, {
2491
2576
  type: i0.Host
@@ -2596,7 +2681,7 @@
2596
2681
  return FsFormDialogActionsComponent;
2597
2682
  }());
2598
2683
  FsFormDialogActionsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogActionsComponent, deps: [{ token: FsFormDirective, optional: true }, { token: i2__namespace$1.MatDialogRef, optional: true }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
2599
- FsFormDialogActionsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", closeData: "closeData", name: "name" }, ngImport: i0__namespace, template: "<div class=\"buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save\">\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 [disabled]=\"close && !dirty && !create\"\n [matDialogClose]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <div class=\"close\" *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n [color]=\"dirty ? 'basic' : 'primary'\"\n (click)=\"closeClick()\">\n Close\n </button>\n </div>\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: [".buttons{display:flex;flex-grow:1;align-items:center}.buttons.save-create .close{display:flex;flex-grow:1;justify-content:flex-end}:host{display:flex;flex-grow:1}@media only screen and (max-width: 599px){.buttons{flex-direction:column}}\n"], components: [{ type: i1__namespace$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit"] }, { type: i2__namespace$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }, { type: i4__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
2684
+ FsFormDialogActionsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", closeData: "closeData", name: "name" }, ngImport: i0__namespace, template: "<div class=\"buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save\">\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 [disabled]=\"close && !dirty && !create\"\n [matDialogClose]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <div class=\"close\" *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n [color]=\"dirty ? 'basic' : 'primary'\"\n (click)=\"closeClick()\">\n Close\n </button>\n </div>\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: [".buttons{display:flex;flex-grow:1;align-items:center}.buttons.save-create .close{display:flex;flex-grow:1;justify-content:flex-end}:host{display:flex;flex-grow:1}@media only screen and (max-width: 599px){.buttons{flex-direction:column}}\n"], components: [{ type: i1__namespace$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit"] }, { type: i2__namespace$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }, { type: i4__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
2600
2685
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogActionsComponent, decorators: [{
2601
2686
  type: i0.Component,
2602
2687
  args: [{
@@ -2730,7 +2815,7 @@
2730
2815
  FsButtonDirective,
2731
2816
  FsSubmitButtonDirective], imports: [i4.CommonModule,
2732
2817
  i1.FormsModule,
2733
- i1$1.MatButtonModule,
2818
+ i1$2.MatButtonModule,
2734
2819
  i2$1.MatDialogModule], exports: [FsFormDirective,
2735
2820
  FsControlDirective,
2736
2821
  FsFormRequiredDirective,
@@ -2764,7 +2849,7 @@
2764
2849
  ], imports: [[
2765
2850
  i4.CommonModule,
2766
2851
  i1.FormsModule,
2767
- i1$1.MatButtonModule,
2852
+ i1$2.MatButtonModule,
2768
2853
  i2$1.MatDialogModule,
2769
2854
  ]] });
2770
2855
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormModule, decorators: [{
@@ -2773,7 +2858,7 @@
2773
2858
  imports: [
2774
2859
  i4.CommonModule,
2775
2860
  i1.FormsModule,
2776
- i1$1.MatButtonModule,
2861
+ i1$2.MatButtonModule,
2777
2862
  i2$1.MatDialogModule,
2778
2863
  ],
2779
2864
  declarations: [
@@ -2839,38 +2924,6 @@
2839
2924
  }]
2840
2925
  }] });
2841
2926
 
2842
- var FormDeactivateGuard = /** @class */ (function () {
2843
- function FormDeactivateGuard(_prompt) {
2844
- this._prompt = _prompt;
2845
- }
2846
- FormDeactivateGuard.prototype.canDeactivate = function (directive) {
2847
- if (!('getForm' in directive)) {
2848
- var error = "Directive " + directive.constructor.name + " does not property implement interface FormDeactivate";
2849
- console.error(error);
2850
- return rxjs.of(true);
2851
- }
2852
- var form = directive.getForm();
2853
- if (!(form instanceof FsFormDirective)) {
2854
- var error = "Directive " + directive.constructor.name + ".getForm() does not return a valid FsFormDirective";
2855
- console.error(error);
2856
- return rxjs.of(true);
2857
- }
2858
- return confirmUnsaved(form, this._prompt)
2859
- .pipe(operators.map(function (result) {
2860
- return confirmResultContinue(result);
2861
- }));
2862
- };
2863
- return FormDeactivateGuard;
2864
- }());
2865
- FormDeactivateGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, deps: [{ token: i3__namespace.FsPrompt }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2866
- FormDeactivateGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, providedIn: 'root' });
2867
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, decorators: [{
2868
- type: i0.Injectable,
2869
- args: [{
2870
- providedIn: 'root'
2871
- }]
2872
- }], ctorParameters: function () { return [{ type: i3__namespace.FsPrompt }]; } });
2873
-
2874
2927
  // Modules
2875
2928
 
2876
2929
  /**