@firestitch/form 13.1.2 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/components/confirm-unsaved/confirm-unsaved.component.d.ts +21 -0
- package/app/components/confirm-unsaved/index.d.ts +1 -0
- package/app/components/form-dialog-actions/form-dialog-actions.component.d.ts +1 -1
- package/app/components/index.d.ts +1 -0
- package/app/consts/error-messages.const.d.ts +2 -0
- package/app/directives/button.directive.d.ts +2 -2
- package/app/directives/form/form.directive.d.ts +5 -7
- package/app/directives/form-dialog-close.directive.d.ts +2 -2
- package/app/directives/index.d.ts +2 -2
- package/app/directives/validators/compare.directive.d.ts +2 -2
- package/app/directives/validators/control.directive.d.ts +12 -12
- package/app/directives/validators/function.directive.d.ts +1 -1
- package/app/directives/validators/greater-equal.directive.d.ts +13 -0
- package/app/directives/validators/index.d.ts +2 -0
- package/app/directives/validators/integer.directive.d.ts +1 -1
- package/app/directives/validators/lesser-equal.directive.d.ts +13 -0
- package/app/directives/validators/no-fs-validators.directive.d.ts +1 -1
- package/app/directives/validators/required.directive.d.ts +1 -1
- package/app/enums/index.d.ts +2 -0
- package/app/fs-form.module.d.ts +20 -16
- package/app/guards/form-deactivate.guard.d.ts +2 -4
- package/app/helpers/index.d.ts +0 -1
- package/app/providers/validate-messages.provider.d.ts +2 -0
- package/app/services/fsform.service.d.ts +5 -1
- package/esm2020/app/components/confirm-unsaved/confirm-unsaved.component.mjs +44 -0
- package/esm2020/app/components/confirm-unsaved/index.mjs +2 -0
- package/esm2020/app/components/form-dialog-actions/form-dialog-actions.component.mjs +3 -3
- package/esm2020/app/components/form-dialog-actions/index.mjs +1 -1
- package/esm2020/app/components/index.mjs +2 -1
- package/esm2020/app/consts/error-messages.const.mjs +3 -1
- package/esm2020/app/directives/button.directive.mjs +6 -6
- package/esm2020/app/directives/form/form.directive.mjs +28 -32
- package/esm2020/app/directives/form/index.mjs +1 -1
- package/esm2020/app/directives/form-dialog-close.directive.mjs +6 -6
- package/esm2020/app/directives/index.mjs +3 -3
- package/esm2020/app/directives/validators/compare.directive.mjs +4 -6
- package/esm2020/app/directives/validators/control.directive.mjs +20 -21
- package/esm2020/app/directives/validators/function.directive.mjs +5 -5
- package/esm2020/app/directives/validators/greater-equal.directive.mjs +40 -0
- package/esm2020/app/directives/validators/index.mjs +3 -1
- package/esm2020/app/directives/validators/integer.directive.mjs +7 -9
- package/esm2020/app/directives/validators/lesser-equal.directive.mjs +40 -0
- package/esm2020/app/directives/validators/no-fs-validators.directive.mjs +3 -2
- package/esm2020/app/directives/validators/required.directive.mjs +6 -8
- package/esm2020/app/enums/index.mjs +3 -0
- package/esm2020/app/fs-form.module.mjs +40 -23
- package/esm2020/app/guards/form-deactivate.guard.mjs +13 -16
- package/esm2020/app/helpers/get-form-errors.mjs +1 -1
- package/esm2020/app/helpers/index.mjs +1 -2
- package/esm2020/app/services/fsform.service.mjs +59 -7
- package/esm2020/public_api.mjs +16 -17
- package/fesm2015/firestitch-form.mjs +979 -878
- package/fesm2015/firestitch-form.mjs.map +1 -1
- package/fesm2020/firestitch-form.mjs +965 -866
- package/fesm2020/firestitch-form.mjs.map +1 -1
- package/package.json +1 -5
- package/public_api.d.ts +16 -17
- package/app/helpers/confirm-unsaved.d.ts +0 -5
- package/esm2020/app/helpers/confirm-unsaved.mjs +0 -72
|
@@ -1,27 +1,67 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, EventEmitter, QueryList, Directive, Inject, Optional, Input, Output, HostBinding, ContentChildren, InjectionToken, Self, HostListener, Host, Component, ChangeDetectionStrategy, ViewChildren, ViewChild, NgModule } from '@angular/core';
|
|
3
1
|
import * as i4 from '@angular/common';
|
|
4
2
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as
|
|
6
|
-
import {
|
|
7
|
-
import * as i1$2 from '@angular/
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Component, ChangeDetectionStrategy, Inject, Injectable, EventEmitter, QueryList, Directive, Optional, Input, Output, HostBinding, ContentChildren, Host, HostListener, ViewChild, ViewChildren, InjectionToken, Self, NgModule } from '@angular/core';
|
|
5
|
+
import * as i1$2 from '@angular/forms';
|
|
6
|
+
import { FormGroup, NgForm, NgModel, Validators, FormsModule } from '@angular/forms';
|
|
7
|
+
import * as i1$1 from '@angular/material/button';
|
|
8
8
|
import { MatButtonModule } from '@angular/material/button';
|
|
9
|
-
import * as i2$1 from '@angular/material/dialog';
|
|
10
|
-
import { MatDialogRef, MatDialogModule } from '@angular/material/dialog';
|
|
11
9
|
import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core';
|
|
10
|
+
import * as i1 from '@angular/material/dialog';
|
|
11
|
+
import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';
|
|
12
|
+
import * as i2 from '@firestitch/dialog';
|
|
13
|
+
import { FsDialogModule } from '@firestitch/dialog';
|
|
14
|
+
import { Subject, of, merge, BehaviorSubject, throwError, fromEvent, iif, defer, from, isObservable } from 'rxjs';
|
|
15
|
+
import { filter, map, switchMap, first, mapTo, take, takeUntil, mergeMap, tap, catchError, delay, startWith } from 'rxjs/operators';
|
|
12
16
|
import { MatTabGroup } from '@angular/material/tabs';
|
|
13
17
|
import { guid, email, isEmpty, isNumeric, phone, url } from '@firestitch/common';
|
|
14
|
-
import * as
|
|
18
|
+
import * as i6 from '@firestitch/drawer';
|
|
15
19
|
import { DrawerRef } from '@firestitch/drawer';
|
|
16
|
-
import * as i2 from '@firestitch/message';
|
|
20
|
+
import * as i2$2 from '@firestitch/message';
|
|
17
21
|
import { MessageMode } from '@firestitch/message';
|
|
18
|
-
import
|
|
19
|
-
import { first, filter, map, takeUntil, take, mergeMap, tap, switchMap, mapTo, catchError, delay, startWith } from 'rxjs/operators';
|
|
20
|
-
import * as i1 from '@firestitch/prompt';
|
|
21
|
-
import * as i3 from '@angular/router';
|
|
22
|
+
import * as i2$1 from '@angular/router';
|
|
22
23
|
import { values, keys, isObject } from 'lodash-es';
|
|
23
24
|
import { isValid } from 'date-fns';
|
|
24
25
|
|
|
26
|
+
class ConfirmUnsavedComponent {
|
|
27
|
+
constructor(_data, _dialogRef) {
|
|
28
|
+
this._data = _data;
|
|
29
|
+
this._dialogRef = _dialogRef;
|
|
30
|
+
this._destroy$ = new Subject();
|
|
31
|
+
}
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
this.saveLabel = this._data.saveLabel;
|
|
34
|
+
this.discardLabel = this._data.discardLabel;
|
|
35
|
+
this.cancelLabel = this._data.cancelLabel;
|
|
36
|
+
this.message = this._data.message;
|
|
37
|
+
this.title = this._data.title;
|
|
38
|
+
}
|
|
39
|
+
save() {
|
|
40
|
+
this._dialogRef.close('save');
|
|
41
|
+
}
|
|
42
|
+
discard() {
|
|
43
|
+
this._dialogRef.close('discard');
|
|
44
|
+
}
|
|
45
|
+
cancel() {
|
|
46
|
+
this._dialogRef.close(null);
|
|
47
|
+
}
|
|
48
|
+
ngOnDestroy() {
|
|
49
|
+
this._destroy$.next();
|
|
50
|
+
this._destroy$.complete();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
ConfirmUnsavedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ConfirmUnsavedComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
54
|
+
ConfirmUnsavedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ConfirmUnsavedComponent, selector: "ng-component", ngImport: i0, template: "<fs-dialog>\n <h1 mat-dialog-title>{{title}}</h1>\n <mat-dialog-content>\n {{message}}\n </mat-dialog-content> \n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n fsFormButtonStandalone\n mat-button>\n {{saveLabel}}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n fsFormButtonStandalone\n mat-button>\n {{discardLabel}}\n </button> \n <button\n type=\"button\"\n (click)=\"cancel()\"\n fsFormButtonStandalone\n mat-button>\n {{cancelLabel}}\n </button> \n </mat-dialog-actions>\n</fs-dialog>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], components: [{ type: i2.FsDialogComponent, selector: "fs-dialog", inputs: ["mobileMode", "mobileButtonPlacement", "mobileWidth", "mode", "buttonLayout"] }, { type: i1$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ConfirmUnsavedComponent, decorators: [{
|
|
56
|
+
type: Component,
|
|
57
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, template: "<fs-dialog>\n <h1 mat-dialog-title>{{title}}</h1>\n <mat-dialog-content>\n {{message}}\n </mat-dialog-content> \n <mat-dialog-actions>\n <button\n type=\"button\"\n color=\"primary\"\n (click)=\"save()\"\n fsFormButtonStandalone\n mat-button>\n {{saveLabel}}\n </button>\n <button\n type=\"button\"\n (click)=\"discard()\"\n fsFormButtonStandalone\n mat-button>\n {{discardLabel}}\n </button> \n <button\n type=\"button\"\n (click)=\"cancel()\"\n fsFormButtonStandalone\n mat-button>\n {{cancelLabel}}\n </button> \n </mat-dialog-actions>\n</fs-dialog>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
58
|
+
}], ctorParameters: function () {
|
|
59
|
+
return [{ type: undefined, decorators: [{
|
|
60
|
+
type: Inject,
|
|
61
|
+
args: [MAT_DIALOG_DATA]
|
|
62
|
+
}] }, { type: i1.MatDialogRef }];
|
|
63
|
+
} });
|
|
64
|
+
|
|
25
65
|
var ConfirmResult;
|
|
26
66
|
(function (ConfirmResult) {
|
|
27
67
|
ConfirmResult["Save"] = "save";
|
|
@@ -31,75 +71,6 @@ var ConfirmResult;
|
|
|
31
71
|
ConfirmResult["Pristine"] = "pristine";
|
|
32
72
|
})(ConfirmResult || (ConfirmResult = {}));
|
|
33
73
|
|
|
34
|
-
function confirmUnsaved(directives, prompt) {
|
|
35
|
-
return new Observable(observer => {
|
|
36
|
-
// TODO support for multiple directives per page
|
|
37
|
-
const form = directives[0];
|
|
38
|
-
if (!form.confirm || !form.ngForm.dirty) {
|
|
39
|
-
observer.next(ConfirmResult.Pristine);
|
|
40
|
-
observer.complete();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
let title = 'You Have Unsaved Changes';
|
|
44
|
-
let message = 'What would you like to do with your changes?';
|
|
45
|
-
let saveLabel = 'Save & Continue';
|
|
46
|
-
let discardLabel = 'Discard Changes & Continue';
|
|
47
|
-
let cancelLabel = 'Review Changes';
|
|
48
|
-
if (typeof form.confirm === 'object') {
|
|
49
|
-
title = form.confirm.title || title;
|
|
50
|
-
message = form.confirm.message || message;
|
|
51
|
-
saveLabel = form.confirm.saveLabel || saveLabel;
|
|
52
|
-
discardLabel = form.confirm.discardLabel || discardLabel;
|
|
53
|
-
cancelLabel = form.confirm.cancelLabel || cancelLabel;
|
|
54
|
-
}
|
|
55
|
-
prompt.confirm({
|
|
56
|
-
title: title,
|
|
57
|
-
template: message,
|
|
58
|
-
dialogConfig: { width: 'auto' },
|
|
59
|
-
buttons: [
|
|
60
|
-
{
|
|
61
|
-
label: saveLabel,
|
|
62
|
-
color: 'primary',
|
|
63
|
-
value: 'save'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: discardLabel,
|
|
67
|
-
value: 'discard'
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: cancelLabel,
|
|
71
|
-
cancel: true
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
}).subscribe((value) => {
|
|
75
|
-
if (value === 'discard') {
|
|
76
|
-
observer.next(ConfirmResult.Discard);
|
|
77
|
-
observer.complete();
|
|
78
|
-
form.reset();
|
|
79
|
-
}
|
|
80
|
-
if (value === 'save') {
|
|
81
|
-
form.submitted
|
|
82
|
-
.pipe(first())
|
|
83
|
-
.subscribe(() => {
|
|
84
|
-
observer.next(ConfirmResult.Save);
|
|
85
|
-
observer.complete();
|
|
86
|
-
});
|
|
87
|
-
form.invalid
|
|
88
|
-
.pipe(first())
|
|
89
|
-
.subscribe(() => {
|
|
90
|
-
observer.next(ConfirmResult.Invalid);
|
|
91
|
-
observer.complete();
|
|
92
|
-
});
|
|
93
|
-
form.ngForm.control.markAsPristine();
|
|
94
|
-
form.triggerSubmit({ confirmed: true });
|
|
95
|
-
}
|
|
96
|
-
}, (error) => {
|
|
97
|
-
observer.next(ConfirmResult.Review);
|
|
98
|
-
observer.complete();
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
74
|
function confirmResultContinue(result) {
|
|
104
75
|
return result === ConfirmResult.Discard || result === ConfirmResult.Save || result === ConfirmResult.Pristine;
|
|
105
76
|
}
|
|
@@ -111,8 +82,21 @@ function getActiveRoute(route) {
|
|
|
111
82
|
return route;
|
|
112
83
|
}
|
|
113
84
|
|
|
85
|
+
var FormStatus;
|
|
86
|
+
(function (FormStatus) {
|
|
87
|
+
FormStatus["Valid"] = "valid";
|
|
88
|
+
FormStatus["Invalid"] = "invalid";
|
|
89
|
+
FormStatus["Validating"] = "validating";
|
|
90
|
+
FormStatus["Submitting"] = "submitting";
|
|
91
|
+
FormStatus["Submitted"] = "submitted";
|
|
92
|
+
FormStatus["Error"] = "error";
|
|
93
|
+
FormStatus["Success"] = "success";
|
|
94
|
+
FormStatus["Completing"] = "completing";
|
|
95
|
+
})(FormStatus || (FormStatus = {}));
|
|
96
|
+
|
|
114
97
|
class FsForm {
|
|
115
|
-
constructor() {
|
|
98
|
+
constructor(_dialog) {
|
|
99
|
+
this._dialog = _dialog;
|
|
116
100
|
// value is array for future possibilities of extension
|
|
117
101
|
this._formDirectiveStore = new WeakMap();
|
|
118
102
|
this._eventBus = new Subject();
|
|
@@ -124,7 +108,7 @@ class FsForm {
|
|
|
124
108
|
// @deprecated
|
|
125
109
|
on(key) {
|
|
126
110
|
return this._eventBus.asObservable()
|
|
127
|
-
.pipe(filter(event => event.key === key), map(event => event.data));
|
|
111
|
+
.pipe(filter((event) => event.key === key), map((event) => event.data));
|
|
128
112
|
}
|
|
129
113
|
registerFormDirective(routeComponent, directive) {
|
|
130
114
|
const directives = this.getFormDirectives(routeComponent) || [];
|
|
@@ -137,47 +121,94 @@ class FsForm {
|
|
|
137
121
|
removeFormDirective(routeComponent) {
|
|
138
122
|
this._formDirectiveStore.delete(routeComponent);
|
|
139
123
|
}
|
|
124
|
+
confirmUnsaved(directives) {
|
|
125
|
+
// TODO support for multiple directives per page
|
|
126
|
+
const form = directives[0];
|
|
127
|
+
if (!form.confirm || !form.ngForm.dirty) {
|
|
128
|
+
return of(ConfirmResult.Pristine);
|
|
129
|
+
}
|
|
130
|
+
let title = 'You Have Unsaved Changes';
|
|
131
|
+
let message = 'What would you like to do with your changes?';
|
|
132
|
+
let saveLabel = 'Save & Continue';
|
|
133
|
+
let discardLabel = 'Discard Changes & Continue';
|
|
134
|
+
let cancelLabel = 'Review Changes';
|
|
135
|
+
if (typeof form.confirm === 'object') {
|
|
136
|
+
title = form.confirm.title || title;
|
|
137
|
+
message = form.confirm.message || message;
|
|
138
|
+
saveLabel = form.confirm.saveLabel || saveLabel;
|
|
139
|
+
discardLabel = form.confirm.discardLabel || discardLabel;
|
|
140
|
+
cancelLabel = form.confirm.cancelLabel || cancelLabel;
|
|
141
|
+
}
|
|
142
|
+
return this._dialog.open(ConfirmUnsavedComponent, {
|
|
143
|
+
data: {
|
|
144
|
+
title,
|
|
145
|
+
message,
|
|
146
|
+
saveLabel,
|
|
147
|
+
discardLabel,
|
|
148
|
+
cancelLabel,
|
|
149
|
+
},
|
|
150
|
+
width: 'auto',
|
|
151
|
+
})
|
|
152
|
+
.afterClosed()
|
|
153
|
+
.pipe(switchMap((result) => {
|
|
154
|
+
if (!result) {
|
|
155
|
+
return of(ConfirmResult.Review);
|
|
156
|
+
}
|
|
157
|
+
if (result === 'discard') {
|
|
158
|
+
form.reset();
|
|
159
|
+
return of(ConfirmResult.Discard);
|
|
160
|
+
}
|
|
161
|
+
if (result === 'save') {
|
|
162
|
+
form.ngForm.control.markAsPristine();
|
|
163
|
+
form.triggerSubmit({ confirmed: true });
|
|
164
|
+
return merge(form.submitted
|
|
165
|
+
.pipe(first(), mapTo(ConfirmResult.Save)), form.invalid
|
|
166
|
+
.pipe(first(), mapTo(ConfirmResult.Invalid)))
|
|
167
|
+
.pipe(take(1));
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
140
171
|
}
|
|
141
|
-
FsForm.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsForm, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
172
|
+
FsForm.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsForm, deps: [{ token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
142
173
|
FsForm.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsForm, providedIn: 'root' });
|
|
143
174
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsForm, decorators: [{
|
|
144
175
|
type: Injectable,
|
|
145
176
|
args: [{
|
|
146
177
|
providedIn: 'root',
|
|
147
178
|
}]
|
|
148
|
-
}], ctorParameters: function () { return []; } });
|
|
179
|
+
}], ctorParameters: function () { return [{ type: i1.MatDialog }]; } });
|
|
149
180
|
|
|
150
181
|
class FormDeactivateGuard {
|
|
151
|
-
constructor(
|
|
152
|
-
this.
|
|
153
|
-
this._fsForm = _fsForm;
|
|
182
|
+
constructor(_form, _route) {
|
|
183
|
+
this._form = _form;
|
|
154
184
|
this._route = _route;
|
|
155
185
|
}
|
|
156
186
|
canDeactivate() {
|
|
157
187
|
const route = getActiveRoute(this._route);
|
|
158
188
|
if (!route) {
|
|
159
|
-
console.error(
|
|
189
|
+
console.error('Can not find route for FormDeactivateGuard checks');
|
|
160
190
|
return of(true);
|
|
161
191
|
}
|
|
162
|
-
const directives = this.
|
|
192
|
+
const directives = this._form
|
|
193
|
+
.getFormDirectives(route.routeConfig.component);
|
|
163
194
|
if (!Array.isArray(directives) || directives.length === 0) {
|
|
164
|
-
console.error(
|
|
195
|
+
console.error('Can not find a valid FsFormDirective');
|
|
165
196
|
return of(true);
|
|
166
197
|
}
|
|
167
|
-
return confirmUnsaved(directives
|
|
198
|
+
return this._form.confirmUnsaved(directives)
|
|
168
199
|
.pipe(map((result) => {
|
|
169
200
|
return confirmResultContinue(result);
|
|
170
201
|
}));
|
|
171
202
|
}
|
|
172
203
|
}
|
|
173
|
-
FormDeactivateGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FormDeactivateGuard, deps: [{ token:
|
|
204
|
+
FormDeactivateGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FormDeactivateGuard, deps: [{ token: FsForm }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
174
205
|
FormDeactivateGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FormDeactivateGuard, providedIn: 'root' });
|
|
175
206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FormDeactivateGuard, decorators: [{
|
|
176
207
|
type: Injectable,
|
|
177
208
|
args: [{
|
|
178
209
|
providedIn: 'root',
|
|
179
210
|
}]
|
|
180
|
-
}], ctorParameters: function () { return [{ type:
|
|
211
|
+
}], ctorParameters: function () { return [{ type: FsForm }, { type: i2$1.ActivatedRoute }]; } });
|
|
181
212
|
|
|
182
213
|
function getFormErrors(control, key) {
|
|
183
214
|
let errors = null;
|
|
@@ -203,25 +234,12 @@ function getFormErrors(control, key) {
|
|
|
203
234
|
return errors;
|
|
204
235
|
}
|
|
205
236
|
|
|
206
|
-
var FormStatus;
|
|
207
|
-
(function (FormStatus) {
|
|
208
|
-
FormStatus["Valid"] = "valid";
|
|
209
|
-
FormStatus["Invalid"] = "invalid";
|
|
210
|
-
FormStatus["Validating"] = "validating";
|
|
211
|
-
FormStatus["Submitting"] = "submitting";
|
|
212
|
-
FormStatus["Submitted"] = "submitted";
|
|
213
|
-
FormStatus["Error"] = "error";
|
|
214
|
-
FormStatus["Success"] = "success";
|
|
215
|
-
FormStatus["Completing"] = "completing";
|
|
216
|
-
})(FormStatus || (FormStatus = {}));
|
|
217
|
-
|
|
218
237
|
class FsFormDirective {
|
|
219
|
-
constructor(ngForm, _form, _element, _message,
|
|
238
|
+
constructor(ngForm, _form, _element, _message, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
|
|
220
239
|
this.ngForm = ngForm;
|
|
221
240
|
this._form = _form;
|
|
222
241
|
this._element = _element;
|
|
223
242
|
this._message = _message;
|
|
224
|
-
this._prompt = _prompt;
|
|
225
243
|
this._ngZone = _ngZone;
|
|
226
244
|
this._cdRef = _cdRef;
|
|
227
245
|
this._dialogRef = _dialogRef;
|
|
@@ -386,7 +404,7 @@ class FsFormDirective {
|
|
|
386
404
|
triggerConfirm() {
|
|
387
405
|
const submitted = this.submitting ? this.submitted.asObservable() : of({});
|
|
388
406
|
return submitted
|
|
389
|
-
.pipe(take(1), mergeMap(() => confirmUnsaved([this]
|
|
407
|
+
.pipe(take(1), mergeMap(() => this._form.confirmUnsaved([this])));
|
|
390
408
|
}
|
|
391
409
|
enable() {
|
|
392
410
|
this.ngForm.control.enable();
|
|
@@ -410,6 +428,14 @@ class FsFormDirective {
|
|
|
410
428
|
.filter((item) => (button !== item)),
|
|
411
429
|
]);
|
|
412
430
|
}
|
|
431
|
+
validate() {
|
|
432
|
+
Object.values(this.ngForm.controls)
|
|
433
|
+
.forEach((control) => {
|
|
434
|
+
control.markAsDirty();
|
|
435
|
+
control.markAsTouched();
|
|
436
|
+
control.updateValueAndValidity();
|
|
437
|
+
});
|
|
438
|
+
}
|
|
413
439
|
_listenSubmit() {
|
|
414
440
|
this.ngForm
|
|
415
441
|
.ngSubmit
|
|
@@ -433,15 +459,7 @@ class FsFormDirective {
|
|
|
433
459
|
}), tap((submittedEvent) => {
|
|
434
460
|
this._completeSubmit(true, submittedEvent);
|
|
435
461
|
}), takeUntil(this._destroy$))
|
|
436
|
-
.subscribe(
|
|
437
|
-
}
|
|
438
|
-
validate() {
|
|
439
|
-
Object.values(this.ngForm.controls)
|
|
440
|
-
.forEach((control) => {
|
|
441
|
-
control.markAsDirty();
|
|
442
|
-
control.markAsTouched();
|
|
443
|
-
control.updateValueAndValidity();
|
|
444
|
-
});
|
|
462
|
+
.subscribe();
|
|
445
463
|
}
|
|
446
464
|
_listenFormStatus() {
|
|
447
465
|
this._status$
|
|
@@ -636,21 +654,21 @@ class FsFormDirective {
|
|
|
636
654
|
}
|
|
637
655
|
_registerConfirmTabs() {
|
|
638
656
|
if (this.tabGroup) {
|
|
639
|
-
this.
|
|
657
|
+
this._registerConfirmTabGroup(this.tabGroup);
|
|
640
658
|
}
|
|
641
|
-
this.
|
|
659
|
+
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
642
660
|
this._tabGroups.changes
|
|
643
661
|
.pipe(takeUntil(this._destroy$))
|
|
644
662
|
.subscribe(() => {
|
|
645
|
-
this.
|
|
663
|
+
this._registerConfirmTabGroups(this._tabGroups.toArray());
|
|
646
664
|
});
|
|
647
665
|
}
|
|
648
|
-
|
|
666
|
+
_registerConfirmTabGroups(tabGroups) {
|
|
649
667
|
tabGroups.forEach((tabGroup) => {
|
|
650
|
-
this.
|
|
668
|
+
this._registerConfirmTabGroup(tabGroup);
|
|
651
669
|
});
|
|
652
670
|
}
|
|
653
|
-
|
|
671
|
+
_registerConfirmTabGroup(tabGroup) {
|
|
654
672
|
const confirmTabGroup = tabGroup;
|
|
655
673
|
if (!confirmTabGroup._originalHandleClick) {
|
|
656
674
|
confirmTabGroup._originalHandleClick = tabGroup._handleClick;
|
|
@@ -782,7 +800,7 @@ class FsFormDirective {
|
|
|
782
800
|
if (!Array.isArray(this._activatedRouteConfig.canDeactivate)) {
|
|
783
801
|
this._activatedRouteConfig.canDeactivate = [];
|
|
784
802
|
}
|
|
785
|
-
if (this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard)
|
|
803
|
+
if (this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard) === -1) {
|
|
786
804
|
this._activatedRouteConfig.canDeactivate.push(FormDeactivateGuard);
|
|
787
805
|
}
|
|
788
806
|
}
|
|
@@ -795,7 +813,7 @@ class FsFormDirective {
|
|
|
795
813
|
this._form.removeFormDirective(this._activatedRouteConfig.component);
|
|
796
814
|
}
|
|
797
815
|
}
|
|
798
|
-
FsFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2.FsMessage }, { token:
|
|
816
|
+
FsFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDirective, deps: [{ token: NgForm }, { token: FsForm }, { token: i0.ElementRef }, { token: i2$2.FsMessage }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: MatDialogRef, optional: true }, { token: DrawerRef, optional: true }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Directive });
|
|
799
817
|
FsFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, queries: [{ propertyName: "_tabGroups", predicate: MatTabGroup, descendants: true }], exportAs: ["fsForm"], usesOnChanges: true, ngImport: i0 });
|
|
800
818
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDirective, decorators: [{
|
|
801
819
|
type: Directive,
|
|
@@ -804,20 +822,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
804
822
|
exportAs: 'fsForm',
|
|
805
823
|
}]
|
|
806
824
|
}], ctorParameters: function () {
|
|
807
|
-
return [{ type: i1$
|
|
825
|
+
return [{ type: i1$2.NgForm, decorators: [{
|
|
808
826
|
type: Inject,
|
|
809
827
|
args: [NgForm]
|
|
810
|
-
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2.FsMessage }, { type:
|
|
828
|
+
}] }, { type: FsForm }, { type: i0.ElementRef }, { type: i2$2.FsMessage }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i1.MatDialogRef, decorators: [{
|
|
811
829
|
type: Optional
|
|
812
830
|
}, {
|
|
813
831
|
type: Inject,
|
|
814
832
|
args: [MatDialogRef]
|
|
815
|
-
}] }, { type:
|
|
833
|
+
}] }, { type: i6.DrawerRef, decorators: [{
|
|
816
834
|
type: Optional
|
|
817
835
|
}, {
|
|
818
836
|
type: Inject,
|
|
819
837
|
args: [DrawerRef]
|
|
820
|
-
}] }, { type:
|
|
838
|
+
}] }, { type: i2$1.ActivatedRoute }];
|
|
821
839
|
}, propDecorators: { wrapperSelector: [{
|
|
822
840
|
type: Input
|
|
823
841
|
}], messageSelector: [{
|
|
@@ -873,105 +891,454 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
873
891
|
args: [MatTabGroup, { descendants: true }]
|
|
874
892
|
}] } });
|
|
875
893
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
compare: 'Inputs do not match',
|
|
888
|
-
pattern: 'Value should match pattern $(1)',
|
|
889
|
-
dateRange: 'Invalid date range',
|
|
890
|
-
url: 'This is not a valid url',
|
|
891
|
-
urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
|
|
892
|
-
greater: 'Value must be greater than $(1)',
|
|
893
|
-
lesser: 'Value must be less than $(1)',
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
|
|
897
|
-
const VALIDATE_MESSAGE_PROVIDER = {
|
|
898
|
-
provide: VALIDATE_MESSAGES,
|
|
899
|
-
useFactory: messageProviderFactory,
|
|
900
|
-
};
|
|
901
|
-
function messageProviderFactory() {
|
|
902
|
-
return Object.assign({}, ERROR_MESSAGES);
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
class FsControlDirective {
|
|
906
|
-
constructor(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
|
|
907
|
-
this.elementRef = elementRef;
|
|
908
|
-
this.renderer2 = renderer2;
|
|
909
|
-
this.injector = injector;
|
|
910
|
-
this._validateMessages = _validateMessages;
|
|
911
|
-
this.ngControl = ngControl;
|
|
912
|
-
this.formDirective = formDirective;
|
|
913
|
-
this.appendMessageClass = 'fs-form-message';
|
|
914
|
-
this.appendLabelClass = 'fs-form-label';
|
|
915
|
-
this.appendErrorClass = 'fs-form-error';
|
|
916
|
-
this.appendHintClass = 'fs-form-hint';
|
|
917
|
-
this.errors = [];
|
|
918
|
-
// protected _validateMessages = { ...ERROR_MESSAGES };
|
|
894
|
+
class FsButtonDirective {
|
|
895
|
+
constructor(_matButton, _form, _elementRef, _cdRef) {
|
|
896
|
+
this._matButton = _matButton;
|
|
897
|
+
this._form = _form;
|
|
898
|
+
this._elementRef = _elementRef;
|
|
899
|
+
this._cdRef = _cdRef;
|
|
900
|
+
this.dirtySubmit = true;
|
|
901
|
+
this.transitionStyle = null;
|
|
902
|
+
this.active = false;
|
|
903
|
+
this.submit = false;
|
|
904
|
+
this._previousDisabled = false;
|
|
919
905
|
this._destroy$ = new Subject();
|
|
920
|
-
if (ngControl) {
|
|
921
|
-
this._control = ngControl.control;
|
|
922
|
-
}
|
|
923
|
-
else {
|
|
924
|
-
console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
set validateMessages(messages) {
|
|
928
|
-
this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
|
|
929
906
|
}
|
|
930
907
|
ngOnInit() {
|
|
931
|
-
this.
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
908
|
+
this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
|
|
909
|
+
this.form = this.form || this._form;
|
|
910
|
+
if (this.form) {
|
|
911
|
+
this.form.addButton(this);
|
|
912
|
+
if (this.submit) {
|
|
913
|
+
fromEvent(this.element, 'click')
|
|
914
|
+
.pipe(takeUntil(this._destroy$))
|
|
915
|
+
.subscribe(() => {
|
|
916
|
+
this.active = true;
|
|
917
|
+
});
|
|
918
|
+
if (this.dirtySubmit) {
|
|
919
|
+
if (this.form.dirtySubmitButton) {
|
|
920
|
+
if (!this.form.ngForm.dirty) {
|
|
921
|
+
this.disable();
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
this.transitionStyle = 'none';
|
|
926
|
+
setTimeout(() => {
|
|
927
|
+
this.transitionStyle = null;
|
|
928
|
+
}, 500);
|
|
929
|
+
}
|
|
945
930
|
}
|
|
946
931
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
if (this.messageSelector) {
|
|
953
|
-
return this.messageSelector;
|
|
954
|
-
}
|
|
955
|
-
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
|
|
956
|
-
return this.formDirective.messageSelector;
|
|
932
|
+
disable() {
|
|
933
|
+
if (this._matButton && !this.active) {
|
|
934
|
+
this._previousDisabled = this._matButton.disabled;
|
|
935
|
+
this._matButton.disabled = true;
|
|
936
|
+
this._cdRef.markForCheck();
|
|
957
937
|
}
|
|
958
938
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
939
|
+
enable() {
|
|
940
|
+
if (this._matButton) {
|
|
941
|
+
this._matButton.disabled = false;
|
|
942
|
+
this._matButton.disableRipple = true;
|
|
943
|
+
this._cdRef.markForCheck();
|
|
963
944
|
}
|
|
964
|
-
|
|
965
|
-
|
|
945
|
+
}
|
|
946
|
+
process() {
|
|
947
|
+
this.setClass('process');
|
|
948
|
+
if (this._matButton) {
|
|
949
|
+
this._matButton.disableRipple = true;
|
|
966
950
|
}
|
|
967
|
-
|
|
968
|
-
|
|
951
|
+
}
|
|
952
|
+
success() {
|
|
953
|
+
this.setClass('success');
|
|
954
|
+
if (this._matButton) {
|
|
955
|
+
this._matButton.disableRipple = false;
|
|
969
956
|
}
|
|
970
957
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (this.
|
|
974
|
-
|
|
958
|
+
error() {
|
|
959
|
+
this.setClass('error');
|
|
960
|
+
if (this._matButton) {
|
|
961
|
+
this._matButton.disableRipple = false;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
setClass(cls) {
|
|
965
|
+
const svg = this._getSvg(cls);
|
|
966
|
+
this._resetClass();
|
|
967
|
+
this._disableShadowAnimation();
|
|
968
|
+
this.element.classList.add(`submit-${cls}`);
|
|
969
|
+
this.element.append(svg);
|
|
970
|
+
}
|
|
971
|
+
get element() {
|
|
972
|
+
return this._elementRef.nativeElement;
|
|
973
|
+
}
|
|
974
|
+
resetActive() {
|
|
975
|
+
this.active = false;
|
|
976
|
+
}
|
|
977
|
+
reset() {
|
|
978
|
+
if (!this._previousDisabled) {
|
|
979
|
+
this.enable();
|
|
980
|
+
}
|
|
981
|
+
this.element.querySelectorAll('.svg-icon')
|
|
982
|
+
.forEach((el) => {
|
|
983
|
+
el.remove();
|
|
984
|
+
});
|
|
985
|
+
if (this._matButton) {
|
|
986
|
+
this._matButton.disableRipple = false;
|
|
987
|
+
}
|
|
988
|
+
this._resetClass();
|
|
989
|
+
}
|
|
990
|
+
ngOnDestroy() {
|
|
991
|
+
var _a;
|
|
992
|
+
this._destroy$.next();
|
|
993
|
+
this._destroy$.complete();
|
|
994
|
+
(_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
|
|
995
|
+
}
|
|
996
|
+
_disableShadowAnimation() {
|
|
997
|
+
// .mat-elevation-z2 removes the click shadow animation
|
|
998
|
+
//this.element.classList.add('mat-elevation-z2');
|
|
999
|
+
}
|
|
1000
|
+
_resetClass() {
|
|
1001
|
+
this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
|
|
1002
|
+
}
|
|
1003
|
+
_getSvg(type) {
|
|
1004
|
+
if (type === 'success') {
|
|
1005
|
+
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">
|
|
1006
|
+
<g>
|
|
1007
|
+
<g class="check">
|
|
1008
|
+
<g>
|
|
1009
|
+
<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"/>
|
|
1010
|
+
</g>
|
|
1011
|
+
</g>
|
|
1012
|
+
</g>
|
|
1013
|
+
</svg>`, 'text/xml').firstChild;
|
|
1014
|
+
}
|
|
1015
|
+
if (type === 'process') {
|
|
1016
|
+
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">
|
|
1017
|
+
<g fill="none" fill-rule="evenodd">
|
|
1018
|
+
<g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
|
|
1019
|
+
<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>
|
|
1020
|
+
</g>
|
|
1021
|
+
</g>
|
|
1022
|
+
</svg>`, 'text/xml').firstChild;
|
|
1023
|
+
}
|
|
1024
|
+
if (type === 'error') {
|
|
1025
|
+
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;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
FsButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsButtonDirective, deps: [{ token: i1$1.MatButton, host: true, optional: true }, { token: FsFormDirective, optional: true }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1030
|
+
FsButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsButtonDirective, selector: "[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])", inputs: { name: "name", dirtySubmit: "dirtySubmit", form: "form" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0 });
|
|
1031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsButtonDirective, decorators: [{
|
|
1032
|
+
type: Directive,
|
|
1033
|
+
args: [{
|
|
1034
|
+
selector: '[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])',
|
|
1035
|
+
}]
|
|
1036
|
+
}], ctorParameters: function () {
|
|
1037
|
+
return [{ type: i1$1.MatButton, decorators: [{
|
|
1038
|
+
type: Optional
|
|
1039
|
+
}, {
|
|
1040
|
+
type: Host
|
|
1041
|
+
}] }, { type: FsFormDirective, decorators: [{
|
|
1042
|
+
type: Optional
|
|
1043
|
+
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
|
|
1044
|
+
}, propDecorators: { name: [{
|
|
1045
|
+
type: Input
|
|
1046
|
+
}], dirtySubmit: [{
|
|
1047
|
+
type: Input
|
|
1048
|
+
}], form: [{
|
|
1049
|
+
type: Input
|
|
1050
|
+
}], transitionStyle: [{
|
|
1051
|
+
type: HostBinding,
|
|
1052
|
+
args: ['style.transition']
|
|
1053
|
+
}] } });
|
|
1054
|
+
|
|
1055
|
+
class FsFormDialogCloseDirective {
|
|
1056
|
+
constructor(_form, _dialogRef) {
|
|
1057
|
+
this._form = _form;
|
|
1058
|
+
this._dialogRef = _dialogRef;
|
|
1059
|
+
this.type = 'button';
|
|
1060
|
+
this._destroy$ = new Subject();
|
|
1061
|
+
}
|
|
1062
|
+
closeClick() {
|
|
1063
|
+
if (this._form) {
|
|
1064
|
+
this._form.triggerConfirm()
|
|
1065
|
+
.pipe(filter((confirmResult) => (confirmResult !== ConfirmResult.Review)), takeUntil(this._destroy$))
|
|
1066
|
+
.subscribe(() => {
|
|
1067
|
+
this._dialogRef.close(this.closeData);
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
this._dialogRef.close(this.closeData);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
ngOnDestroy() {
|
|
1075
|
+
this._destroy$.next();
|
|
1076
|
+
this._destroy$.complete();
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
FsFormDialogCloseDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogCloseDirective, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1080
|
+
FsFormDialogCloseDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: { closeData: "closeData" }, host: { listeners: { "click": "closeClick($event.target)" }, properties: { "attr.type": "this.type" } }, ngImport: i0 });
|
|
1081
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogCloseDirective, decorators: [{
|
|
1082
|
+
type: Directive,
|
|
1083
|
+
args: [{
|
|
1084
|
+
selector: '[fsFormDialogClose],[fs-form-dialog-close]',
|
|
1085
|
+
}]
|
|
1086
|
+
}], ctorParameters: function () {
|
|
1087
|
+
return [{ type: FsFormDirective, decorators: [{
|
|
1088
|
+
type: Optional
|
|
1089
|
+
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
1090
|
+
type: Optional
|
|
1091
|
+
}] }];
|
|
1092
|
+
}, propDecorators: { closeData: [{
|
|
1093
|
+
type: Input
|
|
1094
|
+
}], type: [{
|
|
1095
|
+
type: HostBinding,
|
|
1096
|
+
args: ['attr.type']
|
|
1097
|
+
}], closeClick: [{
|
|
1098
|
+
type: HostListener,
|
|
1099
|
+
args: ['click', ['$event.target']]
|
|
1100
|
+
}] } });
|
|
1101
|
+
|
|
1102
|
+
class FsFormDialogActionsComponent {
|
|
1103
|
+
constructor(_form, _dialogRef, _cdRef) {
|
|
1104
|
+
this._form = _form;
|
|
1105
|
+
this._dialogRef = _dialogRef;
|
|
1106
|
+
this._cdRef = _cdRef;
|
|
1107
|
+
this.save = true;
|
|
1108
|
+
this.create = false;
|
|
1109
|
+
this.close = false;
|
|
1110
|
+
this.done = false;
|
|
1111
|
+
this.closeData = null;
|
|
1112
|
+
this.dirty = false;
|
|
1113
|
+
this._destroy$ = new Subject();
|
|
1114
|
+
}
|
|
1115
|
+
ngOnInit() {
|
|
1116
|
+
if (this._form) {
|
|
1117
|
+
this._form.ngForm.valueChanges
|
|
1118
|
+
.pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
1119
|
+
.subscribe(() => {
|
|
1120
|
+
this.dirty = this._form.ngForm.dirty;
|
|
1121
|
+
this._cdRef.markForCheck();
|
|
1122
|
+
});
|
|
1123
|
+
this._form.submitted
|
|
1124
|
+
.pipe(delay(50), takeUntil(this._destroy$))
|
|
1125
|
+
.subscribe(() => {
|
|
1126
|
+
this.dirty = false;
|
|
1127
|
+
this._cdRef.markForCheck();
|
|
1128
|
+
});
|
|
1129
|
+
this._form.reseted
|
|
1130
|
+
.pipe(takeUntil(this._destroy$))
|
|
1131
|
+
.subscribe(() => {
|
|
1132
|
+
this.dirty = false;
|
|
1133
|
+
this._cdRef.markForCheck();
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
ngOnDestroy() {
|
|
1138
|
+
this._destroy$.next();
|
|
1139
|
+
this._destroy$.complete();
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
FsFormDialogActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogActionsComponent, deps: [{ token: FsFormDirective, optional: true }, { token: i1.MatDialogRef, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1143
|
+
FsFormDialogActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", done: "done", closeData: "closeData", name: "name" }, ngImport: i0, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], components: [{ type: i1$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FsButtonDirective, selector: "[mat-raised-button]:not([fsFormButtonStandalone]),[mat-button]:not([fsFormButtonStandalone]),[mat-flat-button]:not([fsFormButtonStandalone]),[mat-stroked-button]:not([fsFormButtonStandalone])", inputs: ["name", "dirtySubmit", "form"] }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: ["closeData"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
|
|
1145
|
+
type: Component,
|
|
1146
|
+
args: [{ selector: 'fs-form-dialog-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
1147
|
+
}], ctorParameters: function () {
|
|
1148
|
+
return [{ type: FsFormDirective, decorators: [{
|
|
1149
|
+
type: Optional
|
|
1150
|
+
}] }, { type: i1.MatDialogRef, decorators: [{
|
|
1151
|
+
type: Optional
|
|
1152
|
+
}] }, { type: i0.ChangeDetectorRef }];
|
|
1153
|
+
}, propDecorators: { save: [{
|
|
1154
|
+
type: Input
|
|
1155
|
+
}], create: [{
|
|
1156
|
+
type: Input
|
|
1157
|
+
}], close: [{
|
|
1158
|
+
type: Input
|
|
1159
|
+
}], done: [{
|
|
1160
|
+
type: Input
|
|
1161
|
+
}], closeData: [{
|
|
1162
|
+
type: Input
|
|
1163
|
+
}], name: [{
|
|
1164
|
+
type: Input
|
|
1165
|
+
}] } });
|
|
1166
|
+
|
|
1167
|
+
class FsFormTemplateComponent {
|
|
1168
|
+
constructor() { }
|
|
1169
|
+
ngAfterContentInit() {
|
|
1170
|
+
debugger;
|
|
1171
|
+
const x = this.models;
|
|
1172
|
+
this.models.changes.subscribe((x) => {
|
|
1173
|
+
debugger;
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
ngOnInit() {
|
|
1177
|
+
debugger;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
FsFormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1181
|
+
FsFormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFormTemplateComponent, selector: "fs-form-template", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef1"], descendants: true }], ngImport: i0, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateComponent, decorators: [{
|
|
1183
|
+
type: Component,
|
|
1184
|
+
args: [{ selector: 'fs-form-template', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>" }]
|
|
1185
|
+
}], ctorParameters: function () { return []; }, propDecorators: { templateRef: [{
|
|
1186
|
+
type: ViewChild,
|
|
1187
|
+
args: ['templateRef1']
|
|
1188
|
+
}], formTemplate: [{
|
|
1189
|
+
type: Input
|
|
1190
|
+
}], models: [{
|
|
1191
|
+
type: ContentChildren,
|
|
1192
|
+
args: [NgModel, { descendants: true }]
|
|
1193
|
+
}] } });
|
|
1194
|
+
|
|
1195
|
+
class FsFormTemplateOutletComponent {
|
|
1196
|
+
constructor() { }
|
|
1197
|
+
ngOnChanges(changes) {
|
|
1198
|
+
var _a;
|
|
1199
|
+
if ((_a = changes.formTemplate) === null || _a === void 0 ? void 0 : _a.currentValue) {
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
ngAfterContentInit() {
|
|
1203
|
+
// const x = this.models;
|
|
1204
|
+
// this.models.changes.subscribe((x) => {
|
|
1205
|
+
// debugger;
|
|
1206
|
+
// });
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
FsFormTemplateOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1210
|
+
FsFormTemplateOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFormTemplateOutletComponent, selector: "fs-form-template-outlet", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>", directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "json": i4.JsonPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1211
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateOutletComponent, decorators: [{
|
|
1212
|
+
type: Component,
|
|
1213
|
+
args: [{ selector: 'fs-form-template-outlet', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>" }]
|
|
1214
|
+
}], ctorParameters: function () { return []; }, propDecorators: { formTemplate: [{
|
|
1215
|
+
type: Input
|
|
1216
|
+
}], models: [{
|
|
1217
|
+
type: ContentChildren,
|
|
1218
|
+
args: [NgModel, { descendants: true }]
|
|
1219
|
+
}] } });
|
|
1220
|
+
|
|
1221
|
+
class FsFormTemplateDirective {
|
|
1222
|
+
constructor() { }
|
|
1223
|
+
ngAfterContentInit() {
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1227
|
+
FsFormTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
|
|
1228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
|
|
1229
|
+
type: Directive,
|
|
1230
|
+
args: [{
|
|
1231
|
+
selector: '[fsFormTemplate]',
|
|
1232
|
+
}]
|
|
1233
|
+
}], ctorParameters: function () { return []; }, propDecorators: { models: [{
|
|
1234
|
+
type: ViewChildren,
|
|
1235
|
+
args: [NgModel]
|
|
1236
|
+
}] } });
|
|
1237
|
+
|
|
1238
|
+
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
1239
|
+
}
|
|
1240
|
+
FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1241
|
+
FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
|
|
1242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
|
|
1243
|
+
type: Directive,
|
|
1244
|
+
args: [{
|
|
1245
|
+
selector: 'dummy-selector',
|
|
1246
|
+
}]
|
|
1247
|
+
}] });
|
|
1248
|
+
|
|
1249
|
+
const ERROR_MESSAGES = {
|
|
1250
|
+
required: 'This field is required',
|
|
1251
|
+
email: 'This is not a valid email address',
|
|
1252
|
+
emails: 'Input valid email addresses, comma separated',
|
|
1253
|
+
phone: 'Invalid phone number',
|
|
1254
|
+
numeric: 'Value should be numeric',
|
|
1255
|
+
integer: 'Value should be an integer',
|
|
1256
|
+
min: 'Value should not be less than $(1)',
|
|
1257
|
+
max: 'Value should not be greater than $(1)',
|
|
1258
|
+
minlength: 'Should not be shorter than $(1) characters',
|
|
1259
|
+
maxlength: 'Should not be longer than $(1) characters',
|
|
1260
|
+
compare: 'Inputs do not match',
|
|
1261
|
+
pattern: 'Value should match pattern $(1)',
|
|
1262
|
+
dateRange: 'Invalid date range',
|
|
1263
|
+
url: 'This is not a valid url',
|
|
1264
|
+
urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
|
|
1265
|
+
greater: 'Value must be greater than $(1)',
|
|
1266
|
+
lesser: 'Value must be less than $(1)',
|
|
1267
|
+
greaterEqual: 'Value must be greater than or equal $(1)',
|
|
1268
|
+
lesserEqual: 'Value must be less than or equal $(1)',
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
const VALIDATE_MESSAGES = new InjectionToken('fs.form.validate-messages');
|
|
1272
|
+
const VALIDATE_MESSAGE_PROVIDER = {
|
|
1273
|
+
provide: VALIDATE_MESSAGES,
|
|
1274
|
+
useFactory: messageProviderFactory,
|
|
1275
|
+
};
|
|
1276
|
+
function messageProviderFactory() {
|
|
1277
|
+
return Object.assign({}, ERROR_MESSAGES);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
class FsControlDirective {
|
|
1281
|
+
constructor(_elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
|
|
1282
|
+
this._elementRef = _elementRef;
|
|
1283
|
+
this.renderer2 = renderer2;
|
|
1284
|
+
this.injector = injector;
|
|
1285
|
+
this._validateMessages = _validateMessages;
|
|
1286
|
+
this.ngControl = ngControl;
|
|
1287
|
+
this.formDirective = formDirective;
|
|
1288
|
+
this.appendMessageClass = 'fs-form-message';
|
|
1289
|
+
this.appendLabelClass = 'fs-form-label';
|
|
1290
|
+
this.appendErrorClass = 'fs-form-error';
|
|
1291
|
+
this.appendHintClass = 'fs-form-hint';
|
|
1292
|
+
this.errors = [];
|
|
1293
|
+
this._destroy$ = new Subject();
|
|
1294
|
+
if (ngControl) {
|
|
1295
|
+
this._control = ngControl.control;
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
console.error('The element does not have a valid ngModel', this._elementRef.nativeElement);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
set validateMessages(messages) {
|
|
1302
|
+
this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
|
|
1303
|
+
}
|
|
1304
|
+
ngOnInit() {
|
|
1305
|
+
this._setupValidators();
|
|
1306
|
+
}
|
|
1307
|
+
ngOnDestroy() {
|
|
1308
|
+
this._destroy$.next();
|
|
1309
|
+
this._destroy$.complete();
|
|
1310
|
+
}
|
|
1311
|
+
ngAfterContentInit() {
|
|
1312
|
+
this._subscribeToStatusChagnes();
|
|
1313
|
+
}
|
|
1314
|
+
getMessageSelector() {
|
|
1315
|
+
var _a;
|
|
1316
|
+
if (this.messageSelector === false) {
|
|
1317
|
+
return '';
|
|
1318
|
+
}
|
|
1319
|
+
if (this.messageSelector) {
|
|
1320
|
+
return this.messageSelector;
|
|
1321
|
+
}
|
|
1322
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
|
|
1323
|
+
return this.formDirective.messageSelector;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
getHintWrapperSelector() {
|
|
1327
|
+
var _a;
|
|
1328
|
+
if (this.hintSelector === false) {
|
|
1329
|
+
return '';
|
|
1330
|
+
}
|
|
1331
|
+
if (this.hintSelector) {
|
|
1332
|
+
return this.hintSelector;
|
|
1333
|
+
}
|
|
1334
|
+
else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
|
|
1335
|
+
return this.formDirective.hintSelector;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
getWrapperSelector() {
|
|
1339
|
+
var _a;
|
|
1340
|
+
if (this.wrapperSelector === false) {
|
|
1341
|
+
return '';
|
|
975
1342
|
}
|
|
976
1343
|
if (this.wrapperSelector) {
|
|
977
1344
|
return this.wrapperSelector;
|
|
@@ -993,11 +1360,11 @@ class FsControlDirective {
|
|
|
993
1360
|
}
|
|
994
1361
|
}
|
|
995
1362
|
getWrapperElement() {
|
|
996
|
-
const wrapper = this.getWrapper(this.
|
|
1363
|
+
const wrapper = this.getWrapper(this._elementRef.nativeElement);
|
|
997
1364
|
if (wrapper) {
|
|
998
1365
|
return wrapper;
|
|
999
1366
|
}
|
|
1000
|
-
return this.
|
|
1367
|
+
return this._elementRef.nativeElement;
|
|
1001
1368
|
}
|
|
1002
1369
|
/*
|
|
1003
1370
|
<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.
|
|
@@ -1027,7 +1394,7 @@ class FsControlDirective {
|
|
|
1027
1394
|
}
|
|
1028
1395
|
const messageWrapper = wrapper.querySelector(this.getMessageSelector());
|
|
1029
1396
|
if (!messageWrapper) {
|
|
1030
|
-
return console.warn(
|
|
1397
|
+
return console.warn(`Failed to locate ${this.getMessageSelector()}`, this._elementRef.nativeElement);
|
|
1031
1398
|
}
|
|
1032
1399
|
if (this.getlabelSelector()) {
|
|
1033
1400
|
const labelWrapper = wrapper.querySelector(this.getlabelSelector());
|
|
@@ -1059,12 +1426,19 @@ class FsControlDirective {
|
|
|
1059
1426
|
errorWrapper = renderer.createElement('div');
|
|
1060
1427
|
renderer.addClass(errorWrapper, 'fs-form-error-target');
|
|
1061
1428
|
renderer.addClass(errorWrapper, this.appendErrorClass);
|
|
1062
|
-
renderer.addClass(errorWrapper, this.appendErrorClass
|
|
1429
|
+
renderer.addClass(errorWrapper, `${this.appendErrorClass}-${error.name}`);
|
|
1063
1430
|
const errorText = renderer.createText(error.message);
|
|
1064
1431
|
renderer.appendChild(errorWrapper, errorText);
|
|
1065
1432
|
messageWrapper.appendChild(errorWrapper);
|
|
1066
1433
|
}
|
|
1067
1434
|
}
|
|
1435
|
+
_subscribeToStatusChagnes() {
|
|
1436
|
+
if (this._control) {
|
|
1437
|
+
this._control.statusChanges
|
|
1438
|
+
.pipe(takeUntil(this._destroy$))
|
|
1439
|
+
.subscribe(this.render.bind(this));
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1068
1442
|
getWrapper(node, count = 0) {
|
|
1069
1443
|
if (!node || count > 10) {
|
|
1070
1444
|
return null;
|
|
@@ -1109,16 +1483,16 @@ class FsControlDirective {
|
|
|
1109
1483
|
control.updateValueAndValidity();
|
|
1110
1484
|
}
|
|
1111
1485
|
}
|
|
1112
|
-
FsControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsControlDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1$
|
|
1486
|
+
FsControlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsControlDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1$2.NgControl, optional: true }, { token: FsFormDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1113
1487
|
FsControlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsControlDirective, selector: "[fsFormControl]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", appendMessageClass: "appendMessageClass", appendLabelClass: "appendLabelClass", appendErrorClass: "appendErrorClass", appendHintClass: "appendHintClass", validateMessages: "validateMessages" }, providers: [
|
|
1114
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1488
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1115
1489
|
], ngImport: i0 });
|
|
1116
1490
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsControlDirective, decorators: [{
|
|
1117
1491
|
type: Directive,
|
|
1118
1492
|
args: [{
|
|
1119
1493
|
selector: '[fsFormControl]',
|
|
1120
1494
|
providers: [
|
|
1121
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1495
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1122
1496
|
],
|
|
1123
1497
|
}]
|
|
1124
1498
|
}], ctorParameters: function () {
|
|
@@ -1127,7 +1501,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
1127
1501
|
}, {
|
|
1128
1502
|
type: Inject,
|
|
1129
1503
|
args: [VALIDATE_MESSAGES]
|
|
1130
|
-
}] }, { type: i1$
|
|
1504
|
+
}] }, { type: i1$2.NgControl, decorators: [{
|
|
1131
1505
|
type: Optional
|
|
1132
1506
|
}] }, { type: FsFormDirective, decorators: [{
|
|
1133
1507
|
type: Optional
|
|
@@ -1155,73 +1529,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
1155
1529
|
type: Input
|
|
1156
1530
|
}] } });
|
|
1157
1531
|
|
|
1158
|
-
|
|
1159
|
-
return value !== 'false' && (value || value === '');
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
class FsFormRequiredDirective extends FsControlDirective {
|
|
1163
|
-
constructor() {
|
|
1164
|
-
super(...arguments);
|
|
1165
|
-
this.required = false;
|
|
1166
|
-
}
|
|
1167
|
-
set setFsFormRequired(value) {
|
|
1168
|
-
this.required = isEnabled(value);
|
|
1169
|
-
}
|
|
1170
|
-
set setRequired(value) {
|
|
1171
|
-
this.required = isEnabled(value);
|
|
1172
|
-
}
|
|
1532
|
+
class FsFormCompareDirective extends FsControlDirective {
|
|
1173
1533
|
set validationMessage(value) {
|
|
1174
|
-
this._validateMessages.
|
|
1534
|
+
this._validateMessages.compare = value;
|
|
1175
1535
|
}
|
|
1176
1536
|
ngOnChanges() {
|
|
1177
1537
|
this._control.updateValueAndValidity();
|
|
1178
1538
|
}
|
|
1179
1539
|
validate(control) {
|
|
1180
|
-
if (this.
|
|
1181
|
-
return Validators.required(this._control);
|
|
1182
|
-
}
|
|
1183
|
-
else {
|
|
1540
|
+
if (this.fsFormCompare.value === this._elementRef.nativeElement.value) {
|
|
1184
1541
|
return null;
|
|
1185
1542
|
}
|
|
1543
|
+
return { compare: true };
|
|
1186
1544
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
else {
|
|
1197
|
-
this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
super.render();
|
|
1545
|
+
ngAfterViewInit() {
|
|
1546
|
+
this.fsFormCompare.addEventListener('keyup', () => {
|
|
1547
|
+
this._control.updateValueAndValidity();
|
|
1548
|
+
}, false);
|
|
1549
|
+
}
|
|
1550
|
+
ngOnDestroy() {
|
|
1551
|
+
this.fsFormCompare.removeEventListener('keyup', () => {
|
|
1552
|
+
this._control.updateValueAndValidity();
|
|
1553
|
+
}, false);
|
|
1202
1554
|
}
|
|
1203
1555
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1556
|
+
FsFormCompareDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormCompareDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1557
|
+
FsFormCompareDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
|
|
1558
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1207
1559
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormCompareDirective, decorators: [{
|
|
1209
1561
|
type: Directive,
|
|
1210
1562
|
args: [{
|
|
1211
|
-
selector: '[
|
|
1563
|
+
selector: '[fsFormCompare]',
|
|
1212
1564
|
providers: [
|
|
1213
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1565
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1214
1566
|
],
|
|
1215
1567
|
}]
|
|
1216
|
-
}], propDecorators: {
|
|
1217
|
-
type: Input
|
|
1218
|
-
args: ['fsFormRequired']
|
|
1219
|
-
}], setRequired: [{
|
|
1220
|
-
type: Input,
|
|
1221
|
-
args: ['required']
|
|
1568
|
+
}], propDecorators: { fsFormCompare: [{
|
|
1569
|
+
type: Input
|
|
1222
1570
|
}], validationMessage: [{
|
|
1223
1571
|
type: Input,
|
|
1224
|
-
args: ['
|
|
1572
|
+
args: ['fsFormCompareMessage']
|
|
1225
1573
|
}] } });
|
|
1226
1574
|
|
|
1227
1575
|
class FsValidators {
|
|
@@ -1316,763 +1664,694 @@ class FsValidators {
|
|
|
1316
1664
|
}
|
|
1317
1665
|
}
|
|
1318
1666
|
|
|
1319
|
-
|
|
1667
|
+
function isEnabled(value) {
|
|
1668
|
+
return value !== 'false' && (value || value === '');
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
class FsFormDateRangeDirective extends FsControlDirective {
|
|
1320
1672
|
set validationMessage(value) {
|
|
1321
|
-
this._validateMessages.
|
|
1673
|
+
this._validateMessages.dateRange = value;
|
|
1322
1674
|
}
|
|
1323
1675
|
ngOnChanges() {
|
|
1324
1676
|
this._control.updateValueAndValidity();
|
|
1325
1677
|
}
|
|
1326
1678
|
validate(control) {
|
|
1327
|
-
|
|
1679
|
+
if (isEnabled(this.fsFormDateRange)) {
|
|
1680
|
+
return FsValidators.dateRange(this._control);
|
|
1681
|
+
}
|
|
1682
|
+
else {
|
|
1683
|
+
return null;
|
|
1684
|
+
}
|
|
1328
1685
|
}
|
|
1329
1686
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1687
|
+
FsFormDateRangeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDateRangeDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1688
|
+
FsFormDateRangeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
|
|
1332
1689
|
VALIDATE_MESSAGE_PROVIDER
|
|
1333
1690
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1691
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDateRangeDirective, decorators: [{
|
|
1335
1692
|
type: Directive,
|
|
1336
1693
|
args: [{
|
|
1337
|
-
selector: '[
|
|
1694
|
+
selector: '[fsFormDateRange]',
|
|
1338
1695
|
providers: [
|
|
1339
1696
|
VALIDATE_MESSAGE_PROVIDER
|
|
1340
1697
|
],
|
|
1341
1698
|
}]
|
|
1342
|
-
}], propDecorators: {
|
|
1699
|
+
}], propDecorators: { fsFormDateRange: [{
|
|
1343
1700
|
type: Input
|
|
1344
1701
|
}], validationMessage: [{
|
|
1345
1702
|
type: Input,
|
|
1346
|
-
args: ['
|
|
1703
|
+
args: ['fsFormDateRangeMessage']
|
|
1347
1704
|
}] } });
|
|
1348
1705
|
|
|
1349
|
-
class
|
|
1706
|
+
class FsFormEmailDirective extends FsControlDirective {
|
|
1350
1707
|
set validationMessage(value) {
|
|
1351
|
-
this._validateMessages.
|
|
1708
|
+
this._validateMessages.email = value;
|
|
1352
1709
|
}
|
|
1353
1710
|
ngOnChanges() {
|
|
1354
1711
|
this._control.updateValueAndValidity();
|
|
1355
1712
|
}
|
|
1356
1713
|
validate(control) {
|
|
1357
|
-
|
|
1714
|
+
if (isEnabled(this.fsFormEmail)) {
|
|
1715
|
+
return FsValidators.email(this._control);
|
|
1716
|
+
}
|
|
1717
|
+
else {
|
|
1718
|
+
return null;
|
|
1719
|
+
}
|
|
1358
1720
|
}
|
|
1359
1721
|
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1722
|
+
FsFormEmailDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1723
|
+
FsFormEmailDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
|
|
1362
1724
|
VALIDATE_MESSAGE_PROVIDER
|
|
1363
1725
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1364
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1726
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailDirective, decorators: [{
|
|
1365
1727
|
type: Directive,
|
|
1366
1728
|
args: [{
|
|
1367
|
-
selector: '[
|
|
1729
|
+
selector: '[fsFormEmail]',
|
|
1368
1730
|
providers: [
|
|
1369
1731
|
VALIDATE_MESSAGE_PROVIDER
|
|
1370
1732
|
],
|
|
1371
1733
|
}]
|
|
1372
|
-
}], propDecorators: {
|
|
1734
|
+
}], propDecorators: { fsFormEmail: [{
|
|
1373
1735
|
type: Input
|
|
1374
1736
|
}], validationMessage: [{
|
|
1375
1737
|
type: Input,
|
|
1376
|
-
args: ['
|
|
1738
|
+
args: ['fsFormEmailMessage']
|
|
1377
1739
|
}] } });
|
|
1378
1740
|
|
|
1379
|
-
class
|
|
1741
|
+
class FsFormEmailsDirective extends FsControlDirective {
|
|
1380
1742
|
set validationMessage(value) {
|
|
1381
|
-
this._validateMessages.
|
|
1743
|
+
this._validateMessages.emails = value;
|
|
1382
1744
|
}
|
|
1383
1745
|
ngOnChanges() {
|
|
1384
1746
|
this._control.updateValueAndValidity();
|
|
1385
1747
|
}
|
|
1386
1748
|
validate(control) {
|
|
1387
|
-
|
|
1749
|
+
if (isEnabled(this.fsFormEmails)) {
|
|
1750
|
+
return FsValidators.emails(this._control);
|
|
1751
|
+
}
|
|
1752
|
+
else {
|
|
1753
|
+
return null;
|
|
1754
|
+
}
|
|
1388
1755
|
}
|
|
1389
1756
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1757
|
+
FsFormEmailsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1758
|
+
FsFormEmailsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
|
|
1392
1759
|
VALIDATE_MESSAGE_PROVIDER
|
|
1393
1760
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1761
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormEmailsDirective, decorators: [{
|
|
1395
1762
|
type: Directive,
|
|
1396
1763
|
args: [{
|
|
1397
|
-
selector: '[
|
|
1764
|
+
selector: '[fsFormEmails]',
|
|
1398
1765
|
providers: [
|
|
1399
1766
|
VALIDATE_MESSAGE_PROVIDER
|
|
1400
1767
|
],
|
|
1401
1768
|
}]
|
|
1402
|
-
}], propDecorators: {
|
|
1769
|
+
}], propDecorators: { fsFormEmails: [{
|
|
1403
1770
|
type: Input
|
|
1404
1771
|
}], validationMessage: [{
|
|
1405
1772
|
type: Input,
|
|
1406
|
-
args: ['
|
|
1773
|
+
args: ['fsFormEmailsMessage']
|
|
1407
1774
|
}] } });
|
|
1408
1775
|
|
|
1409
|
-
class
|
|
1776
|
+
class FsFormFunctionDirective extends FsControlDirective {
|
|
1777
|
+
constructor() {
|
|
1778
|
+
super(...arguments);
|
|
1779
|
+
this.validateOnSubmit = false;
|
|
1780
|
+
}
|
|
1781
|
+
ngOnChanges() {
|
|
1782
|
+
this._control.updateValueAndValidity();
|
|
1783
|
+
}
|
|
1784
|
+
validateAsync(control) {
|
|
1785
|
+
if (this.validateOnSubmit && !this.formDirective.validating) {
|
|
1786
|
+
return of(null);
|
|
1787
|
+
}
|
|
1788
|
+
return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
FsFormFunctionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormFunctionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1792
|
+
FsFormFunctionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
|
|
1793
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1794
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1795
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormFunctionDirective, decorators: [{
|
|
1796
|
+
type: Directive,
|
|
1797
|
+
args: [{
|
|
1798
|
+
selector: '[fsFormFunction]',
|
|
1799
|
+
providers: [
|
|
1800
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1801
|
+
],
|
|
1802
|
+
}]
|
|
1803
|
+
}], propDecorators: { fsFormFunction: [{
|
|
1804
|
+
type: Input
|
|
1805
|
+
}], fsFormFunctionData: [{
|
|
1806
|
+
type: Input
|
|
1807
|
+
}], validateOnSubmit: [{
|
|
1808
|
+
type: Input
|
|
1809
|
+
}] } });
|
|
1810
|
+
|
|
1811
|
+
class FsFormGreaterEqualDirective extends FsControlDirective {
|
|
1410
1812
|
set validationMessage(value) {
|
|
1411
|
-
this._validateMessages.
|
|
1813
|
+
this._validateMessages.greater = value;
|
|
1412
1814
|
}
|
|
1413
1815
|
ngOnChanges() {
|
|
1414
1816
|
this._control.updateValueAndValidity();
|
|
1415
1817
|
}
|
|
1416
1818
|
validate(control) {
|
|
1417
|
-
|
|
1819
|
+
const greater = parseFloat(this.fsFormGreaterEqual);
|
|
1820
|
+
const value = parseFloat(this._control.value);
|
|
1821
|
+
if (!isNaN(greater) && !isNaN(value) && value < greater) {
|
|
1822
|
+
return { greaterEqual: { greater, actual: value } };
|
|
1823
|
+
}
|
|
1824
|
+
return FsValidators.numeric(this._control);
|
|
1418
1825
|
}
|
|
1419
1826
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1827
|
+
FsFormGreaterEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1828
|
+
FsFormGreaterEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormGreaterEqualDirective, selector: "[fsFormGreaterEqual]", inputs: { fsFormGreaterEqual: "fsFormGreaterEqual", validationMessage: ["fsFormGreaterEqualMessage", "validationMessage"] }, providers: [
|
|
1422
1829
|
VALIDATE_MESSAGE_PROVIDER
|
|
1423
1830
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1424
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterEqualDirective, decorators: [{
|
|
1425
1832
|
type: Directive,
|
|
1426
1833
|
args: [{
|
|
1427
|
-
selector: '[
|
|
1834
|
+
selector: '[fsFormGreaterEqual]',
|
|
1428
1835
|
providers: [
|
|
1429
1836
|
VALIDATE_MESSAGE_PROVIDER
|
|
1430
1837
|
],
|
|
1431
1838
|
}]
|
|
1432
|
-
}], propDecorators: {
|
|
1839
|
+
}], propDecorators: { fsFormGreaterEqual: [{
|
|
1433
1840
|
type: Input
|
|
1434
1841
|
}], validationMessage: [{
|
|
1435
1842
|
type: Input,
|
|
1436
|
-
args: ['
|
|
1843
|
+
args: ['fsFormGreaterEqualMessage']
|
|
1437
1844
|
}] } });
|
|
1438
1845
|
|
|
1439
|
-
class
|
|
1846
|
+
class FsFormGreaterDirective extends FsControlDirective {
|
|
1440
1847
|
set validationMessage(value) {
|
|
1441
|
-
this._validateMessages.
|
|
1848
|
+
this._validateMessages.greater = value;
|
|
1442
1849
|
}
|
|
1443
1850
|
ngOnChanges() {
|
|
1444
1851
|
this._control.updateValueAndValidity();
|
|
1445
|
-
}
|
|
1446
|
-
validate(control) {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
return null;
|
|
1852
|
+
}
|
|
1853
|
+
validate(control) {
|
|
1854
|
+
const greater = parseFloat(this.fsFormGreater);
|
|
1855
|
+
const value = parseFloat(this._control.value);
|
|
1856
|
+
if (!isNaN(greater) && !isNaN(value) && value <= greater) {
|
|
1857
|
+
return { greater: { greater, actual: value } };
|
|
1452
1858
|
}
|
|
1859
|
+
return FsValidators.numeric(this._control);
|
|
1453
1860
|
}
|
|
1454
1861
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1862
|
+
FsFormGreaterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1863
|
+
FsFormGreaterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
|
|
1457
1864
|
VALIDATE_MESSAGE_PROVIDER
|
|
1458
1865
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1459
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1866
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormGreaterDirective, decorators: [{
|
|
1460
1867
|
type: Directive,
|
|
1461
1868
|
args: [{
|
|
1462
|
-
selector: '[
|
|
1869
|
+
selector: '[fsFormGreater]',
|
|
1463
1870
|
providers: [
|
|
1464
1871
|
VALIDATE_MESSAGE_PROVIDER
|
|
1465
1872
|
],
|
|
1466
1873
|
}]
|
|
1467
|
-
}], propDecorators: {
|
|
1874
|
+
}], propDecorators: { fsFormGreater: [{
|
|
1468
1875
|
type: Input
|
|
1469
1876
|
}], validationMessage: [{
|
|
1470
1877
|
type: Input,
|
|
1471
|
-
args: ['
|
|
1878
|
+
args: ['fsFormGreaterMessage']
|
|
1472
1879
|
}] } });
|
|
1473
1880
|
|
|
1474
|
-
class
|
|
1881
|
+
class FsFormIntegerDirective extends FsControlDirective {
|
|
1475
1882
|
set validationMessage(value) {
|
|
1476
|
-
this._validateMessages.
|
|
1883
|
+
this._validateMessages.integer = value;
|
|
1477
1884
|
}
|
|
1478
1885
|
ngOnChanges() {
|
|
1479
1886
|
this._control.updateValueAndValidity();
|
|
1480
1887
|
}
|
|
1481
1888
|
validate(control) {
|
|
1482
|
-
if (isEnabled(this.
|
|
1483
|
-
return FsValidators.
|
|
1484
|
-
}
|
|
1485
|
-
else {
|
|
1486
|
-
return null;
|
|
1889
|
+
if (isEnabled(this.fsFormInteger)) {
|
|
1890
|
+
return FsValidators.integer(this._control);
|
|
1487
1891
|
}
|
|
1892
|
+
return null;
|
|
1488
1893
|
}
|
|
1489
1894
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1895
|
+
FsFormIntegerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormIntegerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1896
|
+
FsFormIntegerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
|
|
1897
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1493
1898
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1494
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1899
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormIntegerDirective, decorators: [{
|
|
1495
1900
|
type: Directive,
|
|
1496
1901
|
args: [{
|
|
1497
|
-
selector: '[
|
|
1902
|
+
selector: '[fsFormInteger]',
|
|
1498
1903
|
providers: [
|
|
1499
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1904
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
1500
1905
|
],
|
|
1501
1906
|
}]
|
|
1502
|
-
}], propDecorators: {
|
|
1907
|
+
}], propDecorators: { fsFormInteger: [{
|
|
1503
1908
|
type: Input
|
|
1504
1909
|
}], validationMessage: [{
|
|
1505
1910
|
type: Input,
|
|
1506
|
-
args: ['
|
|
1911
|
+
args: ['fsFormIntegerMessage']
|
|
1507
1912
|
}] } });
|
|
1508
1913
|
|
|
1509
|
-
class
|
|
1914
|
+
class FsFormLesserEqualDirective extends FsControlDirective {
|
|
1510
1915
|
set validationMessage(value) {
|
|
1511
|
-
this._validateMessages.
|
|
1916
|
+
this._validateMessages.lesser = value;
|
|
1512
1917
|
}
|
|
1513
1918
|
ngOnChanges() {
|
|
1514
1919
|
this._control.updateValueAndValidity();
|
|
1515
1920
|
}
|
|
1516
1921
|
validate(control) {
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
return null;
|
|
1922
|
+
const lesser = parseFloat(this.fsFormLesserEqual);
|
|
1923
|
+
const value = parseFloat(this._control.value);
|
|
1924
|
+
if (!isNaN(lesser) && !isNaN(value) && value > lesser) {
|
|
1925
|
+
return { lesserEqual: { lesser, actual: value } };
|
|
1522
1926
|
}
|
|
1927
|
+
return FsValidators.numeric(this._control);
|
|
1523
1928
|
}
|
|
1524
1929
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1930
|
+
FsFormLesserEqualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserEqualDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1931
|
+
FsFormLesserEqualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormLesserEqualDirective, selector: "[fsFormLesserEqual]", inputs: { fsFormLesserEqual: "fsFormLesserEqual", validationMessage: ["fsFormLesserEqualMessage", "validationMessage"] }, providers: [
|
|
1527
1932
|
VALIDATE_MESSAGE_PROVIDER
|
|
1528
1933
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1529
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1934
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserEqualDirective, decorators: [{
|
|
1530
1935
|
type: Directive,
|
|
1531
1936
|
args: [{
|
|
1532
|
-
selector: '[
|
|
1937
|
+
selector: '[fsFormLesserEqual]',
|
|
1533
1938
|
providers: [
|
|
1534
1939
|
VALIDATE_MESSAGE_PROVIDER
|
|
1535
1940
|
],
|
|
1536
1941
|
}]
|
|
1537
|
-
}], propDecorators: {
|
|
1942
|
+
}], propDecorators: { fsFormLesserEqual: [{
|
|
1538
1943
|
type: Input
|
|
1539
1944
|
}], validationMessage: [{
|
|
1540
1945
|
type: Input,
|
|
1541
|
-
args: ['
|
|
1946
|
+
args: ['fsFormLesserEqualMessage']
|
|
1542
1947
|
}] } });
|
|
1543
1948
|
|
|
1544
|
-
class
|
|
1949
|
+
class FsFormLesserDirective extends FsControlDirective {
|
|
1545
1950
|
set validationMessage(value) {
|
|
1546
|
-
this._validateMessages.
|
|
1951
|
+
this._validateMessages.lesser = value;
|
|
1547
1952
|
}
|
|
1548
1953
|
ngOnChanges() {
|
|
1549
1954
|
this._control.updateValueAndValidity();
|
|
1550
1955
|
}
|
|
1551
1956
|
validate(control) {
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
return { compare: true };
|
|
1957
|
+
const lesser = parseFloat(this.fsFormLesser);
|
|
1958
|
+
const value = parseFloat(this._control.value);
|
|
1959
|
+
if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
|
|
1960
|
+
return { lesser: { lesser, actual: value } };
|
|
1557
1961
|
}
|
|
1558
|
-
|
|
1559
|
-
ngAfterViewInit() {
|
|
1560
|
-
this.fsFormCompare.addEventListener('keyup', () => {
|
|
1561
|
-
this._control.updateValueAndValidity();
|
|
1562
|
-
}, false);
|
|
1563
|
-
}
|
|
1564
|
-
ngOnDestroy() {
|
|
1565
|
-
this.fsFormCompare.removeEventListener('keyup', () => {
|
|
1566
|
-
this._control.updateValueAndValidity();
|
|
1567
|
-
}, false);
|
|
1962
|
+
return FsValidators.numeric(this._control);
|
|
1568
1963
|
}
|
|
1569
1964
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1965
|
+
FsFormLesserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1966
|
+
FsFormLesserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
|
|
1967
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1573
1968
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1969
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormLesserDirective, decorators: [{
|
|
1575
1970
|
type: Directive,
|
|
1576
1971
|
args: [{
|
|
1577
|
-
selector: '[
|
|
1972
|
+
selector: '[fsFormLesser]',
|
|
1578
1973
|
providers: [
|
|
1579
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
1974
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
1580
1975
|
],
|
|
1581
1976
|
}]
|
|
1582
|
-
}], propDecorators: {
|
|
1977
|
+
}], propDecorators: { fsFormLesser: [{
|
|
1583
1978
|
type: Input
|
|
1584
1979
|
}], validationMessage: [{
|
|
1585
1980
|
type: Input,
|
|
1586
|
-
args: ['
|
|
1981
|
+
args: ['fsFormLesserMessage']
|
|
1587
1982
|
}] } });
|
|
1588
1983
|
|
|
1589
|
-
class
|
|
1984
|
+
class FsFormMaxDirective extends FsControlDirective {
|
|
1590
1985
|
set validationMessage(value) {
|
|
1591
|
-
this._validateMessages.
|
|
1986
|
+
this._validateMessages.max = value;
|
|
1592
1987
|
}
|
|
1593
1988
|
ngOnChanges() {
|
|
1594
1989
|
this._control.updateValueAndValidity();
|
|
1595
1990
|
}
|
|
1596
1991
|
validate(control) {
|
|
1597
|
-
|
|
1598
|
-
return FsValidators.integer(this._control);
|
|
1599
|
-
}
|
|
1600
|
-
else {
|
|
1601
|
-
return null;
|
|
1602
|
-
}
|
|
1992
|
+
return FsValidators.numeric(this._control) || Validators.max(this.fsFormMax)(this._control);
|
|
1603
1993
|
}
|
|
1604
1994
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1995
|
+
FsFormMaxDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1996
|
+
FsFormMaxDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
|
|
1607
1997
|
VALIDATE_MESSAGE_PROVIDER
|
|
1608
1998
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1609
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
1999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxDirective, decorators: [{
|
|
1610
2000
|
type: Directive,
|
|
1611
2001
|
args: [{
|
|
1612
|
-
selector: '[
|
|
2002
|
+
selector: '[fsFormMax]',
|
|
1613
2003
|
providers: [
|
|
1614
2004
|
VALIDATE_MESSAGE_PROVIDER
|
|
1615
2005
|
],
|
|
1616
2006
|
}]
|
|
1617
|
-
}], propDecorators: {
|
|
2007
|
+
}], propDecorators: { fsFormMax: [{
|
|
1618
2008
|
type: Input
|
|
1619
2009
|
}], validationMessage: [{
|
|
1620
2010
|
type: Input,
|
|
1621
|
-
args: ['
|
|
2011
|
+
args: ['fsFormMaxMessage']
|
|
1622
2012
|
}] } });
|
|
1623
2013
|
|
|
1624
|
-
class
|
|
2014
|
+
class FsFormMaxLengthDirective extends FsControlDirective {
|
|
1625
2015
|
set validationMessage(value) {
|
|
1626
|
-
this._validateMessages.
|
|
2016
|
+
this._validateMessages.maxlength = value;
|
|
1627
2017
|
}
|
|
1628
2018
|
ngOnChanges() {
|
|
1629
2019
|
this._control.updateValueAndValidity();
|
|
1630
2020
|
}
|
|
1631
2021
|
validate(control) {
|
|
1632
|
-
|
|
1633
|
-
return FsValidators.numeric(this._control);
|
|
1634
|
-
}
|
|
1635
|
-
else {
|
|
1636
|
-
return null;
|
|
1637
|
-
}
|
|
2022
|
+
return Validators.maxLength(this.fsFormMaxLength)(this._control);
|
|
1638
2023
|
}
|
|
1639
2024
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
2025
|
+
FsFormMaxLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2026
|
+
FsFormMaxLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
|
|
1642
2027
|
VALIDATE_MESSAGE_PROVIDER
|
|
1643
2028
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1644
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMaxLengthDirective, decorators: [{
|
|
1645
2030
|
type: Directive,
|
|
1646
2031
|
args: [{
|
|
1647
|
-
selector: '[
|
|
2032
|
+
selector: '[fsFormMaxLength]',
|
|
1648
2033
|
providers: [
|
|
1649
2034
|
VALIDATE_MESSAGE_PROVIDER
|
|
1650
2035
|
],
|
|
1651
2036
|
}]
|
|
1652
|
-
}], propDecorators: {
|
|
2037
|
+
}], propDecorators: { fsFormMaxLength: [{
|
|
1653
2038
|
type: Input
|
|
1654
2039
|
}], validationMessage: [{
|
|
1655
2040
|
type: Input,
|
|
1656
|
-
args: ['
|
|
2041
|
+
args: ['fsFormMaxLengthMessage']
|
|
1657
2042
|
}] } });
|
|
1658
2043
|
|
|
1659
|
-
class
|
|
2044
|
+
class FsFormMinDirective extends FsControlDirective {
|
|
1660
2045
|
set validationMessage(value) {
|
|
1661
|
-
this._validateMessages.
|
|
2046
|
+
this._validateMessages.min = value;
|
|
1662
2047
|
}
|
|
1663
2048
|
ngOnChanges() {
|
|
1664
2049
|
this._control.updateValueAndValidity();
|
|
1665
2050
|
}
|
|
1666
2051
|
validate(control) {
|
|
1667
|
-
return Validators.
|
|
2052
|
+
return FsValidators.numeric(this._control) || Validators.min(parseFloat(this.fsFormMin))(this._control);
|
|
1668
2053
|
}
|
|
1669
2054
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
2055
|
+
FsFormMinDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2056
|
+
FsFormMinDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
|
|
1672
2057
|
VALIDATE_MESSAGE_PROVIDER
|
|
1673
2058
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1674
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2059
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinDirective, decorators: [{
|
|
1675
2060
|
type: Directive,
|
|
1676
2061
|
args: [{
|
|
1677
|
-
selector: '[
|
|
2062
|
+
selector: '[fsFormMin]',
|
|
1678
2063
|
providers: [
|
|
1679
2064
|
VALIDATE_MESSAGE_PROVIDER
|
|
1680
2065
|
],
|
|
1681
2066
|
}]
|
|
1682
|
-
}], propDecorators: {
|
|
2067
|
+
}], propDecorators: { fsFormMin: [{
|
|
1683
2068
|
type: Input
|
|
1684
2069
|
}], validationMessage: [{
|
|
1685
2070
|
type: Input,
|
|
1686
|
-
args: ['
|
|
2071
|
+
args: ['fsFormMinMessage']
|
|
1687
2072
|
}] } });
|
|
1688
2073
|
|
|
1689
|
-
class
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
this.validateOnSubmit = false;
|
|
2074
|
+
class FsFormMinLengthDirective extends FsControlDirective {
|
|
2075
|
+
set validationMessage(value) {
|
|
2076
|
+
this._validateMessages.minlength = value;
|
|
1693
2077
|
}
|
|
1694
2078
|
ngOnChanges() {
|
|
1695
2079
|
this._control.updateValueAndValidity();
|
|
1696
2080
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
return of(null);
|
|
1700
|
-
}
|
|
1701
|
-
return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
|
|
2081
|
+
validate(control) {
|
|
2082
|
+
return Validators.minLength(this.fsFormMinLength)(this._control);
|
|
1702
2083
|
}
|
|
1703
2084
|
}
|
|
1704
|
-
|
|
1705
|
-
|
|
2085
|
+
FsFormMinLengthDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinLengthDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2086
|
+
FsFormMinLengthDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
|
|
1706
2087
|
VALIDATE_MESSAGE_PROVIDER
|
|
1707
2088
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1708
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2089
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormMinLengthDirective, decorators: [{
|
|
1709
2090
|
type: Directive,
|
|
1710
2091
|
args: [{
|
|
1711
|
-
selector: '[
|
|
2092
|
+
selector: '[fsFormMinLength]',
|
|
1712
2093
|
providers: [
|
|
1713
2094
|
VALIDATE_MESSAGE_PROVIDER
|
|
1714
2095
|
],
|
|
1715
2096
|
}]
|
|
1716
|
-
}], propDecorators: {
|
|
1717
|
-
type: Input
|
|
1718
|
-
}], fsFormFunctionData: [{
|
|
1719
|
-
type: Input
|
|
1720
|
-
}], validateOnSubmit: [{
|
|
2097
|
+
}], propDecorators: { fsFormMinLength: [{
|
|
1721
2098
|
type: Input
|
|
2099
|
+
}], validationMessage: [{
|
|
2100
|
+
type: Input,
|
|
2101
|
+
args: ['fsFormMinLengthMessage']
|
|
1722
2102
|
}] } });
|
|
1723
2103
|
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
2104
|
+
/**
|
|
2105
|
+
* This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
|
|
2106
|
+
*
|
|
2107
|
+
* This directive required for automatic validation messages
|
|
2108
|
+
*/
|
|
2109
|
+
class FsFormNoFsValidatorsDirective extends FsControlDirective {
|
|
1728
2110
|
ngOnChanges() {
|
|
1729
2111
|
this._control.updateValueAndValidity();
|
|
1730
2112
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
if (!isNaN(greater) && !isNaN(value) && value <= greater) {
|
|
1735
|
-
return { greater: { greater, actual: value } };
|
|
2113
|
+
_subscribeToStatusChagnes() {
|
|
2114
|
+
if (!!this._control.validator || !!this._control.asyncValidator) {
|
|
2115
|
+
super._subscribeToStatusChagnes();
|
|
1736
2116
|
}
|
|
1737
|
-
return FsValidators.numeric(this._control);
|
|
1738
2117
|
}
|
|
1739
2118
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
2119
|
+
FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2120
|
+
FsFormNoFsValidatorsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormGreaterEqual]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])", providers: [
|
|
1742
2121
|
VALIDATE_MESSAGE_PROVIDER
|
|
1743
2122
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1744
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
|
|
1745
2124
|
type: Directive,
|
|
1746
2125
|
args: [{
|
|
1747
|
-
selector: '[
|
|
2126
|
+
selector: '[ngModel]' +
|
|
2127
|
+
':not([required])' +
|
|
2128
|
+
':not([fsFormRequired])' +
|
|
2129
|
+
':not([fsFormCompare])' +
|
|
2130
|
+
':not([fsFormDateRange])' +
|
|
2131
|
+
':not([fsFormEmail])' +
|
|
2132
|
+
':not([fsFormEmails])' +
|
|
2133
|
+
':not([fsFormFunction])' +
|
|
2134
|
+
':not([fsFormGreater])' +
|
|
2135
|
+
':not([fsFormGreaterEqual])' +
|
|
2136
|
+
':not([fsFormInteger])' +
|
|
2137
|
+
':not([fsFormLesser])' +
|
|
2138
|
+
':not([fsFormMax])' +
|
|
2139
|
+
':not([fsFormMaxLength])' +
|
|
2140
|
+
':not([fsFormMin])' +
|
|
2141
|
+
':not([fsFormMinLength])' +
|
|
2142
|
+
':not([fsFormNumeric])' +
|
|
2143
|
+
':not([fsFormPattern])' +
|
|
2144
|
+
':not([fsFormPhone])' +
|
|
2145
|
+
':not([fsFormUrl])' +
|
|
2146
|
+
':not([validate])',
|
|
1748
2147
|
providers: [
|
|
1749
2148
|
VALIDATE_MESSAGE_PROVIDER
|
|
1750
2149
|
],
|
|
1751
2150
|
}]
|
|
1752
|
-
}]
|
|
1753
|
-
type: Input
|
|
1754
|
-
}], validationMessage: [{
|
|
1755
|
-
type: Input,
|
|
1756
|
-
args: ['fsFormGreaterMessage']
|
|
1757
|
-
}] } });
|
|
2151
|
+
}] });
|
|
1758
2152
|
|
|
1759
|
-
class
|
|
2153
|
+
class FsFormNumericDirective extends FsControlDirective {
|
|
1760
2154
|
set validationMessage(value) {
|
|
1761
|
-
this._validateMessages.
|
|
2155
|
+
this._validateMessages.numeric = value;
|
|
1762
2156
|
}
|
|
1763
2157
|
ngOnChanges() {
|
|
1764
2158
|
this._control.updateValueAndValidity();
|
|
1765
2159
|
}
|
|
1766
2160
|
validate(control) {
|
|
1767
|
-
if (isEnabled(this.
|
|
1768
|
-
return FsValidators.
|
|
2161
|
+
if (isEnabled(this.fsFormNumeric)) {
|
|
2162
|
+
return FsValidators.numeric(this._control);
|
|
1769
2163
|
}
|
|
1770
2164
|
else {
|
|
1771
2165
|
return null;
|
|
1772
2166
|
}
|
|
1773
2167
|
}
|
|
1774
2168
|
}
|
|
1775
|
-
|
|
1776
|
-
|
|
2169
|
+
FsFormNumericDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNumericDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2170
|
+
FsFormNumericDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
|
|
1777
2171
|
VALIDATE_MESSAGE_PROVIDER
|
|
1778
2172
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1779
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNumericDirective, decorators: [{
|
|
1780
2174
|
type: Directive,
|
|
1781
2175
|
args: [{
|
|
1782
|
-
selector: '[
|
|
2176
|
+
selector: '[fsFormNumeric]',
|
|
1783
2177
|
providers: [
|
|
1784
2178
|
VALIDATE_MESSAGE_PROVIDER
|
|
1785
2179
|
],
|
|
1786
2180
|
}]
|
|
1787
|
-
}], propDecorators: {
|
|
2181
|
+
}], propDecorators: { fsFormNumeric: [{
|
|
1788
2182
|
type: Input
|
|
1789
2183
|
}], validationMessage: [{
|
|
1790
2184
|
type: Input,
|
|
1791
|
-
args: ['
|
|
2185
|
+
args: ['fsFormNumericMessage']
|
|
1792
2186
|
}] } });
|
|
1793
2187
|
|
|
1794
|
-
class
|
|
2188
|
+
class FsFormPatternDirective extends FsControlDirective {
|
|
1795
2189
|
set validationMessage(value) {
|
|
1796
|
-
this._validateMessages.
|
|
2190
|
+
this._validateMessages.pattern = value;
|
|
1797
2191
|
}
|
|
1798
2192
|
ngOnChanges() {
|
|
1799
2193
|
this._control.updateValueAndValidity();
|
|
1800
2194
|
}
|
|
1801
2195
|
validate(control) {
|
|
1802
|
-
|
|
1803
|
-
const value = parseFloat(this._control.value);
|
|
1804
|
-
if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
|
|
1805
|
-
return { lesser: { lesser, actual: value } };
|
|
1806
|
-
}
|
|
1807
|
-
return FsValidators.numeric(this._control);
|
|
2196
|
+
return Validators.pattern(this.fsFormPattern)(this._control);
|
|
1808
2197
|
}
|
|
1809
2198
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
2199
|
+
FsFormPatternDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPatternDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2200
|
+
FsFormPatternDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
|
|
1812
2201
|
VALIDATE_MESSAGE_PROVIDER
|
|
1813
2202
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1814
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPatternDirective, decorators: [{
|
|
1815
2204
|
type: Directive,
|
|
1816
2205
|
args: [{
|
|
1817
|
-
selector: '[
|
|
2206
|
+
selector: '[fsFormPattern]',
|
|
1818
2207
|
providers: [
|
|
1819
2208
|
VALIDATE_MESSAGE_PROVIDER
|
|
1820
2209
|
],
|
|
1821
2210
|
}]
|
|
1822
|
-
}], propDecorators: {
|
|
2211
|
+
}], propDecorators: { fsFormPattern: [{
|
|
1823
2212
|
type: Input
|
|
1824
2213
|
}], validationMessage: [{
|
|
1825
2214
|
type: Input,
|
|
1826
|
-
args: ['
|
|
2215
|
+
args: ['fsFormPatternMessage']
|
|
1827
2216
|
}] } });
|
|
1828
2217
|
|
|
1829
|
-
class
|
|
1830
|
-
constructor() {
|
|
1831
|
-
super(...arguments);
|
|
1832
|
-
this.fsFormUrlProtocol = false;
|
|
1833
|
-
}
|
|
2218
|
+
class FsFormPhoneDirective extends FsControlDirective {
|
|
1834
2219
|
set validationMessage(value) {
|
|
1835
|
-
this._validateMessages.
|
|
2220
|
+
this._validateMessages.phone = value;
|
|
1836
2221
|
}
|
|
1837
2222
|
ngOnChanges() {
|
|
1838
2223
|
this._control.updateValueAndValidity();
|
|
1839
2224
|
}
|
|
1840
2225
|
validate(control) {
|
|
1841
|
-
if (isEnabled(this.
|
|
1842
|
-
return FsValidators.
|
|
2226
|
+
if (isEnabled(this.fsFormPhone)) {
|
|
2227
|
+
return FsValidators.phone(this._control);
|
|
1843
2228
|
}
|
|
1844
2229
|
else {
|
|
1845
2230
|
return null;
|
|
1846
2231
|
}
|
|
1847
2232
|
}
|
|
1848
2233
|
}
|
|
1849
|
-
|
|
1850
|
-
|
|
2234
|
+
FsFormPhoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPhoneDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2235
|
+
FsFormPhoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
|
|
1851
2236
|
VALIDATE_MESSAGE_PROVIDER
|
|
1852
2237
|
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
1853
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type:
|
|
2238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormPhoneDirective, decorators: [{
|
|
1854
2239
|
type: Directive,
|
|
1855
2240
|
args: [{
|
|
1856
|
-
selector: '[
|
|
2241
|
+
selector: '[fsFormPhone]',
|
|
1857
2242
|
providers: [
|
|
1858
2243
|
VALIDATE_MESSAGE_PROVIDER
|
|
1859
2244
|
],
|
|
1860
2245
|
}]
|
|
1861
|
-
}], propDecorators: {
|
|
1862
|
-
type: Input
|
|
1863
|
-
}], fsFormUrlProtocol: [{
|
|
2246
|
+
}], propDecorators: { fsFormPhone: [{
|
|
1864
2247
|
type: Input
|
|
1865
2248
|
}], validationMessage: [{
|
|
1866
2249
|
type: Input,
|
|
1867
|
-
args: ['
|
|
2250
|
+
args: ['fsFormPhoneMessage']
|
|
1868
2251
|
}] } });
|
|
1869
2252
|
|
|
1870
|
-
class
|
|
1871
|
-
constructor(
|
|
1872
|
-
|
|
1873
|
-
this.
|
|
1874
|
-
this._destroy$ = new Subject();
|
|
1875
|
-
this.type = 'button';
|
|
2253
|
+
class FsFormRequiredDirective extends FsControlDirective {
|
|
2254
|
+
constructor() {
|
|
2255
|
+
super(...arguments);
|
|
2256
|
+
this.required = false;
|
|
1876
2257
|
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
2258
|
+
set setFsFormRequired(value) {
|
|
2259
|
+
this.required = isEnabled(value);
|
|
2260
|
+
}
|
|
2261
|
+
set setRequired(value) {
|
|
2262
|
+
this.required = isEnabled(value);
|
|
2263
|
+
}
|
|
2264
|
+
set validationMessage(value) {
|
|
2265
|
+
this._validateMessages.required = value;
|
|
2266
|
+
}
|
|
2267
|
+
ngOnChanges() {
|
|
2268
|
+
this._control.updateValueAndValidity();
|
|
2269
|
+
}
|
|
2270
|
+
validate(control) {
|
|
2271
|
+
if (this.required) {
|
|
2272
|
+
return Validators.required(this._control);
|
|
1887
2273
|
}
|
|
2274
|
+
return null;
|
|
1888
2275
|
}
|
|
1889
|
-
|
|
1890
|
-
this.
|
|
1891
|
-
this.
|
|
2276
|
+
render() {
|
|
2277
|
+
const wrapper = this.getWrapperElement();
|
|
2278
|
+
if (wrapper && this.getlabelSelector()) {
|
|
2279
|
+
const labelWrapper = wrapper.querySelector(this.getlabelSelector());
|
|
2280
|
+
// Adding class fs-form-label-requried adds the * to the label
|
|
2281
|
+
if (labelWrapper) {
|
|
2282
|
+
if (this.required) {
|
|
2283
|
+
this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
|
|
2284
|
+
}
|
|
2285
|
+
else {
|
|
2286
|
+
this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
super.render();
|
|
1892
2291
|
}
|
|
1893
2292
|
}
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
2293
|
+
FsFormRequiredDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormRequiredDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2294
|
+
FsFormRequiredDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: { setFsFormRequired: ["fsFormRequired", "setFsFormRequired"], setRequired: ["required", "setRequired"], validationMessage: ["fsFormRequiredMessage", "validationMessage"] }, providers: [
|
|
2295
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
2296
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormRequiredDirective, decorators: [{
|
|
1897
2298
|
type: Directive,
|
|
1898
2299
|
args: [{
|
|
1899
|
-
selector: '[
|
|
2300
|
+
selector: '[fsFormRequired],[ngModel][required]',
|
|
2301
|
+
providers: [
|
|
2302
|
+
VALIDATE_MESSAGE_PROVIDER,
|
|
2303
|
+
],
|
|
1900
2304
|
}]
|
|
1901
|
-
}],
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
type: Input
|
|
1909
|
-
|
|
1910
|
-
type: HostBinding,
|
|
1911
|
-
args: ['attr.type']
|
|
1912
|
-
}], closeClick: [{
|
|
1913
|
-
type: HostListener,
|
|
1914
|
-
args: ['click', ['$event.target']]
|
|
2305
|
+
}], propDecorators: { setFsFormRequired: [{
|
|
2306
|
+
type: Input,
|
|
2307
|
+
args: ['fsFormRequired']
|
|
2308
|
+
}], setRequired: [{
|
|
2309
|
+
type: Input,
|
|
2310
|
+
args: ['required']
|
|
2311
|
+
}], validationMessage: [{
|
|
2312
|
+
type: Input,
|
|
2313
|
+
args: ['fsFormRequiredMessage']
|
|
1915
2314
|
}] } });
|
|
1916
2315
|
|
|
1917
|
-
class
|
|
1918
|
-
constructor(
|
|
1919
|
-
|
|
1920
|
-
this.
|
|
1921
|
-
this._elementRef = _elementRef;
|
|
1922
|
-
this._cdRef = _cdRef;
|
|
1923
|
-
this.dirtySubmit = true;
|
|
1924
|
-
this.transitionStyle = null;
|
|
1925
|
-
this.active = false;
|
|
1926
|
-
this.submit = false;
|
|
1927
|
-
this._previousDisabled = false;
|
|
1928
|
-
this._destroy$ = new Subject();
|
|
1929
|
-
}
|
|
1930
|
-
ngOnInit() {
|
|
1931
|
-
this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
|
|
1932
|
-
this.form = this.form || this._form;
|
|
1933
|
-
if (this.form) {
|
|
1934
|
-
this.form.addButton(this);
|
|
1935
|
-
if (this.submit) {
|
|
1936
|
-
fromEvent(this.element, 'click')
|
|
1937
|
-
.pipe(takeUntil(this._destroy$))
|
|
1938
|
-
.subscribe(() => {
|
|
1939
|
-
this.active = true;
|
|
1940
|
-
});
|
|
1941
|
-
if (this.dirtySubmit) {
|
|
1942
|
-
if (this.form.dirtySubmitButton) {
|
|
1943
|
-
if (!this.form.ngForm.dirty) {
|
|
1944
|
-
this.disable();
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
this.transitionStyle = 'none';
|
|
1949
|
-
setTimeout(() => {
|
|
1950
|
-
this.transitionStyle = null;
|
|
1951
|
-
}, 500);
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
disable() {
|
|
1956
|
-
if (this._matButton && !this.active) {
|
|
1957
|
-
this._previousDisabled = this._matButton.disabled;
|
|
1958
|
-
this._matButton.disabled = true;
|
|
1959
|
-
this._cdRef.markForCheck();
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
enable() {
|
|
1963
|
-
if (this._matButton) {
|
|
1964
|
-
this._matButton.disabled = false;
|
|
1965
|
-
this._matButton.disableRipple = true;
|
|
1966
|
-
this._cdRef.markForCheck();
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
process() {
|
|
1970
|
-
this.setClass('process');
|
|
1971
|
-
if (this._matButton) {
|
|
1972
|
-
this._matButton.disableRipple = true;
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
success() {
|
|
1976
|
-
this.setClass('success');
|
|
1977
|
-
if (this._matButton) {
|
|
1978
|
-
this._matButton.disableRipple = false;
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
error() {
|
|
1982
|
-
this.setClass('error');
|
|
1983
|
-
if (this._matButton) {
|
|
1984
|
-
this._matButton.disableRipple = false;
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
setClass(cls) {
|
|
1988
|
-
const svg = this._getSvg(cls);
|
|
1989
|
-
this._resetClass();
|
|
1990
|
-
this._disableShadowAnimation();
|
|
1991
|
-
this.element.classList.add(`submit-${cls}`);
|
|
1992
|
-
this.element.append(svg);
|
|
1993
|
-
}
|
|
1994
|
-
get element() {
|
|
1995
|
-
return this._elementRef.nativeElement;
|
|
1996
|
-
}
|
|
1997
|
-
resetActive() {
|
|
1998
|
-
this.active = false;
|
|
1999
|
-
}
|
|
2000
|
-
reset() {
|
|
2001
|
-
if (!this._previousDisabled) {
|
|
2002
|
-
this.enable();
|
|
2003
|
-
}
|
|
2004
|
-
this.element.querySelectorAll('.svg-icon')
|
|
2005
|
-
.forEach((el) => {
|
|
2006
|
-
el.remove();
|
|
2007
|
-
});
|
|
2008
|
-
if (this._matButton) {
|
|
2009
|
-
this._matButton.disableRipple = false;
|
|
2010
|
-
}
|
|
2011
|
-
this._resetClass();
|
|
2012
|
-
}
|
|
2013
|
-
ngOnDestroy() {
|
|
2014
|
-
var _a;
|
|
2015
|
-
this._destroy$.next();
|
|
2016
|
-
this._destroy$.complete();
|
|
2017
|
-
(_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
|
|
2018
|
-
}
|
|
2019
|
-
_disableShadowAnimation() {
|
|
2020
|
-
// .mat-elevation-z2 removes the click shadow animation
|
|
2021
|
-
//this.element.classList.add('mat-elevation-z2');
|
|
2316
|
+
class FsFormUrlDirective extends FsControlDirective {
|
|
2317
|
+
constructor() {
|
|
2318
|
+
super(...arguments);
|
|
2319
|
+
this.fsFormUrlProtocol = false;
|
|
2022
2320
|
}
|
|
2023
|
-
|
|
2024
|
-
this.
|
|
2321
|
+
set validationMessage(value) {
|
|
2322
|
+
this._validateMessages.url = value;
|
|
2025
2323
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
<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"/>
|
|
2033
|
-
</g>
|
|
2034
|
-
</g>
|
|
2035
|
-
</g>
|
|
2036
|
-
</svg>`, 'text/xml').firstChild;
|
|
2037
|
-
}
|
|
2038
|
-
if (type === 'process') {
|
|
2039
|
-
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">
|
|
2040
|
-
<g fill="none" fill-rule="evenodd">
|
|
2041
|
-
<g transform="translate(1 1)" stroke-width="2"><circle stroke-opacity=".5" cx="18" cy="18" r="18"/>
|
|
2042
|
-
<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>
|
|
2043
|
-
</g>
|
|
2044
|
-
</g>
|
|
2045
|
-
</svg>`, 'text/xml').firstChild;
|
|
2324
|
+
ngOnChanges() {
|
|
2325
|
+
this._control.updateValueAndValidity();
|
|
2326
|
+
}
|
|
2327
|
+
validate(control) {
|
|
2328
|
+
if (isEnabled(this.fsFormUrl)) {
|
|
2329
|
+
return FsValidators.url(this._control, this.fsFormUrlProtocol);
|
|
2046
2330
|
}
|
|
2047
|
-
|
|
2048
|
-
return
|
|
2331
|
+
else {
|
|
2332
|
+
return null;
|
|
2049
2333
|
}
|
|
2050
2334
|
}
|
|
2051
2335
|
}
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2336
|
+
FsFormUrlDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormUrlDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2337
|
+
FsFormUrlDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormUrlDirective, selector: "[fsFormUrl]", inputs: { fsFormUrl: "fsFormUrl", fsFormUrlProtocol: "fsFormUrlProtocol", validationMessage: ["fsFormUrlMessage", "validationMessage"] }, providers: [
|
|
2338
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2339
|
+
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormUrlDirective, decorators: [{
|
|
2055
2341
|
type: Directive,
|
|
2056
2342
|
args: [{
|
|
2057
|
-
selector: '[
|
|
2343
|
+
selector: '[fsFormUrl]',
|
|
2344
|
+
providers: [
|
|
2345
|
+
VALIDATE_MESSAGE_PROVIDER
|
|
2346
|
+
],
|
|
2058
2347
|
}]
|
|
2059
|
-
}],
|
|
2060
|
-
return [{ type: i1$2.MatButton, decorators: [{
|
|
2061
|
-
type: Optional
|
|
2062
|
-
}, {
|
|
2063
|
-
type: Host
|
|
2064
|
-
}] }, { type: FsFormDirective, decorators: [{
|
|
2065
|
-
type: Optional
|
|
2066
|
-
}] }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
|
|
2067
|
-
}, propDecorators: { name: [{
|
|
2068
|
-
type: Input
|
|
2069
|
-
}], dirtySubmit: [{
|
|
2348
|
+
}], propDecorators: { fsFormUrl: [{
|
|
2070
2349
|
type: Input
|
|
2071
|
-
}],
|
|
2350
|
+
}], fsFormUrlProtocol: [{
|
|
2072
2351
|
type: Input
|
|
2073
|
-
}],
|
|
2074
|
-
type:
|
|
2075
|
-
args: ['
|
|
2352
|
+
}], validationMessage: [{
|
|
2353
|
+
type: Input,
|
|
2354
|
+
args: ['fsFormUrlMessage']
|
|
2076
2355
|
}] } });
|
|
2077
2356
|
|
|
2078
2357
|
class FsFormValidateDirective extends FsControlDirective {
|
|
@@ -2112,207 +2391,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
2112
2391
|
type: Input
|
|
2113
2392
|
}] } });
|
|
2114
2393
|
|
|
2115
|
-
class FsFormDialogActionsComponent {
|
|
2116
|
-
constructor(_form, _dialogRef, _cdRef) {
|
|
2117
|
-
this._form = _form;
|
|
2118
|
-
this._dialogRef = _dialogRef;
|
|
2119
|
-
this._cdRef = _cdRef;
|
|
2120
|
-
this.save = true;
|
|
2121
|
-
this.create = false;
|
|
2122
|
-
this.close = false;
|
|
2123
|
-
this.done = false;
|
|
2124
|
-
this.closeData = null;
|
|
2125
|
-
this.dirty = false;
|
|
2126
|
-
this._destroy$ = new Subject();
|
|
2127
|
-
}
|
|
2128
|
-
ngOnInit() {
|
|
2129
|
-
if (this._form) {
|
|
2130
|
-
this._form.ngForm.valueChanges
|
|
2131
|
-
.pipe(filter(() => (!this.dirty)), takeUntil(this._destroy$))
|
|
2132
|
-
.subscribe(() => {
|
|
2133
|
-
this.dirty = this._form.ngForm.dirty;
|
|
2134
|
-
this._cdRef.markForCheck();
|
|
2135
|
-
});
|
|
2136
|
-
this._form.submitted
|
|
2137
|
-
.pipe(delay(50), takeUntil(this._destroy$))
|
|
2138
|
-
.subscribe(() => {
|
|
2139
|
-
this.dirty = false;
|
|
2140
|
-
this._cdRef.markForCheck();
|
|
2141
|
-
});
|
|
2142
|
-
this._form.reseted
|
|
2143
|
-
.pipe(takeUntil(this._destroy$))
|
|
2144
|
-
.subscribe(() => {
|
|
2145
|
-
this.dirty = false;
|
|
2146
|
-
this._cdRef.markForCheck();
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
ngOnDestroy() {
|
|
2151
|
-
this._destroy$.next();
|
|
2152
|
-
this._destroy$.complete();
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
FsFormDialogActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogActionsComponent, deps: [{ token: FsFormDirective, optional: true }, { token: i2$1.MatDialogRef, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2156
|
-
FsFormDialogActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", done: "done", closeData: "closeData", name: "name" }, ngImport: i0, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"], components: [{ type: i1$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i2$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", inputs: ["closeData"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2157
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormDialogActionsComponent, decorators: [{
|
|
2158
|
-
type: Component,
|
|
2159
|
-
args: [{ selector: 'fs-form-dialog-actions', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-buttons\" [ngClass]=\"{ 'save-create': save || create }\">\n <ng-container *ngIf=\"save || create\">\n <button\n mat-button\n type=\"submit\"\n color=\"primary\"\n [name]=\"name\">\n {{create ? 'Create' : 'Save'}}\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"close-button cancel-button\"\n [disabled]=\"close && !dirty && !create\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"done\">\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"save || create\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"close\">\n <button\n mat-button\n type=\"button\"\n class=\"close-button\"\n fsFormDialogClose\n [closeData]=\"closeData\"\n [color]=\"dirty ? 'basic' : 'primary'\">\n Close\n </button>\n </ng-container>\n\n <ng-container *ngIf=\"!(save || create)\">\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n </ng-container>\n</div>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:100%}.form-buttons.save-create .close-button:not(.cancel-button){float:right}\n"] }]
|
|
2160
|
-
}], ctorParameters: function () {
|
|
2161
|
-
return [{ type: FsFormDirective, decorators: [{
|
|
2162
|
-
type: Optional
|
|
2163
|
-
}] }, { type: i2$1.MatDialogRef, decorators: [{
|
|
2164
|
-
type: Optional
|
|
2165
|
-
}] }, { type: i0.ChangeDetectorRef }];
|
|
2166
|
-
}, propDecorators: { save: [{
|
|
2167
|
-
type: Input
|
|
2168
|
-
}], create: [{
|
|
2169
|
-
type: Input
|
|
2170
|
-
}], close: [{
|
|
2171
|
-
type: Input
|
|
2172
|
-
}], done: [{
|
|
2173
|
-
type: Input
|
|
2174
|
-
}], closeData: [{
|
|
2175
|
-
type: Input
|
|
2176
|
-
}], name: [{
|
|
2177
|
-
type: Input
|
|
2178
|
-
}] } });
|
|
2179
|
-
|
|
2180
|
-
/**
|
|
2181
|
-
* This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
|
|
2182
|
-
*
|
|
2183
|
-
* This directive required for automatic validation messages
|
|
2184
|
-
*/
|
|
2185
|
-
class FsFormNoFsValidatorsDirective extends FsControlDirective {
|
|
2186
|
-
ngOnChanges() {
|
|
2187
|
-
this._control.updateValueAndValidity();
|
|
2188
|
-
}
|
|
2189
|
-
_subscribeToStatusChagnes() {
|
|
2190
|
-
if (!!this._control.validator || !!this._control.asyncValidator) {
|
|
2191
|
-
super._subscribeToStatusChagnes();
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
FsFormNoFsValidatorsDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2196
|
-
FsFormNoFsValidatorsDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormNoFsValidatorsDirective, selector: "[ngModel]:not([required]):not([fsFormRequired]):not([fsFormCompare]):not([fsFormDateRange]):not([fsFormEmail]):not([fsFormEmails]):not([fsFormFunction]):not([fsFormGreater]):not([fsFormInteger]):not([fsFormLesser]):not([fsFormMax]):not([fsFormMaxLength]):not([fsFormMin]):not([fsFormMinLength]):not([fsFormNumeric]):not([fsFormPattern]):not([fsFormPhone]):not([fsFormUrl]):not([validate])", providers: [
|
|
2197
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2198
|
-
], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormNoFsValidatorsDirective, decorators: [{
|
|
2200
|
-
type: Directive,
|
|
2201
|
-
args: [{
|
|
2202
|
-
selector: '[ngModel]' +
|
|
2203
|
-
':not([required])' +
|
|
2204
|
-
':not([fsFormRequired])' +
|
|
2205
|
-
':not([fsFormCompare])' +
|
|
2206
|
-
':not([fsFormDateRange])' +
|
|
2207
|
-
':not([fsFormEmail])' +
|
|
2208
|
-
':not([fsFormEmails])' +
|
|
2209
|
-
':not([fsFormFunction])' +
|
|
2210
|
-
':not([fsFormGreater])' +
|
|
2211
|
-
':not([fsFormInteger])' +
|
|
2212
|
-
':not([fsFormLesser])' +
|
|
2213
|
-
':not([fsFormMax])' +
|
|
2214
|
-
':not([fsFormMaxLength])' +
|
|
2215
|
-
':not([fsFormMin])' +
|
|
2216
|
-
':not([fsFormMinLength])' +
|
|
2217
|
-
':not([fsFormNumeric])' +
|
|
2218
|
-
':not([fsFormPattern])' +
|
|
2219
|
-
':not([fsFormPhone])' +
|
|
2220
|
-
':not([fsFormUrl])' +
|
|
2221
|
-
':not([validate])',
|
|
2222
|
-
providers: [
|
|
2223
|
-
VALIDATE_MESSAGE_PROVIDER
|
|
2224
|
-
],
|
|
2225
|
-
}]
|
|
2226
|
-
}] });
|
|
2227
|
-
|
|
2228
|
-
class FsFormTemplateDirective {
|
|
2229
|
-
constructor() { }
|
|
2230
|
-
ngAfterContentInit() {
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
FsFormTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2234
|
-
FsFormTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsFormTemplateDirective, selector: "[fsFormTemplate]", viewQueries: [{ propertyName: "models", predicate: NgModel, descendants: true }], ngImport: i0 });
|
|
2235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateDirective, decorators: [{
|
|
2236
|
-
type: Directive,
|
|
2237
|
-
args: [{
|
|
2238
|
-
selector: '[fsFormTemplate]',
|
|
2239
|
-
}]
|
|
2240
|
-
}], ctorParameters: function () { return []; }, propDecorators: { models: [{
|
|
2241
|
-
type: ViewChildren,
|
|
2242
|
-
args: [NgModel]
|
|
2243
|
-
}] } });
|
|
2244
|
-
|
|
2245
|
-
class FsSubmitButtonDirective extends FsButtonDirective {
|
|
2246
|
-
}
|
|
2247
|
-
FsSubmitButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSubmitButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2248
|
-
FsSubmitButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.4.0", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0 });
|
|
2249
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsSubmitButtonDirective, decorators: [{
|
|
2250
|
-
type: Directive,
|
|
2251
|
-
args: [{
|
|
2252
|
-
selector: 'dummy-selector',
|
|
2253
|
-
}]
|
|
2254
|
-
}] });
|
|
2255
|
-
|
|
2256
|
-
class FsFormTemplateComponent {
|
|
2257
|
-
constructor() { }
|
|
2258
|
-
ngAfterContentInit() {
|
|
2259
|
-
debugger;
|
|
2260
|
-
const x = this.models;
|
|
2261
|
-
this.models.changes.subscribe((x) => {
|
|
2262
|
-
debugger;
|
|
2263
|
-
});
|
|
2264
|
-
}
|
|
2265
|
-
ngOnInit() {
|
|
2266
|
-
debugger;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
FsFormTemplateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2270
|
-
FsFormTemplateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFormTemplateComponent, selector: "fs-form-template", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["templateRef1"], descendants: true }], ngImport: i0, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2271
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateComponent, decorators: [{
|
|
2272
|
-
type: Component,
|
|
2273
|
-
args: [{ selector: 'fs-form-template', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template #templateRef1>\n <ng-content></ng-content>\n</ng-template>" }]
|
|
2274
|
-
}], ctorParameters: function () { return []; }, propDecorators: { templateRef: [{
|
|
2275
|
-
type: ViewChild,
|
|
2276
|
-
args: ['templateRef1']
|
|
2277
|
-
}], formTemplate: [{
|
|
2278
|
-
type: Input
|
|
2279
|
-
}], models: [{
|
|
2280
|
-
type: ContentChildren,
|
|
2281
|
-
args: [NgModel, { descendants: true }]
|
|
2282
|
-
}] } });
|
|
2283
|
-
|
|
2284
|
-
class FsFormTemplateOutletComponent {
|
|
2285
|
-
constructor() { }
|
|
2286
|
-
ngOnChanges(changes) {
|
|
2287
|
-
var _a;
|
|
2288
|
-
if ((_a = changes.formTemplate) === null || _a === void 0 ? void 0 : _a.currentValue) {
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
ngAfterContentInit() {
|
|
2292
|
-
// const x = this.models;
|
|
2293
|
-
// this.models.changes.subscribe((x) => {
|
|
2294
|
-
// debugger;
|
|
2295
|
-
// });
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
FsFormTemplateOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2299
|
-
FsFormTemplateOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsFormTemplateOutletComponent, selector: "fs-form-template-outlet", inputs: { formTemplate: "formTemplate" }, queries: [{ propertyName: "models", predicate: NgModel, descendants: true }], usesOnChanges: true, ngImport: i0, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>", directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "json": i4.JsonPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2300
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormTemplateOutletComponent, decorators: [{
|
|
2301
|
-
type: Component,
|
|
2302
|
-
args: [{ selector: 'fs-form-template-outlet', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n{{formTemplate.templateRef|json}}\n\n<ng-container *ngIf=\"formTemplate\">\n <ng-container [ngTemplateOutlet]=\"formTemplate.templateRef\"></ng-container> \n</ng-container>" }]
|
|
2303
|
-
}], ctorParameters: function () { return []; }, propDecorators: { formTemplate: [{
|
|
2304
|
-
type: Input
|
|
2305
|
-
}], models: [{
|
|
2306
|
-
type: ContentChildren,
|
|
2307
|
-
args: [NgModel, { descendants: true }]
|
|
2308
|
-
}] } });
|
|
2309
|
-
|
|
2310
2394
|
class FsFormModule {
|
|
2311
2395
|
static forRoot() {
|
|
2312
2396
|
/**
|
|
2313
2397
|
* Hack: https://github.com/angular/components/issues/20097
|
|
2314
2398
|
*/
|
|
2315
|
-
ErrorStateMatcher.prototype
|
|
2399
|
+
ErrorStateMatcher.prototype
|
|
2400
|
+
.isErrorState = (control, form) => {
|
|
2316
2401
|
return (control === null || control === void 0 ? void 0 : control.invalid) && (control === null || control === void 0 ? void 0 : control.touched) && (control === null || control === void 0 ? void 0 : control.dirty);
|
|
2317
2402
|
};
|
|
2318
2403
|
return {
|
|
@@ -2338,7 +2423,9 @@ FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
2338
2423
|
FsFormFunctionDirective,
|
|
2339
2424
|
FsFormDateRangeDirective,
|
|
2340
2425
|
FsFormGreaterDirective,
|
|
2426
|
+
FsFormGreaterEqualDirective,
|
|
2341
2427
|
FsFormLesserDirective,
|
|
2428
|
+
FsFormLesserEqualDirective,
|
|
2342
2429
|
FsFormUrlDirective,
|
|
2343
2430
|
FsFormDialogCloseDirective,
|
|
2344
2431
|
FsFormValidateDirective,
|
|
@@ -2348,10 +2435,13 @@ FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
2348
2435
|
FsSubmitButtonDirective,
|
|
2349
2436
|
FsFormTemplateComponent,
|
|
2350
2437
|
FsFormTemplateDirective,
|
|
2351
|
-
FsFormTemplateOutletComponent
|
|
2438
|
+
FsFormTemplateOutletComponent,
|
|
2439
|
+
ConfirmUnsavedComponent], imports: [CommonModule,
|
|
2352
2440
|
FormsModule,
|
|
2353
2441
|
MatButtonModule,
|
|
2354
|
-
MatDialogModule
|
|
2442
|
+
MatDialogModule,
|
|
2443
|
+
MatDialogModule,
|
|
2444
|
+
FsDialogModule], exports: [FsFormDirective,
|
|
2355
2445
|
FsControlDirective,
|
|
2356
2446
|
FsFormRequiredDirective,
|
|
2357
2447
|
FsFormMinDirective,
|
|
@@ -2368,7 +2458,9 @@ FsFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
|
2368
2458
|
FsFormFunctionDirective,
|
|
2369
2459
|
FsFormDateRangeDirective,
|
|
2370
2460
|
FsFormGreaterDirective,
|
|
2461
|
+
FsFormGreaterEqualDirective,
|
|
2371
2462
|
FsFormLesserDirective,
|
|
2463
|
+
FsFormLesserEqualDirective,
|
|
2372
2464
|
FsFormUrlDirective,
|
|
2373
2465
|
FsFormDialogCloseDirective,
|
|
2374
2466
|
FsFormValidateDirective,
|
|
@@ -2389,6 +2481,8 @@ FsFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
|
2389
2481
|
FormsModule,
|
|
2390
2482
|
MatButtonModule,
|
|
2391
2483
|
MatDialogModule,
|
|
2484
|
+
MatDialogModule,
|
|
2485
|
+
FsDialogModule,
|
|
2392
2486
|
]] });
|
|
2393
2487
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsFormModule, decorators: [{
|
|
2394
2488
|
type: NgModule,
|
|
@@ -2398,6 +2492,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
2398
2492
|
FormsModule,
|
|
2399
2493
|
MatButtonModule,
|
|
2400
2494
|
MatDialogModule,
|
|
2495
|
+
MatDialogModule,
|
|
2496
|
+
FsDialogModule,
|
|
2401
2497
|
],
|
|
2402
2498
|
declarations: [
|
|
2403
2499
|
FsFormDirective,
|
|
@@ -2417,7 +2513,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
2417
2513
|
FsFormFunctionDirective,
|
|
2418
2514
|
FsFormDateRangeDirective,
|
|
2419
2515
|
FsFormGreaterDirective,
|
|
2516
|
+
FsFormGreaterEqualDirective,
|
|
2420
2517
|
FsFormLesserDirective,
|
|
2518
|
+
FsFormLesserEqualDirective,
|
|
2421
2519
|
FsFormUrlDirective,
|
|
2422
2520
|
FsFormDialogCloseDirective,
|
|
2423
2521
|
FsFormValidateDirective,
|
|
@@ -2428,6 +2526,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
2428
2526
|
FsFormTemplateComponent,
|
|
2429
2527
|
FsFormTemplateDirective,
|
|
2430
2528
|
FsFormTemplateOutletComponent,
|
|
2529
|
+
ConfirmUnsavedComponent,
|
|
2431
2530
|
],
|
|
2432
2531
|
exports: [
|
|
2433
2532
|
FsFormDirective,
|
|
@@ -2447,7 +2546,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
2447
2546
|
FsFormFunctionDirective,
|
|
2448
2547
|
FsFormDateRangeDirective,
|
|
2449
2548
|
FsFormGreaterDirective,
|
|
2549
|
+
FsFormGreaterEqualDirective,
|
|
2450
2550
|
FsFormLesserDirective,
|
|
2551
|
+
FsFormLesserEqualDirective,
|
|
2451
2552
|
FsFormUrlDirective,
|
|
2452
2553
|
FsFormDialogCloseDirective,
|
|
2453
2554
|
FsFormValidateDirective,
|
|
@@ -2474,5 +2575,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
|
|
|
2474
2575
|
* Generated bundle index. Do not edit.
|
|
2475
2576
|
*/
|
|
2476
2577
|
|
|
2477
|
-
export { ConfirmResult, FormDeactivateGuard, FormStatus, FsButtonDirective, FsControlDirective, FsForm, FsFormCompareDirective, FsFormDateRangeDirective, FsFormDialogActionsComponent, FsFormDialogCloseDirective, FsFormDirective, FsFormEmailDirective, FsFormEmailsDirective, FsFormFunctionDirective, FsFormGreaterDirective, FsFormIntegerDirective, FsFormLesserDirective, FsFormMaxDirective, FsFormMaxLengthDirective, FsFormMinDirective, FsFormMinLengthDirective, FsFormModule, FsFormNoFsValidatorsDirective, FsFormNumericDirective, FsFormPatternDirective, FsFormPhoneDirective, FsFormRequiredDirective, FsFormTemplateComponent, FsFormTemplateDirective, FsFormTemplateOutletComponent, FsFormUrlDirective, FsFormValidateDirective, FsSubmitButtonDirective, FsValidators };
|
|
2578
|
+
export { ConfirmResult, FormDeactivateGuard, FormStatus, FsButtonDirective, FsControlDirective, FsForm, FsFormCompareDirective, FsFormDateRangeDirective, FsFormDialogActionsComponent, FsFormDialogCloseDirective, FsFormDirective, FsFormEmailDirective, FsFormEmailsDirective, FsFormFunctionDirective, FsFormGreaterDirective, FsFormGreaterEqualDirective, FsFormIntegerDirective, FsFormLesserDirective, FsFormLesserEqualDirective, FsFormMaxDirective, FsFormMaxLengthDirective, FsFormMinDirective, FsFormMinLengthDirective, FsFormModule, FsFormNoFsValidatorsDirective, FsFormNumericDirective, FsFormPatternDirective, FsFormPhoneDirective, FsFormRequiredDirective, FsFormTemplateComponent, FsFormTemplateDirective, FsFormTemplateOutletComponent, FsFormUrlDirective, FsFormValidateDirective, FsSubmitButtonDirective, FsValidators };
|
|
2478
2579
|
//# sourceMappingURL=firestitch-form.mjs.map
|