@firestitch/form 9.7.3 → 9.7.7

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.
Files changed (135) hide show
  1. package/app/components/form-dialog-actions/form-dialog-actions.component.d.ts +18 -15
  2. package/app/consts/error-messages.const.d.ts +19 -19
  3. package/app/directives/form/form.directive.d.ts +102 -100
  4. package/app/directives/form-dialog-close.directive.d.ts +9 -9
  5. package/app/directives/submit-button.directive.d.ts +28 -28
  6. package/app/directives/validators/compare.directive.d.ts +12 -12
  7. package/app/directives/validators/control.directive.d.ts +45 -45
  8. package/app/directives/validators/daterange.directive.d.ts +10 -10
  9. package/app/directives/validators/email.directive.d.ts +10 -10
  10. package/app/directives/validators/emails.directive.d.ts +10 -10
  11. package/app/directives/validators/function.directive.d.ts +11 -11
  12. package/app/directives/validators/greater.directive.d.ts +10 -10
  13. package/app/directives/validators/integer.directive.d.ts +10 -10
  14. package/app/directives/validators/lesser.directive.d.ts +10 -10
  15. package/app/directives/validators/max.directive.d.ts +10 -10
  16. package/app/directives/validators/maxlength.directive.d.ts +10 -10
  17. package/app/directives/validators/min.directive.d.ts +10 -10
  18. package/app/directives/validators/minlength.directive.d.ts +10 -10
  19. package/app/directives/validators/numeric.directive.d.ts +10 -10
  20. package/app/directives/validators/pattern.directive.d.ts +10 -10
  21. package/app/directives/validators/phone.directive.d.ts +10 -10
  22. package/app/directives/validators/required.directive.d.ts +13 -13
  23. package/app/directives/validators/url.directive.d.ts +11 -11
  24. package/app/directives/validators/validate.directive.d.ts +11 -11
  25. package/app/enums/confirm-result.d.ts +7 -7
  26. package/app/enums/form-status.d.ts +9 -9
  27. package/app/fs-form.module.d.ts +4 -4
  28. package/app/guards/form-deactivate.guard.d.ts +9 -9
  29. package/app/helpers/confirm-result-continue.d.ts +1 -1
  30. package/app/helpers/confirm-unsaved.d.ts +5 -5
  31. package/app/helpers/get-form-errors.d.ts +2 -2
  32. package/app/helpers/index.d.ts +2 -2
  33. package/app/helpers/is-enabled.d.ts +1 -1
  34. package/app/interfaces/async-validator.d.ts +14 -14
  35. package/app/interfaces/confirm-config.d.ts +7 -7
  36. package/app/interfaces/confirm-tab-group.d.ts +10 -10
  37. package/app/interfaces/form-deactivate.d.ts +4 -4
  38. package/app/interfaces/index.d.ts +4 -4
  39. package/app/interfaces/submit-event.d.ts +5 -5
  40. package/app/interfaces/submitted-event.d.ts +6 -6
  41. package/app/interfaces/validator.d.ts +13 -13
  42. package/app/providers/validate-messages.provider.d.ts +25 -25
  43. package/app/services/fsform.service.d.ts +7 -7
  44. package/app/validators/validators.d.ts +12 -12
  45. package/bundles/firestitch-form.umd.js +2300 -2267
  46. package/bundles/firestitch-form.umd.js.map +1 -1
  47. package/bundles/firestitch-form.umd.min.js +2 -2
  48. package/bundles/firestitch-form.umd.min.js.map +1 -1
  49. package/esm2015/app/components/form-dialog-actions/form-dialog-actions.component.js +93 -67
  50. package/esm2015/app/consts/error-messages.const.js +19 -19
  51. package/esm2015/app/directives/form/form.directive.js +665 -656
  52. package/esm2015/app/directives/form-dialog-close.directive.js +32 -32
  53. package/esm2015/app/directives/submit-button.directive.js +137 -137
  54. package/esm2015/app/directives/validators/compare.directive.js +48 -48
  55. package/esm2015/app/directives/validators/control.directive.js +272 -272
  56. package/esm2015/app/directives/validators/daterange.directive.js +40 -40
  57. package/esm2015/app/directives/validators/email.directive.js +40 -40
  58. package/esm2015/app/directives/validators/emails.directive.js +40 -40
  59. package/esm2015/app/directives/validators/function.directive.js +30 -30
  60. package/esm2015/app/directives/validators/greater.directive.js +39 -39
  61. package/esm2015/app/directives/validators/integer.directive.js +40 -40
  62. package/esm2015/app/directives/validators/lesser.directive.js +39 -39
  63. package/esm2015/app/directives/validators/max.directive.js +35 -35
  64. package/esm2015/app/directives/validators/maxlength.directive.js +34 -34
  65. package/esm2015/app/directives/validators/min.directive.js +35 -35
  66. package/esm2015/app/directives/validators/minlength.directive.js +34 -34
  67. package/esm2015/app/directives/validators/numeric.directive.js +40 -40
  68. package/esm2015/app/directives/validators/pattern.directive.js +34 -34
  69. package/esm2015/app/directives/validators/phone.directive.js +40 -40
  70. package/esm2015/app/directives/validators/required.directive.js +72 -72
  71. package/esm2015/app/directives/validators/url.directive.js +48 -48
  72. package/esm2015/app/directives/validators/validate.directive.js +30 -30
  73. package/esm2015/app/enums/confirm-result.js +8 -8
  74. package/esm2015/app/enums/form-status.js +10 -10
  75. package/esm2015/app/fs-form.module.js +106 -106
  76. package/esm2015/app/guards/form-deactivate.guard.js +43 -43
  77. package/esm2015/app/helpers/confirm-result-continue.js +4 -4
  78. package/esm2015/app/helpers/confirm-unsaved.js +70 -70
  79. package/esm2015/app/helpers/get-form-errors.js +24 -24
  80. package/esm2015/app/helpers/index.js +2 -2
  81. package/esm2015/app/helpers/is-enabled.js +3 -3
  82. package/esm2015/app/providers/validate-messages.provider.js +10 -10
  83. package/esm2015/app/services/fsform.service.js +25 -25
  84. package/esm2015/app/validators/validators.js +96 -96
  85. package/esm2015/firestitch-form.js +27 -28
  86. package/esm2015/public_api.js +13 -13
  87. package/esm5/app/components/form-dialog-actions/form-dialog-actions.component.js +96 -69
  88. package/esm5/app/consts/error-messages.const.js +19 -19
  89. package/esm5/app/directives/form/form.directive.js +706 -697
  90. package/esm5/app/directives/form-dialog-close.directive.js +33 -33
  91. package/esm5/app/directives/submit-button.directive.js +143 -143
  92. package/esm5/app/directives/validators/compare.directive.js +59 -59
  93. package/esm5/app/directives/validators/control.directive.js +278 -278
  94. package/esm5/app/directives/validators/daterange.directive.js +49 -49
  95. package/esm5/app/directives/validators/email.directive.js +49 -49
  96. package/esm5/app/directives/validators/emails.directive.js +49 -49
  97. package/esm5/app/directives/validators/function.directive.js +35 -35
  98. package/esm5/app/directives/validators/greater.directive.js +48 -48
  99. package/esm5/app/directives/validators/integer.directive.js +49 -49
  100. package/esm5/app/directives/validators/lesser.directive.js +48 -48
  101. package/esm5/app/directives/validators/max.directive.js +44 -44
  102. package/esm5/app/directives/validators/maxlength.directive.js +43 -43
  103. package/esm5/app/directives/validators/min.directive.js +44 -44
  104. package/esm5/app/directives/validators/minlength.directive.js +43 -43
  105. package/esm5/app/directives/validators/numeric.directive.js +49 -49
  106. package/esm5/app/directives/validators/pattern.directive.js +43 -43
  107. package/esm5/app/directives/validators/phone.directive.js +49 -49
  108. package/esm5/app/directives/validators/required.directive.js +87 -87
  109. package/esm5/app/directives/validators/url.directive.js +55 -55
  110. package/esm5/app/directives/validators/validate.directive.js +35 -35
  111. package/esm5/app/enums/confirm-result.js +8 -8
  112. package/esm5/app/enums/form-status.js +10 -10
  113. package/esm5/app/fs-form.module.js +110 -110
  114. package/esm5/app/guards/form-deactivate.guard.js +44 -44
  115. package/esm5/app/helpers/confirm-result-continue.js +4 -4
  116. package/esm5/app/helpers/confirm-unsaved.js +70 -70
  117. package/esm5/app/helpers/get-form-errors.js +27 -27
  118. package/esm5/app/helpers/index.js +2 -2
  119. package/esm5/app/helpers/is-enabled.js +3 -3
  120. package/esm5/app/providers/validate-messages.provider.js +11 -11
  121. package/esm5/app/services/fsform.service.js +26 -26
  122. package/esm5/app/validators/validators.js +101 -101
  123. package/esm5/firestitch-form.js +27 -28
  124. package/esm5/public_api.js +13 -13
  125. package/fesm2015/firestitch-form.js +2075 -2042
  126. package/fesm2015/firestitch-form.js.map +1 -1
  127. package/fesm5/firestitch-form.js +2304 -2270
  128. package/fesm5/firestitch-form.js.map +1 -1
  129. package/firestitch-form.d.ts +26 -27
  130. package/firestitch-form.metadata.json +1 -1
  131. package/package.json +1 -1
  132. package/public_api.d.ts +12 -12
  133. package/app/components/form-dialog-actions/index.d.ts +0 -1
  134. package/esm2015/app/components/form-dialog-actions/index.js +0 -2
  135. package/esm5/app/components/form-dialog-actions/index.js +0 -2
@@ -218,2340 +218,2374 @@
218
218
  return value;
219
219
  }
220
220
 
221
- (function (ConfirmResult) {
222
- ConfirmResult["Save"] = "save";
223
- ConfirmResult["Discard"] = "discard";
224
- ConfirmResult["Review"] = "review";
225
- ConfirmResult["Invalid"] = "invalid";
226
- ConfirmResult["Pristine"] = "pristine";
221
+ (function (ConfirmResult) {
222
+ ConfirmResult["Save"] = "save";
223
+ ConfirmResult["Discard"] = "discard";
224
+ ConfirmResult["Review"] = "review";
225
+ ConfirmResult["Invalid"] = "invalid";
226
+ ConfirmResult["Pristine"] = "pristine";
227
227
  })(exports.ConfirmResult || (exports.ConfirmResult = {}));
228
228
 
229
- function confirmUnsaved(form, prompt) {
230
- return new rxjs.Observable(function (observer) {
231
- if (!form.confirm || !form.ngForm.dirty) {
232
- observer.next(exports.ConfirmResult.Pristine);
233
- observer.complete();
234
- return;
235
- }
236
- var title = 'You Have Unsaved Changes';
237
- var message = 'What would you like to do with your changes?';
238
- var saveLabel = 'Save & Continue';
239
- var discardLabel = 'Discard Changes & Continue';
240
- var cancelLabel = 'Review Changes';
241
- if (typeof form.confirm === 'object') {
242
- title = form.confirm.title || title;
243
- message = form.confirm.message || message;
244
- saveLabel = form.confirm.saveLabel || saveLabel;
245
- discardLabel = form.confirm.discardLabel || discardLabel;
246
- cancelLabel = form.confirm.cancelLabel || cancelLabel;
247
- }
248
- prompt.confirm({
249
- title: title,
250
- template: message,
251
- dialogConfig: { width: 'auto' },
252
- buttons: [
253
- {
254
- label: saveLabel,
255
- color: 'primary',
256
- value: 'save'
257
- },
258
- {
259
- label: discardLabel,
260
- value: 'discard'
261
- },
262
- {
263
- label: cancelLabel,
264
- cancel: true
265
- }
266
- ]
267
- }).subscribe(function (value) {
268
- if (value === 'discard') {
269
- observer.next(exports.ConfirmResult.Discard);
270
- observer.complete();
271
- form.reset();
272
- }
273
- if (value === 'save') {
274
- form.submitted
275
- .pipe(operators.first())
276
- .subscribe(function () {
277
- observer.next(exports.ConfirmResult.Save);
278
- observer.complete();
279
- });
280
- form.invalid
281
- .pipe(operators.first())
282
- .subscribe(function () {
283
- observer.next(exports.ConfirmResult.Invalid);
284
- observer.complete();
285
- });
286
- form.ngForm.control.markAsPristine();
287
- form.ngForm.ngSubmit.emit();
288
- }
289
- }, function (error) {
290
- observer.next(exports.ConfirmResult.Review);
291
- observer.complete();
292
- });
293
- });
229
+ function confirmUnsaved(form, prompt) {
230
+ return new rxjs.Observable(function (observer) {
231
+ if (!form.confirm || !form.ngForm.dirty) {
232
+ observer.next(exports.ConfirmResult.Pristine);
233
+ observer.complete();
234
+ return;
235
+ }
236
+ var title = 'You Have Unsaved Changes';
237
+ var message = 'What would you like to do with your changes?';
238
+ var saveLabel = 'Save & Continue';
239
+ var discardLabel = 'Discard Changes & Continue';
240
+ var cancelLabel = 'Review Changes';
241
+ if (typeof form.confirm === 'object') {
242
+ title = form.confirm.title || title;
243
+ message = form.confirm.message || message;
244
+ saveLabel = form.confirm.saveLabel || saveLabel;
245
+ discardLabel = form.confirm.discardLabel || discardLabel;
246
+ cancelLabel = form.confirm.cancelLabel || cancelLabel;
247
+ }
248
+ prompt.confirm({
249
+ title: title,
250
+ template: message,
251
+ dialogConfig: { width: 'auto' },
252
+ buttons: [
253
+ {
254
+ label: saveLabel,
255
+ color: 'primary',
256
+ value: 'save'
257
+ },
258
+ {
259
+ label: discardLabel,
260
+ value: 'discard'
261
+ },
262
+ {
263
+ label: cancelLabel,
264
+ cancel: true
265
+ }
266
+ ]
267
+ }).subscribe(function (value) {
268
+ if (value === 'discard') {
269
+ observer.next(exports.ConfirmResult.Discard);
270
+ observer.complete();
271
+ form.reset();
272
+ }
273
+ if (value === 'save') {
274
+ form.submitted
275
+ .pipe(operators.first())
276
+ .subscribe(function () {
277
+ observer.next(exports.ConfirmResult.Save);
278
+ observer.complete();
279
+ });
280
+ form.invalid
281
+ .pipe(operators.first())
282
+ .subscribe(function () {
283
+ observer.next(exports.ConfirmResult.Invalid);
284
+ observer.complete();
285
+ });
286
+ form.ngForm.control.markAsPristine();
287
+ form.ngForm.ngSubmit.emit();
288
+ }
289
+ }, function (error) {
290
+ observer.next(exports.ConfirmResult.Review);
291
+ observer.complete();
292
+ });
293
+ });
294
294
  }
295
295
 
296
- var FsFormDialogCloseDirective = /** @class */ (function () {
297
- function FsFormDialogCloseDirective() {
298
- this.clicked$ = new rxjs.Subject();
299
- this.registered = false;
300
- this.type = 'button';
301
- }
302
- FsFormDialogCloseDirective.prototype.click = function () {
303
- this.clicked$.next();
304
- };
305
- FsFormDialogCloseDirective.prototype.ngOnDestroy = function () {
306
- this.clicked$.complete();
307
- };
308
- __decorate([
309
- core.HostBinding('attr.type'),
310
- __metadata("design:type", Object)
311
- ], FsFormDialogCloseDirective.prototype, "type", void 0);
312
- __decorate([
313
- core.HostListener('click', ['$event.target']),
314
- __metadata("design:type", Function),
315
- __metadata("design:paramtypes", []),
316
- __metadata("design:returntype", void 0)
317
- ], FsFormDialogCloseDirective.prototype, "click", null);
318
- FsFormDialogCloseDirective = __decorate([
319
- core.Directive({
320
- selector: '[fsFormDialogClose],[fs-form-dialog-close]'
321
- })
322
- ], FsFormDialogCloseDirective);
323
- return FsFormDialogCloseDirective;
296
+ var FsFormDialogCloseDirective = /** @class */ (function () {
297
+ function FsFormDialogCloseDirective() {
298
+ this.clicked$ = new rxjs.Subject();
299
+ this.registered = false;
300
+ this.type = 'button';
301
+ }
302
+ FsFormDialogCloseDirective.prototype.click = function () {
303
+ this.clicked$.next();
304
+ };
305
+ FsFormDialogCloseDirective.prototype.ngOnDestroy = function () {
306
+ this.clicked$.complete();
307
+ };
308
+ __decorate([
309
+ core.HostBinding('attr.type'),
310
+ __metadata("design:type", Object)
311
+ ], FsFormDialogCloseDirective.prototype, "type", void 0);
312
+ __decorate([
313
+ core.HostListener('click', ['$event.target']),
314
+ __metadata("design:type", Function),
315
+ __metadata("design:paramtypes", []),
316
+ __metadata("design:returntype", void 0)
317
+ ], FsFormDialogCloseDirective.prototype, "click", null);
318
+ FsFormDialogCloseDirective = __decorate([
319
+ core.Directive({
320
+ selector: '[fsFormDialogClose],[fs-form-dialog-close]'
321
+ })
322
+ ], FsFormDialogCloseDirective);
323
+ return FsFormDialogCloseDirective;
324
324
  }());
325
325
 
326
- var FsForm = /** @class */ (function () {
327
- function FsForm() {
328
- this._eventBus = new rxjs.Subject();
329
- }
330
- FsForm.prototype.broadcast = function (key, data) {
331
- this._eventBus.next({ key: key, data: data });
332
- };
333
- FsForm.prototype.on = function (key) {
334
- return this._eventBus.asObservable()
335
- .pipe(operators.filter(function (event) { return event.key === key; }), operators.map(function (event) { return event.data; }));
336
- };
337
- FsForm.ɵprov = core.ɵɵdefineInjectable({ factory: function FsForm_Factory() { return new FsForm(); }, token: FsForm, providedIn: "root" });
338
- FsForm = __decorate([
339
- core.Injectable({
340
- providedIn: 'root',
341
- }),
342
- __metadata("design:paramtypes", [])
343
- ], FsForm);
344
- return FsForm;
326
+ var FsForm = /** @class */ (function () {
327
+ function FsForm() {
328
+ this._eventBus = new rxjs.Subject();
329
+ }
330
+ FsForm.prototype.broadcast = function (key, data) {
331
+ this._eventBus.next({ key: key, data: data });
332
+ };
333
+ FsForm.prototype.on = function (key) {
334
+ return this._eventBus.asObservable()
335
+ .pipe(operators.filter(function (event) { return event.key === key; }), operators.map(function (event) { return event.data; }));
336
+ };
337
+ FsForm.ɵprov = core.ɵɵdefineInjectable({ factory: function FsForm_Factory() { return new FsForm(); }, token: FsForm, providedIn: "root" });
338
+ FsForm = __decorate([
339
+ core.Injectable({
340
+ providedIn: 'root',
341
+ }),
342
+ __metadata("design:paramtypes", [])
343
+ ], FsForm);
344
+ return FsForm;
345
345
  }());
346
346
 
347
-
348
- (function (FormStatus) {
349
- FormStatus["Valid"] = "valid";
350
- FormStatus["Invalid"] = "invalid";
351
- FormStatus["Submitting"] = "submitting";
352
- FormStatus["Submitted"] = "submitted";
353
- FormStatus["Error"] = "error";
354
- FormStatus["Success"] = "success";
355
- FormStatus["Completing"] = "completing";
347
+
348
+ (function (FormStatus) {
349
+ FormStatus["Valid"] = "valid";
350
+ FormStatus["Invalid"] = "invalid";
351
+ FormStatus["Submitting"] = "submitting";
352
+ FormStatus["Submitted"] = "submitted";
353
+ FormStatus["Error"] = "error";
354
+ FormStatus["Success"] = "success";
355
+ FormStatus["Completing"] = "completing";
356
356
  })(exports.FormStatus || (exports.FormStatus = {}));
357
357
 
358
- function confirmResultContinue(result) {
359
- return result === exports.ConfirmResult.Discard || result === exports.ConfirmResult.Save || result === exports.ConfirmResult.Pristine;
358
+ function confirmResultContinue(result) {
359
+ return result === exports.ConfirmResult.Discard || result === exports.ConfirmResult.Save || result === exports.ConfirmResult.Pristine;
360
360
  }
361
361
 
362
- function getFormErrors(control, key) {
363
- var _a;
364
- var errors = null;
365
- if (control.invalid && control.errors) {
366
- errors = (_a = {},
367
- _a[key] = __assign({}, control.errors),
368
- _a);
369
- }
370
- if (control instanceof forms.FormGroup) {
371
- Object.entries(control.controls)
372
- .forEach(function (_a) {
373
- var _b = __read(_a, 2), name = _b[0], childControl = _b[1];
374
- var childErrors = getFormErrors(childControl, name);
375
- if (childErrors) {
376
- if (!errors) {
377
- errors = __assign({}, childErrors);
378
- }
379
- else {
380
- Object.assign(errors, childErrors);
381
- }
382
- }
383
- });
384
- }
385
- return errors;
362
+ function getFormErrors(control, key) {
363
+ var _a;
364
+ var errors = null;
365
+ if (control.invalid && control.errors) {
366
+ errors = (_a = {},
367
+ _a[key] = __assign({}, control.errors),
368
+ _a);
369
+ }
370
+ if (control instanceof forms.FormGroup) {
371
+ Object.entries(control.controls)
372
+ .forEach(function (_a) {
373
+ var _b = __read(_a, 2), name = _b[0], childControl = _b[1];
374
+ var childErrors = getFormErrors(childControl, name);
375
+ if (childErrors) {
376
+ if (!errors) {
377
+ errors = __assign({}, childErrors);
378
+ }
379
+ else {
380
+ Object.assign(errors, childErrors);
381
+ }
382
+ }
383
+ });
384
+ }
385
+ return errors;
386
386
  }
387
387
 
388
- var FsFormDirective = /** @class */ (function () {
389
- function FsFormDirective(ngForm, _form, _element, _message, _prompt, _ngZone, _dialogRef, _drawerRef) {
390
- this.ngForm = ngForm;
391
- this._form = _form;
392
- this._element = _element;
393
- this._message = _message;
394
- this._prompt = _prompt;
395
- this._ngZone = _ngZone;
396
- this._dialogRef = _dialogRef;
397
- this._drawerRef = _drawerRef;
398
- this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
399
- this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
400
- this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
401
- this.labelSelector = '.fs-form-label,.mat-form-field-label';
402
- this.autocomplete = false;
403
- this.shortcuts = true; // Ctrl + s
404
- this.confirm = true;
405
- this.confirmDialog = true;
406
- this.confirmDrawer = true;
407
- this.confirmBrowser = true;
408
- this.confirmTabs = true;
409
- this.dirtySubmitButton = true;
410
- this.successDelay = 0;
411
- this.errorDelay = 1000;
412
- this.submitEvent = new core.EventEmitter();
413
- this.invalid = new core.EventEmitter();
414
- this.valid = new core.EventEmitter();
415
- this.submitted = new core.EventEmitter();
416
- this.fsformClass = true;
417
- this._tabGroups = new core.QueryList();
418
- this._submitButtons = new core.QueryList();
419
- this._dialogBackdropEscape = false;
420
- this._snapshot = {};
421
- this._status$ = new rxjs.BehaviorSubject(exports.FormStatus.Valid);
422
- this._destroy$ = new rxjs.Subject();
423
- }
424
- Object.defineProperty(FsFormDirective.prototype, "submitting", {
425
- get: function () {
426
- return this._status$.getValue() === exports.FormStatus.Submitting;
427
- },
428
- enumerable: true,
429
- configurable: true
430
- });
431
- Object.defineProperty(FsFormDirective.prototype, "completing", {
432
- get: function () {
433
- return this._status$.getValue() === exports.FormStatus.Completing;
434
- },
435
- enumerable: true,
436
- configurable: true
437
- });
438
- Object.defineProperty(FsFormDirective.prototype, "_submitEvent", {
439
- get: function () {
440
- return {
441
- ngForm: this.ngForm,
442
- submitter: this._submitter,
443
- };
444
- },
445
- enumerable: true,
446
- configurable: true
447
- });
448
- Object.defineProperty(FsFormDirective.prototype, "_formValidState$", {
449
- get: function () {
450
- this._form.broadcast('valid', this._submitEvent);
451
- this.submitEvent.emit(this._submitEvent);
452
- this.valid.emit(this._submitEvent);
453
- var submittedEvent = {
454
- ngForm: this.ngForm,
455
- submitter: this._submitter,
456
- response: null
457
- };
458
- if (!this.submit) {
459
- return rxjs.of(submittedEvent);
460
- }
461
- var result = this.submit(this._submitEvent);
462
- if (!rxjs.isObservable(result)) {
463
- return rxjs.of(submittedEvent);
464
- }
465
- return result
466
- .pipe(operators.map(function (response) {
467
- submittedEvent.response = response;
468
- return submittedEvent;
469
- }));
470
- },
471
- enumerable: true,
472
- configurable: true
473
- });
474
- Object.defineProperty(FsFormDirective.prototype, "_formInvalidState$", {
475
- get: function () {
476
- this._form.broadcast('invalid', this._submitEvent);
477
- if (this.invalid) {
478
- this.invalid.emit(this._submitEvent);
479
- }
480
- var message$1 = 'Changes not saved. Please review errors highlighted in red.';
481
- this._message.error(message$1, { mode: message.MessageMode.Toast });
482
- var el = this._element.nativeElement.querySelector('.ng-invalid');
483
- if (el) {
484
- el.scrollIntoView({ behavior: 'smooth', block: 'center' });
485
- }
486
- return rxjs.throwError('Form validation error');
487
- },
488
- enumerable: true,
489
- configurable: true
490
- });
491
- Object.defineProperty(FsFormDirective.prototype, "_submitter", {
492
- get: function () {
493
- return this._activeSubmitButton
494
- ? this._activeSubmitButton.name
495
- : null;
496
- },
497
- enumerable: true,
498
- configurable: true
499
- });
500
- FsFormDirective.prototype.ngOnInit = function () {
501
- this._registerConfirmDialogBackdropEscape();
502
- this._listenHotKeys();
503
- this._listenWindowClose();
504
- this._listenSubmit();
505
- if (!this.autocomplete) {
506
- this._registerAutocomplete();
507
- }
508
- };
509
- FsFormDirective.prototype.ngOnChanges = function (changes) {
510
- if (changes.confirm) {
511
- this._updateDirtySubmitButtons();
512
- }
513
- };
514
- FsFormDirective.prototype.ngAfterContentInit = function () {
515
- this._registerConfirm();
516
- this._registerConfirmDialogClose();
517
- this._registerConfirmDrawerClose();
518
- this._registerConfirmTabs();
519
- this._registerDrawerClose();
520
- this._registerDirtySubmitButton();
521
- };
522
- FsFormDirective.prototype.ngOnDestroy = function () {
523
- this._destroy$.next();
524
- this._destroy$.complete();
525
- };
526
- FsFormDirective.prototype.createSnapshot = function () {
527
- this._snapshot = this.ngForm.value;
528
- };
529
- FsFormDirective.prototype.reset = function () {
530
- var _this = this;
531
- this.ngForm.resetForm();
532
- Object.keys(this.ngForm.controls)
533
- .forEach(function (name) {
534
- var control = _this.ngForm.controls[name];
535
- control.reset(_this._snapshot[name]);
536
- });
537
- };
538
- FsFormDirective.prototype.clear = function () {
539
- this.ngForm.resetForm();
540
- };
541
- FsFormDirective.prototype.dirty = function () {
542
- this.ngForm.form.markAsDirty();
543
- this._updateDirtySubmitButtons();
544
- };
545
- FsFormDirective.prototype.triggerSubmit = function () {
546
- this.ngForm.ngSubmit.next();
547
- };
548
- FsFormDirective.prototype.triggerConfirm = function () {
549
- var _this = this;
550
- var submitted = this.submitting ? this.submitted.asObservable() : rxjs.of({});
551
- return submitted
552
- .pipe(operators.take(1), operators.mergeMap(function () { return confirmUnsaved(_this, _this._prompt); }));
553
- };
554
- FsFormDirective.prototype.enable = function () {
555
- this.ngForm.control.enable();
556
- this._updateDirtySubmitButtons();
557
- };
558
- FsFormDirective.prototype.disable = function () {
559
- this.ngForm.control.disable();
560
- this._submitButtons.forEach(function (button) {
561
- button.disable();
562
- });
563
- };
564
- FsFormDirective.prototype.addSubmitButton = function (submitButton) {
565
- this._submitButtons.reset(__spread(this._submitButtons.toArray(), [
566
- submitButton,
567
- ]));
568
- };
569
- FsFormDirective.prototype.removeSubmitButton = function (submitButton) {
570
- this._submitButtons.reset(__spread(this._submitButtons.toArray()
571
- .filter(function (submitButton_) { return (submitButton !== submitButton_); })));
572
- };
573
- FsFormDirective.prototype._listenSubmit = function () {
574
- var _this = this;
575
- this.ngForm
576
- .ngSubmit
577
- .pipe(operators.tap(function (event) {
578
- event === null || event === void 0 ? void 0 : event.preventDefault();
579
- }), operators.filter(function () {
580
- return [exports.FormStatus.Valid, exports.FormStatus.Invalid]
581
- .includes(_this._status$.getValue());
582
- }), operators.tap(function () { return _this._markControlsAsTouchedAndUpdateValidity(); }), operators.tap(function () { return _this._broadcastSubmittingEvents(); }), operators.switchMap(function () { return _this._waitUntilStatusPending(); }), operators.tap(function () { return _this._setupActiveSubmitButton(); }), operators.mergeMap(function () {
583
- return _this.ngForm.status === 'INVALID'
584
- ? _this._formInvalidState$
585
- : _this._formValidState$;
586
- }), operators.catchError(function (e, source$) {
587
- _this._handleError(e);
588
- return source$;
589
- }), operators.tap(function (submittedEvent) {
590
- _this._completeSubmit(true, submittedEvent);
591
- }), operators.takeUntil(this._destroy$))
592
- .subscribe(function () { });
593
- };
594
- FsFormDirective.prototype._listenWindowClose = function () {
595
- var _this = this;
596
- rxjs.fromEvent(window, 'beforeunload')
597
- .pipe(operators.takeUntil(this._destroy$))
598
- .subscribe(function (event) {
599
- if (_this.confirm && _this.confirmBrowser && _this.ngForm.dirty) {
600
- event.returnValue = false;
601
- }
602
- });
603
- };
604
- FsFormDirective.prototype._listenHotKeys = function () {
605
- var _this = this;
606
- this._ngZone.runOutsideAngular(function () {
607
- rxjs.fromEvent(document, 'keydown')
608
- .pipe(operators.takeUntil(_this._destroy$))
609
- .subscribe(function (event) {
610
- if (_this._dialogBackdropEscape && event.code === 'Escape') {
611
- var dialog_1 = document.getElementById(_this._dialogRef.id);
612
- var paths = event.composedPath();
613
- if (paths) {
614
- paths.forEach(function (item) {
615
- if (dialog_1 === item) {
616
- _this._ngZone.run(function () {
617
- _this._formClose();
618
- });
619
- }
620
- });
621
- }
622
- }
623
- if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
624
- event.preventDefault();
625
- if (_this.shortcuts) {
626
- if (_this._elementInForm(document.activeElement)) {
627
- _this.ngForm.ngSubmit.next();
628
- }
629
- }
630
- }
631
- });
632
- });
633
- };
634
- FsFormDirective.prototype._formClose = function () {
635
- var _this = this;
636
- if (this.confirm && this.confirmDialog) {
637
- this.triggerConfirm()
638
- .pipe(operators.filter(function (result) { return confirmResultContinue(result); }), operators.switchMap(function (result) {
639
- return result === exports.ConfirmResult.Pristine || result === exports.ConfirmResult.Discard
640
- ? rxjs.of(null)
641
- : _this.submitted.asObservable();
642
- }), operators.takeUntil(this._destroy$))
643
- .subscribe(function (result) {
644
- _this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
645
- });
646
- }
647
- else {
648
- this._dialogRef.close(null);
649
- }
650
- };
651
- FsFormDirective.prototype._registerDialogClose = function (directive) {
652
- var _this = this;
653
- if (!directive.registered) {
654
- directive.registered = true;
655
- directive.clicked$
656
- .pipe(operators.takeUntil(this._destroy$))
657
- .subscribe(function () {
658
- _this._formClose();
659
- });
660
- }
661
- };
662
- FsFormDirective.prototype._getActiveButton = function () {
663
- var activeButton = this._submitButtons.find(function (button) {
664
- return button.active;
665
- });
666
- return activeButton ? activeButton : this._submitButtons.first;
667
- };
668
- FsFormDirective.prototype._elementInForm = function (el) {
669
- if (el.isSameNode(this._element.nativeElement)) {
670
- return true;
671
- }
672
- else if (el.parentElement) {
673
- return this._elementInForm(el.parentElement);
674
- }
675
- return false;
676
- };
677
- FsFormDirective.prototype._completeSubmit = function (success, submitEvent) {
678
- var _this = this;
679
- if (success) {
680
- this.ngForm.control.markAsPristine();
681
- this.createSnapshot();
682
- this.submitted.emit(submitEvent);
683
- }
684
- else {
685
- this._resetButtons();
686
- }
687
- if (this._activeSubmitButton) {
688
- if (success) {
689
- this._activeSubmitButton.success();
690
- }
691
- else {
692
- this._activeSubmitButton.error();
693
- }
694
- }
695
- this._status$.next(exports.FormStatus.Submitted);
696
- if (success) {
697
- this._status$.next(exports.FormStatus.Success);
698
- }
699
- else {
700
- this._status$.next(exports.FormStatus.Error);
701
- }
702
- this._status$.next(exports.FormStatus.Completing);
703
- var resetDelay = success ? this.successDelay : this.errorDelay;
704
- rxjs.of(true)
705
- .pipe(operators.delay(resetDelay), operators.first(), operators.takeUntil(this._destroy$)).subscribe(function () {
706
- if (_this.ngForm.form.status === 'VALID') {
707
- _this._status$.next(exports.FormStatus.Valid);
708
- }
709
- else {
710
- _this._status$.next(exports.FormStatus.Invalid);
711
- }
712
- _this._resetButtons();
713
- _this._updateDirtySubmitButtons();
714
- });
715
- };
716
- FsFormDirective.prototype._resetButtons = function () {
717
- this._submitButtons.forEach(function (button) {
718
- button.reset();
719
- });
720
- };
721
- FsFormDirective.prototype._registerConfirm = function () {
722
- var _this = this;
723
- this.ngForm.form.valueChanges
724
- .pipe(operators.takeUntil(this._destroy$))
725
- .subscribe(function (changes) {
726
- if (_this.confirm) {
727
- var existing_1 = Object.keys(_this._snapshot);
728
- Object.keys(changes)
729
- .forEach(function (name) {
730
- if (existing_1.indexOf(name) === -1) {
731
- _this._snapshot[name] = changes[name];
732
- }
733
- });
734
- }
735
- });
736
- };
737
- FsFormDirective.prototype._registerDrawerClose = function () {
738
- var _this = this;
739
- if (this._drawerRef) {
740
- this._drawerRef.closeStart$
741
- .pipe(operators.takeUntil(this._destroy$))
742
- .subscribe(function (subscriber) {
743
- if (_this.submitting) {
744
- _this._status$
745
- .pipe(operators.filter(function (status) { return status === exports.FormStatus.Success || status === exports.FormStatus.Error; }), operators.takeUntil(_this._destroy$))
746
- .subscribe(function (status) {
747
- if (status === exports.FormStatus.Success) {
748
- subscriber.next();
749
- subscriber.complete();
750
- }
751
- else {
752
- subscriber.error();
753
- }
754
- });
755
- }
756
- else {
757
- subscriber.next();
758
- subscriber.complete();
759
- }
760
- });
761
- }
762
- };
763
- FsFormDirective.prototype._registerConfirmDrawerClose = function () {
764
- var _this = this;
765
- if (this._drawerRef) {
766
- this._drawerRef.closeStart$
767
- .pipe(operators.switchMap(function (subscriber) {
768
- return rxjs.iif(function () { return _this.confirm && _this.confirmDrawer; }, _this.triggerConfirm()
769
- .pipe(operators.map(function (result) { return confirmResultContinue(result); }), operators.tap(function (result) {
770
- if (result) {
771
- subscriber.next();
772
- subscriber.complete();
773
- }
774
- else {
775
- subscriber.error();
776
- }
777
- })), rxjs.defer(function () {
778
- subscriber.next();
779
- subscriber.complete();
780
- }));
781
- }), operators.takeUntil(this._destroy$))
782
- .subscribe();
783
- }
784
- };
785
- FsFormDirective.prototype._registerConfirmTabs = function () {
786
- var _this = this;
787
- if (this.tabGroup) {
788
- this.registerConfirmTabGroup(this.tabGroup);
789
- }
790
- this.registerConfirmTabGroups(this._tabGroups.toArray());
791
- this._tabGroups.changes
792
- .pipe(operators.takeUntil(this._destroy$))
793
- .subscribe(function () {
794
- _this.registerConfirmTabGroups(_this._tabGroups.toArray());
795
- });
796
- };
797
- FsFormDirective.prototype.registerConfirmTabGroups = function (tabGroups) {
798
- var _this = this;
799
- tabGroups.forEach(function (tabGroup) {
800
- _this.registerConfirmTabGroup(tabGroup);
801
- });
802
- };
803
- FsFormDirective.prototype.registerConfirmTabGroup = function (tabGroup) {
804
- var _this = this;
805
- var confirmTabGroup = tabGroup;
806
- if (!confirmTabGroup._originalHandleClick) {
807
- confirmTabGroup._originalHandleClick = tabGroup._handleClick;
808
- confirmTabGroup._handlClick$ = new rxjs.Subject();
809
- confirmTabGroup._handleClick = function (tab, tabHeader, idx) {
810
- if (confirmTabGroup._handlClick$.observers.length) {
811
- confirmTabGroup._handlClick$.next({ tab: tab, tabHeader: tabHeader, idx: idx });
812
- }
813
- else {
814
- confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
815
- }
816
- };
817
- }
818
- confirmTabGroup._handlClick$
819
- .pipe(operators.takeUntil(this._destroy$))
820
- .subscribe(function (event) {
821
- if (!_this.submitting) {
822
- if (_this.confirm && _this.confirmTabs) {
823
- _this.triggerConfirm()
824
- .pipe(operators.takeUntil(_this._destroy$))
825
- .subscribe(function (result) {
826
- if (confirmResultContinue(result)) {
827
- confirmTabGroup.selectedIndex = event.idx;
828
- }
829
- });
830
- }
831
- else {
832
- confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
833
- }
834
- }
835
- });
836
- };
837
- FsFormDirective.prototype._registerConfirmDialogClose = function () {
838
- var _this = this;
839
- if (this._dialogRef) {
840
- this.formDialogClose.forEach(function (item) {
841
- _this._registerDialogClose(item);
842
- });
843
- this.formDialogClose.changes
844
- .pipe(operators.takeUntil(this._destroy$))
845
- .subscribe(function (e) {
846
- e.forEach(function (item) {
847
- _this._registerDialogClose(item);
848
- });
849
- });
850
- }
851
- };
852
- FsFormDirective.prototype._registerConfirmDialogBackdropEscape = function () {
853
- var _this = this;
854
- this._dialogBackdropEscape = this._dialogRef && this._dialogRef.disableClose !== true;
855
- if (this._dialogRef && !this._dialogRef.disableClose) {
856
- this._dialogRef.disableClose = true;
857
- this._dialogRef.backdropClick()
858
- .pipe(operators.takeUntil(this._destroy$))
859
- .subscribe(function () {
860
- _this._formClose();
861
- });
862
- this._destroy$
863
- .subscribe(function () {
864
- _this._dialogRef.disableClose = false;
865
- });
866
- }
867
- };
868
- FsFormDirective.prototype._registerAutocomplete = function () {
869
- var _this = this;
870
- this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
871
- this.ngForm.form.registerControl = function (name, control) {
872
- var el = _this._element.nativeElement.querySelector("input[name='" + name + "']");
873
- if (el) {
874
- el.setAttribute('name', name + '_' + common$1.guid());
875
- if (!el.getAttribute('autocomplete')) {
876
- el.setAttribute('autocomplete', 'none');
877
- }
878
- }
879
- return _this._registerControl(name, control);
880
- };
881
- };
882
- FsFormDirective.prototype._registerDirtySubmitButton = function () {
883
- var _this = this;
884
- if (!this.ngForm) {
885
- return;
886
- }
887
- this.ngForm.form.valueChanges
888
- .pipe(operators.takeUntil(this._destroy$))
889
- .subscribe(function () {
890
- _this._updateDirtySubmitButtons();
891
- });
892
- this._submitButtons.changes
893
- .pipe(operators.takeUntil(this._destroy$))
894
- .subscribe(function () {
895
- _this._updateDirtySubmitButtons();
896
- });
897
- };
898
- FsFormDirective.prototype._updateDirtySubmitButtons = function () {
899
- var _this = this;
900
- this._submitButtons
901
- .forEach(function (submitButton) {
902
- if (!_this.confirm || !_this.dirtySubmitButton || _this.ngForm.dirty || !submitButton.dirtySubmit) {
903
- submitButton.enable();
904
- }
905
- else {
906
- submitButton.disable();
907
- }
908
- });
909
- };
910
- FsFormDirective.prototype._broadcastSubmittingEvents = function () {
911
- this._status$.next(exports.FormStatus.Submitting);
912
- this._form.broadcast('submit', this.ngForm);
913
- };
914
- FsFormDirective.prototype._markControlsAsTouchedAndUpdateValidity = function () {
915
- Object.values(this.ngForm.controls)
916
- .forEach(function (control) {
917
- control.markAsDirty();
918
- control.markAsTouched();
919
- control.updateValueAndValidity();
920
- });
921
- };
922
- FsFormDirective.prototype._setupActiveSubmitButton = function () {
923
- this._activeSubmitButton = this._getActiveButton();
924
- this._resetButtons();
925
- if (this._activeSubmitButton) {
926
- this._activeSubmitButton.process();
927
- }
928
- };
929
- FsFormDirective.prototype._waitUntilStatusPending = function () {
930
- return this.ngForm.statusChanges
931
- .pipe(operators.startWith(this.ngForm.status), operators.first(function (state) { return state !== 'PENDING'; }));
932
- };
933
- FsFormDirective.prototype._handleError = function (e) {
934
- console.log('%c Form Submit ', 'color: white; background-color: #D33F49', 'Error occured');
935
- console.group('Error Details:');
936
- console.log('Message: ', e);
937
- console.log('FormRef: ', this);
938
- if (this.ngForm.invalid) {
939
- var errors = getFormErrors(this.ngForm.control, null);
940
- console.log('Validation Errors: ', errors);
941
- }
942
- console.groupEnd();
943
- this._completeSubmit(false, null);
944
- };
945
- FsFormDirective.ctorParameters = function () { return [
946
- { type: forms.NgForm, decorators: [{ type: core.Inject, args: [forms.NgForm,] }] },
947
- { type: FsForm },
948
- { type: core.ElementRef },
949
- { type: message.FsMessage },
950
- { type: prompt.FsPrompt },
951
- { type: core.NgZone },
952
- { type: dialog.MatDialogRef, decorators: [{ type: core.Optional }, { type: core.Inject, args: [dialog.MatDialogRef,] }] },
953
- { type: drawer.DrawerRef, decorators: [{ type: core.Optional }, { type: core.Inject, args: [drawer.DrawerRef,] }] }
954
- ]; };
955
- __decorate([
956
- core.Input(),
957
- __metadata("design:type", Object)
958
- ], FsFormDirective.prototype, "wrapperSelector", void 0);
959
- __decorate([
960
- core.Input(),
961
- __metadata("design:type", Object)
962
- ], FsFormDirective.prototype, "messageSelector", void 0);
963
- __decorate([
964
- core.Input(),
965
- __metadata("design:type", Object)
966
- ], FsFormDirective.prototype, "hintSelector", void 0);
967
- __decorate([
968
- core.Input(),
969
- __metadata("design:type", Object)
970
- ], FsFormDirective.prototype, "labelSelector", void 0);
971
- __decorate([
972
- core.Input(),
973
- __metadata("design:type", Object)
974
- ], FsFormDirective.prototype, "autocomplete", void 0);
975
- __decorate([
976
- core.Input(),
977
- __metadata("design:type", Object)
978
- ], FsFormDirective.prototype, "shortcuts", void 0);
979
- __decorate([
980
- core.Input(),
981
- __metadata("design:type", Object)
982
- ], FsFormDirective.prototype, "confirm", void 0);
983
- __decorate([
984
- core.Input(),
985
- __metadata("design:type", Object)
986
- ], FsFormDirective.prototype, "confirmDialog", void 0);
987
- __decorate([
988
- core.Input(),
989
- __metadata("design:type", Object)
990
- ], FsFormDirective.prototype, "confirmDrawer", void 0);
991
- __decorate([
992
- core.Input(),
993
- __metadata("design:type", Object)
994
- ], FsFormDirective.prototype, "confirmBrowser", void 0);
995
- __decorate([
996
- core.Input(),
997
- __metadata("design:type", Object)
998
- ], FsFormDirective.prototype, "confirmTabs", void 0);
999
- __decorate([
1000
- core.Input(),
1001
- __metadata("design:type", Object)
1002
- ], FsFormDirective.prototype, "dirtySubmitButton", void 0);
1003
- __decorate([
1004
- core.Input(),
1005
- __metadata("design:type", Function)
1006
- ], FsFormDirective.prototype, "submit", void 0);
1007
- __decorate([
1008
- core.Input(),
1009
- __metadata("design:type", Object)
1010
- ], FsFormDirective.prototype, "successDelay", void 0);
1011
- __decorate([
1012
- core.Input(),
1013
- __metadata("design:type", Object)
1014
- ], FsFormDirective.prototype, "errorDelay", void 0);
1015
- __decorate([
1016
- core.Input(),
1017
- __metadata("design:type", tabs.MatTabGroup)
1018
- ], FsFormDirective.prototype, "tabGroup", void 0);
1019
- __decorate([
1020
- core.Output('fsForm'),
1021
- __metadata("design:type", core.EventEmitter)
1022
- ], FsFormDirective.prototype, "submitEvent", void 0);
1023
- __decorate([
1024
- core.Output(),
1025
- __metadata("design:type", core.EventEmitter)
1026
- ], FsFormDirective.prototype, "invalid", void 0);
1027
- __decorate([
1028
- core.Output(),
1029
- __metadata("design:type", core.EventEmitter)
1030
- ], FsFormDirective.prototype, "valid", void 0);
1031
- __decorate([
1032
- core.Output(),
1033
- __metadata("design:type", core.EventEmitter)
1034
- ], FsFormDirective.prototype, "submitted", void 0);
1035
- __decorate([
1036
- core.HostBinding('class.fs-form'),
1037
- __metadata("design:type", Object)
1038
- ], FsFormDirective.prototype, "fsformClass", void 0);
1039
- __decorate([
1040
- core.ContentChildren(FsFormDialogCloseDirective, { descendants: true }),
1041
- __metadata("design:type", core.QueryList)
1042
- ], FsFormDirective.prototype, "formDialogClose", void 0);
1043
- __decorate([
1044
- core.ContentChildren(tabs.MatTabGroup, { descendants: true }),
1045
- __metadata("design:type", core.QueryList)
1046
- ], FsFormDirective.prototype, "_tabGroups", void 0);
1047
- FsFormDirective = __decorate([
1048
- core.Directive({
1049
- selector: '[fsForm]',
1050
- }),
1051
- __param(0, core.Inject(forms.NgForm)),
1052
- __param(6, core.Optional()), __param(6, core.Inject(dialog.MatDialogRef)),
1053
- __param(7, core.Optional()), __param(7, core.Inject(drawer.DrawerRef)),
1054
- __metadata("design:paramtypes", [forms.NgForm,
1055
- FsForm,
1056
- core.ElementRef,
1057
- message.FsMessage,
1058
- prompt.FsPrompt,
1059
- core.NgZone,
1060
- dialog.MatDialogRef,
1061
- drawer.DrawerRef])
1062
- ], FsFormDirective);
1063
- return FsFormDirective;
388
+ var FsFormDirective = /** @class */ (function () {
389
+ function FsFormDirective(ngForm, _form, _element, _message, _prompt, _ngZone, _dialogRef, _drawerRef) {
390
+ this.ngForm = ngForm;
391
+ this._form = _form;
392
+ this._element = _element;
393
+ this._message = _message;
394
+ this._prompt = _prompt;
395
+ this._ngZone = _ngZone;
396
+ this._dialogRef = _dialogRef;
397
+ this._drawerRef = _drawerRef;
398
+ this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
399
+ this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
400
+ this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
401
+ this.labelSelector = '.fs-form-label,.mat-form-field-label';
402
+ this.autocomplete = false;
403
+ this.shortcuts = true; // Ctrl + s
404
+ this.confirm = true;
405
+ this.confirmDialog = true;
406
+ this.confirmDrawer = true;
407
+ this.confirmBrowser = true;
408
+ this.confirmTabs = true;
409
+ this.dirtySubmitButton = true;
410
+ this.successDelay = 0;
411
+ this.errorDelay = 1000;
412
+ this.submitEvent = new core.EventEmitter();
413
+ this.invalid = new core.EventEmitter();
414
+ this.valid = new core.EventEmitter();
415
+ this.submitted = new core.EventEmitter();
416
+ this.reseted = new core.EventEmitter();
417
+ this.cleared = new core.EventEmitter();
418
+ this.fsformClass = true;
419
+ this._tabGroups = new core.QueryList();
420
+ this._submitButtons = new core.QueryList();
421
+ this._dialogBackdropEscape = false;
422
+ this._snapshot = {};
423
+ this._status$ = new rxjs.BehaviorSubject(exports.FormStatus.Valid);
424
+ this._destroy$ = new rxjs.Subject();
425
+ }
426
+ Object.defineProperty(FsFormDirective.prototype, "submitting", {
427
+ get: function () {
428
+ return this._status$.getValue() === exports.FormStatus.Submitting;
429
+ },
430
+ enumerable: true,
431
+ configurable: true
432
+ });
433
+ Object.defineProperty(FsFormDirective.prototype, "completing", {
434
+ get: function () {
435
+ return this._status$.getValue() === exports.FormStatus.Completing;
436
+ },
437
+ enumerable: true,
438
+ configurable: true
439
+ });
440
+ Object.defineProperty(FsFormDirective.prototype, "_submitEvent", {
441
+ get: function () {
442
+ return {
443
+ ngForm: this.ngForm,
444
+ submitter: this._submitter,
445
+ };
446
+ },
447
+ enumerable: true,
448
+ configurable: true
449
+ });
450
+ Object.defineProperty(FsFormDirective.prototype, "_formValidState$", {
451
+ get: function () {
452
+ this._form.broadcast('valid', this._submitEvent);
453
+ this.submitEvent.emit(this._submitEvent);
454
+ this.valid.emit(this._submitEvent);
455
+ var submittedEvent = {
456
+ ngForm: this.ngForm,
457
+ submitter: this._submitter,
458
+ response: null
459
+ };
460
+ if (!this.submit) {
461
+ return rxjs.of(submittedEvent);
462
+ }
463
+ var result = this.submit(this._submitEvent);
464
+ if (!rxjs.isObservable(result)) {
465
+ return rxjs.of(submittedEvent);
466
+ }
467
+ return result
468
+ .pipe(operators.map(function (response) {
469
+ submittedEvent.response = response;
470
+ return submittedEvent;
471
+ }));
472
+ },
473
+ enumerable: true,
474
+ configurable: true
475
+ });
476
+ Object.defineProperty(FsFormDirective.prototype, "_formInvalidState$", {
477
+ get: function () {
478
+ this._form.broadcast('invalid', this._submitEvent);
479
+ if (this.invalid) {
480
+ this.invalid.emit(this._submitEvent);
481
+ }
482
+ var message$1 = 'Changes not saved. Please review errors highlighted in red.';
483
+ this._message.error(message$1, { mode: message.MessageMode.Toast });
484
+ var el = this._element.nativeElement.querySelector('.ng-invalid');
485
+ if (el) {
486
+ el.scrollIntoView({ behavior: 'smooth', block: 'center' });
487
+ }
488
+ return rxjs.throwError('Form validation error');
489
+ },
490
+ enumerable: true,
491
+ configurable: true
492
+ });
493
+ Object.defineProperty(FsFormDirective.prototype, "_submitter", {
494
+ get: function () {
495
+ return this._activeSubmitButton
496
+ ? this._activeSubmitButton.name
497
+ : null;
498
+ },
499
+ enumerable: true,
500
+ configurable: true
501
+ });
502
+ FsFormDirective.prototype.ngOnInit = function () {
503
+ this._registerConfirmDialogBackdropEscape();
504
+ this._listenHotKeys();
505
+ this._listenWindowClose();
506
+ this._listenSubmit();
507
+ if (!this.autocomplete) {
508
+ this._registerAutocomplete();
509
+ }
510
+ };
511
+ FsFormDirective.prototype.ngOnChanges = function (changes) {
512
+ if (changes.confirm) {
513
+ this._updateDirtySubmitButtons();
514
+ }
515
+ };
516
+ FsFormDirective.prototype.ngAfterContentInit = function () {
517
+ this._registerConfirm();
518
+ this._registerConfirmDialogClose();
519
+ this._registerConfirmDrawerClose();
520
+ this._registerConfirmTabs();
521
+ this._registerDrawerClose();
522
+ this._registerDirtySubmitButton();
523
+ };
524
+ FsFormDirective.prototype.ngOnDestroy = function () {
525
+ this._destroy$.next();
526
+ this._destroy$.complete();
527
+ };
528
+ FsFormDirective.prototype.createSnapshot = function () {
529
+ this._snapshot = this.ngForm.value;
530
+ };
531
+ FsFormDirective.prototype.reset = function () {
532
+ var _this = this;
533
+ this.ngForm.resetForm();
534
+ Object.keys(this.ngForm.controls)
535
+ .forEach(function (name) {
536
+ var control = _this.ngForm.controls[name];
537
+ control.reset(_this._snapshot[name]);
538
+ });
539
+ this.reseted.emit();
540
+ };
541
+ FsFormDirective.prototype.clear = function () {
542
+ this.ngForm.resetForm();
543
+ this.cleared.emit();
544
+ };
545
+ FsFormDirective.prototype.dirty = function () {
546
+ this.ngForm.form.markAsDirty();
547
+ this._updateDirtySubmitButtons();
548
+ };
549
+ FsFormDirective.prototype.triggerSubmit = function () {
550
+ this.ngForm.ngSubmit.next();
551
+ };
552
+ FsFormDirective.prototype.triggerConfirm = function () {
553
+ var _this = this;
554
+ var submitted = this.submitting ? this.submitted.asObservable() : rxjs.of({});
555
+ return submitted
556
+ .pipe(operators.take(1), operators.mergeMap(function () { return confirmUnsaved(_this, _this._prompt); }));
557
+ };
558
+ FsFormDirective.prototype.enable = function () {
559
+ this.ngForm.control.enable();
560
+ this._updateDirtySubmitButtons();
561
+ };
562
+ FsFormDirective.prototype.disable = function () {
563
+ this.ngForm.control.disable();
564
+ this._submitButtons.forEach(function (button) {
565
+ button.disable();
566
+ });
567
+ };
568
+ FsFormDirective.prototype.addSubmitButton = function (submitButton) {
569
+ this._submitButtons.reset(__spread(this._submitButtons.toArray(), [
570
+ submitButton,
571
+ ]));
572
+ };
573
+ FsFormDirective.prototype.removeSubmitButton = function (submitButton) {
574
+ this._submitButtons.reset(__spread(this._submitButtons.toArray()
575
+ .filter(function (submitButton_) { return (submitButton !== submitButton_); })));
576
+ };
577
+ FsFormDirective.prototype._listenSubmit = function () {
578
+ var _this = this;
579
+ this.ngForm
580
+ .ngSubmit
581
+ .pipe(operators.tap(function (event) {
582
+ event === null || event === void 0 ? void 0 : event.preventDefault();
583
+ }), operators.filter(function () {
584
+ return [exports.FormStatus.Valid, exports.FormStatus.Invalid]
585
+ .includes(_this._status$.getValue());
586
+ }), operators.tap(function () { return _this._markControlsAsTouchedAndUpdateValidity(); }), operators.tap(function () { return _this._broadcastSubmittingEvents(); }), operators.switchMap(function () { return _this._waitUntilStatusPending(); }), operators.tap(function () { return _this._setupActiveSubmitButton(); }), operators.mergeMap(function () {
587
+ return _this.ngForm.status === 'INVALID'
588
+ ? _this._formInvalidState$
589
+ : _this._formValidState$;
590
+ }), operators.catchError(function (e, source$) {
591
+ _this._handleError(e);
592
+ return source$;
593
+ }), operators.tap(function (submittedEvent) {
594
+ _this._completeSubmit(true, submittedEvent);
595
+ }), operators.takeUntil(this._destroy$))
596
+ .subscribe(function () { });
597
+ };
598
+ FsFormDirective.prototype._listenWindowClose = function () {
599
+ var _this = this;
600
+ rxjs.fromEvent(window, 'beforeunload')
601
+ .pipe(operators.takeUntil(this._destroy$))
602
+ .subscribe(function (event) {
603
+ if (_this.confirm && _this.confirmBrowser && _this.ngForm.dirty) {
604
+ event.returnValue = false;
605
+ }
606
+ });
607
+ };
608
+ FsFormDirective.prototype._listenHotKeys = function () {
609
+ var _this = this;
610
+ this._ngZone.runOutsideAngular(function () {
611
+ rxjs.fromEvent(document, 'keydown')
612
+ .pipe(operators.takeUntil(_this._destroy$))
613
+ .subscribe(function (event) {
614
+ if (_this._dialogBackdropEscape && event.code === 'Escape') {
615
+ var dialog_1 = document.getElementById(_this._dialogRef.id);
616
+ var paths = event.composedPath();
617
+ if (paths) {
618
+ paths.forEach(function (item) {
619
+ if (dialog_1 === item) {
620
+ _this._ngZone.run(function () {
621
+ _this._formClose();
622
+ });
623
+ }
624
+ });
625
+ }
626
+ }
627
+ if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
628
+ event.preventDefault();
629
+ if (_this.shortcuts) {
630
+ if (_this._elementInForm(document.activeElement)) {
631
+ _this.ngForm.ngSubmit.next();
632
+ }
633
+ }
634
+ }
635
+ });
636
+ });
637
+ };
638
+ FsFormDirective.prototype._formClose = function () {
639
+ var _this = this;
640
+ if (this.confirm && this.confirmDialog) {
641
+ this.triggerConfirm()
642
+ .pipe(operators.filter(function (result) { return confirmResultContinue(result); }), operators.switchMap(function (result) {
643
+ return result === exports.ConfirmResult.Pristine || result === exports.ConfirmResult.Discard
644
+ ? rxjs.of(null)
645
+ : _this.submitted.asObservable();
646
+ }), operators.takeUntil(this._destroy$))
647
+ .subscribe(function (result) {
648
+ _this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
649
+ });
650
+ }
651
+ else {
652
+ this._dialogRef.close(null);
653
+ }
654
+ };
655
+ FsFormDirective.prototype._registerDialogClose = function (directive) {
656
+ var _this = this;
657
+ if (!directive.registered) {
658
+ directive.registered = true;
659
+ directive.clicked$
660
+ .pipe(operators.takeUntil(this._destroy$))
661
+ .subscribe(function () {
662
+ _this._formClose();
663
+ });
664
+ }
665
+ };
666
+ FsFormDirective.prototype._getActiveButton = function () {
667
+ var activeButton = this._submitButtons.find(function (button) {
668
+ return button.active;
669
+ });
670
+ return activeButton ? activeButton : this._submitButtons.first;
671
+ };
672
+ FsFormDirective.prototype._elementInForm = function (el) {
673
+ if (el.isSameNode(this._element.nativeElement)) {
674
+ return true;
675
+ }
676
+ else if (el.parentElement) {
677
+ return this._elementInForm(el.parentElement);
678
+ }
679
+ return false;
680
+ };
681
+ FsFormDirective.prototype._completeSubmit = function (success, submitEvent) {
682
+ var _this = this;
683
+ if (success) {
684
+ this.ngForm.control.markAsPristine();
685
+ this.createSnapshot();
686
+ this.submitted.emit(submitEvent);
687
+ }
688
+ else {
689
+ this._resetButtons();
690
+ }
691
+ if (this._activeSubmitButton) {
692
+ if (success) {
693
+ this._activeSubmitButton.success();
694
+ }
695
+ else {
696
+ this._activeSubmitButton.error();
697
+ }
698
+ }
699
+ this._status$.next(exports.FormStatus.Submitted);
700
+ if (success) {
701
+ this._status$.next(exports.FormStatus.Success);
702
+ }
703
+ else {
704
+ this._status$.next(exports.FormStatus.Error);
705
+ }
706
+ this._status$.next(exports.FormStatus.Completing);
707
+ var resetDelay = success ? this.successDelay : this.errorDelay;
708
+ rxjs.of(true)
709
+ .pipe(operators.delay(resetDelay), operators.first(), operators.takeUntil(this._destroy$)).subscribe(function () {
710
+ if (_this.ngForm.form.status === 'VALID') {
711
+ _this._status$.next(exports.FormStatus.Valid);
712
+ }
713
+ else {
714
+ _this._status$.next(exports.FormStatus.Invalid);
715
+ }
716
+ _this._resetButtons();
717
+ _this._updateDirtySubmitButtons();
718
+ });
719
+ };
720
+ FsFormDirective.prototype._resetButtons = function () {
721
+ this._submitButtons.forEach(function (button) {
722
+ button.reset();
723
+ });
724
+ };
725
+ FsFormDirective.prototype._registerConfirm = function () {
726
+ var _this = this;
727
+ this.ngForm.form.valueChanges
728
+ .pipe(operators.takeUntil(this._destroy$))
729
+ .subscribe(function (changes) {
730
+ if (_this.confirm) {
731
+ var existing_1 = Object.keys(_this._snapshot);
732
+ Object.keys(changes)
733
+ .forEach(function (name) {
734
+ if (existing_1.indexOf(name) === -1) {
735
+ _this._snapshot[name] = changes[name];
736
+ }
737
+ });
738
+ }
739
+ });
740
+ };
741
+ FsFormDirective.prototype._registerDrawerClose = function () {
742
+ var _this = this;
743
+ if (this._drawerRef) {
744
+ this._drawerRef.closeStart$
745
+ .pipe(operators.takeUntil(this._destroy$))
746
+ .subscribe(function (subscriber) {
747
+ if (_this.submitting) {
748
+ _this._status$
749
+ .pipe(operators.filter(function (status) { return status === exports.FormStatus.Success || status === exports.FormStatus.Error; }), operators.takeUntil(_this._destroy$))
750
+ .subscribe(function (status) {
751
+ if (status === exports.FormStatus.Success) {
752
+ subscriber.next();
753
+ subscriber.complete();
754
+ }
755
+ else {
756
+ subscriber.error();
757
+ }
758
+ });
759
+ }
760
+ else {
761
+ subscriber.next();
762
+ subscriber.complete();
763
+ }
764
+ });
765
+ }
766
+ };
767
+ FsFormDirective.prototype._registerConfirmDrawerClose = function () {
768
+ var _this = this;
769
+ if (this._drawerRef) {
770
+ this._drawerRef.closeStart$
771
+ .pipe(operators.switchMap(function (subscriber) {
772
+ return rxjs.iif(function () { return _this.confirm && _this.confirmDrawer; }, _this.triggerConfirm()
773
+ .pipe(operators.map(function (result) { return confirmResultContinue(result); }), operators.tap(function (result) {
774
+ if (result) {
775
+ subscriber.next();
776
+ subscriber.complete();
777
+ }
778
+ })), rxjs.defer(function () {
779
+ subscriber.next();
780
+ subscriber.complete();
781
+ }));
782
+ }), operators.takeUntil(this._destroy$))
783
+ .subscribe();
784
+ }
785
+ };
786
+ FsFormDirective.prototype._registerConfirmTabs = function () {
787
+ var _this = this;
788
+ if (this.tabGroup) {
789
+ this.registerConfirmTabGroup(this.tabGroup);
790
+ }
791
+ this.registerConfirmTabGroups(this._tabGroups.toArray());
792
+ this._tabGroups.changes
793
+ .pipe(operators.takeUntil(this._destroy$))
794
+ .subscribe(function () {
795
+ _this.registerConfirmTabGroups(_this._tabGroups.toArray());
796
+ });
797
+ };
798
+ FsFormDirective.prototype.registerConfirmTabGroups = function (tabGroups) {
799
+ var _this = this;
800
+ tabGroups.forEach(function (tabGroup) {
801
+ _this.registerConfirmTabGroup(tabGroup);
802
+ });
803
+ };
804
+ FsFormDirective.prototype.registerConfirmTabGroup = function (tabGroup) {
805
+ var _this = this;
806
+ var confirmTabGroup = tabGroup;
807
+ if (!confirmTabGroup._originalHandleClick) {
808
+ confirmTabGroup._originalHandleClick = tabGroup._handleClick;
809
+ confirmTabGroup._handlClick$ = new rxjs.Subject();
810
+ confirmTabGroup._handleClick = function (tab, tabHeader, idx) {
811
+ if (confirmTabGroup._handlClick$.observers.length) {
812
+ confirmTabGroup._handlClick$.next({ tab: tab, tabHeader: tabHeader, idx: idx });
813
+ }
814
+ else {
815
+ confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
816
+ }
817
+ };
818
+ }
819
+ confirmTabGroup._handlClick$
820
+ .pipe(operators.takeUntil(this._destroy$))
821
+ .subscribe(function (event) {
822
+ if (!_this.submitting) {
823
+ if (_this.confirm && _this.confirmTabs) {
824
+ _this.triggerConfirm()
825
+ .pipe(operators.takeUntil(_this._destroy$))
826
+ .subscribe(function (result) {
827
+ if (confirmResultContinue(result)) {
828
+ confirmTabGroup.selectedIndex = event.idx;
829
+ }
830
+ });
831
+ }
832
+ else {
833
+ confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
834
+ }
835
+ }
836
+ });
837
+ };
838
+ FsFormDirective.prototype._registerConfirmDialogClose = function () {
839
+ var _this = this;
840
+ if (this._dialogRef) {
841
+ this.formDialogClose.forEach(function (item) {
842
+ _this._registerDialogClose(item);
843
+ });
844
+ this.formDialogClose.changes
845
+ .pipe(operators.takeUntil(this._destroy$))
846
+ .subscribe(function (e) {
847
+ e.forEach(function (item) {
848
+ _this._registerDialogClose(item);
849
+ });
850
+ });
851
+ }
852
+ };
853
+ FsFormDirective.prototype._registerConfirmDialogBackdropEscape = function () {
854
+ var _this = this;
855
+ this._dialogBackdropEscape = this._dialogRef && this._dialogRef.disableClose !== true;
856
+ if (this._dialogRef && !this._dialogRef.disableClose) {
857
+ this._dialogRef.disableClose = true;
858
+ this._dialogRef.backdropClick()
859
+ .pipe(operators.takeUntil(this._destroy$))
860
+ .subscribe(function () {
861
+ _this._formClose();
862
+ });
863
+ this._destroy$
864
+ .subscribe(function () {
865
+ _this._dialogRef.disableClose = false;
866
+ });
867
+ }
868
+ };
869
+ FsFormDirective.prototype._registerAutocomplete = function () {
870
+ var _this = this;
871
+ this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
872
+ this.ngForm.form.registerControl = function (name, control) {
873
+ var el = _this._element.nativeElement.querySelector("input[name='" + name + "']");
874
+ if (el) {
875
+ el.setAttribute('name', name + '_' + common$1.guid());
876
+ if (!el.getAttribute('autocomplete')) {
877
+ el.setAttribute('autocomplete', 'none');
878
+ }
879
+ }
880
+ return _this._registerControl(name, control);
881
+ };
882
+ };
883
+ FsFormDirective.prototype._registerDirtySubmitButton = function () {
884
+ var _this = this;
885
+ if (!this.ngForm) {
886
+ return;
887
+ }
888
+ this.ngForm.form.valueChanges
889
+ .pipe(operators.takeUntil(this._destroy$))
890
+ .subscribe(function () {
891
+ _this._updateDirtySubmitButtons();
892
+ });
893
+ this._submitButtons.changes
894
+ .pipe(operators.takeUntil(this._destroy$))
895
+ .subscribe(function () {
896
+ _this._updateDirtySubmitButtons();
897
+ });
898
+ };
899
+ FsFormDirective.prototype._updateDirtySubmitButtons = function () {
900
+ var _this = this;
901
+ this._submitButtons
902
+ .forEach(function (submitButton) {
903
+ if (!_this.confirm || !_this.dirtySubmitButton || _this.ngForm.dirty || !submitButton.dirtySubmit) {
904
+ submitButton.enable();
905
+ }
906
+ else {
907
+ submitButton.disable();
908
+ }
909
+ });
910
+ };
911
+ FsFormDirective.prototype._broadcastSubmittingEvents = function () {
912
+ this._status$.next(exports.FormStatus.Submitting);
913
+ this._form.broadcast('submit', this.ngForm);
914
+ };
915
+ FsFormDirective.prototype._markControlsAsTouchedAndUpdateValidity = function () {
916
+ Object.values(this.ngForm.controls)
917
+ .forEach(function (control) {
918
+ control.markAsDirty();
919
+ control.markAsTouched();
920
+ control.updateValueAndValidity();
921
+ });
922
+ };
923
+ FsFormDirective.prototype._setupActiveSubmitButton = function () {
924
+ this._activeSubmitButton = this._getActiveButton();
925
+ this._resetButtons();
926
+ if (this._activeSubmitButton) {
927
+ this._activeSubmitButton.process();
928
+ }
929
+ };
930
+ FsFormDirective.prototype._waitUntilStatusPending = function () {
931
+ return this.ngForm.statusChanges
932
+ .pipe(operators.startWith(this.ngForm.status), operators.first(function (state) { return state !== 'PENDING'; }));
933
+ };
934
+ FsFormDirective.prototype._handleError = function (e) {
935
+ console.log('%c Form Submit ', 'color: white; background-color: #D33F49', 'Error occured');
936
+ console.group('Error Details:');
937
+ console.log('Message: ', e);
938
+ console.log('FormRef: ', this);
939
+ if (this.ngForm.invalid) {
940
+ var errors = getFormErrors(this.ngForm.control, null);
941
+ console.log('Validation Errors: ', errors);
942
+ }
943
+ console.groupEnd();
944
+ this._completeSubmit(false, null);
945
+ };
946
+ FsFormDirective.ctorParameters = function () { return [
947
+ { type: forms.NgForm, decorators: [{ type: core.Inject, args: [forms.NgForm,] }] },
948
+ { type: FsForm },
949
+ { type: core.ElementRef },
950
+ { type: message.FsMessage },
951
+ { type: prompt.FsPrompt },
952
+ { type: core.NgZone },
953
+ { type: dialog.MatDialogRef, decorators: [{ type: core.Optional }, { type: core.Inject, args: [dialog.MatDialogRef,] }] },
954
+ { type: drawer.DrawerRef, decorators: [{ type: core.Optional }, { type: core.Inject, args: [drawer.DrawerRef,] }] }
955
+ ]; };
956
+ __decorate([
957
+ core.Input(),
958
+ __metadata("design:type", Object)
959
+ ], FsFormDirective.prototype, "wrapperSelector", void 0);
960
+ __decorate([
961
+ core.Input(),
962
+ __metadata("design:type", Object)
963
+ ], FsFormDirective.prototype, "messageSelector", void 0);
964
+ __decorate([
965
+ core.Input(),
966
+ __metadata("design:type", Object)
967
+ ], FsFormDirective.prototype, "hintSelector", void 0);
968
+ __decorate([
969
+ core.Input(),
970
+ __metadata("design:type", Object)
971
+ ], FsFormDirective.prototype, "labelSelector", void 0);
972
+ __decorate([
973
+ core.Input(),
974
+ __metadata("design:type", Object)
975
+ ], FsFormDirective.prototype, "autocomplete", void 0);
976
+ __decorate([
977
+ core.Input(),
978
+ __metadata("design:type", Object)
979
+ ], FsFormDirective.prototype, "shortcuts", void 0);
980
+ __decorate([
981
+ core.Input(),
982
+ __metadata("design:type", Object)
983
+ ], FsFormDirective.prototype, "confirm", void 0);
984
+ __decorate([
985
+ core.Input(),
986
+ __metadata("design:type", Object)
987
+ ], FsFormDirective.prototype, "confirmDialog", void 0);
988
+ __decorate([
989
+ core.Input(),
990
+ __metadata("design:type", Object)
991
+ ], FsFormDirective.prototype, "confirmDrawer", void 0);
992
+ __decorate([
993
+ core.Input(),
994
+ __metadata("design:type", Object)
995
+ ], FsFormDirective.prototype, "confirmBrowser", void 0);
996
+ __decorate([
997
+ core.Input(),
998
+ __metadata("design:type", Object)
999
+ ], FsFormDirective.prototype, "confirmTabs", void 0);
1000
+ __decorate([
1001
+ core.Input(),
1002
+ __metadata("design:type", Object)
1003
+ ], FsFormDirective.prototype, "dirtySubmitButton", void 0);
1004
+ __decorate([
1005
+ core.Input(),
1006
+ __metadata("design:type", Function)
1007
+ ], FsFormDirective.prototype, "submit", void 0);
1008
+ __decorate([
1009
+ core.Input(),
1010
+ __metadata("design:type", Object)
1011
+ ], FsFormDirective.prototype, "successDelay", void 0);
1012
+ __decorate([
1013
+ core.Input(),
1014
+ __metadata("design:type", Object)
1015
+ ], FsFormDirective.prototype, "errorDelay", void 0);
1016
+ __decorate([
1017
+ core.Input(),
1018
+ __metadata("design:type", tabs.MatTabGroup)
1019
+ ], FsFormDirective.prototype, "tabGroup", void 0);
1020
+ __decorate([
1021
+ core.Output('fsForm'),
1022
+ __metadata("design:type", core.EventEmitter)
1023
+ ], FsFormDirective.prototype, "submitEvent", void 0);
1024
+ __decorate([
1025
+ core.Output(),
1026
+ __metadata("design:type", core.EventEmitter)
1027
+ ], FsFormDirective.prototype, "invalid", void 0);
1028
+ __decorate([
1029
+ core.Output(),
1030
+ __metadata("design:type", core.EventEmitter)
1031
+ ], FsFormDirective.prototype, "valid", void 0);
1032
+ __decorate([
1033
+ core.Output(),
1034
+ __metadata("design:type", core.EventEmitter)
1035
+ ], FsFormDirective.prototype, "submitted", void 0);
1036
+ __decorate([
1037
+ core.Output(),
1038
+ __metadata("design:type", core.EventEmitter)
1039
+ ], FsFormDirective.prototype, "reseted", void 0);
1040
+ __decorate([
1041
+ core.Output(),
1042
+ __metadata("design:type", core.EventEmitter)
1043
+ ], FsFormDirective.prototype, "cleared", void 0);
1044
+ __decorate([
1045
+ core.HostBinding('class.fs-form'),
1046
+ __metadata("design:type", Object)
1047
+ ], FsFormDirective.prototype, "fsformClass", void 0);
1048
+ __decorate([
1049
+ core.ContentChildren(FsFormDialogCloseDirective, { descendants: true }),
1050
+ __metadata("design:type", core.QueryList)
1051
+ ], FsFormDirective.prototype, "formDialogClose", void 0);
1052
+ __decorate([
1053
+ core.ContentChildren(tabs.MatTabGroup, { descendants: true }),
1054
+ __metadata("design:type", core.QueryList)
1055
+ ], FsFormDirective.prototype, "_tabGroups", void 0);
1056
+ FsFormDirective = __decorate([
1057
+ core.Directive({
1058
+ selector: '[fsForm]',
1059
+ }),
1060
+ __param(0, core.Inject(forms.NgForm)),
1061
+ __param(6, core.Optional()), __param(6, core.Inject(dialog.MatDialogRef)),
1062
+ __param(7, core.Optional()), __param(7, core.Inject(drawer.DrawerRef)),
1063
+ __metadata("design:paramtypes", [forms.NgForm,
1064
+ FsForm,
1065
+ core.ElementRef,
1066
+ message.FsMessage,
1067
+ prompt.FsPrompt,
1068
+ core.NgZone,
1069
+ dialog.MatDialogRef,
1070
+ drawer.DrawerRef])
1071
+ ], FsFormDirective);
1072
+ return FsFormDirective;
1064
1073
  }());
1065
1074
 
1066
- var ERROR_MESSAGES = {
1067
- required: 'This field is required',
1068
- email: 'This is not a valid email address',
1069
- emails: 'Input valid email addresses, comma separated',
1070
- phone: 'Invalid phone number',
1071
- numeric: 'Value should be numeric',
1072
- integer: 'Value should be an integer',
1073
- min: 'Value should not be less than $(1)',
1074
- max: 'Value should not be greater than $(1)',
1075
- minlength: 'Should not be shorter than $(1) characters',
1076
- maxlength: 'Should not be longer than $(1) characters',
1077
- compare: 'Inputs do not match',
1078
- pattern: 'Value should match pattern $(1)',
1079
- dateRange: 'Invalid date range',
1080
- url: 'This is not a valid url',
1081
- urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
1082
- greater: 'Value must be greater than $(1)',
1083
- lesser: 'Value must be less than $(1)',
1075
+ var ERROR_MESSAGES = {
1076
+ required: 'This field is required',
1077
+ email: 'This is not a valid email address',
1078
+ emails: 'Input valid email addresses, comma separated',
1079
+ phone: 'Invalid phone number',
1080
+ numeric: 'Value should be numeric',
1081
+ integer: 'Value should be an integer',
1082
+ min: 'Value should not be less than $(1)',
1083
+ max: 'Value should not be greater than $(1)',
1084
+ minlength: 'Should not be shorter than $(1) characters',
1085
+ maxlength: 'Should not be longer than $(1) characters',
1086
+ compare: 'Inputs do not match',
1087
+ pattern: 'Value should match pattern $(1)',
1088
+ dateRange: 'Invalid date range',
1089
+ url: 'This is not a valid url',
1090
+ urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
1091
+ greater: 'Value must be greater than $(1)',
1092
+ lesser: 'Value must be less than $(1)',
1084
1093
  };
1085
1094
 
1086
- var VALIDATE_MESSAGES = new core.InjectionToken('fs.form.validate-messages');
1087
- var VALIDATE_MESSAGE_PROVIDER = {
1088
- provide: VALIDATE_MESSAGES,
1089
- useFactory: messageProviderFactory,
1090
- };
1091
- function messageProviderFactory() {
1092
- return __assign({}, ERROR_MESSAGES);
1095
+ var VALIDATE_MESSAGES = new core.InjectionToken('fs.form.validate-messages');
1096
+ var VALIDATE_MESSAGE_PROVIDER = {
1097
+ provide: VALIDATE_MESSAGES,
1098
+ useFactory: messageProviderFactory,
1099
+ };
1100
+ function messageProviderFactory() {
1101
+ return __assign({}, ERROR_MESSAGES);
1093
1102
  }
1094
1103
 
1095
- var FsControlDirective = /** @class */ (function () {
1096
- function FsControlDirective(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
1097
- this.elementRef = elementRef;
1098
- this.renderer2 = renderer2;
1099
- this.injector = injector;
1100
- this._validateMessages = _validateMessages;
1101
- this.ngControl = ngControl;
1102
- this.formDirective = formDirective;
1103
- this.appendMessageClass = 'fs-form-message';
1104
- this.appendLabelClass = 'fs-form-label';
1105
- this.appendErrorClass = 'fs-form-error';
1106
- this.appendHintClass = 'fs-form-hint';
1107
- this.errors = [];
1108
- // protected _validateMessages = { ...ERROR_MESSAGES };
1109
- this._destroy$ = new rxjs.Subject();
1110
- if (ngControl) {
1111
- this._control = ngControl.control;
1112
- }
1113
- else {
1114
- console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
1115
- }
1116
- }
1117
- Object.defineProperty(FsControlDirective.prototype, "validateMessages", {
1118
- set: function (messages) {
1119
- this._validateMessages = __assign(__assign({}, this._validateMessages), messages);
1120
- },
1121
- enumerable: true,
1122
- configurable: true
1123
- });
1124
- FsControlDirective.prototype.ngOnInit = function () {
1125
- this._setupValidators();
1126
- };
1127
- FsControlDirective.prototype.ngOnDestroy = function () {
1128
- this._destroy$.next();
1129
- this._destroy$.complete();
1130
- };
1131
- FsControlDirective.prototype.ngAfterContentInit = function () {
1132
- if (this._control) {
1133
- /*
1134
- Ensure that statusChanges has one subscription per control. Multiple can happen
1135
- when multiple fsForm validation directives are applied to the same element
1136
- */
1137
- if (!this._control.statusChangesSubscribe) {
1138
- this._control.statusChanges
1139
- .pipe(operators.takeUntil(this._destroy$))
1140
- .subscribe(this.render.bind(this));
1141
- this._control.statusChangesSubscribe = true;
1142
- }
1143
- }
1144
- };
1145
- FsControlDirective.prototype.getMessageSelector = function () {
1146
- if (this.messageSelector === false) {
1147
- return '';
1148
- }
1149
- if (this.messageSelector) {
1150
- return this.messageSelector;
1151
- }
1152
- else if (this.formDirective && this.formDirective.messageSelector) {
1153
- return this.formDirective.messageSelector;
1154
- }
1155
- };
1156
- FsControlDirective.prototype.getHintWrapperSelector = function () {
1157
- if (this.hintSelector === false) {
1158
- return '';
1159
- }
1160
- if (this.hintSelector) {
1161
- return this.hintSelector;
1162
- }
1163
- else if (this.formDirective && this.formDirective.hintSelector) {
1164
- return this.formDirective.hintSelector;
1165
- }
1166
- };
1167
- FsControlDirective.prototype.getWrapperSelector = function () {
1168
- if (this.wrapperSelector === false) {
1169
- return '';
1170
- }
1171
- if (this.wrapperSelector) {
1172
- return this.wrapperSelector;
1173
- }
1174
- else if (this.formDirective && this.formDirective.wrapperSelector) {
1175
- return this.formDirective.wrapperSelector;
1176
- }
1177
- };
1178
- FsControlDirective.prototype.getlabelSelector = function () {
1179
- if (this.labelSelector === false) {
1180
- return '';
1181
- }
1182
- if (this.labelSelector) {
1183
- return this.labelSelector;
1184
- }
1185
- else if (this.formDirective && this.formDirective.labelSelector) {
1186
- return this.formDirective.labelSelector;
1187
- }
1188
- };
1189
- FsControlDirective.prototype.getWrapperElement = function () {
1190
- var wrapper = this.getWrapper(this.elementRef.nativeElement);
1191
- if (wrapper) {
1192
- return wrapper;
1193
- }
1194
- return this.elementRef.nativeElement;
1195
- };
1196
- /*
1197
- <mat-form-field class="mat-form-field"> <-- Field Wrapper Class. Look for parents from the native element with the matching wrapperSelector. If not found defaults to native element.
1198
- <input>
1199
- <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1200
- <div class="fs-form-message"></div>
1201
- <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1202
- </div>
1203
- </mat-form-field>
1204
- */
1205
- FsControlDirective.prototype.render = function () {
1206
- var _a;
1207
- if (this.ngControl) {
1208
- var renderer = this.renderer2;
1209
- var wrapper = this.getWrapperElement();
1210
- var error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1211
- if (!this.getMessageSelector()) {
1212
- return;
1213
- }
1214
- var messageWrapper = wrapper.querySelector(this.getMessageSelector());
1215
- if (!messageWrapper) {
1216
- return console.warn('Failed to locate ' + this.getMessageSelector(), this.elementRef.nativeElement);
1217
- }
1218
- if (this.getlabelSelector()) {
1219
- var labelWrapper = wrapper.querySelector(this.getlabelSelector());
1220
- if (labelWrapper) {
1221
- if (this.appendLabelClass) {
1222
- this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1223
- }
1224
- }
1225
- }
1226
- if (this.appendMessageClass) {
1227
- renderer.addClass(messageWrapper, this.appendMessageClass);
1228
- }
1229
- if (this.getHintWrapperSelector()) {
1230
- var hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1231
- if (hint) {
1232
- renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1233
- if (this.appendHintClass) {
1234
- renderer.addClass(hint, this.appendHintClass);
1235
- }
1236
- }
1237
- }
1238
- var errorWrapper = wrapper.querySelector('.fs-form-error-target');
1239
- if (errorWrapper) {
1240
- errorWrapper.remove();
1241
- }
1242
- wrapper.classList.remove('ng-invalid');
1243
- var shouldErrorBeRendered = this.ngControl.invalid
1244
- && (this.ngControl.dirty || ((_a = this.formDirective.ngForm) === null || _a === void 0 ? void 0 : _a.submitted));
1245
- if (!shouldErrorBeRendered || !error) {
1246
- return;
1247
- }
1248
- wrapper.classList.add('ng-invalid');
1249
- errorWrapper = renderer.createElement('div');
1250
- renderer.addClass(errorWrapper, 'fs-form-error-target');
1251
- renderer.addClass(errorWrapper, this.appendErrorClass);
1252
- renderer.addClass(errorWrapper, this.appendErrorClass + '-' + error.name);
1253
- var errorText = renderer.createText(error.message);
1254
- renderer.appendChild(errorWrapper, errorText);
1255
- messageWrapper.appendChild(errorWrapper);
1256
- }
1257
- };
1258
- FsControlDirective.prototype.getWrapper = function (node, count) {
1259
- if (count === void 0) { count = 0; }
1260
- if (!node || count > 10) {
1261
- return null;
1262
- }
1263
- if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1264
- return node;
1265
- }
1266
- return this.getWrapper(node.parentNode, ++count);
1267
- };
1268
- FsControlDirective.prototype.parseErrorMessage = function (message, args) {
1269
- lodashEs.values(args)
1270
- .forEach(function (name) {
1271
- message = message.replace(/\$\(\d\)/, name);
1272
- });
1273
- return message;
1274
- };
1275
- FsControlDirective.prototype.getError = function (controlRef) {
1276
- var name = lodashEs.keys(controlRef.control.errors)[0];
1277
- if (!name) {
1278
- return null;
1279
- }
1280
- var message = controlRef.control.errors[name];
1281
- if (this._validateMessages[name]) {
1282
- message = this.parseErrorMessage(this._validateMessages[name], message);
1283
- }
1284
- return { name: name, message: message };
1285
- };
1286
- FsControlDirective.prototype._setupValidators = function () {
1287
- var control = this._control;
1288
- if (this.validate) {
1289
- var validators = control.validator
1290
- ? [control.validator, this.validate.bind(this)]
1291
- : this.validate.bind(this);
1292
- control.setValidators(validators);
1293
- }
1294
- if (this.validateAsync) {
1295
- var asyncValidators = control.asyncValidator
1296
- ? [control.asyncValidator, this.validateAsync.bind(this)]
1297
- : this.validateAsync.bind(this);
1298
- control.setAsyncValidators(asyncValidators);
1299
- }
1300
- control.updateValueAndValidity();
1301
- };
1302
- FsControlDirective.ctorParameters = function () { return [
1303
- { type: core.ElementRef },
1304
- { type: core.Renderer2 },
1305
- { type: core.Injector },
1306
- { type: undefined, decorators: [{ type: core.Self }, { type: core.Inject, args: [VALIDATE_MESSAGES,] }] },
1307
- { type: forms.NgControl, decorators: [{ type: core.Optional }] },
1308
- { type: FsFormDirective, decorators: [{ type: core.Optional }, { type: core.Inject, args: [FsFormDirective,] }] }
1309
- ]; };
1310
- __decorate([
1311
- core.Input(),
1312
- __metadata("design:type", Object)
1313
- ], FsControlDirective.prototype, "wrapperSelector", void 0);
1314
- __decorate([
1315
- core.Input(),
1316
- __metadata("design:type", Object)
1317
- ], FsControlDirective.prototype, "messageSelector", void 0);
1318
- __decorate([
1319
- core.Input(),
1320
- __metadata("design:type", Object)
1321
- ], FsControlDirective.prototype, "hintSelector", void 0);
1322
- __decorate([
1323
- core.Input(),
1324
- __metadata("design:type", Object)
1325
- ], FsControlDirective.prototype, "labelSelector", void 0);
1326
- __decorate([
1327
- core.Input(),
1328
- __metadata("design:type", Object)
1329
- ], FsControlDirective.prototype, "appendMessageClass", void 0);
1330
- __decorate([
1331
- core.Input(),
1332
- __metadata("design:type", Object)
1333
- ], FsControlDirective.prototype, "appendLabelClass", void 0);
1334
- __decorate([
1335
- core.Input(),
1336
- __metadata("design:type", Object)
1337
- ], FsControlDirective.prototype, "appendErrorClass", void 0);
1338
- __decorate([
1339
- core.Input(),
1340
- __metadata("design:type", Object)
1341
- ], FsControlDirective.prototype, "appendHintClass", void 0);
1342
- __decorate([
1343
- core.Input(),
1344
- __metadata("design:type", Object),
1345
- __metadata("design:paramtypes", [Object])
1346
- ], FsControlDirective.prototype, "validateMessages", null);
1347
- FsControlDirective = __decorate([
1348
- core.Directive({
1349
- selector: '[fsFormControl]',
1350
- providers: [
1351
- VALIDATE_MESSAGE_PROVIDER
1352
- ],
1353
- }),
1354
- __param(3, core.Self()), __param(3, core.Inject(VALIDATE_MESSAGES)),
1355
- __param(4, core.Optional()),
1356
- __param(5, core.Optional()), __param(5, core.Inject(FsFormDirective)),
1357
- __metadata("design:paramtypes", [core.ElementRef,
1358
- core.Renderer2,
1359
- core.Injector, Object, forms.NgControl,
1360
- FsFormDirective])
1361
- ], FsControlDirective);
1362
- return FsControlDirective;
1104
+ var FsControlDirective = /** @class */ (function () {
1105
+ function FsControlDirective(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
1106
+ this.elementRef = elementRef;
1107
+ this.renderer2 = renderer2;
1108
+ this.injector = injector;
1109
+ this._validateMessages = _validateMessages;
1110
+ this.ngControl = ngControl;
1111
+ this.formDirective = formDirective;
1112
+ this.appendMessageClass = 'fs-form-message';
1113
+ this.appendLabelClass = 'fs-form-label';
1114
+ this.appendErrorClass = 'fs-form-error';
1115
+ this.appendHintClass = 'fs-form-hint';
1116
+ this.errors = [];
1117
+ // protected _validateMessages = { ...ERROR_MESSAGES };
1118
+ this._destroy$ = new rxjs.Subject();
1119
+ if (ngControl) {
1120
+ this._control = ngControl.control;
1121
+ }
1122
+ else {
1123
+ console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
1124
+ }
1125
+ }
1126
+ Object.defineProperty(FsControlDirective.prototype, "validateMessages", {
1127
+ set: function (messages) {
1128
+ this._validateMessages = __assign(__assign({}, this._validateMessages), messages);
1129
+ },
1130
+ enumerable: true,
1131
+ configurable: true
1132
+ });
1133
+ FsControlDirective.prototype.ngOnInit = function () {
1134
+ this._setupValidators();
1135
+ };
1136
+ FsControlDirective.prototype.ngOnDestroy = function () {
1137
+ this._destroy$.next();
1138
+ this._destroy$.complete();
1139
+ };
1140
+ FsControlDirective.prototype.ngAfterContentInit = function () {
1141
+ if (this._control) {
1142
+ /*
1143
+ Ensure that statusChanges has one subscription per control. Multiple can happen
1144
+ when multiple fsForm validation directives are applied to the same element
1145
+ */
1146
+ if (!this._control.statusChangesSubscribe) {
1147
+ this._control.statusChanges
1148
+ .pipe(operators.takeUntil(this._destroy$))
1149
+ .subscribe(this.render.bind(this));
1150
+ this._control.statusChangesSubscribe = true;
1151
+ }
1152
+ }
1153
+ };
1154
+ FsControlDirective.prototype.getMessageSelector = function () {
1155
+ if (this.messageSelector === false) {
1156
+ return '';
1157
+ }
1158
+ if (this.messageSelector) {
1159
+ return this.messageSelector;
1160
+ }
1161
+ else if (this.formDirective && this.formDirective.messageSelector) {
1162
+ return this.formDirective.messageSelector;
1163
+ }
1164
+ };
1165
+ FsControlDirective.prototype.getHintWrapperSelector = function () {
1166
+ if (this.hintSelector === false) {
1167
+ return '';
1168
+ }
1169
+ if (this.hintSelector) {
1170
+ return this.hintSelector;
1171
+ }
1172
+ else if (this.formDirective && this.formDirective.hintSelector) {
1173
+ return this.formDirective.hintSelector;
1174
+ }
1175
+ };
1176
+ FsControlDirective.prototype.getWrapperSelector = function () {
1177
+ if (this.wrapperSelector === false) {
1178
+ return '';
1179
+ }
1180
+ if (this.wrapperSelector) {
1181
+ return this.wrapperSelector;
1182
+ }
1183
+ else if (this.formDirective && this.formDirective.wrapperSelector) {
1184
+ return this.formDirective.wrapperSelector;
1185
+ }
1186
+ };
1187
+ FsControlDirective.prototype.getlabelSelector = function () {
1188
+ if (this.labelSelector === false) {
1189
+ return '';
1190
+ }
1191
+ if (this.labelSelector) {
1192
+ return this.labelSelector;
1193
+ }
1194
+ else if (this.formDirective && this.formDirective.labelSelector) {
1195
+ return this.formDirective.labelSelector;
1196
+ }
1197
+ };
1198
+ FsControlDirective.prototype.getWrapperElement = function () {
1199
+ var wrapper = this.getWrapper(this.elementRef.nativeElement);
1200
+ if (wrapper) {
1201
+ return wrapper;
1202
+ }
1203
+ return this.elementRef.nativeElement;
1204
+ };
1205
+ /*
1206
+ <mat-form-field class="mat-form-field"> <-- Field Wrapper Class. Look for parents from the native element with the matching wrapperSelector. If not found defaults to native element.
1207
+ <input>
1208
+ <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1209
+ <div class="fs-form-message"></div>
1210
+ <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1211
+ </div>
1212
+ </mat-form-field>
1213
+ */
1214
+ FsControlDirective.prototype.render = function () {
1215
+ var _a;
1216
+ if (this.ngControl) {
1217
+ var renderer = this.renderer2;
1218
+ var wrapper = this.getWrapperElement();
1219
+ var error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1220
+ if (!this.getMessageSelector()) {
1221
+ return;
1222
+ }
1223
+ var messageWrapper = wrapper.querySelector(this.getMessageSelector());
1224
+ if (!messageWrapper) {
1225
+ return console.warn('Failed to locate ' + this.getMessageSelector(), this.elementRef.nativeElement);
1226
+ }
1227
+ if (this.getlabelSelector()) {
1228
+ var labelWrapper = wrapper.querySelector(this.getlabelSelector());
1229
+ if (labelWrapper) {
1230
+ if (this.appendLabelClass) {
1231
+ this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1232
+ }
1233
+ }
1234
+ }
1235
+ if (this.appendMessageClass) {
1236
+ renderer.addClass(messageWrapper, this.appendMessageClass);
1237
+ }
1238
+ if (this.getHintWrapperSelector()) {
1239
+ var hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1240
+ if (hint) {
1241
+ renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1242
+ if (this.appendHintClass) {
1243
+ renderer.addClass(hint, this.appendHintClass);
1244
+ }
1245
+ }
1246
+ }
1247
+ var errorWrapper = wrapper.querySelector('.fs-form-error-target');
1248
+ if (errorWrapper) {
1249
+ errorWrapper.remove();
1250
+ }
1251
+ wrapper.classList.remove('ng-invalid');
1252
+ var shouldErrorBeRendered = this.ngControl.invalid
1253
+ && (this.ngControl.dirty || ((_a = this.formDirective.ngForm) === null || _a === void 0 ? void 0 : _a.submitted));
1254
+ if (!shouldErrorBeRendered || !error) {
1255
+ return;
1256
+ }
1257
+ wrapper.classList.add('ng-invalid');
1258
+ errorWrapper = renderer.createElement('div');
1259
+ renderer.addClass(errorWrapper, 'fs-form-error-target');
1260
+ renderer.addClass(errorWrapper, this.appendErrorClass);
1261
+ renderer.addClass(errorWrapper, this.appendErrorClass + '-' + error.name);
1262
+ var errorText = renderer.createText(error.message);
1263
+ renderer.appendChild(errorWrapper, errorText);
1264
+ messageWrapper.appendChild(errorWrapper);
1265
+ }
1266
+ };
1267
+ FsControlDirective.prototype.getWrapper = function (node, count) {
1268
+ if (count === void 0) { count = 0; }
1269
+ if (!node || count > 10) {
1270
+ return null;
1271
+ }
1272
+ if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1273
+ return node;
1274
+ }
1275
+ return this.getWrapper(node.parentNode, ++count);
1276
+ };
1277
+ FsControlDirective.prototype.parseErrorMessage = function (message, args) {
1278
+ lodashEs.values(args)
1279
+ .forEach(function (name) {
1280
+ message = message.replace(/\$\(\d\)/, name);
1281
+ });
1282
+ return message;
1283
+ };
1284
+ FsControlDirective.prototype.getError = function (controlRef) {
1285
+ var name = lodashEs.keys(controlRef.control.errors)[0];
1286
+ if (!name) {
1287
+ return null;
1288
+ }
1289
+ var message = controlRef.control.errors[name];
1290
+ if (this._validateMessages[name]) {
1291
+ message = this.parseErrorMessage(this._validateMessages[name], message);
1292
+ }
1293
+ return { name: name, message: message };
1294
+ };
1295
+ FsControlDirective.prototype._setupValidators = function () {
1296
+ var control = this._control;
1297
+ if (this.validate) {
1298
+ var validators = control.validator
1299
+ ? [control.validator, this.validate.bind(this)]
1300
+ : this.validate.bind(this);
1301
+ control.setValidators(validators);
1302
+ }
1303
+ if (this.validateAsync) {
1304
+ var asyncValidators = control.asyncValidator
1305
+ ? [control.asyncValidator, this.validateAsync.bind(this)]
1306
+ : this.validateAsync.bind(this);
1307
+ control.setAsyncValidators(asyncValidators);
1308
+ }
1309
+ control.updateValueAndValidity();
1310
+ };
1311
+ FsControlDirective.ctorParameters = function () { return [
1312
+ { type: core.ElementRef },
1313
+ { type: core.Renderer2 },
1314
+ { type: core.Injector },
1315
+ { type: undefined, decorators: [{ type: core.Self }, { type: core.Inject, args: [VALIDATE_MESSAGES,] }] },
1316
+ { type: forms.NgControl, decorators: [{ type: core.Optional }] },
1317
+ { type: FsFormDirective, decorators: [{ type: core.Optional }, { type: core.Inject, args: [FsFormDirective,] }] }
1318
+ ]; };
1319
+ __decorate([
1320
+ core.Input(),
1321
+ __metadata("design:type", Object)
1322
+ ], FsControlDirective.prototype, "wrapperSelector", void 0);
1323
+ __decorate([
1324
+ core.Input(),
1325
+ __metadata("design:type", Object)
1326
+ ], FsControlDirective.prototype, "messageSelector", void 0);
1327
+ __decorate([
1328
+ core.Input(),
1329
+ __metadata("design:type", Object)
1330
+ ], FsControlDirective.prototype, "hintSelector", void 0);
1331
+ __decorate([
1332
+ core.Input(),
1333
+ __metadata("design:type", Object)
1334
+ ], FsControlDirective.prototype, "labelSelector", void 0);
1335
+ __decorate([
1336
+ core.Input(),
1337
+ __metadata("design:type", Object)
1338
+ ], FsControlDirective.prototype, "appendMessageClass", void 0);
1339
+ __decorate([
1340
+ core.Input(),
1341
+ __metadata("design:type", Object)
1342
+ ], FsControlDirective.prototype, "appendLabelClass", void 0);
1343
+ __decorate([
1344
+ core.Input(),
1345
+ __metadata("design:type", Object)
1346
+ ], FsControlDirective.prototype, "appendErrorClass", void 0);
1347
+ __decorate([
1348
+ core.Input(),
1349
+ __metadata("design:type", Object)
1350
+ ], FsControlDirective.prototype, "appendHintClass", void 0);
1351
+ __decorate([
1352
+ core.Input(),
1353
+ __metadata("design:type", Object),
1354
+ __metadata("design:paramtypes", [Object])
1355
+ ], FsControlDirective.prototype, "validateMessages", null);
1356
+ FsControlDirective = __decorate([
1357
+ core.Directive({
1358
+ selector: '[fsFormControl]',
1359
+ providers: [
1360
+ VALIDATE_MESSAGE_PROVIDER
1361
+ ],
1362
+ }),
1363
+ __param(3, core.Self()), __param(3, core.Inject(VALIDATE_MESSAGES)),
1364
+ __param(4, core.Optional()),
1365
+ __param(5, core.Optional()), __param(5, core.Inject(FsFormDirective)),
1366
+ __metadata("design:paramtypes", [core.ElementRef,
1367
+ core.Renderer2,
1368
+ core.Injector, Object, forms.NgControl,
1369
+ FsFormDirective])
1370
+ ], FsControlDirective);
1371
+ return FsControlDirective;
1363
1372
  }());
1364
1373
 
1365
- function isEnabled(value) {
1366
- return value !== 'false' && (value || value === '');
1374
+ function isEnabled(value) {
1375
+ return value !== 'false' && (value || value === '');
1367
1376
  }
1368
1377
 
1369
- var FsFormRequiredDirective = /** @class */ (function (_super) {
1370
- __extends(FsFormRequiredDirective, _super);
1371
- function FsFormRequiredDirective() {
1372
- var _this = _super !== null && _super.apply(this, arguments) || this;
1373
- _this.required = false;
1374
- return _this;
1375
- }
1376
- Object.defineProperty(FsFormRequiredDirective.prototype, "setFsFormRequired", {
1377
- set: function (value) {
1378
- this.required = isEnabled(value);
1379
- },
1380
- enumerable: true,
1381
- configurable: true
1382
- });
1383
- Object.defineProperty(FsFormRequiredDirective.prototype, "setRequired", {
1384
- set: function (value) {
1385
- this.required = isEnabled(value);
1386
- },
1387
- enumerable: true,
1388
- configurable: true
1389
- });
1390
- Object.defineProperty(FsFormRequiredDirective.prototype, "validationMessage", {
1391
- set: function (value) {
1392
- this._validateMessages.required = value;
1393
- },
1394
- enumerable: true,
1395
- configurable: true
1396
- });
1397
- FsFormRequiredDirective.prototype.ngOnChanges = function () {
1398
- this._control.updateValueAndValidity();
1399
- };
1400
- FsFormRequiredDirective.prototype.validate = function (control) {
1401
- if (this.required) {
1402
- return forms.Validators.required(this._control);
1403
- }
1404
- else {
1405
- return null;
1406
- }
1407
- };
1408
- FsFormRequiredDirective.prototype.render = function () {
1409
- var wrapper = this.getWrapperElement();
1410
- if (wrapper && this.getlabelSelector()) {
1411
- var labelWrapper = wrapper.querySelector(this.getlabelSelector());
1412
- // Adding class fs-form-label-requried adds the * to the label
1413
- if (labelWrapper) {
1414
- if (this.required) {
1415
- this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
1416
- }
1417
- else {
1418
- this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
1419
- }
1420
- }
1421
- }
1422
- _super.prototype.render.call(this);
1423
- };
1424
- __decorate([
1425
- core.Input('fsFormRequired'),
1426
- __metadata("design:type", Object),
1427
- __metadata("design:paramtypes", [Object])
1428
- ], FsFormRequiredDirective.prototype, "setFsFormRequired", null);
1429
- __decorate([
1430
- core.Input('required'),
1431
- __metadata("design:type", Object),
1432
- __metadata("design:paramtypes", [Object])
1433
- ], FsFormRequiredDirective.prototype, "setRequired", null);
1434
- __decorate([
1435
- core.Input('fsFormRequiredMessage'),
1436
- __metadata("design:type", String),
1437
- __metadata("design:paramtypes", [String])
1438
- ], FsFormRequiredDirective.prototype, "validationMessage", null);
1439
- FsFormRequiredDirective = __decorate([
1440
- core.Directive({
1441
- selector: '[fsFormRequired],[ngModel][required]',
1442
- providers: [
1443
- VALIDATE_MESSAGE_PROVIDER
1444
- ],
1445
- })
1446
- ], FsFormRequiredDirective);
1447
- return FsFormRequiredDirective;
1378
+ var FsFormRequiredDirective = /** @class */ (function (_super) {
1379
+ __extends(FsFormRequiredDirective, _super);
1380
+ function FsFormRequiredDirective() {
1381
+ var _this = _super !== null && _super.apply(this, arguments) || this;
1382
+ _this.required = false;
1383
+ return _this;
1384
+ }
1385
+ Object.defineProperty(FsFormRequiredDirective.prototype, "setFsFormRequired", {
1386
+ set: function (value) {
1387
+ this.required = isEnabled(value);
1388
+ },
1389
+ enumerable: true,
1390
+ configurable: true
1391
+ });
1392
+ Object.defineProperty(FsFormRequiredDirective.prototype, "setRequired", {
1393
+ set: function (value) {
1394
+ this.required = isEnabled(value);
1395
+ },
1396
+ enumerable: true,
1397
+ configurable: true
1398
+ });
1399
+ Object.defineProperty(FsFormRequiredDirective.prototype, "validationMessage", {
1400
+ set: function (value) {
1401
+ this._validateMessages.required = value;
1402
+ },
1403
+ enumerable: true,
1404
+ configurable: true
1405
+ });
1406
+ FsFormRequiredDirective.prototype.ngOnChanges = function () {
1407
+ this._control.updateValueAndValidity();
1408
+ };
1409
+ FsFormRequiredDirective.prototype.validate = function (control) {
1410
+ if (this.required) {
1411
+ return forms.Validators.required(this._control);
1412
+ }
1413
+ else {
1414
+ return null;
1415
+ }
1416
+ };
1417
+ FsFormRequiredDirective.prototype.render = function () {
1418
+ var wrapper = this.getWrapperElement();
1419
+ if (wrapper && this.getlabelSelector()) {
1420
+ var labelWrapper = wrapper.querySelector(this.getlabelSelector());
1421
+ // Adding class fs-form-label-requried adds the * to the label
1422
+ if (labelWrapper) {
1423
+ if (this.required) {
1424
+ this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
1425
+ }
1426
+ else {
1427
+ this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
1428
+ }
1429
+ }
1430
+ }
1431
+ _super.prototype.render.call(this);
1432
+ };
1433
+ __decorate([
1434
+ core.Input('fsFormRequired'),
1435
+ __metadata("design:type", Object),
1436
+ __metadata("design:paramtypes", [Object])
1437
+ ], FsFormRequiredDirective.prototype, "setFsFormRequired", null);
1438
+ __decorate([
1439
+ core.Input('required'),
1440
+ __metadata("design:type", Object),
1441
+ __metadata("design:paramtypes", [Object])
1442
+ ], FsFormRequiredDirective.prototype, "setRequired", null);
1443
+ __decorate([
1444
+ core.Input('fsFormRequiredMessage'),
1445
+ __metadata("design:type", String),
1446
+ __metadata("design:paramtypes", [String])
1447
+ ], FsFormRequiredDirective.prototype, "validationMessage", null);
1448
+ FsFormRequiredDirective = __decorate([
1449
+ core.Directive({
1450
+ selector: '[fsFormRequired],[ngModel][required]',
1451
+ providers: [
1452
+ VALIDATE_MESSAGE_PROVIDER
1453
+ ],
1454
+ })
1455
+ ], FsFormRequiredDirective);
1456
+ return FsFormRequiredDirective;
1448
1457
  }(FsControlDirective));
1449
1458
 
1450
- var FsValidators = /** @class */ (function () {
1451
- function FsValidators() {
1452
- }
1453
- FsValidators.email = function (control) {
1454
- if (!control.value || common$1.email(control.value)) {
1455
- return null;
1456
- }
1457
- return { email: true };
1458
- };
1459
- FsValidators.emails = function (control) {
1460
- var model = control.value || '';
1461
- var hasInvalidEmails = model
1462
- .split(',')
1463
- .some(function (part) { return !common$1.email(part); });
1464
- return hasInvalidEmails ? { email: true } : null;
1465
- };
1466
- FsValidators.numeric = function (control) {
1467
- if (common$1.isEmpty(control.value) || common$1.isNumeric(control.value)) {
1468
- return null;
1469
- }
1470
- else {
1471
- return { numeric: true };
1472
- }
1473
- };
1474
- FsValidators.integer = function (control) {
1475
- if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1476
- return null;
1477
- }
1478
- else {
1479
- return { integer: true };
1480
- }
1481
- };
1482
- FsValidators.phone = function (control) {
1483
- if (!control.value || common$1.phone(control.value)) {
1484
- return null;
1485
- }
1486
- return { phone: true };
1487
- };
1488
- FsValidators.url = function (control, protocolRequired) {
1489
- if (protocolRequired === void 0) { protocolRequired = false; }
1490
- if (!control.value) {
1491
- return null;
1492
- }
1493
- if (!common$1.url(control.value)) {
1494
- return { url: true };
1495
- }
1496
- if (protocolRequired) {
1497
- var pattern = new RegExp(/^http(s)?:\/\//gm);
1498
- if (!String(control.value).match(pattern)) {
1499
- return { urlProtocol: true };
1500
- }
1501
- }
1502
- return null;
1503
- };
1504
- FsValidators.dateRange = function (control) {
1505
- if (!control.value) {
1506
- return null;
1507
- }
1508
- if (lodashEs.isObject(control.value)) {
1509
- var start = control.value.start;
1510
- var end = control.value.end;
1511
- if ((!start && !end) || (dateFns.isValid(start) && dateFns.isValid(end))) {
1512
- return null;
1513
- }
1514
- }
1515
- return { dateRange: true };
1516
- };
1517
- FsValidators.func = function (control, formFunction, data) {
1518
- var result;
1519
- var stream$;
1520
- try {
1521
- result = formFunction(control, data);
1522
- }
1523
- catch (err) {
1524
- err = err instanceof Error ? err.message : err;
1525
- stream$ = rxjs.throwError(err);
1526
- }
1527
- if (!stream$) {
1528
- if (result instanceof Promise) {
1529
- stream$ = rxjs.from(result);
1530
- }
1531
- else if (rxjs.isObservable(result)) {
1532
- stream$ = result;
1533
- }
1534
- else {
1535
- stream$ = rxjs.of(null);
1536
- }
1537
- }
1538
- return stream$
1539
- .pipe(operators.map(function () { return null; }), operators.catchError(function (err) {
1540
- return rxjs.of({ validationError: err });
1541
- }), operators.take(1));
1542
- };
1543
- return FsValidators;
1459
+ var FsValidators = /** @class */ (function () {
1460
+ function FsValidators() {
1461
+ }
1462
+ FsValidators.email = function (control) {
1463
+ if (!control.value || common$1.email(control.value)) {
1464
+ return null;
1465
+ }
1466
+ return { email: true };
1467
+ };
1468
+ FsValidators.emails = function (control) {
1469
+ var model = control.value || '';
1470
+ var hasInvalidEmails = model
1471
+ .split(',')
1472
+ .some(function (part) { return !common$1.email(part); });
1473
+ return hasInvalidEmails ? { email: true } : null;
1474
+ };
1475
+ FsValidators.numeric = function (control) {
1476
+ if (common$1.isEmpty(control.value) || common$1.isNumeric(control.value)) {
1477
+ return null;
1478
+ }
1479
+ else {
1480
+ return { numeric: true };
1481
+ }
1482
+ };
1483
+ FsValidators.integer = function (control) {
1484
+ if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1485
+ return null;
1486
+ }
1487
+ else {
1488
+ return { integer: true };
1489
+ }
1490
+ };
1491
+ FsValidators.phone = function (control) {
1492
+ if (!control.value || common$1.phone(control.value)) {
1493
+ return null;
1494
+ }
1495
+ return { phone: true };
1496
+ };
1497
+ FsValidators.url = function (control, protocolRequired) {
1498
+ if (protocolRequired === void 0) { protocolRequired = false; }
1499
+ if (!control.value) {
1500
+ return null;
1501
+ }
1502
+ if (!common$1.url(control.value)) {
1503
+ return { url: true };
1504
+ }
1505
+ if (protocolRequired) {
1506
+ var pattern = new RegExp(/^http(s)?:\/\//gm);
1507
+ if (!String(control.value).match(pattern)) {
1508
+ return { urlProtocol: true };
1509
+ }
1510
+ }
1511
+ return null;
1512
+ };
1513
+ FsValidators.dateRange = function (control) {
1514
+ if (!control.value) {
1515
+ return null;
1516
+ }
1517
+ if (lodashEs.isObject(control.value)) {
1518
+ var start = control.value.start;
1519
+ var end = control.value.end;
1520
+ if ((!start && !end) || (dateFns.isValid(start) && dateFns.isValid(end))) {
1521
+ return null;
1522
+ }
1523
+ }
1524
+ return { dateRange: true };
1525
+ };
1526
+ FsValidators.func = function (control, formFunction, data) {
1527
+ var result;
1528
+ var stream$;
1529
+ try {
1530
+ result = formFunction(control, data);
1531
+ }
1532
+ catch (err) {
1533
+ err = err instanceof Error ? err.message : err;
1534
+ stream$ = rxjs.throwError(err);
1535
+ }
1536
+ if (!stream$) {
1537
+ if (result instanceof Promise) {
1538
+ stream$ = rxjs.from(result);
1539
+ }
1540
+ else if (rxjs.isObservable(result)) {
1541
+ stream$ = result;
1542
+ }
1543
+ else {
1544
+ stream$ = rxjs.of(null);
1545
+ }
1546
+ }
1547
+ return stream$
1548
+ .pipe(operators.map(function () { return null; }), operators.catchError(function (err) {
1549
+ return rxjs.of({ validationError: err });
1550
+ }), operators.take(1));
1551
+ };
1552
+ return FsValidators;
1544
1553
  }());
1545
1554
 
1546
- var FsFormMinDirective = /** @class */ (function (_super) {
1547
- __extends(FsFormMinDirective, _super);
1548
- function FsFormMinDirective() {
1549
- return _super !== null && _super.apply(this, arguments) || this;
1550
- }
1551
- Object.defineProperty(FsFormMinDirective.prototype, "validationMessage", {
1552
- set: function (value) {
1553
- this._validateMessages.min = value;
1554
- },
1555
- enumerable: true,
1556
- configurable: true
1557
- });
1558
- FsFormMinDirective.prototype.ngOnChanges = function () {
1559
- this._control.updateValueAndValidity();
1560
- };
1561
- FsFormMinDirective.prototype.validate = function (control) {
1562
- return FsValidators.numeric(this._control) || forms.Validators.min(parseFloat(this.fsFormMin))(this._control);
1563
- };
1564
- __decorate([
1565
- core.Input(),
1566
- __metadata("design:type", Object)
1567
- ], FsFormMinDirective.prototype, "fsFormMin", void 0);
1568
- __decorate([
1569
- core.Input('fsFormMinMessage'),
1570
- __metadata("design:type", String),
1571
- __metadata("design:paramtypes", [String])
1572
- ], FsFormMinDirective.prototype, "validationMessage", null);
1573
- FsFormMinDirective = __decorate([
1574
- core.Directive({
1575
- selector: '[fsFormMin]',
1576
- providers: [
1577
- VALIDATE_MESSAGE_PROVIDER
1578
- ],
1579
- })
1580
- ], FsFormMinDirective);
1581
- return FsFormMinDirective;
1555
+ var FsFormMinDirective = /** @class */ (function (_super) {
1556
+ __extends(FsFormMinDirective, _super);
1557
+ function FsFormMinDirective() {
1558
+ return _super !== null && _super.apply(this, arguments) || this;
1559
+ }
1560
+ Object.defineProperty(FsFormMinDirective.prototype, "validationMessage", {
1561
+ set: function (value) {
1562
+ this._validateMessages.min = value;
1563
+ },
1564
+ enumerable: true,
1565
+ configurable: true
1566
+ });
1567
+ FsFormMinDirective.prototype.ngOnChanges = function () {
1568
+ this._control.updateValueAndValidity();
1569
+ };
1570
+ FsFormMinDirective.prototype.validate = function (control) {
1571
+ return FsValidators.numeric(this._control) || forms.Validators.min(parseFloat(this.fsFormMin))(this._control);
1572
+ };
1573
+ __decorate([
1574
+ core.Input(),
1575
+ __metadata("design:type", Object)
1576
+ ], FsFormMinDirective.prototype, "fsFormMin", void 0);
1577
+ __decorate([
1578
+ core.Input('fsFormMinMessage'),
1579
+ __metadata("design:type", String),
1580
+ __metadata("design:paramtypes", [String])
1581
+ ], FsFormMinDirective.prototype, "validationMessage", null);
1582
+ FsFormMinDirective = __decorate([
1583
+ core.Directive({
1584
+ selector: '[fsFormMin]',
1585
+ providers: [
1586
+ VALIDATE_MESSAGE_PROVIDER
1587
+ ],
1588
+ })
1589
+ ], FsFormMinDirective);
1590
+ return FsFormMinDirective;
1582
1591
  }(FsControlDirective));
1583
1592
 
1584
- var FsFormMaxDirective = /** @class */ (function (_super) {
1585
- __extends(FsFormMaxDirective, _super);
1586
- function FsFormMaxDirective() {
1587
- return _super !== null && _super.apply(this, arguments) || this;
1588
- }
1589
- Object.defineProperty(FsFormMaxDirective.prototype, "validationMessage", {
1590
- set: function (value) {
1591
- this._validateMessages.max = value;
1592
- },
1593
- enumerable: true,
1594
- configurable: true
1595
- });
1596
- FsFormMaxDirective.prototype.ngOnChanges = function () {
1597
- this._control.updateValueAndValidity();
1598
- };
1599
- FsFormMaxDirective.prototype.validate = function (control) {
1600
- return FsValidators.numeric(this._control) || forms.Validators.max(this.fsFormMax)(this._control);
1601
- };
1602
- __decorate([
1603
- core.Input(),
1604
- __metadata("design:type", Number)
1605
- ], FsFormMaxDirective.prototype, "fsFormMax", void 0);
1606
- __decorate([
1607
- core.Input('fsFormMaxMessage'),
1608
- __metadata("design:type", String),
1609
- __metadata("design:paramtypes", [String])
1610
- ], FsFormMaxDirective.prototype, "validationMessage", null);
1611
- FsFormMaxDirective = __decorate([
1612
- core.Directive({
1613
- selector: '[fsFormMax]',
1614
- providers: [
1615
- VALIDATE_MESSAGE_PROVIDER
1616
- ],
1617
- })
1618
- ], FsFormMaxDirective);
1619
- return FsFormMaxDirective;
1593
+ var FsFormMaxDirective = /** @class */ (function (_super) {
1594
+ __extends(FsFormMaxDirective, _super);
1595
+ function FsFormMaxDirective() {
1596
+ return _super !== null && _super.apply(this, arguments) || this;
1597
+ }
1598
+ Object.defineProperty(FsFormMaxDirective.prototype, "validationMessage", {
1599
+ set: function (value) {
1600
+ this._validateMessages.max = value;
1601
+ },
1602
+ enumerable: true,
1603
+ configurable: true
1604
+ });
1605
+ FsFormMaxDirective.prototype.ngOnChanges = function () {
1606
+ this._control.updateValueAndValidity();
1607
+ };
1608
+ FsFormMaxDirective.prototype.validate = function (control) {
1609
+ return FsValidators.numeric(this._control) || forms.Validators.max(this.fsFormMax)(this._control);
1610
+ };
1611
+ __decorate([
1612
+ core.Input(),
1613
+ __metadata("design:type", Number)
1614
+ ], FsFormMaxDirective.prototype, "fsFormMax", void 0);
1615
+ __decorate([
1616
+ core.Input('fsFormMaxMessage'),
1617
+ __metadata("design:type", String),
1618
+ __metadata("design:paramtypes", [String])
1619
+ ], FsFormMaxDirective.prototype, "validationMessage", null);
1620
+ FsFormMaxDirective = __decorate([
1621
+ core.Directive({
1622
+ selector: '[fsFormMax]',
1623
+ providers: [
1624
+ VALIDATE_MESSAGE_PROVIDER
1625
+ ],
1626
+ })
1627
+ ], FsFormMaxDirective);
1628
+ return FsFormMaxDirective;
1620
1629
  }(FsControlDirective));
1621
1630
 
1622
- var FsFormMinLengthDirective = /** @class */ (function (_super) {
1623
- __extends(FsFormMinLengthDirective, _super);
1624
- function FsFormMinLengthDirective() {
1625
- return _super !== null && _super.apply(this, arguments) || this;
1626
- }
1627
- Object.defineProperty(FsFormMinLengthDirective.prototype, "validationMessage", {
1628
- set: function (value) {
1629
- this._validateMessages.minlength = value;
1630
- },
1631
- enumerable: true,
1632
- configurable: true
1633
- });
1634
- FsFormMinLengthDirective.prototype.ngOnChanges = function () {
1635
- this._control.updateValueAndValidity();
1636
- };
1637
- FsFormMinLengthDirective.prototype.validate = function (control) {
1638
- return forms.Validators.minLength(this.fsFormMinLength)(this._control);
1639
- };
1640
- __decorate([
1641
- core.Input(),
1642
- __metadata("design:type", Number)
1643
- ], FsFormMinLengthDirective.prototype, "fsFormMinLength", void 0);
1644
- __decorate([
1645
- core.Input('fsFormMinLengthMessage'),
1646
- __metadata("design:type", String),
1647
- __metadata("design:paramtypes", [String])
1648
- ], FsFormMinLengthDirective.prototype, "validationMessage", null);
1649
- FsFormMinLengthDirective = __decorate([
1650
- core.Directive({
1651
- selector: '[fsFormMinLength]',
1652
- providers: [
1653
- VALIDATE_MESSAGE_PROVIDER
1654
- ],
1655
- })
1656
- ], FsFormMinLengthDirective);
1657
- return FsFormMinLengthDirective;
1631
+ var FsFormMinLengthDirective = /** @class */ (function (_super) {
1632
+ __extends(FsFormMinLengthDirective, _super);
1633
+ function FsFormMinLengthDirective() {
1634
+ return _super !== null && _super.apply(this, arguments) || this;
1635
+ }
1636
+ Object.defineProperty(FsFormMinLengthDirective.prototype, "validationMessage", {
1637
+ set: function (value) {
1638
+ this._validateMessages.minlength = value;
1639
+ },
1640
+ enumerable: true,
1641
+ configurable: true
1642
+ });
1643
+ FsFormMinLengthDirective.prototype.ngOnChanges = function () {
1644
+ this._control.updateValueAndValidity();
1645
+ };
1646
+ FsFormMinLengthDirective.prototype.validate = function (control) {
1647
+ return forms.Validators.minLength(this.fsFormMinLength)(this._control);
1648
+ };
1649
+ __decorate([
1650
+ core.Input(),
1651
+ __metadata("design:type", Number)
1652
+ ], FsFormMinLengthDirective.prototype, "fsFormMinLength", void 0);
1653
+ __decorate([
1654
+ core.Input('fsFormMinLengthMessage'),
1655
+ __metadata("design:type", String),
1656
+ __metadata("design:paramtypes", [String])
1657
+ ], FsFormMinLengthDirective.prototype, "validationMessage", null);
1658
+ FsFormMinLengthDirective = __decorate([
1659
+ core.Directive({
1660
+ selector: '[fsFormMinLength]',
1661
+ providers: [
1662
+ VALIDATE_MESSAGE_PROVIDER
1663
+ ],
1664
+ })
1665
+ ], FsFormMinLengthDirective);
1666
+ return FsFormMinLengthDirective;
1658
1667
  }(FsControlDirective));
1659
1668
 
1660
- var FsFormMaxLengthDirective = /** @class */ (function (_super) {
1661
- __extends(FsFormMaxLengthDirective, _super);
1662
- function FsFormMaxLengthDirective() {
1663
- return _super !== null && _super.apply(this, arguments) || this;
1664
- }
1665
- Object.defineProperty(FsFormMaxLengthDirective.prototype, "validationMessage", {
1666
- set: function (value) {
1667
- this._validateMessages.maxlength = value;
1668
- },
1669
- enumerable: true,
1670
- configurable: true
1671
- });
1672
- FsFormMaxLengthDirective.prototype.ngOnChanges = function () {
1673
- this._control.updateValueAndValidity();
1674
- };
1675
- FsFormMaxLengthDirective.prototype.validate = function (control) {
1676
- return forms.Validators.maxLength(this.fsFormMaxLength)(this._control);
1677
- };
1678
- __decorate([
1679
- core.Input(),
1680
- __metadata("design:type", Number)
1681
- ], FsFormMaxLengthDirective.prototype, "fsFormMaxLength", void 0);
1682
- __decorate([
1683
- core.Input('fsFormMaxLengthMessage'),
1684
- __metadata("design:type", String),
1685
- __metadata("design:paramtypes", [String])
1686
- ], FsFormMaxLengthDirective.prototype, "validationMessage", null);
1687
- FsFormMaxLengthDirective = __decorate([
1688
- core.Directive({
1689
- selector: '[fsFormMaxLength]',
1690
- providers: [
1691
- VALIDATE_MESSAGE_PROVIDER
1692
- ],
1693
- })
1694
- ], FsFormMaxLengthDirective);
1695
- return FsFormMaxLengthDirective;
1669
+ var FsFormMaxLengthDirective = /** @class */ (function (_super) {
1670
+ __extends(FsFormMaxLengthDirective, _super);
1671
+ function FsFormMaxLengthDirective() {
1672
+ return _super !== null && _super.apply(this, arguments) || this;
1673
+ }
1674
+ Object.defineProperty(FsFormMaxLengthDirective.prototype, "validationMessage", {
1675
+ set: function (value) {
1676
+ this._validateMessages.maxlength = value;
1677
+ },
1678
+ enumerable: true,
1679
+ configurable: true
1680
+ });
1681
+ FsFormMaxLengthDirective.prototype.ngOnChanges = function () {
1682
+ this._control.updateValueAndValidity();
1683
+ };
1684
+ FsFormMaxLengthDirective.prototype.validate = function (control) {
1685
+ return forms.Validators.maxLength(this.fsFormMaxLength)(this._control);
1686
+ };
1687
+ __decorate([
1688
+ core.Input(),
1689
+ __metadata("design:type", Number)
1690
+ ], FsFormMaxLengthDirective.prototype, "fsFormMaxLength", void 0);
1691
+ __decorate([
1692
+ core.Input('fsFormMaxLengthMessage'),
1693
+ __metadata("design:type", String),
1694
+ __metadata("design:paramtypes", [String])
1695
+ ], FsFormMaxLengthDirective.prototype, "validationMessage", null);
1696
+ FsFormMaxLengthDirective = __decorate([
1697
+ core.Directive({
1698
+ selector: '[fsFormMaxLength]',
1699
+ providers: [
1700
+ VALIDATE_MESSAGE_PROVIDER
1701
+ ],
1702
+ })
1703
+ ], FsFormMaxLengthDirective);
1704
+ return FsFormMaxLengthDirective;
1696
1705
  }(FsControlDirective));
1697
1706
 
1698
- var FsFormEmailDirective = /** @class */ (function (_super) {
1699
- __extends(FsFormEmailDirective, _super);
1700
- function FsFormEmailDirective() {
1701
- return _super !== null && _super.apply(this, arguments) || this;
1702
- }
1703
- Object.defineProperty(FsFormEmailDirective.prototype, "validationMessage", {
1704
- set: function (value) {
1705
- this._validateMessages.email = value;
1706
- },
1707
- enumerable: true,
1708
- configurable: true
1709
- });
1710
- FsFormEmailDirective.prototype.ngOnChanges = function () {
1711
- this._control.updateValueAndValidity();
1712
- };
1713
- FsFormEmailDirective.prototype.validate = function (control) {
1714
- if (isEnabled(this.fsFormEmail)) {
1715
- return FsValidators.email(this._control);
1716
- }
1717
- else {
1718
- return null;
1719
- }
1720
- };
1721
- __decorate([
1722
- core.Input(),
1723
- __metadata("design:type", Object)
1724
- ], FsFormEmailDirective.prototype, "fsFormEmail", void 0);
1725
- __decorate([
1726
- core.Input('fsFormEmailMessage'),
1727
- __metadata("design:type", String),
1728
- __metadata("design:paramtypes", [String])
1729
- ], FsFormEmailDirective.prototype, "validationMessage", null);
1730
- FsFormEmailDirective = __decorate([
1731
- core.Directive({
1732
- selector: '[fsFormEmail]',
1733
- providers: [
1734
- VALIDATE_MESSAGE_PROVIDER
1735
- ],
1736
- })
1737
- ], FsFormEmailDirective);
1738
- return FsFormEmailDirective;
1707
+ var FsFormEmailDirective = /** @class */ (function (_super) {
1708
+ __extends(FsFormEmailDirective, _super);
1709
+ function FsFormEmailDirective() {
1710
+ return _super !== null && _super.apply(this, arguments) || this;
1711
+ }
1712
+ Object.defineProperty(FsFormEmailDirective.prototype, "validationMessage", {
1713
+ set: function (value) {
1714
+ this._validateMessages.email = value;
1715
+ },
1716
+ enumerable: true,
1717
+ configurable: true
1718
+ });
1719
+ FsFormEmailDirective.prototype.ngOnChanges = function () {
1720
+ this._control.updateValueAndValidity();
1721
+ };
1722
+ FsFormEmailDirective.prototype.validate = function (control) {
1723
+ if (isEnabled(this.fsFormEmail)) {
1724
+ return FsValidators.email(this._control);
1725
+ }
1726
+ else {
1727
+ return null;
1728
+ }
1729
+ };
1730
+ __decorate([
1731
+ core.Input(),
1732
+ __metadata("design:type", Object)
1733
+ ], FsFormEmailDirective.prototype, "fsFormEmail", void 0);
1734
+ __decorate([
1735
+ core.Input('fsFormEmailMessage'),
1736
+ __metadata("design:type", String),
1737
+ __metadata("design:paramtypes", [String])
1738
+ ], FsFormEmailDirective.prototype, "validationMessage", null);
1739
+ FsFormEmailDirective = __decorate([
1740
+ core.Directive({
1741
+ selector: '[fsFormEmail]',
1742
+ providers: [
1743
+ VALIDATE_MESSAGE_PROVIDER
1744
+ ],
1745
+ })
1746
+ ], FsFormEmailDirective);
1747
+ return FsFormEmailDirective;
1739
1748
  }(FsControlDirective));
1740
1749
 
1741
- var FsFormEmailsDirective = /** @class */ (function (_super) {
1742
- __extends(FsFormEmailsDirective, _super);
1743
- function FsFormEmailsDirective() {
1744
- return _super !== null && _super.apply(this, arguments) || this;
1745
- }
1746
- Object.defineProperty(FsFormEmailsDirective.prototype, "validationMessage", {
1747
- set: function (value) {
1748
- this._validateMessages.emails = value;
1749
- },
1750
- enumerable: true,
1751
- configurable: true
1752
- });
1753
- FsFormEmailsDirective.prototype.ngOnChanges = function () {
1754
- this._control.updateValueAndValidity();
1755
- };
1756
- FsFormEmailsDirective.prototype.validate = function (control) {
1757
- if (isEnabled(this.fsFormEmails)) {
1758
- return FsValidators.emails(this._control);
1759
- }
1760
- else {
1761
- return null;
1762
- }
1763
- };
1764
- __decorate([
1765
- core.Input(),
1766
- __metadata("design:type", Object)
1767
- ], FsFormEmailsDirective.prototype, "fsFormEmails", void 0);
1768
- __decorate([
1769
- core.Input('fsFormEmailsMessage'),
1770
- __metadata("design:type", String),
1771
- __metadata("design:paramtypes", [String])
1772
- ], FsFormEmailsDirective.prototype, "validationMessage", null);
1773
- FsFormEmailsDirective = __decorate([
1774
- core.Directive({
1775
- selector: '[fsFormEmails]',
1776
- providers: [
1777
- VALIDATE_MESSAGE_PROVIDER
1778
- ],
1779
- })
1780
- ], FsFormEmailsDirective);
1781
- return FsFormEmailsDirective;
1750
+ var FsFormEmailsDirective = /** @class */ (function (_super) {
1751
+ __extends(FsFormEmailsDirective, _super);
1752
+ function FsFormEmailsDirective() {
1753
+ return _super !== null && _super.apply(this, arguments) || this;
1754
+ }
1755
+ Object.defineProperty(FsFormEmailsDirective.prototype, "validationMessage", {
1756
+ set: function (value) {
1757
+ this._validateMessages.emails = value;
1758
+ },
1759
+ enumerable: true,
1760
+ configurable: true
1761
+ });
1762
+ FsFormEmailsDirective.prototype.ngOnChanges = function () {
1763
+ this._control.updateValueAndValidity();
1764
+ };
1765
+ FsFormEmailsDirective.prototype.validate = function (control) {
1766
+ if (isEnabled(this.fsFormEmails)) {
1767
+ return FsValidators.emails(this._control);
1768
+ }
1769
+ else {
1770
+ return null;
1771
+ }
1772
+ };
1773
+ __decorate([
1774
+ core.Input(),
1775
+ __metadata("design:type", Object)
1776
+ ], FsFormEmailsDirective.prototype, "fsFormEmails", void 0);
1777
+ __decorate([
1778
+ core.Input('fsFormEmailsMessage'),
1779
+ __metadata("design:type", String),
1780
+ __metadata("design:paramtypes", [String])
1781
+ ], FsFormEmailsDirective.prototype, "validationMessage", null);
1782
+ FsFormEmailsDirective = __decorate([
1783
+ core.Directive({
1784
+ selector: '[fsFormEmails]',
1785
+ providers: [
1786
+ VALIDATE_MESSAGE_PROVIDER
1787
+ ],
1788
+ })
1789
+ ], FsFormEmailsDirective);
1790
+ return FsFormEmailsDirective;
1782
1791
  }(FsControlDirective));
1783
1792
 
1784
- var FsFormPhoneDirective = /** @class */ (function (_super) {
1785
- __extends(FsFormPhoneDirective, _super);
1786
- function FsFormPhoneDirective() {
1787
- return _super !== null && _super.apply(this, arguments) || this;
1788
- }
1789
- Object.defineProperty(FsFormPhoneDirective.prototype, "validationMessage", {
1790
- set: function (value) {
1791
- this._validateMessages.phone = value;
1792
- },
1793
- enumerable: true,
1794
- configurable: true
1795
- });
1796
- FsFormPhoneDirective.prototype.ngOnChanges = function () {
1797
- this._control.updateValueAndValidity();
1798
- };
1799
- FsFormPhoneDirective.prototype.validate = function (control) {
1800
- if (isEnabled(this.fsFormPhone)) {
1801
- return FsValidators.phone(this._control);
1802
- }
1803
- else {
1804
- return null;
1805
- }
1806
- };
1807
- __decorate([
1808
- core.Input(),
1809
- __metadata("design:type", Object)
1810
- ], FsFormPhoneDirective.prototype, "fsFormPhone", void 0);
1811
- __decorate([
1812
- core.Input('fsFormPhoneMessage'),
1813
- __metadata("design:type", String),
1814
- __metadata("design:paramtypes", [String])
1815
- ], FsFormPhoneDirective.prototype, "validationMessage", null);
1816
- FsFormPhoneDirective = __decorate([
1817
- core.Directive({
1818
- selector: '[fsFormPhone]',
1819
- providers: [
1820
- VALIDATE_MESSAGE_PROVIDER
1821
- ],
1822
- })
1823
- ], FsFormPhoneDirective);
1824
- return FsFormPhoneDirective;
1793
+ var FsFormPhoneDirective = /** @class */ (function (_super) {
1794
+ __extends(FsFormPhoneDirective, _super);
1795
+ function FsFormPhoneDirective() {
1796
+ return _super !== null && _super.apply(this, arguments) || this;
1797
+ }
1798
+ Object.defineProperty(FsFormPhoneDirective.prototype, "validationMessage", {
1799
+ set: function (value) {
1800
+ this._validateMessages.phone = value;
1801
+ },
1802
+ enumerable: true,
1803
+ configurable: true
1804
+ });
1805
+ FsFormPhoneDirective.prototype.ngOnChanges = function () {
1806
+ this._control.updateValueAndValidity();
1807
+ };
1808
+ FsFormPhoneDirective.prototype.validate = function (control) {
1809
+ if (isEnabled(this.fsFormPhone)) {
1810
+ return FsValidators.phone(this._control);
1811
+ }
1812
+ else {
1813
+ return null;
1814
+ }
1815
+ };
1816
+ __decorate([
1817
+ core.Input(),
1818
+ __metadata("design:type", Object)
1819
+ ], FsFormPhoneDirective.prototype, "fsFormPhone", void 0);
1820
+ __decorate([
1821
+ core.Input('fsFormPhoneMessage'),
1822
+ __metadata("design:type", String),
1823
+ __metadata("design:paramtypes", [String])
1824
+ ], FsFormPhoneDirective.prototype, "validationMessage", null);
1825
+ FsFormPhoneDirective = __decorate([
1826
+ core.Directive({
1827
+ selector: '[fsFormPhone]',
1828
+ providers: [
1829
+ VALIDATE_MESSAGE_PROVIDER
1830
+ ],
1831
+ })
1832
+ ], FsFormPhoneDirective);
1833
+ return FsFormPhoneDirective;
1825
1834
  }(FsControlDirective));
1826
1835
 
1827
- var FsFormCompareDirective = /** @class */ (function (_super) {
1828
- __extends(FsFormCompareDirective, _super);
1829
- function FsFormCompareDirective() {
1830
- return _super !== null && _super.apply(this, arguments) || this;
1831
- }
1832
- Object.defineProperty(FsFormCompareDirective.prototype, "validationMessage", {
1833
- set: function (value) {
1834
- this._validateMessages.compare = value;
1835
- },
1836
- enumerable: true,
1837
- configurable: true
1838
- });
1839
- FsFormCompareDirective.prototype.ngOnChanges = function () {
1840
- this._control.updateValueAndValidity();
1841
- };
1842
- FsFormCompareDirective.prototype.validate = function (control) {
1843
- if (this.fsFormCompare.value === this.elementRef.nativeElement.value) {
1844
- return null;
1845
- }
1846
- else {
1847
- return { compare: true };
1848
- }
1849
- };
1850
- FsFormCompareDirective.prototype.ngAfterViewInit = function () {
1851
- var _this = this;
1852
- this.fsFormCompare.addEventListener('keyup', function () {
1853
- _this._control.updateValueAndValidity();
1854
- }, false);
1855
- };
1856
- FsFormCompareDirective.prototype.ngOnDestroy = function () {
1857
- var _this = this;
1858
- this.fsFormCompare.removeEventListener('keyup', function () {
1859
- _this._control.updateValueAndValidity();
1860
- }, false);
1861
- };
1862
- __decorate([
1863
- core.Input(),
1864
- __metadata("design:type", Object)
1865
- ], FsFormCompareDirective.prototype, "fsFormCompare", void 0);
1866
- __decorate([
1867
- core.Input('fsFormCompareMessage'),
1868
- __metadata("design:type", String),
1869
- __metadata("design:paramtypes", [String])
1870
- ], FsFormCompareDirective.prototype, "validationMessage", null);
1871
- FsFormCompareDirective = __decorate([
1872
- core.Directive({
1873
- selector: '[fsFormCompare]',
1874
- providers: [
1875
- VALIDATE_MESSAGE_PROVIDER,
1876
- ],
1877
- })
1878
- ], FsFormCompareDirective);
1879
- return FsFormCompareDirective;
1836
+ var FsFormCompareDirective = /** @class */ (function (_super) {
1837
+ __extends(FsFormCompareDirective, _super);
1838
+ function FsFormCompareDirective() {
1839
+ return _super !== null && _super.apply(this, arguments) || this;
1840
+ }
1841
+ Object.defineProperty(FsFormCompareDirective.prototype, "validationMessage", {
1842
+ set: function (value) {
1843
+ this._validateMessages.compare = value;
1844
+ },
1845
+ enumerable: true,
1846
+ configurable: true
1847
+ });
1848
+ FsFormCompareDirective.prototype.ngOnChanges = function () {
1849
+ this._control.updateValueAndValidity();
1850
+ };
1851
+ FsFormCompareDirective.prototype.validate = function (control) {
1852
+ if (this.fsFormCompare.value === this.elementRef.nativeElement.value) {
1853
+ return null;
1854
+ }
1855
+ else {
1856
+ return { compare: true };
1857
+ }
1858
+ };
1859
+ FsFormCompareDirective.prototype.ngAfterViewInit = function () {
1860
+ var _this = this;
1861
+ this.fsFormCompare.addEventListener('keyup', function () {
1862
+ _this._control.updateValueAndValidity();
1863
+ }, false);
1864
+ };
1865
+ FsFormCompareDirective.prototype.ngOnDestroy = function () {
1866
+ var _this = this;
1867
+ this.fsFormCompare.removeEventListener('keyup', function () {
1868
+ _this._control.updateValueAndValidity();
1869
+ }, false);
1870
+ };
1871
+ __decorate([
1872
+ core.Input(),
1873
+ __metadata("design:type", Object)
1874
+ ], FsFormCompareDirective.prototype, "fsFormCompare", void 0);
1875
+ __decorate([
1876
+ core.Input('fsFormCompareMessage'),
1877
+ __metadata("design:type", String),
1878
+ __metadata("design:paramtypes", [String])
1879
+ ], FsFormCompareDirective.prototype, "validationMessage", null);
1880
+ FsFormCompareDirective = __decorate([
1881
+ core.Directive({
1882
+ selector: '[fsFormCompare]',
1883
+ providers: [
1884
+ VALIDATE_MESSAGE_PROVIDER,
1885
+ ],
1886
+ })
1887
+ ], FsFormCompareDirective);
1888
+ return FsFormCompareDirective;
1880
1889
  }(FsControlDirective));
1881
1890
 
1882
- var FsFormIntegerDirective = /** @class */ (function (_super) {
1883
- __extends(FsFormIntegerDirective, _super);
1884
- function FsFormIntegerDirective() {
1885
- return _super !== null && _super.apply(this, arguments) || this;
1886
- }
1887
- Object.defineProperty(FsFormIntegerDirective.prototype, "validationMessage", {
1888
- set: function (value) {
1889
- this._validateMessages.integer = value;
1890
- },
1891
- enumerable: true,
1892
- configurable: true
1893
- });
1894
- FsFormIntegerDirective.prototype.ngOnChanges = function () {
1895
- this._control.updateValueAndValidity();
1896
- };
1897
- FsFormIntegerDirective.prototype.validate = function (control) {
1898
- if (isEnabled(this.fsFormInteger)) {
1899
- return FsValidators.integer(this._control);
1900
- }
1901
- else {
1902
- return null;
1903
- }
1904
- };
1905
- __decorate([
1906
- core.Input(),
1907
- __metadata("design:type", Object)
1908
- ], FsFormIntegerDirective.prototype, "fsFormInteger", void 0);
1909
- __decorate([
1910
- core.Input('fsFormIntegerMessage'),
1911
- __metadata("design:type", String),
1912
- __metadata("design:paramtypes", [String])
1913
- ], FsFormIntegerDirective.prototype, "validationMessage", null);
1914
- FsFormIntegerDirective = __decorate([
1915
- core.Directive({
1916
- selector: '[fsFormInteger]',
1917
- providers: [
1918
- VALIDATE_MESSAGE_PROVIDER
1919
- ],
1920
- })
1921
- ], FsFormIntegerDirective);
1922
- return FsFormIntegerDirective;
1891
+ var FsFormIntegerDirective = /** @class */ (function (_super) {
1892
+ __extends(FsFormIntegerDirective, _super);
1893
+ function FsFormIntegerDirective() {
1894
+ return _super !== null && _super.apply(this, arguments) || this;
1895
+ }
1896
+ Object.defineProperty(FsFormIntegerDirective.prototype, "validationMessage", {
1897
+ set: function (value) {
1898
+ this._validateMessages.integer = value;
1899
+ },
1900
+ enumerable: true,
1901
+ configurable: true
1902
+ });
1903
+ FsFormIntegerDirective.prototype.ngOnChanges = function () {
1904
+ this._control.updateValueAndValidity();
1905
+ };
1906
+ FsFormIntegerDirective.prototype.validate = function (control) {
1907
+ if (isEnabled(this.fsFormInteger)) {
1908
+ return FsValidators.integer(this._control);
1909
+ }
1910
+ else {
1911
+ return null;
1912
+ }
1913
+ };
1914
+ __decorate([
1915
+ core.Input(),
1916
+ __metadata("design:type", Object)
1917
+ ], FsFormIntegerDirective.prototype, "fsFormInteger", void 0);
1918
+ __decorate([
1919
+ core.Input('fsFormIntegerMessage'),
1920
+ __metadata("design:type", String),
1921
+ __metadata("design:paramtypes", [String])
1922
+ ], FsFormIntegerDirective.prototype, "validationMessage", null);
1923
+ FsFormIntegerDirective = __decorate([
1924
+ core.Directive({
1925
+ selector: '[fsFormInteger]',
1926
+ providers: [
1927
+ VALIDATE_MESSAGE_PROVIDER
1928
+ ],
1929
+ })
1930
+ ], FsFormIntegerDirective);
1931
+ return FsFormIntegerDirective;
1923
1932
  }(FsControlDirective));
1924
1933
 
1925
- var FsFormNumericDirective = /** @class */ (function (_super) {
1926
- __extends(FsFormNumericDirective, _super);
1927
- function FsFormNumericDirective() {
1928
- return _super !== null && _super.apply(this, arguments) || this;
1929
- }
1930
- Object.defineProperty(FsFormNumericDirective.prototype, "validationMessage", {
1931
- set: function (value) {
1932
- this._validateMessages.numeric = value;
1933
- },
1934
- enumerable: true,
1935
- configurable: true
1936
- });
1937
- FsFormNumericDirective.prototype.ngOnChanges = function () {
1938
- this._control.updateValueAndValidity();
1939
- };
1940
- FsFormNumericDirective.prototype.validate = function (control) {
1941
- if (isEnabled(this.fsFormNumeric)) {
1942
- return FsValidators.numeric(this._control);
1943
- }
1944
- else {
1945
- return null;
1946
- }
1947
- };
1948
- __decorate([
1949
- core.Input(),
1950
- __metadata("design:type", Object)
1951
- ], FsFormNumericDirective.prototype, "fsFormNumeric", void 0);
1952
- __decorate([
1953
- core.Input('fsFormNumericMessage'),
1954
- __metadata("design:type", String),
1955
- __metadata("design:paramtypes", [String])
1956
- ], FsFormNumericDirective.prototype, "validationMessage", null);
1957
- FsFormNumericDirective = __decorate([
1958
- core.Directive({
1959
- selector: '[fsFormNumeric]',
1960
- providers: [
1961
- VALIDATE_MESSAGE_PROVIDER
1962
- ],
1963
- })
1964
- ], FsFormNumericDirective);
1965
- return FsFormNumericDirective;
1934
+ var FsFormNumericDirective = /** @class */ (function (_super) {
1935
+ __extends(FsFormNumericDirective, _super);
1936
+ function FsFormNumericDirective() {
1937
+ return _super !== null && _super.apply(this, arguments) || this;
1938
+ }
1939
+ Object.defineProperty(FsFormNumericDirective.prototype, "validationMessage", {
1940
+ set: function (value) {
1941
+ this._validateMessages.numeric = value;
1942
+ },
1943
+ enumerable: true,
1944
+ configurable: true
1945
+ });
1946
+ FsFormNumericDirective.prototype.ngOnChanges = function () {
1947
+ this._control.updateValueAndValidity();
1948
+ };
1949
+ FsFormNumericDirective.prototype.validate = function (control) {
1950
+ if (isEnabled(this.fsFormNumeric)) {
1951
+ return FsValidators.numeric(this._control);
1952
+ }
1953
+ else {
1954
+ return null;
1955
+ }
1956
+ };
1957
+ __decorate([
1958
+ core.Input(),
1959
+ __metadata("design:type", Object)
1960
+ ], FsFormNumericDirective.prototype, "fsFormNumeric", void 0);
1961
+ __decorate([
1962
+ core.Input('fsFormNumericMessage'),
1963
+ __metadata("design:type", String),
1964
+ __metadata("design:paramtypes", [String])
1965
+ ], FsFormNumericDirective.prototype, "validationMessage", null);
1966
+ FsFormNumericDirective = __decorate([
1967
+ core.Directive({
1968
+ selector: '[fsFormNumeric]',
1969
+ providers: [
1970
+ VALIDATE_MESSAGE_PROVIDER
1971
+ ],
1972
+ })
1973
+ ], FsFormNumericDirective);
1974
+ return FsFormNumericDirective;
1966
1975
  }(FsControlDirective));
1967
1976
 
1968
- var FsFormPatternDirective = /** @class */ (function (_super) {
1969
- __extends(FsFormPatternDirective, _super);
1970
- function FsFormPatternDirective() {
1971
- return _super !== null && _super.apply(this, arguments) || this;
1972
- }
1973
- Object.defineProperty(FsFormPatternDirective.prototype, "validationMessage", {
1974
- set: function (value) {
1975
- this._validateMessages.pattern = value;
1976
- },
1977
- enumerable: true,
1978
- configurable: true
1979
- });
1980
- FsFormPatternDirective.prototype.ngOnChanges = function () {
1981
- this._control.updateValueAndValidity();
1982
- };
1983
- FsFormPatternDirective.prototype.validate = function (control) {
1984
- return forms.Validators.pattern(this.fsFormPattern)(this._control);
1985
- };
1986
- __decorate([
1987
- core.Input(),
1988
- __metadata("design:type", RegExp)
1989
- ], FsFormPatternDirective.prototype, "fsFormPattern", void 0);
1990
- __decorate([
1991
- core.Input('fsFormPatternMessage'),
1992
- __metadata("design:type", String),
1993
- __metadata("design:paramtypes", [String])
1994
- ], FsFormPatternDirective.prototype, "validationMessage", null);
1995
- FsFormPatternDirective = __decorate([
1996
- core.Directive({
1997
- selector: '[fsFormPattern]',
1998
- providers: [
1999
- VALIDATE_MESSAGE_PROVIDER
2000
- ],
2001
- })
2002
- ], FsFormPatternDirective);
2003
- return FsFormPatternDirective;
1977
+ var FsFormPatternDirective = /** @class */ (function (_super) {
1978
+ __extends(FsFormPatternDirective, _super);
1979
+ function FsFormPatternDirective() {
1980
+ return _super !== null && _super.apply(this, arguments) || this;
1981
+ }
1982
+ Object.defineProperty(FsFormPatternDirective.prototype, "validationMessage", {
1983
+ set: function (value) {
1984
+ this._validateMessages.pattern = value;
1985
+ },
1986
+ enumerable: true,
1987
+ configurable: true
1988
+ });
1989
+ FsFormPatternDirective.prototype.ngOnChanges = function () {
1990
+ this._control.updateValueAndValidity();
1991
+ };
1992
+ FsFormPatternDirective.prototype.validate = function (control) {
1993
+ return forms.Validators.pattern(this.fsFormPattern)(this._control);
1994
+ };
1995
+ __decorate([
1996
+ core.Input(),
1997
+ __metadata("design:type", RegExp)
1998
+ ], FsFormPatternDirective.prototype, "fsFormPattern", void 0);
1999
+ __decorate([
2000
+ core.Input('fsFormPatternMessage'),
2001
+ __metadata("design:type", String),
2002
+ __metadata("design:paramtypes", [String])
2003
+ ], FsFormPatternDirective.prototype, "validationMessage", null);
2004
+ FsFormPatternDirective = __decorate([
2005
+ core.Directive({
2006
+ selector: '[fsFormPattern]',
2007
+ providers: [
2008
+ VALIDATE_MESSAGE_PROVIDER
2009
+ ],
2010
+ })
2011
+ ], FsFormPatternDirective);
2012
+ return FsFormPatternDirective;
2004
2013
  }(FsControlDirective));
2005
2014
 
2006
- var FsFormFunctionDirective = /** @class */ (function (_super) {
2007
- __extends(FsFormFunctionDirective, _super);
2008
- function FsFormFunctionDirective() {
2009
- return _super !== null && _super.apply(this, arguments) || this;
2010
- }
2011
- FsFormFunctionDirective.prototype.ngOnChanges = function () {
2012
- this._control.updateValueAndValidity();
2013
- };
2014
- FsFormFunctionDirective.prototype.validateAsync = function (control) {
2015
- return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
2016
- };
2017
- __decorate([
2018
- core.Input(),
2019
- __metadata("design:type", Object)
2020
- ], FsFormFunctionDirective.prototype, "fsFormFunction", void 0);
2021
- __decorate([
2022
- core.Input(),
2023
- __metadata("design:type", Object)
2024
- ], FsFormFunctionDirective.prototype, "fsFormFunctionData", void 0);
2025
- FsFormFunctionDirective = __decorate([
2026
- core.Directive({
2027
- selector: '[fsFormFunction]',
2028
- providers: [
2029
- VALIDATE_MESSAGE_PROVIDER
2030
- ],
2031
- })
2032
- ], FsFormFunctionDirective);
2033
- return FsFormFunctionDirective;
2015
+ var FsFormFunctionDirective = /** @class */ (function (_super) {
2016
+ __extends(FsFormFunctionDirective, _super);
2017
+ function FsFormFunctionDirective() {
2018
+ return _super !== null && _super.apply(this, arguments) || this;
2019
+ }
2020
+ FsFormFunctionDirective.prototype.ngOnChanges = function () {
2021
+ this._control.updateValueAndValidity();
2022
+ };
2023
+ FsFormFunctionDirective.prototype.validateAsync = function (control) {
2024
+ return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
2025
+ };
2026
+ __decorate([
2027
+ core.Input(),
2028
+ __metadata("design:type", Object)
2029
+ ], FsFormFunctionDirective.prototype, "fsFormFunction", void 0);
2030
+ __decorate([
2031
+ core.Input(),
2032
+ __metadata("design:type", Object)
2033
+ ], FsFormFunctionDirective.prototype, "fsFormFunctionData", void 0);
2034
+ FsFormFunctionDirective = __decorate([
2035
+ core.Directive({
2036
+ selector: '[fsFormFunction]',
2037
+ providers: [
2038
+ VALIDATE_MESSAGE_PROVIDER
2039
+ ],
2040
+ })
2041
+ ], FsFormFunctionDirective);
2042
+ return FsFormFunctionDirective;
2034
2043
  }(FsControlDirective));
2035
2044
 
2036
- var FsFormGreaterDirective = /** @class */ (function (_super) {
2037
- __extends(FsFormGreaterDirective, _super);
2038
- function FsFormGreaterDirective() {
2039
- return _super !== null && _super.apply(this, arguments) || this;
2040
- }
2041
- Object.defineProperty(FsFormGreaterDirective.prototype, "validationMessage", {
2042
- set: function (value) {
2043
- this._validateMessages.greater = value;
2044
- },
2045
- enumerable: true,
2046
- configurable: true
2047
- });
2048
- FsFormGreaterDirective.prototype.ngOnChanges = function () {
2049
- this._control.updateValueAndValidity();
2050
- };
2051
- FsFormGreaterDirective.prototype.validate = function (control) {
2052
- var greater = parseFloat(this.fsFormGreater);
2053
- var value = parseFloat(this._control.value);
2054
- if (!isNaN(greater) && !isNaN(value) && value <= greater) {
2055
- return { greater: { greater: greater, actual: value } };
2056
- }
2057
- return FsValidators.numeric(this._control);
2058
- };
2059
- __decorate([
2060
- core.Input(),
2061
- __metadata("design:type", Object)
2062
- ], FsFormGreaterDirective.prototype, "fsFormGreater", void 0);
2063
- __decorate([
2064
- core.Input('fsFormGreaterMessage'),
2065
- __metadata("design:type", String),
2066
- __metadata("design:paramtypes", [String])
2067
- ], FsFormGreaterDirective.prototype, "validationMessage", null);
2068
- FsFormGreaterDirective = __decorate([
2069
- core.Directive({
2070
- selector: '[fsFormGreater]',
2071
- providers: [
2072
- VALIDATE_MESSAGE_PROVIDER
2073
- ],
2074
- })
2075
- ], FsFormGreaterDirective);
2076
- return FsFormGreaterDirective;
2045
+ var FsFormGreaterDirective = /** @class */ (function (_super) {
2046
+ __extends(FsFormGreaterDirective, _super);
2047
+ function FsFormGreaterDirective() {
2048
+ return _super !== null && _super.apply(this, arguments) || this;
2049
+ }
2050
+ Object.defineProperty(FsFormGreaterDirective.prototype, "validationMessage", {
2051
+ set: function (value) {
2052
+ this._validateMessages.greater = value;
2053
+ },
2054
+ enumerable: true,
2055
+ configurable: true
2056
+ });
2057
+ FsFormGreaterDirective.prototype.ngOnChanges = function () {
2058
+ this._control.updateValueAndValidity();
2059
+ };
2060
+ FsFormGreaterDirective.prototype.validate = function (control) {
2061
+ var greater = parseFloat(this.fsFormGreater);
2062
+ var value = parseFloat(this._control.value);
2063
+ if (!isNaN(greater) && !isNaN(value) && value <= greater) {
2064
+ return { greater: { greater: greater, actual: value } };
2065
+ }
2066
+ return FsValidators.numeric(this._control);
2067
+ };
2068
+ __decorate([
2069
+ core.Input(),
2070
+ __metadata("design:type", Object)
2071
+ ], FsFormGreaterDirective.prototype, "fsFormGreater", void 0);
2072
+ __decorate([
2073
+ core.Input('fsFormGreaterMessage'),
2074
+ __metadata("design:type", String),
2075
+ __metadata("design:paramtypes", [String])
2076
+ ], FsFormGreaterDirective.prototype, "validationMessage", null);
2077
+ FsFormGreaterDirective = __decorate([
2078
+ core.Directive({
2079
+ selector: '[fsFormGreater]',
2080
+ providers: [
2081
+ VALIDATE_MESSAGE_PROVIDER
2082
+ ],
2083
+ })
2084
+ ], FsFormGreaterDirective);
2085
+ return FsFormGreaterDirective;
2077
2086
  }(FsControlDirective));
2078
2087
 
2079
- var FsFormDateRangeDirective = /** @class */ (function (_super) {
2080
- __extends(FsFormDateRangeDirective, _super);
2081
- function FsFormDateRangeDirective() {
2082
- return _super !== null && _super.apply(this, arguments) || this;
2083
- }
2084
- Object.defineProperty(FsFormDateRangeDirective.prototype, "validationMessage", {
2085
- set: function (value) {
2086
- this._validateMessages.dateRange = value;
2087
- },
2088
- enumerable: true,
2089
- configurable: true
2090
- });
2091
- FsFormDateRangeDirective.prototype.ngOnChanges = function () {
2092
- this._control.updateValueAndValidity();
2093
- };
2094
- FsFormDateRangeDirective.prototype.validate = function (control) {
2095
- if (isEnabled(this.fsFormDateRange)) {
2096
- return FsValidators.dateRange(this._control);
2097
- }
2098
- else {
2099
- return null;
2100
- }
2101
- };
2102
- __decorate([
2103
- core.Input(),
2104
- __metadata("design:type", Object)
2105
- ], FsFormDateRangeDirective.prototype, "fsFormDateRange", void 0);
2106
- __decorate([
2107
- core.Input('fsFormDateRangeMessage'),
2108
- __metadata("design:type", String),
2109
- __metadata("design:paramtypes", [String])
2110
- ], FsFormDateRangeDirective.prototype, "validationMessage", null);
2111
- FsFormDateRangeDirective = __decorate([
2112
- core.Directive({
2113
- selector: '[fsFormDateRange]',
2114
- providers: [
2115
- VALIDATE_MESSAGE_PROVIDER
2116
- ],
2117
- })
2118
- ], FsFormDateRangeDirective);
2119
- return FsFormDateRangeDirective;
2088
+ var FsFormDateRangeDirective = /** @class */ (function (_super) {
2089
+ __extends(FsFormDateRangeDirective, _super);
2090
+ function FsFormDateRangeDirective() {
2091
+ return _super !== null && _super.apply(this, arguments) || this;
2092
+ }
2093
+ Object.defineProperty(FsFormDateRangeDirective.prototype, "validationMessage", {
2094
+ set: function (value) {
2095
+ this._validateMessages.dateRange = value;
2096
+ },
2097
+ enumerable: true,
2098
+ configurable: true
2099
+ });
2100
+ FsFormDateRangeDirective.prototype.ngOnChanges = function () {
2101
+ this._control.updateValueAndValidity();
2102
+ };
2103
+ FsFormDateRangeDirective.prototype.validate = function (control) {
2104
+ if (isEnabled(this.fsFormDateRange)) {
2105
+ return FsValidators.dateRange(this._control);
2106
+ }
2107
+ else {
2108
+ return null;
2109
+ }
2110
+ };
2111
+ __decorate([
2112
+ core.Input(),
2113
+ __metadata("design:type", Object)
2114
+ ], FsFormDateRangeDirective.prototype, "fsFormDateRange", void 0);
2115
+ __decorate([
2116
+ core.Input('fsFormDateRangeMessage'),
2117
+ __metadata("design:type", String),
2118
+ __metadata("design:paramtypes", [String])
2119
+ ], FsFormDateRangeDirective.prototype, "validationMessage", null);
2120
+ FsFormDateRangeDirective = __decorate([
2121
+ core.Directive({
2122
+ selector: '[fsFormDateRange]',
2123
+ providers: [
2124
+ VALIDATE_MESSAGE_PROVIDER
2125
+ ],
2126
+ })
2127
+ ], FsFormDateRangeDirective);
2128
+ return FsFormDateRangeDirective;
2120
2129
  }(FsControlDirective));
2121
2130
 
2122
- var FsFormLesserDirective = /** @class */ (function (_super) {
2123
- __extends(FsFormLesserDirective, _super);
2124
- function FsFormLesserDirective() {
2125
- return _super !== null && _super.apply(this, arguments) || this;
2126
- }
2127
- Object.defineProperty(FsFormLesserDirective.prototype, "validationMessage", {
2128
- set: function (value) {
2129
- this._validateMessages.lesser = value;
2130
- },
2131
- enumerable: true,
2132
- configurable: true
2133
- });
2134
- FsFormLesserDirective.prototype.ngOnChanges = function () {
2135
- this._control.updateValueAndValidity();
2136
- };
2137
- FsFormLesserDirective.prototype.validate = function (control) {
2138
- var lesser = parseFloat(this.fsFormLesser);
2139
- var value = parseFloat(this._control.value);
2140
- if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
2141
- return { lesser: { lesser: lesser, actual: value } };
2142
- }
2143
- return FsValidators.numeric(this._control);
2144
- };
2145
- __decorate([
2146
- core.Input(),
2147
- __metadata("design:type", Object)
2148
- ], FsFormLesserDirective.prototype, "fsFormLesser", void 0);
2149
- __decorate([
2150
- core.Input('fsFormLesserMessage'),
2151
- __metadata("design:type", String),
2152
- __metadata("design:paramtypes", [String])
2153
- ], FsFormLesserDirective.prototype, "validationMessage", null);
2154
- FsFormLesserDirective = __decorate([
2155
- core.Directive({
2156
- selector: '[fsFormLesser]',
2157
- providers: [
2158
- VALIDATE_MESSAGE_PROVIDER
2159
- ],
2160
- })
2161
- ], FsFormLesserDirective);
2162
- return FsFormLesserDirective;
2131
+ var FsFormLesserDirective = /** @class */ (function (_super) {
2132
+ __extends(FsFormLesserDirective, _super);
2133
+ function FsFormLesserDirective() {
2134
+ return _super !== null && _super.apply(this, arguments) || this;
2135
+ }
2136
+ Object.defineProperty(FsFormLesserDirective.prototype, "validationMessage", {
2137
+ set: function (value) {
2138
+ this._validateMessages.lesser = value;
2139
+ },
2140
+ enumerable: true,
2141
+ configurable: true
2142
+ });
2143
+ FsFormLesserDirective.prototype.ngOnChanges = function () {
2144
+ this._control.updateValueAndValidity();
2145
+ };
2146
+ FsFormLesserDirective.prototype.validate = function (control) {
2147
+ var lesser = parseFloat(this.fsFormLesser);
2148
+ var value = parseFloat(this._control.value);
2149
+ if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
2150
+ return { lesser: { lesser: lesser, actual: value } };
2151
+ }
2152
+ return FsValidators.numeric(this._control);
2153
+ };
2154
+ __decorate([
2155
+ core.Input(),
2156
+ __metadata("design:type", Object)
2157
+ ], FsFormLesserDirective.prototype, "fsFormLesser", void 0);
2158
+ __decorate([
2159
+ core.Input('fsFormLesserMessage'),
2160
+ __metadata("design:type", String),
2161
+ __metadata("design:paramtypes", [String])
2162
+ ], FsFormLesserDirective.prototype, "validationMessage", null);
2163
+ FsFormLesserDirective = __decorate([
2164
+ core.Directive({
2165
+ selector: '[fsFormLesser]',
2166
+ providers: [
2167
+ VALIDATE_MESSAGE_PROVIDER
2168
+ ],
2169
+ })
2170
+ ], FsFormLesserDirective);
2171
+ return FsFormLesserDirective;
2163
2172
  }(FsControlDirective));
2164
2173
 
2165
- var FsFormUrlDirective = /** @class */ (function (_super) {
2166
- __extends(FsFormUrlDirective, _super);
2167
- function FsFormUrlDirective() {
2168
- var _this = _super !== null && _super.apply(this, arguments) || this;
2169
- _this.fsFormUrlProtocol = false;
2170
- return _this;
2171
- }
2172
- Object.defineProperty(FsFormUrlDirective.prototype, "validationMessage", {
2173
- set: function (value) {
2174
- this._validateMessages.url = value;
2175
- },
2176
- enumerable: true,
2177
- configurable: true
2178
- });
2179
- FsFormUrlDirective.prototype.ngOnChanges = function () {
2180
- this._control.updateValueAndValidity();
2181
- };
2182
- FsFormUrlDirective.prototype.validate = function (control) {
2183
- if (isEnabled(this.fsFormUrl)) {
2184
- return FsValidators.url(this._control, this.fsFormUrlProtocol);
2185
- }
2186
- else {
2187
- return null;
2188
- }
2189
- };
2190
- __decorate([
2191
- core.Input(),
2192
- __metadata("design:type", Object)
2193
- ], FsFormUrlDirective.prototype, "fsFormUrl", void 0);
2194
- __decorate([
2195
- core.Input(),
2196
- __metadata("design:type", Object)
2197
- ], FsFormUrlDirective.prototype, "fsFormUrlProtocol", void 0);
2198
- __decorate([
2199
- core.Input('fsFormUrlMessage'),
2200
- __metadata("design:type", String),
2201
- __metadata("design:paramtypes", [String])
2202
- ], FsFormUrlDirective.prototype, "validationMessage", null);
2203
- FsFormUrlDirective = __decorate([
2204
- core.Directive({
2205
- selector: '[fsFormUrl]',
2206
- providers: [
2207
- VALIDATE_MESSAGE_PROVIDER
2208
- ],
2209
- })
2210
- ], FsFormUrlDirective);
2211
- return FsFormUrlDirective;
2174
+ var FsFormUrlDirective = /** @class */ (function (_super) {
2175
+ __extends(FsFormUrlDirective, _super);
2176
+ function FsFormUrlDirective() {
2177
+ var _this = _super !== null && _super.apply(this, arguments) || this;
2178
+ _this.fsFormUrlProtocol = false;
2179
+ return _this;
2180
+ }
2181
+ Object.defineProperty(FsFormUrlDirective.prototype, "validationMessage", {
2182
+ set: function (value) {
2183
+ this._validateMessages.url = value;
2184
+ },
2185
+ enumerable: true,
2186
+ configurable: true
2187
+ });
2188
+ FsFormUrlDirective.prototype.ngOnChanges = function () {
2189
+ this._control.updateValueAndValidity();
2190
+ };
2191
+ FsFormUrlDirective.prototype.validate = function (control) {
2192
+ if (isEnabled(this.fsFormUrl)) {
2193
+ return FsValidators.url(this._control, this.fsFormUrlProtocol);
2194
+ }
2195
+ else {
2196
+ return null;
2197
+ }
2198
+ };
2199
+ __decorate([
2200
+ core.Input(),
2201
+ __metadata("design:type", Object)
2202
+ ], FsFormUrlDirective.prototype, "fsFormUrl", void 0);
2203
+ __decorate([
2204
+ core.Input(),
2205
+ __metadata("design:type", Object)
2206
+ ], FsFormUrlDirective.prototype, "fsFormUrlProtocol", void 0);
2207
+ __decorate([
2208
+ core.Input('fsFormUrlMessage'),
2209
+ __metadata("design:type", String),
2210
+ __metadata("design:paramtypes", [String])
2211
+ ], FsFormUrlDirective.prototype, "validationMessage", null);
2212
+ FsFormUrlDirective = __decorate([
2213
+ core.Directive({
2214
+ selector: '[fsFormUrl]',
2215
+ providers: [
2216
+ VALIDATE_MESSAGE_PROVIDER
2217
+ ],
2218
+ })
2219
+ ], FsFormUrlDirective);
2220
+ return FsFormUrlDirective;
2212
2221
  }(FsControlDirective));
2213
2222
 
2214
- var FsSubmitButtonDirective = /** @class */ (function () {
2215
- function FsSubmitButtonDirective(_matButton, _form, _elementRef, _cdRef) {
2216
- this._matButton = _matButton;
2217
- this._form = _form;
2218
- this._elementRef = _elementRef;
2219
- this._cdRef = _cdRef;
2220
- this.dirtySubmit = true;
2221
- this.transitionStyle = null;
2222
- this.active = false;
2223
- this._destroy$ = new rxjs.Subject();
2224
- }
2225
- FsSubmitButtonDirective.prototype.ngOnInit = function () {
2226
- var _this = this;
2227
- if (this._form) {
2228
- this._form.addSubmitButton(this);
2229
- rxjs.fromEvent(this.element, 'click')
2230
- .pipe(operators.takeUntil(this._destroy$))
2231
- .subscribe(function () {
2232
- _this.active = true;
2233
- });
2234
- if (this.dirtySubmit) {
2235
- if (this._form.dirtySubmitButton) {
2236
- if (!this._form.ngForm.dirty) {
2237
- this.disable();
2238
- }
2239
- }
2240
- }
2241
- this.transitionStyle = 'none';
2242
- setTimeout(function () {
2243
- _this.transitionStyle = null;
2244
- }, 500);
2245
- }
2246
- };
2247
- FsSubmitButtonDirective.prototype.disable = function () {
2248
- if (this._matButton) {
2249
- this._matButton.disabled = true;
2250
- this._cdRef.markForCheck();
2251
- }
2252
- };
2253
- FsSubmitButtonDirective.prototype.enable = function () {
2254
- if (this._matButton) {
2255
- this._matButton.disabled = false;
2256
- this._matButton.disableRipple = true;
2257
- this._cdRef.markForCheck();
2258
- }
2259
- };
2260
- FsSubmitButtonDirective.prototype.process = function () {
2261
- this.setClass('process');
2262
- this._matButton.disableRipple = true;
2263
- };
2264
- FsSubmitButtonDirective.prototype.success = function () {
2265
- this.setClass('success');
2266
- this._matButton.disableRipple = false;
2267
- };
2268
- FsSubmitButtonDirective.prototype.error = function () {
2269
- this.setClass('error');
2270
- this._matButton.disableRipple = false;
2271
- };
2272
- FsSubmitButtonDirective.prototype.setClass = function (cls) {
2273
- var svg = this._getSvg(cls);
2274
- this._resetClass();
2275
- this._disableShadowAnimation();
2276
- this.element.classList.add("submit-" + cls);
2277
- this.element.append(svg);
2278
- };
2279
- Object.defineProperty(FsSubmitButtonDirective.prototype, "element", {
2280
- get: function () {
2281
- return this._elementRef.nativeElement;
2282
- },
2283
- enumerable: true,
2284
- configurable: true
2285
- });
2286
- FsSubmitButtonDirective.prototype.reset = function () {
2287
- this.active = false;
2288
- this.enable();
2289
- this.element.querySelectorAll('.svg-icon')
2290
- .forEach(function (el) {
2291
- el.remove();
2292
- });
2293
- this._matButton.disableRipple = false;
2294
- this._resetClass();
2295
- };
2296
- FsSubmitButtonDirective.prototype.ngOnDestroy = function () {
2297
- this._destroy$.next();
2298
- this._destroy$.complete();
2299
- this._form.removeSubmitButton(this);
2300
- };
2301
- FsSubmitButtonDirective.prototype._disableShadowAnimation = function () {
2302
- // .mat-elevation-z2 removes the click shadow animation
2303
- //this.element.classList.add('mat-elevation-z2');
2304
- };
2305
- FsSubmitButtonDirective.prototype._resetClass = function () {
2306
- this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2307
- };
2308
- FsSubmitButtonDirective.prototype._getSvg = function (type) {
2309
- if (type === 'success') {
2310
- 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;
2311
- }
2312
- if (type === 'process') {
2313
- return new DOMParser().parseFromString("<svg class=\"svg-icon svg-icon-process\" width=\"38\" height=\"38\" viewBox=\"0 0 38 38\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(1 1)\" stroke-width=\"2\"><circle stroke-opacity=\".5\" cx=\"18\" cy=\"18\" r=\"18\"/>\n <path d=\"M36 18c0-9.94-8.06-18-18-18\"><animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 18 18\" to=\"360 18 18\" dur=\".7s\" repeatCount=\"indefinite\"/></path>\n </g>\n </g>\n </svg>", 'text/xml').firstChild;
2314
- }
2315
- if (type === 'error') {
2316
- 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;
2317
- }
2318
- };
2319
- FsSubmitButtonDirective.ctorParameters = function () { return [
2320
- { type: button.MatButton, decorators: [{ type: core.Optional }, { type: core.Host }] },
2321
- { type: FsFormDirective, decorators: [{ type: core.Optional }] },
2322
- { type: core.ElementRef },
2323
- { type: core.ChangeDetectorRef }
2324
- ]; };
2325
- __decorate([
2326
- core.Input(),
2327
- __metadata("design:type", Object)
2328
- ], FsSubmitButtonDirective.prototype, "name", void 0);
2329
- __decorate([
2330
- core.Input(),
2331
- __metadata("design:type", Object)
2332
- ], FsSubmitButtonDirective.prototype, "dirtySubmit", void 0);
2333
- __decorate([
2334
- core.HostBinding('style.transition'),
2335
- __metadata("design:type", Object)
2336
- ], FsSubmitButtonDirective.prototype, "transitionStyle", void 0);
2337
- FsSubmitButtonDirective = __decorate([
2338
- core.Directive({
2339
- selector: 'button[type="submit"]',
2340
- }),
2341
- __param(0, core.Optional()), __param(0, core.Host()),
2342
- __param(1, core.Optional()),
2343
- __metadata("design:paramtypes", [button.MatButton,
2344
- FsFormDirective,
2345
- core.ElementRef,
2346
- core.ChangeDetectorRef])
2347
- ], FsSubmitButtonDirective);
2348
- return FsSubmitButtonDirective;
2223
+ var FsSubmitButtonDirective = /** @class */ (function () {
2224
+ function FsSubmitButtonDirective(_matButton, _form, _elementRef, _cdRef) {
2225
+ this._matButton = _matButton;
2226
+ this._form = _form;
2227
+ this._elementRef = _elementRef;
2228
+ this._cdRef = _cdRef;
2229
+ this.dirtySubmit = true;
2230
+ this.transitionStyle = null;
2231
+ this.active = false;
2232
+ this._destroy$ = new rxjs.Subject();
2233
+ }
2234
+ FsSubmitButtonDirective.prototype.ngOnInit = function () {
2235
+ var _this = this;
2236
+ if (this._form) {
2237
+ this._form.addSubmitButton(this);
2238
+ rxjs.fromEvent(this.element, 'click')
2239
+ .pipe(operators.takeUntil(this._destroy$))
2240
+ .subscribe(function () {
2241
+ _this.active = true;
2242
+ });
2243
+ if (this.dirtySubmit) {
2244
+ if (this._form.dirtySubmitButton) {
2245
+ if (!this._form.ngForm.dirty) {
2246
+ this.disable();
2247
+ }
2248
+ }
2249
+ }
2250
+ this.transitionStyle = 'none';
2251
+ setTimeout(function () {
2252
+ _this.transitionStyle = null;
2253
+ }, 500);
2254
+ }
2255
+ };
2256
+ FsSubmitButtonDirective.prototype.disable = function () {
2257
+ if (this._matButton) {
2258
+ this._matButton.disabled = true;
2259
+ this._cdRef.markForCheck();
2260
+ }
2261
+ };
2262
+ FsSubmitButtonDirective.prototype.enable = function () {
2263
+ if (this._matButton) {
2264
+ this._matButton.disabled = false;
2265
+ this._matButton.disableRipple = true;
2266
+ this._cdRef.markForCheck();
2267
+ }
2268
+ };
2269
+ FsSubmitButtonDirective.prototype.process = function () {
2270
+ this.setClass('process');
2271
+ this._matButton.disableRipple = true;
2272
+ };
2273
+ FsSubmitButtonDirective.prototype.success = function () {
2274
+ this.setClass('success');
2275
+ this._matButton.disableRipple = false;
2276
+ };
2277
+ FsSubmitButtonDirective.prototype.error = function () {
2278
+ this.setClass('error');
2279
+ this._matButton.disableRipple = false;
2280
+ };
2281
+ FsSubmitButtonDirective.prototype.setClass = function (cls) {
2282
+ var svg = this._getSvg(cls);
2283
+ this._resetClass();
2284
+ this._disableShadowAnimation();
2285
+ this.element.classList.add("submit-" + cls);
2286
+ this.element.append(svg);
2287
+ };
2288
+ Object.defineProperty(FsSubmitButtonDirective.prototype, "element", {
2289
+ get: function () {
2290
+ return this._elementRef.nativeElement;
2291
+ },
2292
+ enumerable: true,
2293
+ configurable: true
2294
+ });
2295
+ FsSubmitButtonDirective.prototype.reset = function () {
2296
+ this.active = false;
2297
+ this.enable();
2298
+ this.element.querySelectorAll('.svg-icon')
2299
+ .forEach(function (el) {
2300
+ el.remove();
2301
+ });
2302
+ this._matButton.disableRipple = false;
2303
+ this._resetClass();
2304
+ };
2305
+ FsSubmitButtonDirective.prototype.ngOnDestroy = function () {
2306
+ this._destroy$.next();
2307
+ this._destroy$.complete();
2308
+ this._form.removeSubmitButton(this);
2309
+ };
2310
+ FsSubmitButtonDirective.prototype._disableShadowAnimation = function () {
2311
+ // .mat-elevation-z2 removes the click shadow animation
2312
+ //this.element.classList.add('mat-elevation-z2');
2313
+ };
2314
+ FsSubmitButtonDirective.prototype._resetClass = function () {
2315
+ this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2316
+ };
2317
+ FsSubmitButtonDirective.prototype._getSvg = function (type) {
2318
+ if (type === 'success') {
2319
+ 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;
2320
+ }
2321
+ if (type === 'process') {
2322
+ return new DOMParser().parseFromString("<svg class=\"svg-icon svg-icon-process\" width=\"38\" height=\"38\" viewBox=\"0 0 38 38\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(1 1)\" stroke-width=\"2\"><circle stroke-opacity=\".5\" cx=\"18\" cy=\"18\" r=\"18\"/>\n <path d=\"M36 18c0-9.94-8.06-18-18-18\"><animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 18 18\" to=\"360 18 18\" dur=\".7s\" repeatCount=\"indefinite\"/></path>\n </g>\n </g>\n </svg>", 'text/xml').firstChild;
2323
+ }
2324
+ if (type === 'error') {
2325
+ 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;
2326
+ }
2327
+ };
2328
+ FsSubmitButtonDirective.ctorParameters = function () { return [
2329
+ { type: button.MatButton, decorators: [{ type: core.Optional }, { type: core.Host }] },
2330
+ { type: FsFormDirective, decorators: [{ type: core.Optional }] },
2331
+ { type: core.ElementRef },
2332
+ { type: core.ChangeDetectorRef }
2333
+ ]; };
2334
+ __decorate([
2335
+ core.Input(),
2336
+ __metadata("design:type", Object)
2337
+ ], FsSubmitButtonDirective.prototype, "name", void 0);
2338
+ __decorate([
2339
+ core.Input(),
2340
+ __metadata("design:type", Object)
2341
+ ], FsSubmitButtonDirective.prototype, "dirtySubmit", void 0);
2342
+ __decorate([
2343
+ core.HostBinding('style.transition'),
2344
+ __metadata("design:type", Object)
2345
+ ], FsSubmitButtonDirective.prototype, "transitionStyle", void 0);
2346
+ FsSubmitButtonDirective = __decorate([
2347
+ core.Directive({
2348
+ selector: 'button[type="submit"]',
2349
+ }),
2350
+ __param(0, core.Optional()), __param(0, core.Host()),
2351
+ __param(1, core.Optional()),
2352
+ __metadata("design:paramtypes", [button.MatButton,
2353
+ FsFormDirective,
2354
+ core.ElementRef,
2355
+ core.ChangeDetectorRef])
2356
+ ], FsSubmitButtonDirective);
2357
+ return FsSubmitButtonDirective;
2349
2358
  }());
2350
2359
 
2351
- var FsFormValidateDirective = /** @class */ (function (_super) {
2352
- __extends(FsFormValidateDirective, _super);
2353
- function FsFormValidateDirective() {
2354
- return _super !== null && _super.apply(this, arguments) || this;
2355
- }
2356
- FsFormValidateDirective.prototype.ngOnChanges = function () {
2357
- this._control.updateValueAndValidity();
2358
- };
2359
- FsFormValidateDirective.prototype.validateAsync = function (control) {
2360
- return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2361
- };
2362
- __decorate([
2363
- core.Input('validate'),
2364
- __metadata("design:type", Object)
2365
- ], FsFormValidateDirective.prototype, "validateFn", void 0);
2366
- __decorate([
2367
- core.Input('validateData'),
2368
- __metadata("design:type", Object)
2369
- ], FsFormValidateDirective.prototype, "validateFnData", void 0);
2370
- FsFormValidateDirective = __decorate([
2371
- core.Directive({
2372
- selector: '[validate]',
2373
- providers: [
2374
- VALIDATE_MESSAGE_PROVIDER
2375
- ],
2376
- })
2377
- ], FsFormValidateDirective);
2378
- return FsFormValidateDirective;
2360
+ var FsFormValidateDirective = /** @class */ (function (_super) {
2361
+ __extends(FsFormValidateDirective, _super);
2362
+ function FsFormValidateDirective() {
2363
+ return _super !== null && _super.apply(this, arguments) || this;
2364
+ }
2365
+ FsFormValidateDirective.prototype.ngOnChanges = function () {
2366
+ this._control.updateValueAndValidity();
2367
+ };
2368
+ FsFormValidateDirective.prototype.validateAsync = function (control) {
2369
+ return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2370
+ };
2371
+ __decorate([
2372
+ core.Input('validate'),
2373
+ __metadata("design:type", Object)
2374
+ ], FsFormValidateDirective.prototype, "validateFn", void 0);
2375
+ __decorate([
2376
+ core.Input('validateData'),
2377
+ __metadata("design:type", Object)
2378
+ ], FsFormValidateDirective.prototype, "validateFnData", void 0);
2379
+ FsFormValidateDirective = __decorate([
2380
+ core.Directive({
2381
+ selector: '[validate]',
2382
+ providers: [
2383
+ VALIDATE_MESSAGE_PROVIDER
2384
+ ],
2385
+ })
2386
+ ], FsFormValidateDirective);
2387
+ return FsFormValidateDirective;
2379
2388
  }(FsControlDirective));
2380
2389
 
2381
- var FsFormDialogActionsComponent = /** @class */ (function () {
2382
- function FsFormDialogActionsComponent(_form, _cdRef) {
2383
- this._form = _form;
2384
- this._cdRef = _cdRef;
2385
- this.save = true;
2386
- this.create = false;
2387
- this.close = false;
2388
- this.dirty = false;
2389
- this._destroy$ = new rxjs.Subject();
2390
- }
2391
- FsFormDialogActionsComponent.prototype.ngOnInit = function () {
2392
- var _this = this;
2393
- this._form.ngForm.valueChanges
2394
- .pipe(operators.filter(function () { return (!_this.dirty); }), operators.takeUntil(this._destroy$))
2395
- .subscribe(function () {
2396
- _this.dirty = _this._form.ngForm.dirty;
2397
- _this._cdRef.markForCheck();
2398
- });
2399
- this._form.submitted
2400
- .pipe(operators.delay(50), operators.takeUntil(this._destroy$))
2401
- .subscribe(function () {
2402
- _this.dirty = false;
2403
- _this._cdRef.markForCheck();
2404
- });
2405
- };
2406
- FsFormDialogActionsComponent.prototype.ngOnDestroy = function () {
2407
- this._destroy$.next();
2408
- this._destroy$.complete();
2409
- };
2410
- FsFormDialogActionsComponent.ctorParameters = function () { return [
2411
- { type: FsFormDirective, decorators: [{ type: core.Optional }] },
2412
- { type: core.ChangeDetectorRef }
2413
- ]; };
2414
- __decorate([
2415
- core.Input(),
2416
- __metadata("design:type", Object)
2417
- ], FsFormDialogActionsComponent.prototype, "save", void 0);
2418
- __decorate([
2419
- core.Input(),
2420
- __metadata("design:type", Object)
2421
- ], FsFormDialogActionsComponent.prototype, "create", void 0);
2422
- __decorate([
2423
- core.Input(),
2424
- __metadata("design:type", Object)
2425
- ], FsFormDialogActionsComponent.prototype, "close", void 0);
2426
- __decorate([
2427
- core.Input(),
2428
- __metadata("design:type", String)
2429
- ], FsFormDialogActionsComponent.prototype, "name", void 0);
2430
- FsFormDialogActionsComponent = __decorate([
2431
- core.Component({
2432
- selector: 'fs-form-dialog-actions',
2433
- template: "<div class=\"buttons\">\r\n <ng-container *ngIf=\"save\">\r\n <button \r\n mat-button \r\n type=\"submit\"\r\n color=\"primary\" \r\n [name]=\"name\">\r\n {{create ? 'Create' : 'Save'}}\r\n </button>\r\n <button \r\n mat-button \r\n type=\"button\"\r\n [disabled]=\"close && !dirty && !create\"\r\n [matDialogClose]=\"null\">\r\n Cancel\r\n </button>\r\n </ng-container>\r\n\r\n <ng-content></ng-content>\r\n <div class=\"close\" *ngIf=\"close\">\r\n <button \r\n mat-button \r\n type=\"button\"\r\n [color]=\"dirty ? 'basic' : 'primary'\"\r\n [matDialogClose]=\"null\">\r\n Close\r\n </button>\r\n </div>\r\n</div>",
2434
- changeDetection: core.ChangeDetectionStrategy.OnPush,
2435
- styles: [".buttons{display:flex;flex-grow:1;align-items:center}.buttons .close{display:flex;flex-grow:1;justify-content:flex-end}:host{display:flex;flex-grow:1}"]
2436
- }),
2437
- __param(0, core.Optional()),
2438
- __metadata("design:paramtypes", [FsFormDirective,
2439
- core.ChangeDetectorRef])
2440
- ], FsFormDialogActionsComponent);
2441
- return FsFormDialogActionsComponent;
2390
+ var FsFormDialogActionsComponent = /** @class */ (function () {
2391
+ function FsFormDialogActionsComponent(_form, _dialogRef, _cdRef) {
2392
+ this._form = _form;
2393
+ this._dialogRef = _dialogRef;
2394
+ this._cdRef = _cdRef;
2395
+ this.save = true;
2396
+ this.create = false;
2397
+ this.close = false;
2398
+ this.dirty = false;
2399
+ this._destroy$ = new rxjs.Subject();
2400
+ }
2401
+ FsFormDialogActionsComponent.prototype.ngOnInit = function () {
2402
+ var _this = this;
2403
+ if (this._form) {
2404
+ this._form.ngForm.valueChanges
2405
+ .pipe(operators.filter(function () { return (!_this.dirty); }), operators.takeUntil(this._destroy$))
2406
+ .subscribe(function () {
2407
+ _this.dirty = _this._form.ngForm.dirty;
2408
+ _this._cdRef.markForCheck();
2409
+ });
2410
+ this._form.submitted
2411
+ .pipe(operators.delay(50), operators.takeUntil(this._destroy$))
2412
+ .subscribe(function () {
2413
+ _this.dirty = false;
2414
+ _this._cdRef.markForCheck();
2415
+ });
2416
+ this._form.reseted
2417
+ .pipe(operators.takeUntil(this._destroy$))
2418
+ .subscribe(function () {
2419
+ _this.dirty = false;
2420
+ _this._cdRef.markForCheck();
2421
+ });
2422
+ }
2423
+ };
2424
+ FsFormDialogActionsComponent.prototype.closeClick = function () {
2425
+ var _this = this;
2426
+ if (this._form) {
2427
+ this._form.triggerConfirm()
2428
+ .pipe(operators.filter(function (confirmResult) { return (confirmResult !== exports.ConfirmResult.Review); }), operators.takeUntil(this._destroy$))
2429
+ .subscribe(function () {
2430
+ _this._dialogRef.close(null);
2431
+ });
2432
+ }
2433
+ else {
2434
+ this._dialogRef.close(null);
2435
+ }
2436
+ };
2437
+ FsFormDialogActionsComponent.prototype.ngOnDestroy = function () {
2438
+ this._destroy$.next();
2439
+ this._destroy$.complete();
2440
+ };
2441
+ FsFormDialogActionsComponent.ctorParameters = function () { return [
2442
+ { type: FsFormDirective, decorators: [{ type: core.Optional }] },
2443
+ { type: dialog.MatDialogRef, decorators: [{ type: core.Optional }] },
2444
+ { type: core.ChangeDetectorRef }
2445
+ ]; };
2446
+ __decorate([
2447
+ core.Input(),
2448
+ __metadata("design:type", Object)
2449
+ ], FsFormDialogActionsComponent.prototype, "save", void 0);
2450
+ __decorate([
2451
+ core.Input(),
2452
+ __metadata("design:type", Object)
2453
+ ], FsFormDialogActionsComponent.prototype, "create", void 0);
2454
+ __decorate([
2455
+ core.Input(),
2456
+ __metadata("design:type", Object)
2457
+ ], FsFormDialogActionsComponent.prototype, "close", void 0);
2458
+ __decorate([
2459
+ core.Input(),
2460
+ __metadata("design:type", String)
2461
+ ], FsFormDialogActionsComponent.prototype, "name", void 0);
2462
+ FsFormDialogActionsComponent = __decorate([
2463
+ core.Component({
2464
+ selector: 'fs-form-dialog-actions',
2465
+ template: "<div class=\"buttons\">\r\n <ng-container *ngIf=\"save\">\r\n <button \r\n mat-button \r\n type=\"submit\"\r\n color=\"primary\" \r\n [name]=\"name\">\r\n {{create ? 'Create' : 'Save'}}\r\n </button>\r\n <button \r\n mat-button \r\n type=\"button\"\r\n [disabled]=\"close && !dirty && !create\"\r\n [matDialogClose]=\"null\">\r\n Cancel\r\n </button>\r\n </ng-container>\r\n\r\n <ng-content></ng-content>\r\n <div class=\"close\" *ngIf=\"close\">\r\n <button \r\n mat-button \r\n type=\"button\"\r\n [color]=\"dirty ? 'basic' : 'primary'\"\r\n (click)=\"closeClick()\">\r\n Close\r\n </button>\r\n </div>\r\n</div>",
2466
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
2467
+ styles: [".buttons{display:flex;flex-grow:1;align-items:center}.buttons .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}}"]
2468
+ }),
2469
+ __param(0, core.Optional()),
2470
+ __param(1, core.Optional()),
2471
+ __metadata("design:paramtypes", [FsFormDirective,
2472
+ dialog.MatDialogRef,
2473
+ core.ChangeDetectorRef])
2474
+ ], FsFormDialogActionsComponent);
2475
+ return FsFormDialogActionsComponent;
2442
2476
  }());
2443
2477
 
2444
- var FsFormModule = /** @class */ (function () {
2445
- function FsFormModule() {
2446
- }
2447
- FsFormModule_1 = FsFormModule;
2448
- FsFormModule.forRoot = function () {
2449
- return {
2450
- ngModule: FsFormModule_1,
2451
- };
2452
- };
2453
- var FsFormModule_1;
2454
- FsFormModule = FsFormModule_1 = __decorate([
2455
- core.NgModule({
2456
- imports: [
2457
- common.CommonModule,
2458
- forms.FormsModule,
2459
- button.MatButtonModule,
2460
- dialog.MatDialogModule,
2461
- ],
2462
- declarations: [
2463
- FsFormDirective,
2464
- FsControlDirective,
2465
- FsFormRequiredDirective,
2466
- FsFormMinDirective,
2467
- FsFormMaxDirective,
2468
- FsFormMinLengthDirective,
2469
- FsFormMaxLengthDirective,
2470
- FsFormEmailDirective,
2471
- FsFormEmailsDirective,
2472
- FsFormPhoneDirective,
2473
- FsFormCompareDirective,
2474
- FsFormIntegerDirective,
2475
- FsFormNumericDirective,
2476
- FsFormPatternDirective,
2477
- FsFormFunctionDirective,
2478
- FsFormDateRangeDirective,
2479
- FsFormGreaterDirective,
2480
- FsFormLesserDirective,
2481
- FsFormUrlDirective,
2482
- FsFormDialogCloseDirective,
2483
- FsSubmitButtonDirective,
2484
- FsFormValidateDirective,
2485
- FsFormDialogActionsComponent,
2486
- ],
2487
- exports: [
2488
- FsFormDirective,
2489
- FsControlDirective,
2490
- FsFormRequiredDirective,
2491
- FsFormMinDirective,
2492
- FsFormMaxDirective,
2493
- FsFormMinLengthDirective,
2494
- FsFormMaxLengthDirective,
2495
- FsFormEmailDirective,
2496
- FsFormEmailsDirective,
2497
- FsFormPhoneDirective,
2498
- FsFormCompareDirective,
2499
- FsFormIntegerDirective,
2500
- FsFormNumericDirective,
2501
- FsFormPatternDirective,
2502
- FsFormFunctionDirective,
2503
- FsFormDateRangeDirective,
2504
- FsFormGreaterDirective,
2505
- FsFormLesserDirective,
2506
- FsFormUrlDirective,
2507
- FsFormDialogCloseDirective,
2508
- FsSubmitButtonDirective,
2509
- FsFormValidateDirective,
2510
- FsFormDialogActionsComponent,
2511
- ],
2512
- providers: [
2513
- {
2514
- provide: core$1.ErrorStateMatcher,
2515
- useClass: core$1.ShowOnDirtyErrorStateMatcher,
2516
- },
2517
- ],
2518
- })
2519
- ], FsFormModule);
2520
- return FsFormModule;
2478
+ var FsFormModule = /** @class */ (function () {
2479
+ function FsFormModule() {
2480
+ }
2481
+ FsFormModule_1 = FsFormModule;
2482
+ FsFormModule.forRoot = function () {
2483
+ return {
2484
+ ngModule: FsFormModule_1,
2485
+ };
2486
+ };
2487
+ var FsFormModule_1;
2488
+ FsFormModule = FsFormModule_1 = __decorate([
2489
+ core.NgModule({
2490
+ imports: [
2491
+ common.CommonModule,
2492
+ forms.FormsModule,
2493
+ button.MatButtonModule,
2494
+ dialog.MatDialogModule,
2495
+ ],
2496
+ declarations: [
2497
+ FsFormDirective,
2498
+ FsControlDirective,
2499
+ FsFormRequiredDirective,
2500
+ FsFormMinDirective,
2501
+ FsFormMaxDirective,
2502
+ FsFormMinLengthDirective,
2503
+ FsFormMaxLengthDirective,
2504
+ FsFormEmailDirective,
2505
+ FsFormEmailsDirective,
2506
+ FsFormPhoneDirective,
2507
+ FsFormCompareDirective,
2508
+ FsFormIntegerDirective,
2509
+ FsFormNumericDirective,
2510
+ FsFormPatternDirective,
2511
+ FsFormFunctionDirective,
2512
+ FsFormDateRangeDirective,
2513
+ FsFormGreaterDirective,
2514
+ FsFormLesserDirective,
2515
+ FsFormUrlDirective,
2516
+ FsFormDialogCloseDirective,
2517
+ FsSubmitButtonDirective,
2518
+ FsFormValidateDirective,
2519
+ FsFormDialogActionsComponent,
2520
+ ],
2521
+ exports: [
2522
+ FsFormDirective,
2523
+ FsControlDirective,
2524
+ FsFormRequiredDirective,
2525
+ FsFormMinDirective,
2526
+ FsFormMaxDirective,
2527
+ FsFormMinLengthDirective,
2528
+ FsFormMaxLengthDirective,
2529
+ FsFormEmailDirective,
2530
+ FsFormEmailsDirective,
2531
+ FsFormPhoneDirective,
2532
+ FsFormCompareDirective,
2533
+ FsFormIntegerDirective,
2534
+ FsFormNumericDirective,
2535
+ FsFormPatternDirective,
2536
+ FsFormFunctionDirective,
2537
+ FsFormDateRangeDirective,
2538
+ FsFormGreaterDirective,
2539
+ FsFormLesserDirective,
2540
+ FsFormUrlDirective,
2541
+ FsFormDialogCloseDirective,
2542
+ FsSubmitButtonDirective,
2543
+ FsFormValidateDirective,
2544
+ FsFormDialogActionsComponent,
2545
+ ],
2546
+ providers: [
2547
+ {
2548
+ provide: core$1.ErrorStateMatcher,
2549
+ useClass: core$1.ShowOnDirtyErrorStateMatcher,
2550
+ },
2551
+ ],
2552
+ })
2553
+ ], FsFormModule);
2554
+ return FsFormModule;
2521
2555
  }());
2522
2556
 
2523
- var FormDeactivateGuard = /** @class */ (function () {
2524
- function FormDeactivateGuard(_prompt) {
2525
- this._prompt = _prompt;
2526
- }
2527
- FormDeactivateGuard.prototype.canDeactivate = function (directive) {
2528
- if (!('getForm' in directive)) {
2529
- var error = "Directive " + directive.constructor.name + " does not property implement interface FormDeactivate";
2530
- console.error(error);
2531
- return rxjs.of(true);
2532
- }
2533
- var form = directive.getForm();
2534
- if (!(form instanceof FsFormDirective)) {
2535
- var error = "Directive " + directive.constructor.name + ".getForm() does not return a valid FsFormDirective";
2536
- console.error(error);
2537
- return rxjs.of(true);
2538
- }
2539
- return confirmUnsaved(form, this._prompt)
2540
- .pipe(operators.map(function (result) {
2541
- return confirmResultContinue(result);
2542
- }));
2543
- };
2544
- FormDeactivateGuard.ctorParameters = function () { return [
2545
- { type: prompt.FsPrompt }
2546
- ]; };
2547
- FormDeactivateGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function FormDeactivateGuard_Factory() { return new FormDeactivateGuard(core.ɵɵinject(prompt.FsPrompt)); }, token: FormDeactivateGuard, providedIn: "root" });
2548
- FormDeactivateGuard = __decorate([
2549
- core.Injectable({
2550
- providedIn: 'root'
2551
- }),
2552
- __metadata("design:paramtypes", [prompt.FsPrompt])
2553
- ], FormDeactivateGuard);
2554
- return FormDeactivateGuard;
2557
+ var FormDeactivateGuard = /** @class */ (function () {
2558
+ function FormDeactivateGuard(_prompt) {
2559
+ this._prompt = _prompt;
2560
+ }
2561
+ FormDeactivateGuard.prototype.canDeactivate = function (directive) {
2562
+ if (!('getForm' in directive)) {
2563
+ var error = "Directive " + directive.constructor.name + " does not property implement interface FormDeactivate";
2564
+ console.error(error);
2565
+ return rxjs.of(true);
2566
+ }
2567
+ var form = directive.getForm();
2568
+ if (!(form instanceof FsFormDirective)) {
2569
+ var error = "Directive " + directive.constructor.name + ".getForm() does not return a valid FsFormDirective";
2570
+ console.error(error);
2571
+ return rxjs.of(true);
2572
+ }
2573
+ return confirmUnsaved(form, this._prompt)
2574
+ .pipe(operators.map(function (result) {
2575
+ return confirmResultContinue(result);
2576
+ }));
2577
+ };
2578
+ FormDeactivateGuard.ctorParameters = function () { return [
2579
+ { type: prompt.FsPrompt }
2580
+ ]; };
2581
+ FormDeactivateGuard.ɵprov = core.ɵɵdefineInjectable({ factory: function FormDeactivateGuard_Factory() { return new FormDeactivateGuard(core.ɵɵinject(prompt.FsPrompt)); }, token: FormDeactivateGuard, providedIn: "root" });
2582
+ FormDeactivateGuard = __decorate([
2583
+ core.Injectable({
2584
+ providedIn: 'root'
2585
+ }),
2586
+ __metadata("design:paramtypes", [prompt.FsPrompt])
2587
+ ], FormDeactivateGuard);
2588
+ return FormDeactivateGuard;
2555
2589
  }());
2556
2590
 
2557
2591
  exports.FormDeactivateGuard = FormDeactivateGuard;
@@ -2584,7 +2618,6 @@
2584
2618
  exports.ɵv = FsFormUrlDirective;
2585
2619
  exports.ɵw = FsSubmitButtonDirective;
2586
2620
  exports.ɵx = FsFormValidateDirective;
2587
- exports.ɵy = FsFormDialogActionsComponent;
2588
2621
 
2589
2622
  Object.defineProperty(exports, '__esModule', { value: true });
2590
2623