@firestitch/form 12.3.0 → 12.3.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,19 +1,34 @@
1
- import { ChangeDetectorRef, OnInit, OnDestroy } from '@angular/core';
1
+ import { OnInit, ElementRef, OnDestroy, ChangeDetectorRef } from '@angular/core';
2
2
  import { MatButton } from '@angular/material/button';
3
3
  import { FsFormDirective } from './form/form.directive';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class FsButtonDirective implements OnInit, OnDestroy {
6
6
  private _matButton;
7
7
  private _form;
8
+ private _elementRef;
8
9
  private _cdRef;
9
- previous: boolean;
10
+ name: any;
11
+ dirtySubmit: boolean;
12
+ transitionStyle: any;
13
+ active: boolean;
14
+ submit: boolean;
15
+ private _previousDisabled;
10
16
  private _destroy$;
11
- constructor(_matButton: MatButton, _form: FsFormDirective, _cdRef: ChangeDetectorRef);
17
+ constructor(_matButton: MatButton, _form: FsFormDirective, _elementRef: ElementRef, _cdRef: ChangeDetectorRef);
18
+ ngOnInit(): void;
12
19
  disable(): void;
13
20
  enable(): void;
21
+ process(): void;
22
+ success(): void;
23
+ error(): void;
24
+ setClass(cls: any): void;
25
+ get element(): any;
26
+ resetActive(): void;
14
27
  reset(): void;
15
- ngOnInit(): void;
16
28
  ngOnDestroy(): void;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<FsButtonDirective, [{ optional: true; host: true; }, { optional: true; }, null]>;
18
- static ɵdir: i0.ɵɵDirectiveDeclaration<FsButtonDirective, "[mat-raised-button][type=\"button\"],[mat-flat-button][type=\"button\"],[mat-stroked-button][type=\"button\"],[mat-button][type=\"button\"]", never, {}, {}, never>;
29
+ private _disableShadowAnimation;
30
+ private _resetClass;
31
+ private _getSvg;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<FsButtonDirective, [{ optional: true; host: true; }, { optional: true; }, null, null]>;
33
+ static ɵdir: i0.ɵɵDirectiveDeclaration<FsButtonDirective, "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", never, { "name": "name"; "dirtySubmit": "dirtySubmit"; }, {}, never>;
19
34
  }
@@ -7,12 +7,11 @@ import { FsPrompt } from '@firestitch/prompt';
7
7
  import { DrawerRef } from '@firestitch/drawer';
8
8
  import { Observable } from 'rxjs';
9
9
  import { FsFormDialogCloseDirective } from '../form-dialog-close.directive';
10
- import { FsSubmitButtonDirective } from '../submit-button.directive';
10
+ import { FsButtonDirective } from '../button.directive';
11
11
  import { ConfirmConfig } from './../../interfaces';
12
12
  import { ConfirmResult } from './../../enums/confirm-result';
13
13
  import { FsForm } from '../../services/fsform.service';
14
14
  import { SubmitEvent } from './../../interfaces/submit-event';
15
- import { FsButtonDirective } from '../button.directive';
16
15
  import * as i0 from "@angular/core";
17
16
  export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentInit, OnChanges {
18
17
  ngForm: NgForm;
@@ -48,7 +47,6 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
48
47
  fsformClass: boolean;
49
48
  formDialogClose: QueryList<FsFormDialogCloseDirective>;
50
49
  private _tabGroups;
51
- private _submitButtons;
52
50
  private _buttons;
53
51
  private _registerControl;
54
52
  private _activeSubmitButton;
@@ -80,17 +78,16 @@ export declare class FsFormDirective implements OnInit, OnDestroy, AfterContentI
80
78
  disable(): void;
81
79
  addButton(button: FsButtonDirective): void;
82
80
  removeButton(button: FsButtonDirective): void;
83
- addSubmitButton(submitButton: FsSubmitButtonDirective): void;
84
- removeSubmitButton(submitButton: FsSubmitButtonDirective): void;
85
81
  private _listenSubmit;
86
82
  private _listenWindowClose;
87
83
  private _listenHotKeys;
88
84
  private _formClose;
89
85
  private _registerDialogClose;
90
- private _getActiveButton;
86
+ private _getActiveSubmitButton;
91
87
  private _elementInForm;
92
88
  private _completeSubmit;
93
89
  private _resetButtons;
90
+ private _resetActiveButtons;
94
91
  private _registerConfirm;
95
92
  private _registerDrawerClose;
96
93
  private _registerConfirmDrawerClose;
@@ -20,18 +20,17 @@ import * as i17 from "./directives/validators/greater.directive";
20
20
  import * as i18 from "./directives/validators/lesser.directive";
21
21
  import * as i19 from "./directives/validators/url.directive";
22
22
  import * as i20 from "./directives/form-dialog-close.directive";
23
- import * as i21 from "./directives/submit-button.directive";
24
- import * as i22 from "./directives/validators/validate.directive";
25
- import * as i23 from "./components/form-dialog-actions/form-dialog-actions.component";
26
- import * as i24 from "./directives/validators/no-fs-validators.directive";
27
- import * as i25 from "./directives/button.directive";
28
- import * as i26 from "@angular/common";
29
- import * as i27 from "@angular/forms";
30
- import * as i28 from "@angular/material/button";
31
- import * as i29 from "@angular/material/dialog";
23
+ import * as i21 from "./directives/validators/validate.directive";
24
+ import * as i22 from "./components/form-dialog-actions/form-dialog-actions.component";
25
+ import * as i23 from "./directives/validators/no-fs-validators.directive";
26
+ import * as i24 from "./directives/button.directive";
27
+ import * as i25 from "@angular/common";
28
+ import * as i26 from "@angular/forms";
29
+ import * as i27 from "@angular/material/button";
30
+ import * as i28 from "@angular/material/dialog";
32
31
  export declare class FsFormModule {
33
32
  static forRoot(): ModuleWithProviders<FsFormModule>;
34
33
  static ɵfac: i0.ɵɵFactoryDeclaration<FsFormModule, never>;
35
- static ɵmod: i0.ɵɵNgModuleDeclaration<FsFormModule, [typeof i1.FsFormDirective, typeof i2.FsControlDirective, typeof i3.FsFormRequiredDirective, typeof i4.FsFormMinDirective, typeof i5.FsFormMaxDirective, typeof i6.FsFormMinLengthDirective, typeof i7.FsFormMaxLengthDirective, typeof i8.FsFormEmailDirective, typeof i9.FsFormEmailsDirective, typeof i10.FsFormPhoneDirective, typeof i11.FsFormCompareDirective, typeof i12.FsFormIntegerDirective, typeof i13.FsFormNumericDirective, typeof i14.FsFormPatternDirective, typeof i15.FsFormFunctionDirective, typeof i16.FsFormDateRangeDirective, typeof i17.FsFormGreaterDirective, typeof i18.FsFormLesserDirective, typeof i19.FsFormUrlDirective, typeof i20.FsFormDialogCloseDirective, typeof i21.FsSubmitButtonDirective, typeof i22.FsFormValidateDirective, typeof i23.FsFormDialogActionsComponent, typeof i24.FsFormNoFsValidatorsDirective, typeof i25.FsButtonDirective], [typeof i26.CommonModule, typeof i27.FormsModule, typeof i28.MatButtonModule, typeof i29.MatDialogModule], [typeof i1.FsFormDirective, typeof i2.FsControlDirective, typeof i3.FsFormRequiredDirective, typeof i4.FsFormMinDirective, typeof i5.FsFormMaxDirective, typeof i6.FsFormMinLengthDirective, typeof i7.FsFormMaxLengthDirective, typeof i8.FsFormEmailDirective, typeof i9.FsFormEmailsDirective, typeof i10.FsFormPhoneDirective, typeof i11.FsFormCompareDirective, typeof i12.FsFormIntegerDirective, typeof i13.FsFormNumericDirective, typeof i14.FsFormPatternDirective, typeof i15.FsFormFunctionDirective, typeof i16.FsFormDateRangeDirective, typeof i17.FsFormGreaterDirective, typeof i18.FsFormLesserDirective, typeof i19.FsFormUrlDirective, typeof i20.FsFormDialogCloseDirective, typeof i21.FsSubmitButtonDirective, typeof i22.FsFormValidateDirective, typeof i23.FsFormDialogActionsComponent, typeof i24.FsFormNoFsValidatorsDirective, typeof i25.FsButtonDirective]>;
34
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FsFormModule, [typeof i1.FsFormDirective, typeof i2.FsControlDirective, typeof i3.FsFormRequiredDirective, typeof i4.FsFormMinDirective, typeof i5.FsFormMaxDirective, typeof i6.FsFormMinLengthDirective, typeof i7.FsFormMaxLengthDirective, typeof i8.FsFormEmailDirective, typeof i9.FsFormEmailsDirective, typeof i10.FsFormPhoneDirective, typeof i11.FsFormCompareDirective, typeof i12.FsFormIntegerDirective, typeof i13.FsFormNumericDirective, typeof i14.FsFormPatternDirective, typeof i15.FsFormFunctionDirective, typeof i16.FsFormDateRangeDirective, typeof i17.FsFormGreaterDirective, typeof i18.FsFormLesserDirective, typeof i19.FsFormUrlDirective, typeof i20.FsFormDialogCloseDirective, typeof i21.FsFormValidateDirective, typeof i22.FsFormDialogActionsComponent, typeof i23.FsFormNoFsValidatorsDirective, typeof i24.FsButtonDirective], [typeof i25.CommonModule, typeof i26.FormsModule, typeof i27.MatButtonModule, typeof i28.MatDialogModule], [typeof i1.FsFormDirective, typeof i2.FsControlDirective, typeof i3.FsFormRequiredDirective, typeof i4.FsFormMinDirective, typeof i5.FsFormMaxDirective, typeof i6.FsFormMinLengthDirective, typeof i7.FsFormMaxLengthDirective, typeof i8.FsFormEmailDirective, typeof i9.FsFormEmailsDirective, typeof i10.FsFormPhoneDirective, typeof i11.FsFormCompareDirective, typeof i12.FsFormIntegerDirective, typeof i13.FsFormNumericDirective, typeof i14.FsFormPatternDirective, typeof i15.FsFormFunctionDirective, typeof i16.FsFormDateRangeDirective, typeof i17.FsFormGreaterDirective, typeof i18.FsFormLesserDirective, typeof i19.FsFormUrlDirective, typeof i20.FsFormDialogCloseDirective, typeof i21.FsFormValidateDirective, typeof i22.FsFormDialogActionsComponent, typeof i23.FsFormNoFsValidatorsDirective, typeof i24.FsButtonDirective]>;
36
35
  static ɵinj: i0.ɵɵInjectorDeclaration<FsFormModule>;
37
36
  }
@@ -549,7 +549,6 @@
549
549
  this.cleared = new i0.EventEmitter();
550
550
  this.fsformClass = true;
551
551
  this._tabGroups = new i0.QueryList();
552
- this._submitButtons = new i0.QueryList();
553
552
  this._buttons = new i0.QueryList();
554
553
  this._dialogBackdropEscape = false;
555
554
  this._snapshot = {};
@@ -697,7 +696,7 @@
697
696
  };
698
697
  FsFormDirective.prototype.disable = function () {
699
698
  this.ngForm.control.disable();
700
- this._submitButtons.forEach(function (button) {
699
+ this._buttons.forEach(function (button) {
701
700
  button.disable();
702
701
  });
703
702
  };
@@ -710,15 +709,6 @@
710
709
  this._buttons.reset(__spreadArray([], __read(this._buttons.toArray()
711
710
  .filter(function (item) { return (button !== item); }))));
712
711
  };
713
- FsFormDirective.prototype.addSubmitButton = function (submitButton) {
714
- this._submitButtons.reset(__spreadArray(__spreadArray([], __read(this._submitButtons.toArray())), [
715
- submitButton,
716
- ]));
717
- };
718
- FsFormDirective.prototype.removeSubmitButton = function (submitButton) {
719
- this._submitButtons.reset(__spreadArray([], __read(this._submitButtons.toArray()
720
- .filter(function (submitButton_) { return (submitButton !== submitButton_); }))));
721
- };
722
712
  FsFormDirective.prototype._listenSubmit = function () {
723
713
  var _this = this;
724
714
  this.ngForm
@@ -808,11 +798,14 @@
808
798
  });
809
799
  }
810
800
  };
811
- FsFormDirective.prototype._getActiveButton = function () {
812
- var activeButton = this._submitButtons.find(function (button) {
801
+ FsFormDirective.prototype._getActiveSubmitButton = function () {
802
+ var submitButtons = this._buttons
803
+ .filter(function (button) { return button.submit; });
804
+ var activeButton = submitButtons
805
+ .find(function (button) {
813
806
  return button.active;
814
807
  });
815
- return activeButton ? activeButton : this._submitButtons.first;
808
+ return activeButton ? activeButton : submitButtons[0];
816
809
  };
817
810
  FsFormDirective.prototype._elementInForm = function (el) {
818
811
  if (el.isSameNode(this._element.nativeElement)) {
@@ -859,15 +852,18 @@
859
852
  _this._status$.next(exports.FormStatus.Invalid);
860
853
  }
861
854
  _this._resetButtons();
855
+ _this._resetActiveButtons();
862
856
  _this._updateDirtySubmitButtons();
863
857
  });
864
858
  };
865
859
  FsFormDirective.prototype._resetButtons = function () {
866
- this._submitButtons.forEach(function (button) {
860
+ this._buttons.forEach(function (button) {
867
861
  button.reset();
868
862
  });
863
+ };
864
+ FsFormDirective.prototype._resetActiveButtons = function () {
869
865
  this._buttons.forEach(function (button) {
870
- button.reset();
866
+ button.resetActive();
871
867
  });
872
868
  };
873
869
  FsFormDirective.prototype._registerConfirm = function () {
@@ -1038,7 +1034,7 @@
1038
1034
  .subscribe(function () {
1039
1035
  _this._updateDirtySubmitButtons();
1040
1036
  });
1041
- this._submitButtons.changes
1037
+ this._buttons.changes
1042
1038
  .pipe(operators.takeUntil(this._destroy$))
1043
1039
  .subscribe(function () {
1044
1040
  _this._updateDirtySubmitButtons();
@@ -1046,7 +1042,8 @@
1046
1042
  };
1047
1043
  FsFormDirective.prototype._updateDirtySubmitButtons = function () {
1048
1044
  var _this = this;
1049
- this._submitButtons
1045
+ this._buttons
1046
+ .filter(function (button) { return button.submit; })
1050
1047
  .forEach(function (submitButton) {
1051
1048
  if (!_this.confirm || !_this.dirtySubmitButton || _this.ngForm.dirty || !submitButton.dirtySubmit) {
1052
1049
  submitButton.enable();
@@ -1069,7 +1066,7 @@
1069
1066
  });
1070
1067
  };
1071
1068
  FsFormDirective.prototype._setupActiveSubmitButton = function () {
1072
- this._activeSubmitButton = this._getActiveButton();
1069
+ this._activeSubmitButton = this._getActiveSubmitButton();
1073
1070
  this._resetButtons();
1074
1071
  if (this._activeSubmitButton) {
1075
1072
  this._activeSubmitButton.process();
@@ -2322,8 +2319,8 @@
2322
2319
  args: ['fsFormUrlMessage']
2323
2320
  }] } });
2324
2321
 
2325
- var FsSubmitButtonDirective = /** @class */ (function () {
2326
- function FsSubmitButtonDirective(_matButton, _form, _elementRef, _cdRef) {
2322
+ var FsButtonDirective = /** @class */ (function () {
2323
+ function FsButtonDirective(_matButton, _form, _elementRef, _cdRef) {
2327
2324
  this._matButton = _matButton;
2328
2325
  this._form = _form;
2329
2326
  this._elementRef = _elementRef;
@@ -2331,72 +2328,82 @@
2331
2328
  this.dirtySubmit = true;
2332
2329
  this.transitionStyle = null;
2333
2330
  this.active = false;
2331
+ this.submit = false;
2332
+ this._previousDisabled = false;
2334
2333
  this._destroy$ = new rxjs.Subject();
2335
2334
  }
2336
- FsSubmitButtonDirective.prototype.ngOnInit = function () {
2335
+ FsButtonDirective.prototype.ngOnInit = function () {
2337
2336
  var _this = this;
2337
+ this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
2338
2338
  if (this._form) {
2339
- this._form.addSubmitButton(this);
2340
- rxjs.fromEvent(this.element, 'click')
2341
- .pipe(operators.takeUntil(this._destroy$))
2342
- .subscribe(function () {
2343
- _this.active = true;
2344
- });
2345
- if (this.dirtySubmit) {
2346
- if (this._form.dirtySubmitButton) {
2347
- if (!this._form.ngForm.dirty) {
2348
- this.disable();
2339
+ this._form.addButton(this);
2340
+ if (this.submit) {
2341
+ rxjs.fromEvent(this.element, 'click')
2342
+ .pipe(operators.takeUntil(this._destroy$))
2343
+ .subscribe(function () {
2344
+ _this.active = true;
2345
+ });
2346
+ if (this.dirtySubmit) {
2347
+ if (this._form.dirtySubmitButton) {
2348
+ if (!this._form.ngForm.dirty) {
2349
+ this.disable();
2350
+ }
2349
2351
  }
2350
2352
  }
2353
+ this.transitionStyle = 'none';
2354
+ setTimeout(function () {
2355
+ _this.transitionStyle = null;
2356
+ }, 500);
2351
2357
  }
2352
- this.transitionStyle = 'none';
2353
- setTimeout(function () {
2354
- _this.transitionStyle = null;
2355
- }, 500);
2356
2358
  }
2357
2359
  };
2358
- FsSubmitButtonDirective.prototype.disable = function () {
2359
- if (this._matButton) {
2360
+ FsButtonDirective.prototype.disable = function () {
2361
+ if (this._matButton && !this.active) {
2362
+ this._previousDisabled = this._matButton.disabled;
2360
2363
  this._matButton.disabled = true;
2361
2364
  this._cdRef.markForCheck();
2362
2365
  }
2363
2366
  };
2364
- FsSubmitButtonDirective.prototype.enable = function () {
2367
+ FsButtonDirective.prototype.enable = function () {
2365
2368
  if (this._matButton) {
2366
2369
  this._matButton.disabled = false;
2367
2370
  this._matButton.disableRipple = true;
2368
2371
  this._cdRef.markForCheck();
2369
2372
  }
2370
2373
  };
2371
- FsSubmitButtonDirective.prototype.process = function () {
2374
+ FsButtonDirective.prototype.process = function () {
2372
2375
  this.setClass('process');
2373
2376
  this._matButton.disableRipple = true;
2374
2377
  };
2375
- FsSubmitButtonDirective.prototype.success = function () {
2378
+ FsButtonDirective.prototype.success = function () {
2376
2379
  this.setClass('success');
2377
2380
  this._matButton.disableRipple = false;
2378
2381
  };
2379
- FsSubmitButtonDirective.prototype.error = function () {
2382
+ FsButtonDirective.prototype.error = function () {
2380
2383
  this.setClass('error');
2381
2384
  this._matButton.disableRipple = false;
2382
2385
  };
2383
- FsSubmitButtonDirective.prototype.setClass = function (cls) {
2386
+ FsButtonDirective.prototype.setClass = function (cls) {
2384
2387
  var svg = this._getSvg(cls);
2385
2388
  this._resetClass();
2386
2389
  this._disableShadowAnimation();
2387
2390
  this.element.classList.add("submit-" + cls);
2388
2391
  this.element.append(svg);
2389
2392
  };
2390
- Object.defineProperty(FsSubmitButtonDirective.prototype, "element", {
2393
+ Object.defineProperty(FsButtonDirective.prototype, "element", {
2391
2394
  get: function () {
2392
2395
  return this._elementRef.nativeElement;
2393
2396
  },
2394
2397
  enumerable: false,
2395
2398
  configurable: true
2396
2399
  });
2397
- FsSubmitButtonDirective.prototype.reset = function () {
2400
+ FsButtonDirective.prototype.resetActive = function () {
2398
2401
  this.active = false;
2399
- this.enable();
2402
+ };
2403
+ FsButtonDirective.prototype.reset = function () {
2404
+ if (!this._previousDisabled) {
2405
+ this.enable();
2406
+ }
2400
2407
  this.element.querySelectorAll('.svg-icon')
2401
2408
  .forEach(function (el) {
2402
2409
  el.remove();
@@ -2404,20 +2411,20 @@
2404
2411
  this._matButton.disableRipple = false;
2405
2412
  this._resetClass();
2406
2413
  };
2407
- FsSubmitButtonDirective.prototype.ngOnDestroy = function () {
2414
+ FsButtonDirective.prototype.ngOnDestroy = function () {
2408
2415
  var _a;
2409
2416
  this._destroy$.next();
2410
2417
  this._destroy$.complete();
2411
- (_a = this._form) === null || _a === void 0 ? void 0 : _a.removeSubmitButton(this);
2418
+ (_a = this._form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
2412
2419
  };
2413
- FsSubmitButtonDirective.prototype._disableShadowAnimation = function () {
2420
+ FsButtonDirective.prototype._disableShadowAnimation = function () {
2414
2421
  // .mat-elevation-z2 removes the click shadow animation
2415
2422
  //this.element.classList.add('mat-elevation-z2');
2416
2423
  };
2417
- FsSubmitButtonDirective.prototype._resetClass = function () {
2424
+ FsButtonDirective.prototype._resetClass = function () {
2418
2425
  this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2419
2426
  };
2420
- FsSubmitButtonDirective.prototype._getSvg = function (type) {
2427
+ FsButtonDirective.prototype._getSvg = function (type) {
2421
2428
  if (type === 'success') {
2422
2429
  return new DOMParser().parseFromString("<svg class=\"svg-icon svg-icon-success\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" x=\"0px\" y=\"0px\" viewBox=\"0 0 38 38\" style=\"enable-background:new 0 0 38 38;\" xml:space=\"preserve\" width=\"38px\" height=\"38px\">\n <g>\n <g class=\"check\">\n <g>\n <path d=\"M29.6,11.9c-0.5-0.5-1.3-0.5-1.8,0L16.3,23.4l-6.1-6.1c-0.5-0.5-1.3-0.5-1.8,0s-0.5,1.3,0,1.8l7,7c0.3,0.3,0.6,0.4,0.9,0.4s0.7-0.1,0.9-0.4l12.4-12.4C30.1,13.2,30.1,12.4,29.6,11.9z\"/>\n </g>\n </g>\n </g>\n </svg>", 'text/xml').firstChild;
2423
2430
  }
@@ -2428,14 +2435,14 @@
2428
2435
  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;
2429
2436
  }
2430
2437
  };
2431
- return FsSubmitButtonDirective;
2438
+ return FsButtonDirective;
2432
2439
  }());
2433
- FsSubmitButtonDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsSubmitButtonDirective, 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 });
2434
- FsSubmitButtonDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: { name: "name", dirtySubmit: "dirtySubmit" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0__namespace });
2435
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsSubmitButtonDirective, decorators: [{
2440
+ 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 });
2441
+ 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 });
2442
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, decorators: [{
2436
2443
  type: i0.Directive,
2437
2444
  args: [{
2438
- selector: 'button[type="submit"]',
2445
+ selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
2439
2446
  }]
2440
2447
  }], ctorParameters: function () {
2441
2448
  return [{ type: i1__namespace$1.MatButton, decorators: [{
@@ -2487,62 +2494,6 @@
2487
2494
  args: ['validateData']
2488
2495
  }] } });
2489
2496
 
2490
- var FsButtonDirective = /** @class */ (function () {
2491
- function FsButtonDirective(_matButton, _form, _cdRef) {
2492
- this._matButton = _matButton;
2493
- this._form = _form;
2494
- this._cdRef = _cdRef;
2495
- this.previous = false;
2496
- this._destroy$ = new rxjs.Subject();
2497
- }
2498
- FsButtonDirective.prototype.disable = function () {
2499
- this.previous = this._matButton.disabled;
2500
- if (this._matButton && !this.previous) {
2501
- this._matButton.disabled = true;
2502
- this._cdRef.markForCheck();
2503
- }
2504
- };
2505
- FsButtonDirective.prototype.enable = function () {
2506
- if (this._matButton) {
2507
- this._matButton.disabled = false;
2508
- this._cdRef.markForCheck();
2509
- }
2510
- };
2511
- FsButtonDirective.prototype.reset = function () {
2512
- if (this._matButton && !this.previous) {
2513
- this.enable();
2514
- }
2515
- };
2516
- FsButtonDirective.prototype.ngOnInit = function () {
2517
- if (this._form) {
2518
- this._form.addButton(this);
2519
- }
2520
- };
2521
- FsButtonDirective.prototype.ngOnDestroy = function () {
2522
- var _a;
2523
- this._destroy$.next();
2524
- this._destroy$.complete();
2525
- (_a = this._form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
2526
- };
2527
- return FsButtonDirective;
2528
- }());
2529
- 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.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
2530
- FsButtonDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsButtonDirective, selector: "[mat-raised-button][type=\"button\"],[mat-flat-button][type=\"button\"],[mat-stroked-button][type=\"button\"],[mat-button][type=\"button\"]", ngImport: i0__namespace });
2531
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, decorators: [{
2532
- type: i0.Directive,
2533
- args: [{
2534
- selector: '[mat-raised-button][type="button"],[mat-flat-button][type="button"],[mat-stroked-button][type="button"],[mat-button][type="button"]',
2535
- }]
2536
- }], ctorParameters: function () {
2537
- return [{ type: i1__namespace$1.MatButton, decorators: [{
2538
- type: i0.Optional
2539
- }, {
2540
- type: i0.Host
2541
- }] }, { type: FsFormDirective, decorators: [{
2542
- type: i0.Optional
2543
- }] }, { type: i0__namespace.ChangeDetectorRef }];
2544
- } });
2545
-
2546
2497
  var FsFormDialogActionsComponent = /** @class */ (function () {
2547
2498
  function FsFormDialogActionsComponent(_form, _dialogRef, _cdRef) {
2548
2499
  this._form = _form;
@@ -2598,7 +2549,7 @@
2598
2549
  return FsFormDialogActionsComponent;
2599
2550
  }());
2600
2551
  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 });
2601
- 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: FsSubmitButtonDirective, selector: "button[type=\"submit\"]", inputs: ["name", "dirtySubmit"] }, { type: FsButtonDirective, selector: "[mat-raised-button][type=\"button\"],[mat-flat-button][type=\"button\"],[mat-stroked-button][type=\"button\"],[mat-button][type=\"button\"]" }, { 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 });
2552
+ 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 });
2602
2553
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogActionsComponent, decorators: [{
2603
2554
  type: i0.Component,
2604
2555
  args: [{
@@ -2710,7 +2661,6 @@
2710
2661
  FsFormLesserDirective,
2711
2662
  FsFormUrlDirective,
2712
2663
  FsFormDialogCloseDirective,
2713
- FsSubmitButtonDirective,
2714
2664
  FsFormValidateDirective,
2715
2665
  FsFormDialogActionsComponent,
2716
2666
  FsFormNoFsValidatorsDirective,
@@ -2737,7 +2687,6 @@
2737
2687
  FsFormLesserDirective,
2738
2688
  FsFormUrlDirective,
2739
2689
  FsFormDialogCloseDirective,
2740
- FsSubmitButtonDirective,
2741
2690
  FsFormValidateDirective,
2742
2691
  FsFormDialogActionsComponent,
2743
2692
  FsFormNoFsValidatorsDirective,
@@ -2783,7 +2732,6 @@
2783
2732
  FsFormLesserDirective,
2784
2733
  FsFormUrlDirective,
2785
2734
  FsFormDialogCloseDirective,
2786
- FsSubmitButtonDirective,
2787
2735
  FsFormValidateDirective,
2788
2736
  FsFormDialogActionsComponent,
2789
2737
  FsFormNoFsValidatorsDirective,
@@ -2810,7 +2758,6 @@
2810
2758
  FsFormLesserDirective,
2811
2759
  FsFormUrlDirective,
2812
2760
  FsFormDialogCloseDirective,
2813
- FsSubmitButtonDirective,
2814
2761
  FsFormValidateDirective,
2815
2762
  FsFormDialogActionsComponent,
2816
2763
  FsFormNoFsValidatorsDirective,
@@ -2890,7 +2837,6 @@
2890
2837
  exports.FsFormRequiredDirective = FsFormRequiredDirective;
2891
2838
  exports.FsFormUrlDirective = FsFormUrlDirective;
2892
2839
  exports.FsFormValidateDirective = FsFormValidateDirective;
2893
- exports.FsSubmitButtonDirective = FsSubmitButtonDirective;
2894
2840
  exports.FsValidators = FsValidators;
2895
2841
 
2896
2842
  Object.defineProperty(exports, '__esModule', { value: true });