@firestitch/form 12.5.2 → 13.1.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.
Files changed (132) hide show
  1. package/app/components/form-dialog-actions/form-dialog-actions.component.d.ts +22 -23
  2. package/app/components/form-dialog-actions/index.d.ts +1 -0
  3. package/app/components/form-template/form-template.component.d.ts +13 -0
  4. package/app/components/form-template/index.d.ts +1 -0
  5. package/app/components/form-template-outlet/form-template-outlet.component.d.ts +13 -0
  6. package/app/components/form-template-outlet/index.d.ts +1 -0
  7. package/app/components/index.d.ts +3 -0
  8. package/app/consts/error-messages.const.d.ts +19 -19
  9. package/app/directives/button.directive.d.ts +35 -35
  10. package/app/directives/form/form.directive.d.ts +123 -127
  11. package/app/directives/form/index.d.ts +1 -0
  12. package/app/directives/form-dialog-close.directive.d.ts +16 -12
  13. package/app/directives/form-template.directive.d.ts +10 -0
  14. package/app/directives/index.d.ts +6 -2
  15. package/app/directives/submit-button.directive.d.ts +6 -6
  16. package/app/directives/validators/compare.directive.d.ts +15 -15
  17. package/app/directives/validators/control.directive.d.ts +49 -49
  18. package/app/directives/validators/daterange.directive.d.ts +13 -13
  19. package/app/directives/validators/email.directive.d.ts +13 -13
  20. package/app/directives/validators/emails.directive.d.ts +13 -13
  21. package/app/directives/validators/function.directive.d.ts +15 -15
  22. package/app/directives/validators/greater.directive.d.ts +13 -13
  23. package/app/directives/validators/index.d.ts +20 -0
  24. package/app/directives/validators/integer.directive.d.ts +13 -13
  25. package/app/directives/validators/lesser.directive.d.ts +13 -13
  26. package/app/directives/validators/max.directive.d.ts +13 -13
  27. package/app/directives/validators/maxlength.directive.d.ts +13 -13
  28. package/app/directives/validators/min.directive.d.ts +13 -13
  29. package/app/directives/validators/minlength.directive.d.ts +13 -13
  30. package/app/directives/validators/no-fs-validators.directive.d.ts +14 -14
  31. package/app/directives/validators/numeric.directive.d.ts +13 -13
  32. package/app/directives/validators/pattern.directive.d.ts +13 -13
  33. package/app/directives/validators/phone.directive.d.ts +13 -13
  34. package/app/directives/validators/required.directive.d.ts +16 -16
  35. package/app/directives/validators/url.directive.d.ts +14 -14
  36. package/app/directives/validators/validate.directive.d.ts +15 -15
  37. package/app/enums/confirm-result.d.ts +7 -7
  38. package/app/enums/form-status.d.ts +10 -10
  39. package/app/fs-form.module.d.ts +40 -37
  40. package/app/guards/form-deactivate.guard.d.ts +14 -14
  41. package/app/helpers/confirm-result-continue.d.ts +1 -1
  42. package/app/helpers/confirm-unsaved.d.ts +5 -5
  43. package/app/helpers/get-active-route.d.ts +2 -2
  44. package/app/helpers/get-form-errors.d.ts +2 -2
  45. package/app/helpers/index.d.ts +2 -2
  46. package/app/helpers/is-enabled.d.ts +1 -1
  47. package/app/interfaces/async-validator.d.ts +14 -14
  48. package/app/interfaces/confirm-config.d.ts +7 -7
  49. package/app/interfaces/confirm-tab-group.d.ts +10 -10
  50. package/app/interfaces/index.d.ts +4 -4
  51. package/app/interfaces/submit-event.d.ts +6 -6
  52. package/app/interfaces/submitted-event.d.ts +7 -7
  53. package/app/interfaces/validator.d.ts +13 -13
  54. package/app/providers/validate-messages.provider.d.ts +25 -25
  55. package/app/services/fsform.service.d.ts +16 -16
  56. package/app/validators/validators.d.ts +12 -12
  57. package/esm2020/app/components/form-dialog-actions/form-dialog-actions.component.mjs +75 -0
  58. package/esm2020/app/components/form-dialog-actions/index.mjs +2 -0
  59. package/esm2020/app/components/form-template/form-template.component.mjs +31 -0
  60. package/esm2020/app/components/form-template/index.mjs +2 -0
  61. package/esm2020/app/components/form-template-outlet/form-template-outlet.component.mjs +30 -0
  62. package/esm2020/app/components/form-template-outlet/index.mjs +2 -0
  63. package/esm2020/app/components/index.mjs +4 -0
  64. package/{esm2015/app/consts/error-messages.const.js → esm2020/app/consts/error-messages.const.mjs} +19 -19
  65. package/{esm2015/app/directives/button.directive.js → esm2020/app/directives/button.directive.mjs} +152 -153
  66. package/esm2020/app/directives/form/form.directive.mjs +686 -0
  67. package/esm2020/app/directives/form/index.mjs +2 -0
  68. package/esm2020/app/directives/form-dialog-close.directive.mjs +54 -0
  69. package/esm2020/app/directives/form-template.directive.mjs +20 -0
  70. package/esm2020/app/directives/index.mjs +7 -0
  71. package/{esm2015/app/directives/submit-button.directive.js → esm2020/app/directives/submit-button.directive.mjs} +14 -14
  72. package/{esm2015/app/directives/validators/compare.directive.js → esm2020/app/directives/validators/compare.directive.mjs} +49 -49
  73. package/esm2020/app/directives/validators/control.directive.mjs +259 -0
  74. package/{esm2015/app/directives/validators/daterange.directive.js → esm2020/app/directives/validators/daterange.directive.mjs} +41 -41
  75. package/{esm2015/app/directives/validators/email.directive.js → esm2020/app/directives/validators/email.directive.mjs} +41 -41
  76. package/{esm2015/app/directives/validators/emails.directive.js → esm2020/app/directives/validators/emails.directive.mjs} +41 -41
  77. package/{esm2015/app/directives/validators/function.directive.js → esm2020/app/directives/validators/function.directive.mjs} +41 -41
  78. package/{esm2015/app/directives/validators/greater.directive.js → esm2020/app/directives/validators/greater.directive.mjs} +40 -40
  79. package/esm2020/app/directives/validators/index.mjs +21 -0
  80. package/{esm2015/app/directives/validators/integer.directive.js → esm2020/app/directives/validators/integer.directive.mjs} +41 -41
  81. package/{esm2015/app/directives/validators/lesser.directive.js → esm2020/app/directives/validators/lesser.directive.mjs} +40 -40
  82. package/{esm2015/app/directives/validators/max.directive.js → esm2020/app/directives/validators/max.directive.mjs} +36 -36
  83. package/{esm2015/app/directives/validators/maxlength.directive.js → esm2020/app/directives/validators/maxlength.directive.mjs} +35 -35
  84. package/{esm2015/app/directives/validators/min.directive.js → esm2020/app/directives/validators/min.directive.mjs} +36 -36
  85. package/{esm2015/app/directives/validators/minlength.directive.js → esm2020/app/directives/validators/minlength.directive.mjs} +35 -35
  86. package/{esm2015/app/directives/validators/no-fs-validators.directive.js → esm2020/app/directives/validators/no-fs-validators.directive.mjs} +52 -52
  87. package/{esm2015/app/directives/validators/numeric.directive.js → esm2020/app/directives/validators/numeric.directive.mjs} +41 -41
  88. package/{esm2015/app/directives/validators/pattern.directive.js → esm2020/app/directives/validators/pattern.directive.mjs} +35 -35
  89. package/{esm2015/app/directives/validators/phone.directive.js → esm2020/app/directives/validators/phone.directive.mjs} +41 -41
  90. package/{esm2015/app/directives/validators/required.directive.js → esm2020/app/directives/validators/required.directive.mjs} +71 -71
  91. package/{esm2015/app/directives/validators/url.directive.js → esm2020/app/directives/validators/url.directive.mjs} +47 -47
  92. package/{esm2015/app/directives/validators/validate.directive.js → esm2020/app/directives/validators/validate.directive.mjs} +43 -43
  93. package/{esm2015/app/enums/confirm-result.js → esm2020/app/enums/confirm-result.mjs} +8 -8
  94. package/{esm2015/app/enums/form-status.js → esm2020/app/enums/form-status.mjs} +11 -11
  95. package/esm2020/app/fs-form.module.mjs +194 -0
  96. package/{esm2015/app/guards/form-deactivate.guard.js → esm2020/app/guards/form-deactivate.guard.mjs} +45 -45
  97. package/{esm2015/app/helpers/confirm-result-continue.js → esm2020/app/helpers/confirm-result-continue.mjs} +4 -4
  98. package/{esm2015/app/helpers/confirm-unsaved.js → esm2020/app/helpers/confirm-unsaved.mjs} +71 -71
  99. package/{esm2015/app/helpers/get-active-route.js → esm2020/app/helpers/get-active-route.mjs} +6 -6
  100. package/esm2020/app/helpers/get-form-errors.mjs +25 -0
  101. package/{esm2015/app/helpers/index.js → esm2020/app/helpers/index.mjs} +2 -2
  102. package/{esm2015/app/helpers/is-enabled.js → esm2020/app/helpers/is-enabled.mjs} +3 -3
  103. package/{esm2015/app/interfaces/async-validator.js → esm2020/app/interfaces/async-validator.mjs} +1 -1
  104. package/{esm2015/app/interfaces/confirm-config.js → esm2020/app/interfaces/confirm-config.mjs} +1 -1
  105. package/{esm2015/app/interfaces/confirm-tab-group.js → esm2020/app/interfaces/confirm-tab-group.mjs} +1 -1
  106. package/{esm2015/app/interfaces/index.js → esm2020/app/interfaces/index.mjs} +4 -4
  107. package/{esm2015/app/interfaces/submit-event.js → esm2020/app/interfaces/submit-event.mjs} +1 -1
  108. package/{esm2015/app/interfaces/submitted-event.js → esm2020/app/interfaces/submitted-event.mjs} +1 -1
  109. package/{esm2015/app/interfaces/validator.js → esm2020/app/interfaces/validator.mjs} +1 -1
  110. package/{esm2015/app/providers/validate-messages.provider.js → esm2020/app/providers/validate-messages.provider.mjs} +11 -11
  111. package/{esm2015/app/services/fsform.service.js → esm2020/app/services/fsform.service.mjs} +40 -40
  112. package/{esm2015/app/validators/validators.js → esm2020/app/validators/validators.mjs} +96 -96
  113. package/{esm2015/firestitch-form.js → esm2020/firestitch-form.mjs} +4 -4
  114. package/esm2020/public_api.mjs +38 -0
  115. package/fesm2015/firestitch-form.mjs +2478 -0
  116. package/fesm2015/firestitch-form.mjs.map +1 -0
  117. package/{fesm2015/firestitch-form.js → fesm2020/firestitch-form.mjs} +2353 -2299
  118. package/fesm2020/firestitch-form.mjs.map +1 -0
  119. package/firestitch-form.d.ts +5 -5
  120. package/package.json +20 -7
  121. package/public_api.d.ts +35 -34
  122. package/bundles/firestitch-form.umd.js +0 -3012
  123. package/bundles/firestitch-form.umd.js.map +0 -1
  124. package/esm2015/app/components/form-dialog-actions/form-dialog-actions.component.js +0 -92
  125. package/esm2015/app/directives/form/form.directive.js +0 -712
  126. package/esm2015/app/directives/form-dialog-close.directive.js +0 -31
  127. package/esm2015/app/directives/index.js +0 -3
  128. package/esm2015/app/directives/validators/control.directive.js +0 -261
  129. package/esm2015/app/fs-form.module.js +0 -181
  130. package/esm2015/app/helpers/get-form-errors.js +0 -25
  131. package/esm2015/public_api.js +0 -37
  132. package/fesm2015/firestitch-form.js.map +0 -1
@@ -1,3012 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/button'), require('@angular/material/dialog'), require('@angular/material/core'), require('@angular/material/tabs'), require('@firestitch/common'), require('@firestitch/drawer'), require('@firestitch/message'), require('rxjs'), require('rxjs/operators'), require('@firestitch/prompt'), require('@angular/router'), require('lodash-es'), require('date-fns')) :
3
- typeof define === 'function' && define.amd ? define('@firestitch/form', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/button', '@angular/material/dialog', '@angular/material/core', '@angular/material/tabs', '@firestitch/common', '@firestitch/drawer', '@firestitch/message', 'rxjs', 'rxjs/operators', '@firestitch/prompt', '@angular/router', 'lodash-es', 'date-fns'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch.form = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.material.button, global.ng.material.dialog, global.ng.material.core, global.ng.material.tabs, global.common, global.i7, global.i2, global.rxjs, global.rxjs.operators, global.i1, global.ng.router, global.lodashEs, global.dateFns));
5
- })(this, (function (exports, i0, i4, i1$1, i1$2, i2$1, core, tabs, common, i7, i2, rxjs, operators, i1, i3, lodashEs, dateFns) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
27
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
28
- var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
29
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
30
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
31
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
32
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
33
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
34
-
35
- /*! *****************************************************************************
36
- Copyright (c) Microsoft Corporation.
37
-
38
- Permission to use, copy, modify, and/or distribute this software for any
39
- purpose with or without fee is hereby granted.
40
-
41
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
42
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
43
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
44
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
45
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
46
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
47
- PERFORMANCE OF THIS SOFTWARE.
48
- ***************************************************************************** */
49
- /* global Reflect, Promise */
50
- var extendStatics = function (d, b) {
51
- extendStatics = Object.setPrototypeOf ||
52
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
53
- function (d, b) { for (var p in b)
54
- if (Object.prototype.hasOwnProperty.call(b, p))
55
- d[p] = b[p]; };
56
- return extendStatics(d, b);
57
- };
58
- function __extends(d, b) {
59
- if (typeof b !== "function" && b !== null)
60
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
61
- extendStatics(d, b);
62
- function __() { this.constructor = d; }
63
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
64
- }
65
- var __assign = function () {
66
- __assign = Object.assign || function __assign(t) {
67
- for (var s, i = 1, n = arguments.length; i < n; i++) {
68
- s = arguments[i];
69
- for (var p in s)
70
- if (Object.prototype.hasOwnProperty.call(s, p))
71
- t[p] = s[p];
72
- }
73
- return t;
74
- };
75
- return __assign.apply(this, arguments);
76
- };
77
- function __rest(s, e) {
78
- var t = {};
79
- for (var p in s)
80
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
81
- t[p] = s[p];
82
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
83
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
84
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
85
- t[p[i]] = s[p[i]];
86
- }
87
- return t;
88
- }
89
- function __decorate(decorators, target, key, desc) {
90
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
91
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
92
- r = Reflect.decorate(decorators, target, key, desc);
93
- else
94
- for (var i = decorators.length - 1; i >= 0; i--)
95
- if (d = decorators[i])
96
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
97
- return c > 3 && r && Object.defineProperty(target, key, r), r;
98
- }
99
- function __param(paramIndex, decorator) {
100
- return function (target, key) { decorator(target, key, paramIndex); };
101
- }
102
- function __metadata(metadataKey, metadataValue) {
103
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
104
- return Reflect.metadata(metadataKey, metadataValue);
105
- }
106
- function __awaiter(thisArg, _arguments, P, generator) {
107
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
108
- return new (P || (P = Promise))(function (resolve, reject) {
109
- function fulfilled(value) { try {
110
- step(generator.next(value));
111
- }
112
- catch (e) {
113
- reject(e);
114
- } }
115
- function rejected(value) { try {
116
- step(generator["throw"](value));
117
- }
118
- catch (e) {
119
- reject(e);
120
- } }
121
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
122
- step((generator = generator.apply(thisArg, _arguments || [])).next());
123
- });
124
- }
125
- function __generator(thisArg, body) {
126
- var _ = { label: 0, sent: function () { if (t[0] & 1)
127
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
128
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
129
- function verb(n) { return function (v) { return step([n, v]); }; }
130
- function step(op) {
131
- if (f)
132
- throw new TypeError("Generator is already executing.");
133
- while (_)
134
- try {
135
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
136
- return t;
137
- if (y = 0, t)
138
- op = [op[0] & 2, t.value];
139
- switch (op[0]) {
140
- case 0:
141
- case 1:
142
- t = op;
143
- break;
144
- case 4:
145
- _.label++;
146
- return { value: op[1], done: false };
147
- case 5:
148
- _.label++;
149
- y = op[1];
150
- op = [0];
151
- continue;
152
- case 7:
153
- op = _.ops.pop();
154
- _.trys.pop();
155
- continue;
156
- default:
157
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
158
- _ = 0;
159
- continue;
160
- }
161
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
162
- _.label = op[1];
163
- break;
164
- }
165
- if (op[0] === 6 && _.label < t[1]) {
166
- _.label = t[1];
167
- t = op;
168
- break;
169
- }
170
- if (t && _.label < t[2]) {
171
- _.label = t[2];
172
- _.ops.push(op);
173
- break;
174
- }
175
- if (t[2])
176
- _.ops.pop();
177
- _.trys.pop();
178
- continue;
179
- }
180
- op = body.call(thisArg, _);
181
- }
182
- catch (e) {
183
- op = [6, e];
184
- y = 0;
185
- }
186
- finally {
187
- f = t = 0;
188
- }
189
- if (op[0] & 5)
190
- throw op[1];
191
- return { value: op[0] ? op[1] : void 0, done: true };
192
- }
193
- }
194
- var __createBinding = Object.create ? (function (o, m, k, k2) {
195
- if (k2 === undefined)
196
- k2 = k;
197
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
198
- }) : (function (o, m, k, k2) {
199
- if (k2 === undefined)
200
- k2 = k;
201
- o[k2] = m[k];
202
- });
203
- function __exportStar(m, o) {
204
- for (var p in m)
205
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
206
- __createBinding(o, m, p);
207
- }
208
- function __values(o) {
209
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
210
- if (m)
211
- return m.call(o);
212
- if (o && typeof o.length === "number")
213
- return {
214
- next: function () {
215
- if (o && i >= o.length)
216
- o = void 0;
217
- return { value: o && o[i++], done: !o };
218
- }
219
- };
220
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
221
- }
222
- function __read(o, n) {
223
- var m = typeof Symbol === "function" && o[Symbol.iterator];
224
- if (!m)
225
- return o;
226
- var i = m.call(o), r, ar = [], e;
227
- try {
228
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
229
- ar.push(r.value);
230
- }
231
- catch (error) {
232
- e = { error: error };
233
- }
234
- finally {
235
- try {
236
- if (r && !r.done && (m = i["return"]))
237
- m.call(i);
238
- }
239
- finally {
240
- if (e)
241
- throw e.error;
242
- }
243
- }
244
- return ar;
245
- }
246
- /** @deprecated */
247
- function __spread() {
248
- for (var ar = [], i = 0; i < arguments.length; i++)
249
- ar = ar.concat(__read(arguments[i]));
250
- return ar;
251
- }
252
- /** @deprecated */
253
- function __spreadArrays() {
254
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
255
- s += arguments[i].length;
256
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
257
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
258
- r[k] = a[j];
259
- return r;
260
- }
261
- function __spreadArray(to, from, pack) {
262
- if (pack || arguments.length === 2)
263
- for (var i = 0, l = from.length, ar; i < l; i++) {
264
- if (ar || !(i in from)) {
265
- if (!ar)
266
- ar = Array.prototype.slice.call(from, 0, i);
267
- ar[i] = from[i];
268
- }
269
- }
270
- return to.concat(ar || Array.prototype.slice.call(from));
271
- }
272
- function __await(v) {
273
- return this instanceof __await ? (this.v = v, this) : new __await(v);
274
- }
275
- function __asyncGenerator(thisArg, _arguments, generator) {
276
- if (!Symbol.asyncIterator)
277
- throw new TypeError("Symbol.asyncIterator is not defined.");
278
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
279
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
280
- function verb(n) { if (g[n])
281
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
282
- function resume(n, v) { try {
283
- step(g[n](v));
284
- }
285
- catch (e) {
286
- settle(q[0][3], e);
287
- } }
288
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
289
- function fulfill(value) { resume("next", value); }
290
- function reject(value) { resume("throw", value); }
291
- function settle(f, v) { if (f(v), q.shift(), q.length)
292
- resume(q[0][0], q[0][1]); }
293
- }
294
- function __asyncDelegator(o) {
295
- var i, p;
296
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
297
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
298
- }
299
- function __asyncValues(o) {
300
- if (!Symbol.asyncIterator)
301
- throw new TypeError("Symbol.asyncIterator is not defined.");
302
- var m = o[Symbol.asyncIterator], i;
303
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
304
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
305
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
306
- }
307
- function __makeTemplateObject(cooked, raw) {
308
- if (Object.defineProperty) {
309
- Object.defineProperty(cooked, "raw", { value: raw });
310
- }
311
- else {
312
- cooked.raw = raw;
313
- }
314
- return cooked;
315
- }
316
- ;
317
- var __setModuleDefault = Object.create ? (function (o, v) {
318
- Object.defineProperty(o, "default", { enumerable: true, value: v });
319
- }) : function (o, v) {
320
- o["default"] = v;
321
- };
322
- function __importStar(mod) {
323
- if (mod && mod.__esModule)
324
- return mod;
325
- var result = {};
326
- if (mod != null)
327
- for (var k in mod)
328
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
329
- __createBinding(result, mod, k);
330
- __setModuleDefault(result, mod);
331
- return result;
332
- }
333
- function __importDefault(mod) {
334
- return (mod && mod.__esModule) ? mod : { default: mod };
335
- }
336
- function __classPrivateFieldGet(receiver, state, kind, f) {
337
- if (kind === "a" && !f)
338
- throw new TypeError("Private accessor was defined without a getter");
339
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
340
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
341
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
342
- }
343
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
344
- if (kind === "m")
345
- throw new TypeError("Private method is not writable");
346
- if (kind === "a" && !f)
347
- throw new TypeError("Private accessor was defined without a setter");
348
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
349
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
350
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
351
- }
352
-
353
- exports.ConfirmResult = void 0;
354
- (function (ConfirmResult) {
355
- ConfirmResult["Save"] = "save";
356
- ConfirmResult["Discard"] = "discard";
357
- ConfirmResult["Review"] = "review";
358
- ConfirmResult["Invalid"] = "invalid";
359
- ConfirmResult["Pristine"] = "pristine";
360
- })(exports.ConfirmResult || (exports.ConfirmResult = {}));
361
-
362
- function confirmUnsaved(directives, prompt) {
363
- return new rxjs.Observable(function (observer) {
364
- // TODO support for multiple directives per page
365
- var form = directives[0];
366
- if (!form.confirm || !form.ngForm.dirty) {
367
- observer.next(exports.ConfirmResult.Pristine);
368
- observer.complete();
369
- return;
370
- }
371
- var title = 'You Have Unsaved Changes';
372
- var message = 'What would you like to do with your changes?';
373
- var saveLabel = 'Save & Continue';
374
- var discardLabel = 'Discard Changes & Continue';
375
- var cancelLabel = 'Review Changes';
376
- if (typeof form.confirm === 'object') {
377
- title = form.confirm.title || title;
378
- message = form.confirm.message || message;
379
- saveLabel = form.confirm.saveLabel || saveLabel;
380
- discardLabel = form.confirm.discardLabel || discardLabel;
381
- cancelLabel = form.confirm.cancelLabel || cancelLabel;
382
- }
383
- prompt.confirm({
384
- title: title,
385
- template: message,
386
- dialogConfig: { width: 'auto' },
387
- buttons: [
388
- {
389
- label: saveLabel,
390
- color: 'primary',
391
- value: 'save'
392
- },
393
- {
394
- label: discardLabel,
395
- value: 'discard'
396
- },
397
- {
398
- label: cancelLabel,
399
- cancel: true
400
- }
401
- ]
402
- }).subscribe(function (value) {
403
- if (value === 'discard') {
404
- observer.next(exports.ConfirmResult.Discard);
405
- observer.complete();
406
- form.reset();
407
- }
408
- if (value === 'save') {
409
- form.submitted
410
- .pipe(operators.first())
411
- .subscribe(function () {
412
- observer.next(exports.ConfirmResult.Save);
413
- observer.complete();
414
- });
415
- form.invalid
416
- .pipe(operators.first())
417
- .subscribe(function () {
418
- observer.next(exports.ConfirmResult.Invalid);
419
- observer.complete();
420
- });
421
- form.ngForm.control.markAsPristine();
422
- form.triggerSubmit({ confirmed: true });
423
- }
424
- }, function (error) {
425
- observer.next(exports.ConfirmResult.Review);
426
- observer.complete();
427
- });
428
- });
429
- }
430
-
431
- function confirmResultContinue(result) {
432
- return result === exports.ConfirmResult.Discard || result === exports.ConfirmResult.Save || result === exports.ConfirmResult.Pristine;
433
- }
434
-
435
- function getActiveRoute(route) {
436
- while (route.firstChild) {
437
- route = route.firstChild;
438
- }
439
- return route;
440
- }
441
-
442
- var FsForm = /** @class */ (function () {
443
- function FsForm() {
444
- // value is array for future possibilities of extension
445
- this._formDirectiveStore = new WeakMap();
446
- this._eventBus = new rxjs.Subject();
447
- }
448
- // @deprecated
449
- FsForm.prototype.broadcast = function (key, data) {
450
- this._eventBus.next({ key: key, data: data });
451
- };
452
- // @deprecated
453
- FsForm.prototype.on = function (key) {
454
- return this._eventBus.asObservable()
455
- .pipe(operators.filter(function (event) { return event.key === key; }), operators.map(function (event) { return event.data; }));
456
- };
457
- FsForm.prototype.registerFormDirective = function (routeComponent, directive) {
458
- var directives = this.getFormDirectives(routeComponent) || [];
459
- directives.push(directive);
460
- this._formDirectiveStore.set(routeComponent, directives);
461
- };
462
- FsForm.prototype.getFormDirectives = function (routeComponent) {
463
- return this._formDirectiveStore.get(routeComponent);
464
- };
465
- FsForm.prototype.removeFormDirective = function (routeComponent) {
466
- this._formDirectiveStore.delete(routeComponent);
467
- };
468
- return FsForm;
469
- }());
470
- FsForm.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsForm, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
471
- FsForm.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsForm, providedIn: 'root' });
472
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsForm, decorators: [{
473
- type: i0.Injectable,
474
- args: [{
475
- providedIn: 'root',
476
- }]
477
- }], ctorParameters: function () { return []; } });
478
-
479
- var FormDeactivateGuard = /** @class */ (function () {
480
- function FormDeactivateGuard(_prompt, _fsForm, _route) {
481
- this._prompt = _prompt;
482
- this._fsForm = _fsForm;
483
- this._route = _route;
484
- }
485
- FormDeactivateGuard.prototype.canDeactivate = function () {
486
- var route = getActiveRoute(this._route);
487
- if (!route) {
488
- console.error("Can not find route for FormDeactivateGuard checks");
489
- return rxjs.of(true);
490
- }
491
- var directives = this._fsForm.getFormDirectives(route.routeConfig.component);
492
- if (!Array.isArray(directives) || directives.length === 0) {
493
- console.error("Can not find a valid FsFormDirective");
494
- return rxjs.of(true);
495
- }
496
- return confirmUnsaved(directives, this._prompt)
497
- .pipe(operators.map(function (result) {
498
- return confirmResultContinue(result);
499
- }));
500
- };
501
- return FormDeactivateGuard;
502
- }());
503
- FormDeactivateGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, deps: [{ token: i1__namespace.FsPrompt }, { token: FsForm }, { token: i3__namespace.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
504
- FormDeactivateGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, providedIn: 'root' });
505
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FormDeactivateGuard, decorators: [{
506
- type: i0.Injectable,
507
- args: [{
508
- providedIn: 'root',
509
- }]
510
- }], ctorParameters: function () { return [{ type: i1__namespace.FsPrompt }, { type: FsForm }, { type: i3__namespace.ActivatedRoute }]; } });
511
-
512
- function getFormErrors(control, key) {
513
- var _a;
514
- var errors = null;
515
- if (control.invalid && control.errors) {
516
- errors = (_a = {},
517
- _a[key] = Object.assign({}, control.errors),
518
- _a);
519
- }
520
- if (control instanceof i1$1.FormGroup) {
521
- Object.entries(control.controls)
522
- .forEach(function (_a) {
523
- var _b = __read(_a, 2), name = _b[0], childControl = _b[1];
524
- var childErrors = getFormErrors(childControl, name);
525
- if (childErrors) {
526
- if (!errors) {
527
- errors = Object.assign({}, childErrors);
528
- }
529
- else {
530
- Object.assign(errors, childErrors);
531
- }
532
- }
533
- });
534
- }
535
- return errors;
536
- }
537
-
538
- var FsFormDialogCloseDirective = /** @class */ (function () {
539
- function FsFormDialogCloseDirective() {
540
- this.clicked$ = new rxjs.Subject();
541
- this.registered = false;
542
- this.type = 'button';
543
- }
544
- FsFormDialogCloseDirective.prototype.click = function () {
545
- this.clicked$.next();
546
- };
547
- FsFormDialogCloseDirective.prototype.ngOnDestroy = function () {
548
- this.clicked$.complete();
549
- };
550
- return FsFormDialogCloseDirective;
551
- }());
552
- FsFormDialogCloseDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogCloseDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
553
- FsFormDialogCloseDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDialogCloseDirective, selector: "[fsFormDialogClose],[fs-form-dialog-close]", host: { listeners: { "click": "click($event.target)" }, properties: { "attr.type": "this.type" } }, ngImport: i0__namespace });
554
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogCloseDirective, decorators: [{
555
- type: i0.Directive,
556
- args: [{
557
- selector: '[fsFormDialogClose],[fs-form-dialog-close]'
558
- }]
559
- }], propDecorators: { type: [{
560
- type: i0.HostBinding,
561
- args: ['attr.type']
562
- }], click: [{
563
- type: i0.HostListener,
564
- args: ['click', ['$event.target']]
565
- }] } });
566
-
567
- exports.FormStatus = void 0;
568
- (function (FormStatus) {
569
- FormStatus["Valid"] = "valid";
570
- FormStatus["Invalid"] = "invalid";
571
- FormStatus["Validating"] = "validating";
572
- FormStatus["Submitting"] = "submitting";
573
- FormStatus["Submitted"] = "submitted";
574
- FormStatus["Error"] = "error";
575
- FormStatus["Success"] = "success";
576
- FormStatus["Completing"] = "completing";
577
- })(exports.FormStatus || (exports.FormStatus = {}));
578
-
579
- var FsFormDirective = /** @class */ (function () {
580
- function FsFormDirective(ngForm, _form, _element, _message, _prompt, _ngZone, _cdRef, _dialogRef, _drawerRef, _route) {
581
- this.ngForm = ngForm;
582
- this._form = _form;
583
- this._element = _element;
584
- this._message = _message;
585
- this._prompt = _prompt;
586
- this._ngZone = _ngZone;
587
- this._cdRef = _cdRef;
588
- this._dialogRef = _dialogRef;
589
- this._drawerRef = _drawerRef;
590
- this._route = _route;
591
- this.wrapperSelector = '.fs-form-wrapper,.mat-form-field';
592
- this.messageSelector = '.fs-form-message,.mat-form-field-subscript-wrapper';
593
- this.hintSelector = '.fs-form-hint,.mat-form-field-hint-wrapper';
594
- this.labelSelector = '.fs-form-label,.mat-form-field-label';
595
- this.autocomplete = false;
596
- this.shortcuts = true; // Ctrl + s
597
- this.confirm = true;
598
- this.confirmDialog = true;
599
- this.confirmDrawer = true;
600
- this.confirmBrowser = true;
601
- this.confirmTabs = true;
602
- this.dirtySubmitButton = true;
603
- this.successDelay = 0;
604
- this.errorDelay = 1000;
605
- this.deactivationGuard = true;
606
- this.submitEvent = new i0.EventEmitter();
607
- this.invalid = new i0.EventEmitter();
608
- this.valid = new i0.EventEmitter();
609
- this.submitted = new i0.EventEmitter();
610
- this.reseted = new i0.EventEmitter();
611
- this.cleared = new i0.EventEmitter();
612
- this.fsFormClass = true;
613
- this._tabGroups = new i0.QueryList();
614
- this._buttons = new i0.QueryList();
615
- this._dialogBackdropEscape = false;
616
- this._snapshot = {};
617
- this._status$ = new rxjs.BehaviorSubject(exports.FormStatus.Valid);
618
- this._destroy$ = new rxjs.Subject();
619
- this._confirmed = false;
620
- this._submit$ = null;
621
- }
622
- Object.defineProperty(FsFormDirective.prototype, "submit", {
623
- get: function () {
624
- return this._submit$;
625
- },
626
- set: function (submit$) {
627
- this._submit$ = submit$;
628
- },
629
- enumerable: false,
630
- configurable: true
631
- });
632
- Object.defineProperty(FsFormDirective.prototype, "submitting", {
633
- get: function () {
634
- return this._status$.getValue() === exports.FormStatus.Submitting;
635
- },
636
- enumerable: false,
637
- configurable: true
638
- });
639
- Object.defineProperty(FsFormDirective.prototype, "validating", {
640
- get: function () {
641
- return this._status$.getValue() === exports.FormStatus.Validating;
642
- },
643
- enumerable: false,
644
- configurable: true
645
- });
646
- Object.defineProperty(FsFormDirective.prototype, "completing", {
647
- get: function () {
648
- return this._status$.getValue() === exports.FormStatus.Completing;
649
- },
650
- enumerable: false,
651
- configurable: true
652
- });
653
- Object.defineProperty(FsFormDirective.prototype, "_submitEvent", {
654
- get: function () {
655
- return {
656
- ngForm: this.ngForm,
657
- submitter: this._submitter,
658
- };
659
- },
660
- enumerable: false,
661
- configurable: true
662
- });
663
- Object.defineProperty(FsFormDirective.prototype, "_formValidState$", {
664
- get: function () {
665
- this._form.broadcast('valid', this._submitEvent);
666
- this.submitEvent.emit(this._submitEvent);
667
- this.valid.emit(this._submitEvent);
668
- var submittedEvent = {
669
- ngForm: this.ngForm,
670
- submitter: this._submitter,
671
- response: null,
672
- };
673
- var submit$ = this._submit$ ?
674
- this._submit$(this._submitEvent) : rxjs.of(submittedEvent);
675
- return submit$
676
- .pipe(operators.map(function (response) {
677
- submittedEvent.response = response;
678
- return submittedEvent;
679
- }), operators.takeUntil(this._destroy$));
680
- },
681
- enumerable: false,
682
- configurable: true
683
- });
684
- Object.defineProperty(FsFormDirective.prototype, "_formInvalidState$", {
685
- get: function () {
686
- this._form.broadcast('invalid', this._submitEvent);
687
- if (this.invalid) {
688
- this.invalid.emit(this._submitEvent);
689
- }
690
- var message = 'Please review errors highlighted in red';
691
- this._message.error(message, { mode: i2.MessageMode.Toast });
692
- var el = this._element.nativeElement.querySelector('.ng-invalid');
693
- if (el) {
694
- el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
695
- }
696
- return rxjs.throwError('Form validation error');
697
- },
698
- enumerable: false,
699
- configurable: true
700
- });
701
- Object.defineProperty(FsFormDirective.prototype, "_submitter", {
702
- get: function () {
703
- return this._activeSubmitButton
704
- ? this._activeSubmitButton.name
705
- : null;
706
- },
707
- enumerable: false,
708
- configurable: true
709
- });
710
- FsFormDirective.prototype.ngOnInit = function () {
711
- if (this.deactivationGuard) {
712
- this._registerCanDeactivateGuard();
713
- }
714
- this._registerConfirmDialogBackdropEscape();
715
- this._listenHotKeys();
716
- this._listenWindowClose();
717
- this._listenSubmit();
718
- this._listenFormStatus();
719
- if (!this.autocomplete) {
720
- this._registerAutocomplete();
721
- }
722
- };
723
- FsFormDirective.prototype.ngOnChanges = function (changes) {
724
- if (changes.confirm) {
725
- this._updateDirtySubmitButtons();
726
- }
727
- };
728
- FsFormDirective.prototype.clearSubmit = function () {
729
- var _this = this;
730
- this._submit$ = null;
731
- setTimeout(function () {
732
- _this._cdRef.markForCheck();
733
- });
734
- };
735
- FsFormDirective.prototype.registerSubmit = function (submit$) {
736
- var _this = this;
737
- this._submit$ = submit$;
738
- setTimeout(function () {
739
- _this._cdRef.markForCheck();
740
- });
741
- };
742
- FsFormDirective.prototype.ngAfterContentInit = function () {
743
- this._registerConfirm();
744
- this._registerConfirmDialogClose();
745
- this._registerConfirmDrawerClose();
746
- this._registerConfirmTabs();
747
- this._registerDrawerClose();
748
- this._registerDirtySubmitButton();
749
- };
750
- FsFormDirective.prototype.ngOnDestroy = function () {
751
- this._cleanupCanDeactivate();
752
- this._destroy$.next();
753
- this._destroy$.complete();
754
- };
755
- FsFormDirective.prototype.createSnapshot = function () {
756
- this._snapshot = this.ngForm.value;
757
- };
758
- FsFormDirective.prototype.getSnapshot = function () {
759
- return this._snapshot || {};
760
- };
761
- FsFormDirective.prototype.reset = function () {
762
- var _this = this;
763
- this.ngForm.resetForm();
764
- Object.keys(this.ngForm.controls)
765
- .forEach(function (name) {
766
- var control = _this.ngForm.controls[name];
767
- control.reset(_this._snapshot[name]);
768
- });
769
- this.reseted.emit();
770
- };
771
- FsFormDirective.prototype.clear = function () {
772
- this.ngForm.resetForm();
773
- this.cleared.emit();
774
- };
775
- FsFormDirective.prototype.dirty = function () {
776
- this.ngForm.form.markAsDirty();
777
- this._updateDirtySubmitButtons();
778
- };
779
- FsFormDirective.prototype.triggerSubmit = function (options) {
780
- this._confirmed = options === null || options === void 0 ? void 0 : options.confirmed;
781
- this.ngForm.ngSubmit.emit();
782
- };
783
- FsFormDirective.prototype.triggerConfirm = function () {
784
- var _this = this;
785
- var submitted = this.submitting ? this.submitted.asObservable() : rxjs.of({});
786
- return submitted
787
- .pipe(operators.take(1), operators.mergeMap(function () { return confirmUnsaved([_this], _this._prompt); }));
788
- };
789
- FsFormDirective.prototype.enable = function () {
790
- this.ngForm.control.enable();
791
- this._updateDirtySubmitButtons();
792
- };
793
- FsFormDirective.prototype.disable = function () {
794
- this.ngForm.control.disable();
795
- this._buttons.forEach(function (button) {
796
- button.disable();
797
- });
798
- };
799
- FsFormDirective.prototype.addButton = function (button) {
800
- this._buttons.reset(__spreadArray(__spreadArray([], __read(this._buttons.toArray())), [
801
- button,
802
- ]));
803
- };
804
- FsFormDirective.prototype.removeButton = function (button) {
805
- this._buttons.reset(__spreadArray([], __read(this._buttons.toArray()
806
- .filter(function (item) { return (button !== item); }))));
807
- };
808
- FsFormDirective.prototype._listenSubmit = function () {
809
- var _this = this;
810
- this.ngForm
811
- .ngSubmit
812
- .pipe(operators.tap(function (event) {
813
- event === null || event === void 0 ? void 0 : event.preventDefault();
814
- }), operators.map(function (event) {
815
- return { event: event, confirmed: _this._confirmed };
816
- }), operators.tap(function () { return _this._confirmed = false; }), operators.filter(function () {
817
- return [exports.FormStatus.Valid, exports.FormStatus.Invalid]
818
- .includes(_this._status$.getValue());
819
- }), operators.tap(function () { return _this._broadcasValidatingEvents(); }), operators.tap(function () { return _this.validate(); }), operators.tap(function () { return _this._broadcastSubmittingEvents(); }), operators.switchMap(function (data) { return _this._waitUntilStatusPending()
820
- .pipe(operators.mapTo(data)); }), operators.tap(function () { return _this._setupActiveSubmitButton(); }), operators.tap(function () { return _this._disableButtons(); }), operators.mergeMap(function (data) {
821
- if (_this.ngForm.status === 'INVALID') {
822
- return _this._formInvalidState$;
823
- }
824
- return _this._formValidState$
825
- .pipe(operators.map(function (submitEvent) { return (Object.assign(Object.assign({}, submitEvent), { confirmed: data.confirmed })); }));
826
- }), operators.catchError(function (e, source$) {
827
- _this._handleError(e);
828
- return source$;
829
- }), operators.tap(function (submittedEvent) {
830
- _this._completeSubmit(true, submittedEvent);
831
- }), operators.takeUntil(this._destroy$))
832
- .subscribe(function () { });
833
- };
834
- FsFormDirective.prototype.validate = function () {
835
- Object.values(this.ngForm.controls)
836
- .forEach(function (control) {
837
- control.markAsDirty();
838
- control.markAsTouched();
839
- control.updateValueAndValidity();
840
- });
841
- };
842
- FsFormDirective.prototype._listenFormStatus = function () {
843
- var _this = this;
844
- this._status$
845
- .pipe(operators.takeUntil(this._destroy$))
846
- .subscribe(function (formStatus) {
847
- var cls = [exports.FormStatus.Submitting, exports.FormStatus.Validating];
848
- var classList = _this._element.nativeElement.classList;
849
- classList.remove.apply(classList, __spreadArray([], __read(cls)));
850
- if (cls.indexOf(formStatus) !== -1) {
851
- classList.add(formStatus);
852
- }
853
- });
854
- };
855
- FsFormDirective.prototype._listenWindowClose = function () {
856
- var _this = this;
857
- rxjs.fromEvent(window, 'beforeunload')
858
- .pipe(operators.takeUntil(this._destroy$))
859
- .subscribe(function (event) {
860
- if (_this.confirm && _this.confirmBrowser && _this.ngForm.dirty) {
861
- event.returnValue = false;
862
- }
863
- });
864
- };
865
- FsFormDirective.prototype._listenHotKeys = function () {
866
- var _this = this;
867
- this._ngZone.runOutsideAngular(function () {
868
- rxjs.fromEvent(document, 'keydown')
869
- .pipe(operators.takeUntil(_this._destroy$))
870
- .subscribe(function (event) {
871
- if (_this._dialogBackdropEscape && event.code === 'Escape') {
872
- var dialog_1 = document.getElementById(_this._dialogRef.id);
873
- var paths = event.composedPath();
874
- if (paths) {
875
- paths.forEach(function (item) {
876
- if (dialog_1 === item) {
877
- _this._ngZone.run(function () {
878
- _this._formClose();
879
- });
880
- }
881
- });
882
- }
883
- }
884
- if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
885
- event.preventDefault();
886
- if (_this.shortcuts) {
887
- if (_this._elementInForm(document.activeElement)) {
888
- _this.ngForm.ngSubmit.next();
889
- }
890
- }
891
- }
892
- });
893
- });
894
- };
895
- FsFormDirective.prototype._formClose = function () {
896
- var _this = this;
897
- if (this.confirm && this.confirmDialog) {
898
- this.triggerConfirm()
899
- .pipe(operators.filter(function (result) { return confirmResultContinue(result); }), operators.switchMap(function (result) {
900
- return result === exports.ConfirmResult.Pristine || result === exports.ConfirmResult.Discard
901
- ? rxjs.of(null)
902
- : _this.submitted.asObservable();
903
- }), operators.takeUntil(this._destroy$))
904
- .subscribe(function (result) {
905
- _this._dialogRef.close(result === null || result === void 0 ? void 0 : result.response);
906
- });
907
- }
908
- else {
909
- this._dialogRef.close(null);
910
- }
911
- };
912
- FsFormDirective.prototype._registerDialogClose = function (directive) {
913
- var _this = this;
914
- if (!directive.registered) {
915
- directive.registered = true;
916
- directive.clicked$
917
- .pipe(operators.takeUntil(this._destroy$))
918
- .subscribe(function () {
919
- _this._formClose();
920
- });
921
- }
922
- };
923
- FsFormDirective.prototype._getActiveSubmitButton = function () {
924
- var submitButtons = this._buttons
925
- .filter(function (button) { return button.submit; });
926
- var activeButton = submitButtons
927
- .find(function (button) {
928
- return button.active;
929
- });
930
- return activeButton ? activeButton : submitButtons[0];
931
- };
932
- FsFormDirective.prototype._elementInForm = function (el) {
933
- if (el.isSameNode(this._element.nativeElement)) {
934
- return true;
935
- }
936
- else if (el.parentElement) {
937
- return this._elementInForm(el.parentElement);
938
- }
939
- return false;
940
- };
941
- FsFormDirective.prototype._completeSubmit = function (success, submitEvent) {
942
- var _this = this;
943
- if (success) {
944
- this.ngForm.control.markAsPristine();
945
- this.createSnapshot();
946
- this.submitted.emit(submitEvent);
947
- }
948
- else {
949
- this._resetButtons();
950
- }
951
- if (this._activeSubmitButton) {
952
- if (success) {
953
- this._activeSubmitButton.success();
954
- }
955
- else {
956
- this._activeSubmitButton.error();
957
- }
958
- }
959
- this._status$.next(exports.FormStatus.Submitted);
960
- if (success) {
961
- this._status$.next(exports.FormStatus.Success);
962
- }
963
- else {
964
- this._status$.next(exports.FormStatus.Error);
965
- }
966
- this._status$.next(exports.FormStatus.Completing);
967
- var resetDelay = success ? this.successDelay : this.errorDelay;
968
- rxjs.of(true)
969
- .pipe(operators.delay(resetDelay), operators.first(), operators.takeUntil(this._destroy$)).subscribe(function () {
970
- if (_this.ngForm.form.status === 'VALID') {
971
- _this._status$.next(exports.FormStatus.Valid);
972
- }
973
- else {
974
- _this._status$.next(exports.FormStatus.Invalid);
975
- }
976
- _this._resetButtons();
977
- _this._resetActiveButtons();
978
- _this._updateDirtySubmitButtons();
979
- });
980
- };
981
- FsFormDirective.prototype._resetButtons = function () {
982
- this._buttons.forEach(function (button) {
983
- button.reset();
984
- });
985
- };
986
- FsFormDirective.prototype._resetActiveButtons = function () {
987
- this._buttons.forEach(function (button) {
988
- button.resetActive();
989
- });
990
- };
991
- FsFormDirective.prototype._registerConfirm = function () {
992
- var _this = this;
993
- this.ngForm.form.valueChanges
994
- .pipe(operators.takeUntil(this._destroy$))
995
- .subscribe(function (changes) {
996
- if (_this.confirm) {
997
- var existing_1 = Object.keys(_this._snapshot);
998
- Object.keys(changes)
999
- .forEach(function (name) {
1000
- if (existing_1.indexOf(name) === -1) {
1001
- _this._snapshot[name] = changes[name];
1002
- }
1003
- });
1004
- }
1005
- });
1006
- };
1007
- FsFormDirective.prototype._registerDrawerClose = function () {
1008
- var _this = this;
1009
- if (this._drawerRef) {
1010
- this._drawerRef.closeStart$
1011
- .pipe(operators.takeUntil(this._destroy$))
1012
- .subscribe(function (subscriber) {
1013
- if (_this.submitting) {
1014
- _this._status$
1015
- .pipe(operators.filter(function (status) { return status === exports.FormStatus.Success || status === exports.FormStatus.Error; }), operators.takeUntil(_this._destroy$))
1016
- .subscribe(function (status) {
1017
- if (status === exports.FormStatus.Success) {
1018
- subscriber.next();
1019
- subscriber.complete();
1020
- }
1021
- else {
1022
- subscriber.error();
1023
- }
1024
- });
1025
- }
1026
- else {
1027
- subscriber.next();
1028
- subscriber.complete();
1029
- }
1030
- });
1031
- }
1032
- };
1033
- FsFormDirective.prototype._registerConfirmDrawerClose = function () {
1034
- var _this = this;
1035
- if (this._drawerRef) {
1036
- this._drawerRef.closeStart$
1037
- .pipe(operators.switchMap(function (subscriber) {
1038
- return rxjs.iif(function () { return _this.confirm && _this.confirmDrawer; }, _this.triggerConfirm()
1039
- .pipe(operators.map(function (result) { return confirmResultContinue(result); }), operators.tap(function (result) {
1040
- if (result) {
1041
- subscriber.next();
1042
- subscriber.complete();
1043
- }
1044
- })), rxjs.defer(function () {
1045
- subscriber.next();
1046
- subscriber.complete();
1047
- }));
1048
- }), operators.takeUntil(this._destroy$))
1049
- .subscribe();
1050
- }
1051
- };
1052
- FsFormDirective.prototype._registerConfirmTabs = function () {
1053
- var _this = this;
1054
- if (this.tabGroup) {
1055
- this.registerConfirmTabGroup(this.tabGroup);
1056
- }
1057
- this.registerConfirmTabGroups(this._tabGroups.toArray());
1058
- this._tabGroups.changes
1059
- .pipe(operators.takeUntil(this._destroy$))
1060
- .subscribe(function () {
1061
- _this.registerConfirmTabGroups(_this._tabGroups.toArray());
1062
- });
1063
- };
1064
- FsFormDirective.prototype.registerConfirmTabGroups = function (tabGroups) {
1065
- var _this = this;
1066
- tabGroups.forEach(function (tabGroup) {
1067
- _this.registerConfirmTabGroup(tabGroup);
1068
- });
1069
- };
1070
- FsFormDirective.prototype.registerConfirmTabGroup = function (tabGroup) {
1071
- var _this = this;
1072
- var confirmTabGroup = tabGroup;
1073
- if (!confirmTabGroup._originalHandleClick) {
1074
- confirmTabGroup._originalHandleClick = tabGroup._handleClick;
1075
- confirmTabGroup._handlClick$ = new rxjs.Subject();
1076
- confirmTabGroup._handleClick = function (tab, tabHeader, idx) {
1077
- if (confirmTabGroup._handlClick$.observers.length) {
1078
- confirmTabGroup._handlClick$.next({ tab: tab, tabHeader: tabHeader, idx: idx });
1079
- }
1080
- else {
1081
- confirmTabGroup._originalHandleClick(tab, tabHeader, idx);
1082
- }
1083
- };
1084
- }
1085
- confirmTabGroup._handlClick$
1086
- .pipe(operators.takeUntil(this._destroy$))
1087
- .subscribe(function (event) {
1088
- if (!_this.submitting) {
1089
- if (_this.confirm && _this.confirmTabs) {
1090
- _this.triggerConfirm()
1091
- .pipe(operators.takeUntil(_this._destroy$))
1092
- .subscribe(function (result) {
1093
- if (confirmResultContinue(result)) {
1094
- confirmTabGroup.selectedIndex = event.idx;
1095
- }
1096
- });
1097
- }
1098
- else {
1099
- confirmTabGroup._originalHandleClick(event.tab, event.tabHeader, event.idx);
1100
- }
1101
- }
1102
- });
1103
- };
1104
- FsFormDirective.prototype._registerConfirmDialogClose = function () {
1105
- var _this = this;
1106
- if (this._dialogRef) {
1107
- this.formDialogClose.forEach(function (item) {
1108
- _this._registerDialogClose(item);
1109
- });
1110
- this.formDialogClose.changes
1111
- .pipe(operators.takeUntil(this._destroy$))
1112
- .subscribe(function (e) {
1113
- e.forEach(function (item) {
1114
- _this._registerDialogClose(item);
1115
- });
1116
- });
1117
- }
1118
- };
1119
- FsFormDirective.prototype._registerConfirmDialogBackdropEscape = function () {
1120
- var _this = this;
1121
- this._dialogBackdropEscape = this._dialogRef && !this._dialogRef.disableClose;
1122
- if (this._dialogRef && !this._dialogRef.disableClose) {
1123
- this._dialogRef.disableClose = true;
1124
- this._dialogRef.backdropClick()
1125
- .pipe(operators.takeUntil(this._destroy$))
1126
- .subscribe(function () {
1127
- _this._formClose();
1128
- });
1129
- this._destroy$
1130
- .subscribe(function () {
1131
- _this._dialogRef.disableClose = false;
1132
- });
1133
- }
1134
- };
1135
- FsFormDirective.prototype._registerAutocomplete = function () {
1136
- var _this = this;
1137
- this._registerControl = this.ngForm.form.registerControl.bind(this.ngForm.form);
1138
- this.ngForm.form.registerControl = function (name, control) {
1139
- var el = _this._element.nativeElement.querySelector("input[name='" + name + "']");
1140
- if (el) {
1141
- el.setAttribute('name', name + "_" + common.guid());
1142
- if (!el.getAttribute('autocomplete')) {
1143
- el.setAttribute('autocomplete', 'none');
1144
- }
1145
- }
1146
- return _this._registerControl(name, control);
1147
- };
1148
- };
1149
- FsFormDirective.prototype._registerDirtySubmitButton = function () {
1150
- var _this = this;
1151
- if (!this.ngForm) {
1152
- return;
1153
- }
1154
- this.ngForm.form.valueChanges
1155
- .pipe(operators.takeUntil(this._destroy$))
1156
- .subscribe(function () {
1157
- _this._updateDirtySubmitButtons();
1158
- });
1159
- this._buttons.changes
1160
- .pipe(operators.takeUntil(this._destroy$))
1161
- .subscribe(function () {
1162
- _this._updateDirtySubmitButtons();
1163
- });
1164
- };
1165
- FsFormDirective.prototype._updateDirtySubmitButtons = function () {
1166
- var _this = this;
1167
- this._buttons
1168
- .filter(function (button) { return button.submit; })
1169
- .forEach(function (submitButton) {
1170
- if (!_this.confirm || !_this.dirtySubmitButton || _this.ngForm.dirty || !submitButton.dirtySubmit) {
1171
- submitButton.enable();
1172
- }
1173
- else {
1174
- submitButton.disable();
1175
- }
1176
- });
1177
- };
1178
- FsFormDirective.prototype._broadcastSubmittingEvents = function () {
1179
- this._status$.next(exports.FormStatus.Submitting);
1180
- this._form.broadcast('submit', this.ngForm);
1181
- };
1182
- FsFormDirective.prototype._broadcasValidatingEvents = function () {
1183
- this._status$.next(exports.FormStatus.Validating);
1184
- };
1185
- FsFormDirective.prototype._setupActiveSubmitButton = function () {
1186
- this._activeSubmitButton = this._getActiveSubmitButton();
1187
- this._resetButtons();
1188
- if (this._activeSubmitButton) {
1189
- this._activeSubmitButton.process();
1190
- }
1191
- };
1192
- FsFormDirective.prototype._disableButtons = function () {
1193
- this._buttons.forEach(function (button) {
1194
- button.disable();
1195
- });
1196
- };
1197
- FsFormDirective.prototype._waitUntilStatusPending = function () {
1198
- return this.ngForm.statusChanges
1199
- .pipe(operators.startWith(this.ngForm.status), operators.first(function (state) { return state !== 'PENDING'; }));
1200
- };
1201
- FsFormDirective.prototype._handleError = function (e) {
1202
- console.log('%c Form Submit ', 'color: white; background-color: #D33F49', 'Error occured');
1203
- console.group('Error Details:');
1204
- console.log('Message: ', e);
1205
- console.log('FormRef: ', this);
1206
- if (this.ngForm.invalid) {
1207
- var errors = getFormErrors(this.ngForm.control, null);
1208
- console.log('Validation Errors: ', errors);
1209
- }
1210
- console.groupEnd();
1211
- this._completeSubmit(false, null);
1212
- };
1213
- FsFormDirective.prototype._registerCanDeactivateGuard = function () {
1214
- this._activatedRouteConfig = getActiveRoute(this._route).routeConfig;
1215
- if (!this._activatedRouteConfig) {
1216
- return;
1217
- }
1218
- this._form.registerFormDirective(this._activatedRouteConfig.component, this);
1219
- if (!Array.isArray(this._activatedRouteConfig.canDeactivate)) {
1220
- this._activatedRouteConfig.canDeactivate = [];
1221
- }
1222
- if (this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard) == -1) {
1223
- this._activatedRouteConfig.canDeactivate.push(FormDeactivateGuard);
1224
- }
1225
- };
1226
- FsFormDirective.prototype._cleanupCanDeactivate = function () {
1227
- if (!this._activatedRouteConfig) {
1228
- return;
1229
- }
1230
- var guardIndex = this._activatedRouteConfig.canDeactivate.indexOf(FormDeactivateGuard);
1231
- this._activatedRouteConfig.canDeactivate.splice(guardIndex, 1);
1232
- this._form.removeFormDirective(this._activatedRouteConfig.component);
1233
- };
1234
- return FsFormDirective;
1235
- }());
1236
- FsFormDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, deps: [{ token: i1$1.NgForm }, { token: FsForm }, { token: i0__namespace.ElementRef }, { token: i2__namespace.FsMessage }, { token: i1__namespace.FsPrompt }, { token: i0__namespace.NgZone }, { token: i0__namespace.ChangeDetectorRef }, { token: i2$1.MatDialogRef, optional: true }, { token: i7.DrawerRef, optional: true }, { token: i3__namespace.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1237
- FsFormDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDirective, selector: "[fsForm]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", autocomplete: "autocomplete", shortcuts: "shortcuts", confirm: "confirm", confirmDialog: "confirmDialog", confirmDrawer: "confirmDrawer", confirmBrowser: "confirmBrowser", confirmTabs: "confirmTabs", dirtySubmitButton: "dirtySubmitButton", submit: "submit", successDelay: "successDelay", errorDelay: "errorDelay", tabGroup: "tabGroup", deactivationGuard: "deactivationGuard" }, outputs: { submitEvent: "fsForm", invalid: "invalid", valid: "valid", submitted: "submitted", reseted: "reseted", cleared: "cleared" }, host: { properties: { "class.fs-form": "this.fsFormClass" } }, queries: [{ propertyName: "formDialogClose", predicate: FsFormDialogCloseDirective, descendants: true }, { propertyName: "_tabGroups", predicate: tabs.MatTabGroup, descendants: true }], exportAs: ["fsForm"], usesOnChanges: true, ngImport: i0__namespace });
1238
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDirective, decorators: [{
1239
- type: i0.Directive,
1240
- args: [{
1241
- selector: '[fsForm]',
1242
- exportAs: 'fsForm',
1243
- }]
1244
- }], ctorParameters: function () {
1245
- return [{ type: i1__namespace$1.NgForm, decorators: [{
1246
- type: i0.Inject,
1247
- args: [i1$1.NgForm]
1248
- }] }, { type: FsForm }, { type: i0__namespace.ElementRef }, { type: i2__namespace.FsMessage }, { type: i1__namespace.FsPrompt }, { type: i0__namespace.NgZone }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace$1.MatDialogRef, decorators: [{
1249
- type: i0.Optional
1250
- }, {
1251
- type: i0.Inject,
1252
- args: [i2$1.MatDialogRef]
1253
- }] }, { type: i7__namespace.DrawerRef, decorators: [{
1254
- type: i0.Optional
1255
- }, {
1256
- type: i0.Inject,
1257
- args: [i7.DrawerRef]
1258
- }] }, { type: i3__namespace.ActivatedRoute }];
1259
- }, propDecorators: { wrapperSelector: [{
1260
- type: i0.Input
1261
- }], messageSelector: [{
1262
- type: i0.Input
1263
- }], hintSelector: [{
1264
- type: i0.Input
1265
- }], labelSelector: [{
1266
- type: i0.Input
1267
- }], autocomplete: [{
1268
- type: i0.Input
1269
- }], shortcuts: [{
1270
- type: i0.Input
1271
- }], confirm: [{
1272
- type: i0.Input
1273
- }], confirmDialog: [{
1274
- type: i0.Input
1275
- }], confirmDrawer: [{
1276
- type: i0.Input
1277
- }], confirmBrowser: [{
1278
- type: i0.Input
1279
- }], confirmTabs: [{
1280
- type: i0.Input
1281
- }], dirtySubmitButton: [{
1282
- type: i0.Input
1283
- }], submit: [{
1284
- type: i0.Input
1285
- }], successDelay: [{
1286
- type: i0.Input
1287
- }], errorDelay: [{
1288
- type: i0.Input
1289
- }], tabGroup: [{
1290
- type: i0.Input
1291
- }], deactivationGuard: [{
1292
- type: i0.Input
1293
- }], submitEvent: [{
1294
- type: i0.Output,
1295
- args: ['fsForm']
1296
- }], invalid: [{
1297
- type: i0.Output
1298
- }], valid: [{
1299
- type: i0.Output
1300
- }], submitted: [{
1301
- type: i0.Output
1302
- }], reseted: [{
1303
- type: i0.Output
1304
- }], cleared: [{
1305
- type: i0.Output
1306
- }], fsFormClass: [{
1307
- type: i0.HostBinding,
1308
- args: ['class.fs-form']
1309
- }], formDialogClose: [{
1310
- type: i0.ContentChildren,
1311
- args: [FsFormDialogCloseDirective, { descendants: true }]
1312
- }], _tabGroups: [{
1313
- type: i0.ContentChildren,
1314
- args: [tabs.MatTabGroup, { descendants: true }]
1315
- }] } });
1316
-
1317
- var ERROR_MESSAGES = {
1318
- required: 'This field is required',
1319
- email: 'This is not a valid email address',
1320
- emails: 'Input valid email addresses, comma separated',
1321
- phone: 'Invalid phone number',
1322
- numeric: 'Value should be numeric',
1323
- integer: 'Value should be an integer',
1324
- min: 'Value should not be less than $(1)',
1325
- max: 'Value should not be greater than $(1)',
1326
- minlength: 'Should not be shorter than $(1) characters',
1327
- maxlength: 'Should not be longer than $(1) characters',
1328
- compare: 'Inputs do not match',
1329
- pattern: 'Value should match pattern $(1)',
1330
- dateRange: 'Invalid date range',
1331
- url: 'This is not a valid url',
1332
- urlProtocol: 'Invalid URL. Proper http protocol is required. eg. https://google.com',
1333
- greater: 'Value must be greater than $(1)',
1334
- lesser: 'Value must be less than $(1)',
1335
- };
1336
-
1337
- var VALIDATE_MESSAGES = new i0.InjectionToken('fs.form.validate-messages');
1338
- var VALIDATE_MESSAGE_PROVIDER = {
1339
- provide: VALIDATE_MESSAGES,
1340
- useFactory: messageProviderFactory,
1341
- };
1342
- function messageProviderFactory() {
1343
- return Object.assign({}, ERROR_MESSAGES);
1344
- }
1345
-
1346
- var FsControlDirective = /** @class */ (function () {
1347
- function FsControlDirective(elementRef, renderer2, injector, _validateMessages, ngControl, formDirective) {
1348
- this.elementRef = elementRef;
1349
- this.renderer2 = renderer2;
1350
- this.injector = injector;
1351
- this._validateMessages = _validateMessages;
1352
- this.ngControl = ngControl;
1353
- this.formDirective = formDirective;
1354
- this.appendMessageClass = 'fs-form-message';
1355
- this.appendLabelClass = 'fs-form-label';
1356
- this.appendErrorClass = 'fs-form-error';
1357
- this.appendHintClass = 'fs-form-hint';
1358
- this.errors = [];
1359
- // protected _validateMessages = { ...ERROR_MESSAGES };
1360
- this._destroy$ = new rxjs.Subject();
1361
- if (ngControl) {
1362
- this._control = ngControl.control;
1363
- }
1364
- else {
1365
- console.error('The element does not have a valid ngModel', this.elementRef.nativeElement);
1366
- }
1367
- }
1368
- Object.defineProperty(FsControlDirective.prototype, "validateMessages", {
1369
- set: function (messages) {
1370
- this._validateMessages = Object.assign(Object.assign({}, this._validateMessages), messages);
1371
- },
1372
- enumerable: false,
1373
- configurable: true
1374
- });
1375
- FsControlDirective.prototype.ngOnInit = function () {
1376
- this._setupValidators();
1377
- };
1378
- FsControlDirective.prototype.ngOnDestroy = function () {
1379
- this._destroy$.next();
1380
- this._destroy$.complete();
1381
- };
1382
- FsControlDirective.prototype.ngAfterContentInit = function () {
1383
- this._subscribeToStatusChagnes();
1384
- };
1385
- FsControlDirective.prototype._subscribeToStatusChagnes = function () {
1386
- if (this._control) {
1387
- this._control.statusChanges
1388
- .pipe(operators.takeUntil(this._destroy$))
1389
- .subscribe(this.render.bind(this));
1390
- }
1391
- };
1392
- FsControlDirective.prototype.getMessageSelector = function () {
1393
- var _a;
1394
- if (this.messageSelector === false) {
1395
- return '';
1396
- }
1397
- if (this.messageSelector) {
1398
- return this.messageSelector;
1399
- }
1400
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.messageSelector) {
1401
- return this.formDirective.messageSelector;
1402
- }
1403
- };
1404
- FsControlDirective.prototype.getHintWrapperSelector = function () {
1405
- var _a;
1406
- if (this.hintSelector === false) {
1407
- return '';
1408
- }
1409
- if (this.hintSelector) {
1410
- return this.hintSelector;
1411
- }
1412
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.hintSelector) {
1413
- return this.formDirective.hintSelector;
1414
- }
1415
- };
1416
- FsControlDirective.prototype.getWrapperSelector = function () {
1417
- var _a;
1418
- if (this.wrapperSelector === false) {
1419
- return '';
1420
- }
1421
- if (this.wrapperSelector) {
1422
- return this.wrapperSelector;
1423
- }
1424
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.wrapperSelector) {
1425
- return this.formDirective.wrapperSelector;
1426
- }
1427
- };
1428
- FsControlDirective.prototype.getlabelSelector = function () {
1429
- var _a;
1430
- if (this.labelSelector === false) {
1431
- return '';
1432
- }
1433
- if (this.labelSelector) {
1434
- return this.labelSelector;
1435
- }
1436
- else if ((_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.labelSelector) {
1437
- return this.formDirective.labelSelector;
1438
- }
1439
- };
1440
- FsControlDirective.prototype.getWrapperElement = function () {
1441
- var wrapper = this.getWrapper(this.elementRef.nativeElement);
1442
- if (wrapper) {
1443
- return wrapper;
1444
- }
1445
- return this.elementRef.nativeElement;
1446
- };
1447
- /*
1448
- <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.
1449
- <input>
1450
- <div class="fs-form-message"> <-- Message Selector. Look for the element with class .fs-form-message or messageSelector
1451
- <div class="fs-form-message"></div>
1452
- <div class="fs-form-hint"></div> <-- Hint Selector. Look for the element with class .fs-form-hint or hintSelector
1453
- </div>
1454
- </mat-form-field>
1455
- */
1456
- FsControlDirective.prototype.render = function () {
1457
- var _a, _b;
1458
- if (this.ngControl) {
1459
- var renderer = this.renderer2;
1460
- var wrapper = this.getWrapperElement();
1461
- var error = this.ngControl.dirty ? this.getError(this.ngControl) : null;
1462
- var shouldErrorBeRendered = this.ngControl.invalid
1463
- && (this.ngControl.dirty || ((_b = (_a = this.formDirective) === null || _a === void 0 ? void 0 : _a.ngForm) === null || _b === void 0 ? void 0 : _b.submitted));
1464
- if (shouldErrorBeRendered && error) {
1465
- wrapper.classList.add('ng-invalid', 'ng-dirty');
1466
- }
1467
- else {
1468
- wrapper.classList.remove('ng-invalid');
1469
- }
1470
- if (!this.getMessageSelector()) {
1471
- return;
1472
- }
1473
- var messageWrapper = wrapper.querySelector(this.getMessageSelector());
1474
- if (!messageWrapper) {
1475
- return console.warn('Failed to locate ' + this.getMessageSelector(), this.elementRef.nativeElement);
1476
- }
1477
- if (this.getlabelSelector()) {
1478
- var labelWrapper = wrapper.querySelector(this.getlabelSelector());
1479
- if (labelWrapper) {
1480
- if (this.appendLabelClass) {
1481
- this.renderer2.addClass(labelWrapper, this.appendLabelClass);
1482
- }
1483
- }
1484
- }
1485
- if (this.appendMessageClass) {
1486
- renderer.addClass(messageWrapper, this.appendMessageClass);
1487
- }
1488
- if (this.getHintWrapperSelector()) {
1489
- var hint = messageWrapper.querySelector(this.getHintWrapperSelector());
1490
- if (hint) {
1491
- renderer.setStyle(hint, 'display', error ? 'none' : 'block');
1492
- if (this.appendHintClass) {
1493
- renderer.addClass(hint, this.appendHintClass);
1494
- }
1495
- }
1496
- }
1497
- var errorWrapper = wrapper.querySelector('.fs-form-error-target');
1498
- if (errorWrapper) {
1499
- errorWrapper.remove();
1500
- }
1501
- if (!shouldErrorBeRendered || !error) {
1502
- return;
1503
- }
1504
- errorWrapper = renderer.createElement('div');
1505
- renderer.addClass(errorWrapper, 'fs-form-error-target');
1506
- renderer.addClass(errorWrapper, this.appendErrorClass);
1507
- renderer.addClass(errorWrapper, this.appendErrorClass + '-' + error.name);
1508
- var errorText = renderer.createText(error.message);
1509
- renderer.appendChild(errorWrapper, errorText);
1510
- messageWrapper.appendChild(errorWrapper);
1511
- }
1512
- };
1513
- FsControlDirective.prototype.getWrapper = function (node, count) {
1514
- if (count === void 0) { count = 0; }
1515
- if (!node || count > 10) {
1516
- return null;
1517
- }
1518
- if (node.parentNode && node.parentNode.querySelector(this.getWrapperSelector())) {
1519
- return node;
1520
- }
1521
- return this.getWrapper(node.parentNode, ++count);
1522
- };
1523
- FsControlDirective.prototype.parseErrorMessage = function (message, args) {
1524
- lodashEs.values(args)
1525
- .forEach(function (name) {
1526
- message = message.replace(/\$\(\d\)/, name);
1527
- });
1528
- return message;
1529
- };
1530
- FsControlDirective.prototype.getError = function (controlRef) {
1531
- var name = lodashEs.keys(controlRef.control.errors)[0];
1532
- if (!name) {
1533
- return null;
1534
- }
1535
- var message = controlRef.control.errors[name];
1536
- if (this._validateMessages[name]) {
1537
- message = this.parseErrorMessage(this._validateMessages[name], message);
1538
- }
1539
- return { name: name, message: message };
1540
- };
1541
- FsControlDirective.prototype._setupValidators = function () {
1542
- var control = this._control;
1543
- if (this.validate) {
1544
- var validators = control.validator
1545
- ? [control.validator, this.validate.bind(this)]
1546
- : this.validate.bind(this);
1547
- control.setValidators(validators);
1548
- }
1549
- if (this.validateAsync) {
1550
- var asyncValidators = control.asyncValidator
1551
- ? [control.asyncValidator, this.validateAsync.bind(this)]
1552
- : this.validateAsync.bind(this);
1553
- control.setAsyncValidators(asyncValidators);
1554
- }
1555
- control.updateValueAndValidity();
1556
- };
1557
- return FsControlDirective;
1558
- }());
1559
- FsControlDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsControlDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }, { token: i0__namespace.Injector }, { token: VALIDATE_MESSAGES, self: true }, { token: i1__namespace$1.NgControl, optional: true }, { token: FsFormDirective, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1560
- FsControlDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsControlDirective, selector: "[fsFormControl]", inputs: { wrapperSelector: "wrapperSelector", messageSelector: "messageSelector", hintSelector: "hintSelector", labelSelector: "labelSelector", appendMessageClass: "appendMessageClass", appendLabelClass: "appendLabelClass", appendErrorClass: "appendErrorClass", appendHintClass: "appendHintClass", validateMessages: "validateMessages" }, providers: [
1561
- VALIDATE_MESSAGE_PROVIDER
1562
- ], ngImport: i0__namespace });
1563
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsControlDirective, decorators: [{
1564
- type: i0.Directive,
1565
- args: [{
1566
- selector: '[fsFormControl]',
1567
- providers: [
1568
- VALIDATE_MESSAGE_PROVIDER
1569
- ],
1570
- }]
1571
- }], ctorParameters: function () {
1572
- return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.Renderer2 }, { type: i0__namespace.Injector }, { type: undefined, decorators: [{
1573
- type: i0.Self
1574
- }, {
1575
- type: i0.Inject,
1576
- args: [VALIDATE_MESSAGES]
1577
- }] }, { type: i1__namespace$1.NgControl, decorators: [{
1578
- type: i0.Optional
1579
- }] }, { type: FsFormDirective, decorators: [{
1580
- type: i0.Optional
1581
- }, {
1582
- type: i0.Inject,
1583
- args: [FsFormDirective]
1584
- }] }];
1585
- }, propDecorators: { wrapperSelector: [{
1586
- type: i0.Input
1587
- }], messageSelector: [{
1588
- type: i0.Input
1589
- }], hintSelector: [{
1590
- type: i0.Input
1591
- }], labelSelector: [{
1592
- type: i0.Input
1593
- }], appendMessageClass: [{
1594
- type: i0.Input
1595
- }], appendLabelClass: [{
1596
- type: i0.Input
1597
- }], appendErrorClass: [{
1598
- type: i0.Input
1599
- }], appendHintClass: [{
1600
- type: i0.Input
1601
- }], validateMessages: [{
1602
- type: i0.Input
1603
- }] } });
1604
-
1605
- function isEnabled(value) {
1606
- return value !== 'false' && (value || value === '');
1607
- }
1608
-
1609
- var FsFormRequiredDirective = /** @class */ (function (_super) {
1610
- __extends(FsFormRequiredDirective, _super);
1611
- function FsFormRequiredDirective() {
1612
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1613
- _this.required = false;
1614
- return _this;
1615
- }
1616
- Object.defineProperty(FsFormRequiredDirective.prototype, "setFsFormRequired", {
1617
- set: function (value) {
1618
- this.required = isEnabled(value);
1619
- },
1620
- enumerable: false,
1621
- configurable: true
1622
- });
1623
- Object.defineProperty(FsFormRequiredDirective.prototype, "setRequired", {
1624
- set: function (value) {
1625
- this.required = isEnabled(value);
1626
- },
1627
- enumerable: false,
1628
- configurable: true
1629
- });
1630
- Object.defineProperty(FsFormRequiredDirective.prototype, "validationMessage", {
1631
- set: function (value) {
1632
- this._validateMessages.required = value;
1633
- },
1634
- enumerable: false,
1635
- configurable: true
1636
- });
1637
- FsFormRequiredDirective.prototype.ngOnChanges = function () {
1638
- this._control.updateValueAndValidity();
1639
- };
1640
- FsFormRequiredDirective.prototype.validate = function (control) {
1641
- if (this.required) {
1642
- return i1$1.Validators.required(this._control);
1643
- }
1644
- else {
1645
- return null;
1646
- }
1647
- };
1648
- FsFormRequiredDirective.prototype.render = function () {
1649
- var wrapper = this.getWrapperElement();
1650
- if (wrapper && this.getlabelSelector()) {
1651
- var labelWrapper = wrapper.querySelector(this.getlabelSelector());
1652
- // Adding class fs-form-label-requried adds the * to the label
1653
- if (labelWrapper) {
1654
- if (this.required) {
1655
- this.renderer2.addClass(labelWrapper, 'fs-form-label-required');
1656
- }
1657
- else {
1658
- this.renderer2.removeClass(labelWrapper, 'fs-form-label-required');
1659
- }
1660
- }
1661
- }
1662
- _super.prototype.render.call(this);
1663
- };
1664
- return FsFormRequiredDirective;
1665
- }(FsControlDirective));
1666
- FsFormRequiredDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormRequiredDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
1667
- FsFormRequiredDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormRequiredDirective, selector: "[fsFormRequired],[ngModel][required]", inputs: { setFsFormRequired: ["fsFormRequired", "setFsFormRequired"], setRequired: ["required", "setRequired"], validationMessage: ["fsFormRequiredMessage", "validationMessage"] }, providers: [
1668
- VALIDATE_MESSAGE_PROVIDER
1669
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
1670
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormRequiredDirective, decorators: [{
1671
- type: i0.Directive,
1672
- args: [{
1673
- selector: '[fsFormRequired],[ngModel][required]',
1674
- providers: [
1675
- VALIDATE_MESSAGE_PROVIDER
1676
- ],
1677
- }]
1678
- }], propDecorators: { setFsFormRequired: [{
1679
- type: i0.Input,
1680
- args: ['fsFormRequired']
1681
- }], setRequired: [{
1682
- type: i0.Input,
1683
- args: ['required']
1684
- }], validationMessage: [{
1685
- type: i0.Input,
1686
- args: ['fsFormRequiredMessage']
1687
- }] } });
1688
-
1689
- var FsValidators = /** @class */ (function () {
1690
- function FsValidators() {
1691
- }
1692
- FsValidators.email = function (control) {
1693
- if (!control.value || common.email(control.value)) {
1694
- return null;
1695
- }
1696
- return { email: true };
1697
- };
1698
- FsValidators.emails = function (control) {
1699
- var model = control.value || '';
1700
- var hasInvalidEmails = model
1701
- .split(',')
1702
- .some(function (part) { return !common.email(part); });
1703
- return hasInvalidEmails ? { email: true } : null;
1704
- };
1705
- FsValidators.numeric = function (control) {
1706
- if (common.isEmpty(control.value) || common.isNumeric(control.value)) {
1707
- return null;
1708
- }
1709
- else {
1710
- return { numeric: true };
1711
- }
1712
- };
1713
- FsValidators.integer = function (control) {
1714
- if (!control.value || String(control.value) === '' || (control.value % 1 === 0)) {
1715
- return null;
1716
- }
1717
- else {
1718
- return { integer: true };
1719
- }
1720
- };
1721
- FsValidators.phone = function (control) {
1722
- if (!control.value || common.phone(control.value)) {
1723
- return null;
1724
- }
1725
- return { phone: true };
1726
- };
1727
- FsValidators.url = function (control, protocolRequired) {
1728
- if (protocolRequired === void 0) { protocolRequired = false; }
1729
- if (!control.value) {
1730
- return null;
1731
- }
1732
- if (!common.url(control.value)) {
1733
- return { url: true };
1734
- }
1735
- if (protocolRequired) {
1736
- var pattern = new RegExp(/^http(s)?:\/\//gm);
1737
- if (!String(control.value).match(pattern)) {
1738
- return { urlProtocol: true };
1739
- }
1740
- }
1741
- return null;
1742
- };
1743
- FsValidators.dateRange = function (control) {
1744
- if (!control.value) {
1745
- return null;
1746
- }
1747
- if (lodashEs.isObject(control.value)) {
1748
- var start = control.value.start;
1749
- var end = control.value.end;
1750
- if ((!start && !end) || (dateFns.isValid(start) && dateFns.isValid(end))) {
1751
- return null;
1752
- }
1753
- }
1754
- return { dateRange: true };
1755
- };
1756
- FsValidators.func = function (control, formFunction, data) {
1757
- var result;
1758
- var stream$;
1759
- try {
1760
- result = formFunction(control, data);
1761
- }
1762
- catch (err) {
1763
- err = err instanceof Error ? err.message : err;
1764
- stream$ = rxjs.throwError(err);
1765
- }
1766
- if (!stream$) {
1767
- if (result instanceof Promise) {
1768
- stream$ = rxjs.from(result);
1769
- }
1770
- else if (rxjs.isObservable(result)) {
1771
- stream$ = result;
1772
- }
1773
- else {
1774
- stream$ = rxjs.of(null);
1775
- }
1776
- }
1777
- return stream$
1778
- .pipe(operators.mapTo(null), operators.catchError(function (err) {
1779
- return rxjs.of({ validationError: err });
1780
- }), operators.take(1));
1781
- };
1782
- return FsValidators;
1783
- }());
1784
-
1785
- var FsFormMinDirective = /** @class */ (function (_super) {
1786
- __extends(FsFormMinDirective, _super);
1787
- function FsFormMinDirective() {
1788
- return _super !== null && _super.apply(this, arguments) || this;
1789
- }
1790
- Object.defineProperty(FsFormMinDirective.prototype, "validationMessage", {
1791
- set: function (value) {
1792
- this._validateMessages.min = value;
1793
- },
1794
- enumerable: false,
1795
- configurable: true
1796
- });
1797
- FsFormMinDirective.prototype.ngOnChanges = function () {
1798
- this._control.updateValueAndValidity();
1799
- };
1800
- FsFormMinDirective.prototype.validate = function (control) {
1801
- return FsValidators.numeric(this._control) || i1$1.Validators.min(parseFloat(this.fsFormMin))(this._control);
1802
- };
1803
- return FsFormMinDirective;
1804
- }(FsControlDirective));
1805
- FsFormMinDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMinDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
1806
- FsFormMinDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinDirective, selector: "[fsFormMin]", inputs: { fsFormMin: "fsFormMin", validationMessage: ["fsFormMinMessage", "validationMessage"] }, providers: [
1807
- VALIDATE_MESSAGE_PROVIDER
1808
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
1809
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMinDirective, decorators: [{
1810
- type: i0.Directive,
1811
- args: [{
1812
- selector: '[fsFormMin]',
1813
- providers: [
1814
- VALIDATE_MESSAGE_PROVIDER
1815
- ],
1816
- }]
1817
- }], propDecorators: { fsFormMin: [{
1818
- type: i0.Input
1819
- }], validationMessage: [{
1820
- type: i0.Input,
1821
- args: ['fsFormMinMessage']
1822
- }] } });
1823
-
1824
- var FsFormMaxDirective = /** @class */ (function (_super) {
1825
- __extends(FsFormMaxDirective, _super);
1826
- function FsFormMaxDirective() {
1827
- return _super !== null && _super.apply(this, arguments) || this;
1828
- }
1829
- Object.defineProperty(FsFormMaxDirective.prototype, "validationMessage", {
1830
- set: function (value) {
1831
- this._validateMessages.max = value;
1832
- },
1833
- enumerable: false,
1834
- configurable: true
1835
- });
1836
- FsFormMaxDirective.prototype.ngOnChanges = function () {
1837
- this._control.updateValueAndValidity();
1838
- };
1839
- FsFormMaxDirective.prototype.validate = function (control) {
1840
- return FsValidators.numeric(this._control) || i1$1.Validators.max(this.fsFormMax)(this._control);
1841
- };
1842
- return FsFormMaxDirective;
1843
- }(FsControlDirective));
1844
- FsFormMaxDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMaxDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
1845
- FsFormMaxDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxDirective, selector: "[fsFormMax]", inputs: { fsFormMax: "fsFormMax", validationMessage: ["fsFormMaxMessage", "validationMessage"] }, providers: [
1846
- VALIDATE_MESSAGE_PROVIDER
1847
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
1848
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMaxDirective, decorators: [{
1849
- type: i0.Directive,
1850
- args: [{
1851
- selector: '[fsFormMax]',
1852
- providers: [
1853
- VALIDATE_MESSAGE_PROVIDER
1854
- ],
1855
- }]
1856
- }], propDecorators: { fsFormMax: [{
1857
- type: i0.Input
1858
- }], validationMessage: [{
1859
- type: i0.Input,
1860
- args: ['fsFormMaxMessage']
1861
- }] } });
1862
-
1863
- var FsFormMinLengthDirective = /** @class */ (function (_super) {
1864
- __extends(FsFormMinLengthDirective, _super);
1865
- function FsFormMinLengthDirective() {
1866
- return _super !== null && _super.apply(this, arguments) || this;
1867
- }
1868
- Object.defineProperty(FsFormMinLengthDirective.prototype, "validationMessage", {
1869
- set: function (value) {
1870
- this._validateMessages.minlength = value;
1871
- },
1872
- enumerable: false,
1873
- configurable: true
1874
- });
1875
- FsFormMinLengthDirective.prototype.ngOnChanges = function () {
1876
- this._control.updateValueAndValidity();
1877
- };
1878
- FsFormMinLengthDirective.prototype.validate = function (control) {
1879
- return i1$1.Validators.minLength(this.fsFormMinLength)(this._control);
1880
- };
1881
- return FsFormMinLengthDirective;
1882
- }(FsControlDirective));
1883
- FsFormMinLengthDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMinLengthDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
1884
- FsFormMinLengthDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMinLengthDirective, selector: "[fsFormMinLength]", inputs: { fsFormMinLength: "fsFormMinLength", validationMessage: ["fsFormMinLengthMessage", "validationMessage"] }, providers: [
1885
- VALIDATE_MESSAGE_PROVIDER
1886
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
1887
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMinLengthDirective, decorators: [{
1888
- type: i0.Directive,
1889
- args: [{
1890
- selector: '[fsFormMinLength]',
1891
- providers: [
1892
- VALIDATE_MESSAGE_PROVIDER
1893
- ],
1894
- }]
1895
- }], propDecorators: { fsFormMinLength: [{
1896
- type: i0.Input
1897
- }], validationMessage: [{
1898
- type: i0.Input,
1899
- args: ['fsFormMinLengthMessage']
1900
- }] } });
1901
-
1902
- var FsFormMaxLengthDirective = /** @class */ (function (_super) {
1903
- __extends(FsFormMaxLengthDirective, _super);
1904
- function FsFormMaxLengthDirective() {
1905
- return _super !== null && _super.apply(this, arguments) || this;
1906
- }
1907
- Object.defineProperty(FsFormMaxLengthDirective.prototype, "validationMessage", {
1908
- set: function (value) {
1909
- this._validateMessages.maxlength = value;
1910
- },
1911
- enumerable: false,
1912
- configurable: true
1913
- });
1914
- FsFormMaxLengthDirective.prototype.ngOnChanges = function () {
1915
- this._control.updateValueAndValidity();
1916
- };
1917
- FsFormMaxLengthDirective.prototype.validate = function (control) {
1918
- return i1$1.Validators.maxLength(this.fsFormMaxLength)(this._control);
1919
- };
1920
- return FsFormMaxLengthDirective;
1921
- }(FsControlDirective));
1922
- FsFormMaxLengthDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMaxLengthDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
1923
- FsFormMaxLengthDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormMaxLengthDirective, selector: "[fsFormMaxLength]", inputs: { fsFormMaxLength: "fsFormMaxLength", validationMessage: ["fsFormMaxLengthMessage", "validationMessage"] }, providers: [
1924
- VALIDATE_MESSAGE_PROVIDER
1925
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
1926
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormMaxLengthDirective, decorators: [{
1927
- type: i0.Directive,
1928
- args: [{
1929
- selector: '[fsFormMaxLength]',
1930
- providers: [
1931
- VALIDATE_MESSAGE_PROVIDER
1932
- ],
1933
- }]
1934
- }], propDecorators: { fsFormMaxLength: [{
1935
- type: i0.Input
1936
- }], validationMessage: [{
1937
- type: i0.Input,
1938
- args: ['fsFormMaxLengthMessage']
1939
- }] } });
1940
-
1941
- var FsFormEmailDirective = /** @class */ (function (_super) {
1942
- __extends(FsFormEmailDirective, _super);
1943
- function FsFormEmailDirective() {
1944
- return _super !== null && _super.apply(this, arguments) || this;
1945
- }
1946
- Object.defineProperty(FsFormEmailDirective.prototype, "validationMessage", {
1947
- set: function (value) {
1948
- this._validateMessages.email = value;
1949
- },
1950
- enumerable: false,
1951
- configurable: true
1952
- });
1953
- FsFormEmailDirective.prototype.ngOnChanges = function () {
1954
- this._control.updateValueAndValidity();
1955
- };
1956
- FsFormEmailDirective.prototype.validate = function (control) {
1957
- if (isEnabled(this.fsFormEmail)) {
1958
- return FsValidators.email(this._control);
1959
- }
1960
- else {
1961
- return null;
1962
- }
1963
- };
1964
- return FsFormEmailDirective;
1965
- }(FsControlDirective));
1966
- FsFormEmailDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormEmailDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
1967
- FsFormEmailDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailDirective, selector: "[fsFormEmail]", inputs: { fsFormEmail: "fsFormEmail", validationMessage: ["fsFormEmailMessage", "validationMessage"] }, providers: [
1968
- VALIDATE_MESSAGE_PROVIDER
1969
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
1970
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormEmailDirective, decorators: [{
1971
- type: i0.Directive,
1972
- args: [{
1973
- selector: '[fsFormEmail]',
1974
- providers: [
1975
- VALIDATE_MESSAGE_PROVIDER
1976
- ],
1977
- }]
1978
- }], propDecorators: { fsFormEmail: [{
1979
- type: i0.Input
1980
- }], validationMessage: [{
1981
- type: i0.Input,
1982
- args: ['fsFormEmailMessage']
1983
- }] } });
1984
-
1985
- var FsFormEmailsDirective = /** @class */ (function (_super) {
1986
- __extends(FsFormEmailsDirective, _super);
1987
- function FsFormEmailsDirective() {
1988
- return _super !== null && _super.apply(this, arguments) || this;
1989
- }
1990
- Object.defineProperty(FsFormEmailsDirective.prototype, "validationMessage", {
1991
- set: function (value) {
1992
- this._validateMessages.emails = value;
1993
- },
1994
- enumerable: false,
1995
- configurable: true
1996
- });
1997
- FsFormEmailsDirective.prototype.ngOnChanges = function () {
1998
- this._control.updateValueAndValidity();
1999
- };
2000
- FsFormEmailsDirective.prototype.validate = function (control) {
2001
- if (isEnabled(this.fsFormEmails)) {
2002
- return FsValidators.emails(this._control);
2003
- }
2004
- else {
2005
- return null;
2006
- }
2007
- };
2008
- return FsFormEmailsDirective;
2009
- }(FsControlDirective));
2010
- FsFormEmailsDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormEmailsDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2011
- FsFormEmailsDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormEmailsDirective, selector: "[fsFormEmails]", inputs: { fsFormEmails: "fsFormEmails", validationMessage: ["fsFormEmailsMessage", "validationMessage"] }, providers: [
2012
- VALIDATE_MESSAGE_PROVIDER
2013
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2014
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormEmailsDirective, decorators: [{
2015
- type: i0.Directive,
2016
- args: [{
2017
- selector: '[fsFormEmails]',
2018
- providers: [
2019
- VALIDATE_MESSAGE_PROVIDER
2020
- ],
2021
- }]
2022
- }], propDecorators: { fsFormEmails: [{
2023
- type: i0.Input
2024
- }], validationMessage: [{
2025
- type: i0.Input,
2026
- args: ['fsFormEmailsMessage']
2027
- }] } });
2028
-
2029
- var FsFormPhoneDirective = /** @class */ (function (_super) {
2030
- __extends(FsFormPhoneDirective, _super);
2031
- function FsFormPhoneDirective() {
2032
- return _super !== null && _super.apply(this, arguments) || this;
2033
- }
2034
- Object.defineProperty(FsFormPhoneDirective.prototype, "validationMessage", {
2035
- set: function (value) {
2036
- this._validateMessages.phone = value;
2037
- },
2038
- enumerable: false,
2039
- configurable: true
2040
- });
2041
- FsFormPhoneDirective.prototype.ngOnChanges = function () {
2042
- this._control.updateValueAndValidity();
2043
- };
2044
- FsFormPhoneDirective.prototype.validate = function (control) {
2045
- if (isEnabled(this.fsFormPhone)) {
2046
- return FsValidators.phone(this._control);
2047
- }
2048
- else {
2049
- return null;
2050
- }
2051
- };
2052
- return FsFormPhoneDirective;
2053
- }(FsControlDirective));
2054
- FsFormPhoneDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormPhoneDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2055
- FsFormPhoneDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPhoneDirective, selector: "[fsFormPhone]", inputs: { fsFormPhone: "fsFormPhone", validationMessage: ["fsFormPhoneMessage", "validationMessage"] }, providers: [
2056
- VALIDATE_MESSAGE_PROVIDER
2057
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2058
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormPhoneDirective, decorators: [{
2059
- type: i0.Directive,
2060
- args: [{
2061
- selector: '[fsFormPhone]',
2062
- providers: [
2063
- VALIDATE_MESSAGE_PROVIDER
2064
- ],
2065
- }]
2066
- }], propDecorators: { fsFormPhone: [{
2067
- type: i0.Input
2068
- }], validationMessage: [{
2069
- type: i0.Input,
2070
- args: ['fsFormPhoneMessage']
2071
- }] } });
2072
-
2073
- var FsFormCompareDirective = /** @class */ (function (_super) {
2074
- __extends(FsFormCompareDirective, _super);
2075
- function FsFormCompareDirective() {
2076
- return _super !== null && _super.apply(this, arguments) || this;
2077
- }
2078
- Object.defineProperty(FsFormCompareDirective.prototype, "validationMessage", {
2079
- set: function (value) {
2080
- this._validateMessages.compare = value;
2081
- },
2082
- enumerable: false,
2083
- configurable: true
2084
- });
2085
- FsFormCompareDirective.prototype.ngOnChanges = function () {
2086
- this._control.updateValueAndValidity();
2087
- };
2088
- FsFormCompareDirective.prototype.validate = function (control) {
2089
- if (this.fsFormCompare.value === this.elementRef.nativeElement.value) {
2090
- return null;
2091
- }
2092
- else {
2093
- return { compare: true };
2094
- }
2095
- };
2096
- FsFormCompareDirective.prototype.ngAfterViewInit = function () {
2097
- var _this = this;
2098
- this.fsFormCompare.addEventListener('keyup', function () {
2099
- _this._control.updateValueAndValidity();
2100
- }, false);
2101
- };
2102
- FsFormCompareDirective.prototype.ngOnDestroy = function () {
2103
- var _this = this;
2104
- this.fsFormCompare.removeEventListener('keyup', function () {
2105
- _this._control.updateValueAndValidity();
2106
- }, false);
2107
- };
2108
- return FsFormCompareDirective;
2109
- }(FsControlDirective));
2110
- FsFormCompareDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormCompareDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2111
- FsFormCompareDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormCompareDirective, selector: "[fsFormCompare]", inputs: { fsFormCompare: "fsFormCompare", validationMessage: ["fsFormCompareMessage", "validationMessage"] }, providers: [
2112
- VALIDATE_MESSAGE_PROVIDER,
2113
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2114
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormCompareDirective, decorators: [{
2115
- type: i0.Directive,
2116
- args: [{
2117
- selector: '[fsFormCompare]',
2118
- providers: [
2119
- VALIDATE_MESSAGE_PROVIDER,
2120
- ],
2121
- }]
2122
- }], propDecorators: { fsFormCompare: [{
2123
- type: i0.Input
2124
- }], validationMessage: [{
2125
- type: i0.Input,
2126
- args: ['fsFormCompareMessage']
2127
- }] } });
2128
-
2129
- var FsFormIntegerDirective = /** @class */ (function (_super) {
2130
- __extends(FsFormIntegerDirective, _super);
2131
- function FsFormIntegerDirective() {
2132
- return _super !== null && _super.apply(this, arguments) || this;
2133
- }
2134
- Object.defineProperty(FsFormIntegerDirective.prototype, "validationMessage", {
2135
- set: function (value) {
2136
- this._validateMessages.integer = value;
2137
- },
2138
- enumerable: false,
2139
- configurable: true
2140
- });
2141
- FsFormIntegerDirective.prototype.ngOnChanges = function () {
2142
- this._control.updateValueAndValidity();
2143
- };
2144
- FsFormIntegerDirective.prototype.validate = function (control) {
2145
- if (isEnabled(this.fsFormInteger)) {
2146
- return FsValidators.integer(this._control);
2147
- }
2148
- else {
2149
- return null;
2150
- }
2151
- };
2152
- return FsFormIntegerDirective;
2153
- }(FsControlDirective));
2154
- FsFormIntegerDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormIntegerDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2155
- FsFormIntegerDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormIntegerDirective, selector: "[fsFormInteger]", inputs: { fsFormInteger: "fsFormInteger", validationMessage: ["fsFormIntegerMessage", "validationMessage"] }, providers: [
2156
- VALIDATE_MESSAGE_PROVIDER
2157
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2158
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormIntegerDirective, decorators: [{
2159
- type: i0.Directive,
2160
- args: [{
2161
- selector: '[fsFormInteger]',
2162
- providers: [
2163
- VALIDATE_MESSAGE_PROVIDER
2164
- ],
2165
- }]
2166
- }], propDecorators: { fsFormInteger: [{
2167
- type: i0.Input
2168
- }], validationMessage: [{
2169
- type: i0.Input,
2170
- args: ['fsFormIntegerMessage']
2171
- }] } });
2172
-
2173
- var FsFormNumericDirective = /** @class */ (function (_super) {
2174
- __extends(FsFormNumericDirective, _super);
2175
- function FsFormNumericDirective() {
2176
- return _super !== null && _super.apply(this, arguments) || this;
2177
- }
2178
- Object.defineProperty(FsFormNumericDirective.prototype, "validationMessage", {
2179
- set: function (value) {
2180
- this._validateMessages.numeric = value;
2181
- },
2182
- enumerable: false,
2183
- configurable: true
2184
- });
2185
- FsFormNumericDirective.prototype.ngOnChanges = function () {
2186
- this._control.updateValueAndValidity();
2187
- };
2188
- FsFormNumericDirective.prototype.validate = function (control) {
2189
- if (isEnabled(this.fsFormNumeric)) {
2190
- return FsValidators.numeric(this._control);
2191
- }
2192
- else {
2193
- return null;
2194
- }
2195
- };
2196
- return FsFormNumericDirective;
2197
- }(FsControlDirective));
2198
- FsFormNumericDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormNumericDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2199
- FsFormNumericDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormNumericDirective, selector: "[fsFormNumeric]", inputs: { fsFormNumeric: "fsFormNumeric", validationMessage: ["fsFormNumericMessage", "validationMessage"] }, providers: [
2200
- VALIDATE_MESSAGE_PROVIDER
2201
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2202
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormNumericDirective, decorators: [{
2203
- type: i0.Directive,
2204
- args: [{
2205
- selector: '[fsFormNumeric]',
2206
- providers: [
2207
- VALIDATE_MESSAGE_PROVIDER
2208
- ],
2209
- }]
2210
- }], propDecorators: { fsFormNumeric: [{
2211
- type: i0.Input
2212
- }], validationMessage: [{
2213
- type: i0.Input,
2214
- args: ['fsFormNumericMessage']
2215
- }] } });
2216
-
2217
- var FsFormPatternDirective = /** @class */ (function (_super) {
2218
- __extends(FsFormPatternDirective, _super);
2219
- function FsFormPatternDirective() {
2220
- return _super !== null && _super.apply(this, arguments) || this;
2221
- }
2222
- Object.defineProperty(FsFormPatternDirective.prototype, "validationMessage", {
2223
- set: function (value) {
2224
- this._validateMessages.pattern = value;
2225
- },
2226
- enumerable: false,
2227
- configurable: true
2228
- });
2229
- FsFormPatternDirective.prototype.ngOnChanges = function () {
2230
- this._control.updateValueAndValidity();
2231
- };
2232
- FsFormPatternDirective.prototype.validate = function (control) {
2233
- return i1$1.Validators.pattern(this.fsFormPattern)(this._control);
2234
- };
2235
- return FsFormPatternDirective;
2236
- }(FsControlDirective));
2237
- FsFormPatternDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormPatternDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2238
- FsFormPatternDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormPatternDirective, selector: "[fsFormPattern]", inputs: { fsFormPattern: "fsFormPattern", validationMessage: ["fsFormPatternMessage", "validationMessage"] }, providers: [
2239
- VALIDATE_MESSAGE_PROVIDER
2240
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2241
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormPatternDirective, decorators: [{
2242
- type: i0.Directive,
2243
- args: [{
2244
- selector: '[fsFormPattern]',
2245
- providers: [
2246
- VALIDATE_MESSAGE_PROVIDER
2247
- ],
2248
- }]
2249
- }], propDecorators: { fsFormPattern: [{
2250
- type: i0.Input
2251
- }], validationMessage: [{
2252
- type: i0.Input,
2253
- args: ['fsFormPatternMessage']
2254
- }] } });
2255
-
2256
- var FsFormFunctionDirective = /** @class */ (function (_super) {
2257
- __extends(FsFormFunctionDirective, _super);
2258
- function FsFormFunctionDirective() {
2259
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2260
- _this.validateOnSubmit = false;
2261
- return _this;
2262
- }
2263
- FsFormFunctionDirective.prototype.ngOnChanges = function () {
2264
- this._control.updateValueAndValidity();
2265
- };
2266
- FsFormFunctionDirective.prototype.validateAsync = function (control) {
2267
- if (this.validateOnSubmit && !this.formDirective.validating) {
2268
- return rxjs.of(null);
2269
- }
2270
- return FsValidators.func(this._control, this.fsFormFunction, this.fsFormFunctionData);
2271
- };
2272
- return FsFormFunctionDirective;
2273
- }(FsControlDirective));
2274
- FsFormFunctionDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormFunctionDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2275
- FsFormFunctionDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormFunctionDirective, selector: "[fsFormFunction]", inputs: { fsFormFunction: "fsFormFunction", fsFormFunctionData: "fsFormFunctionData", validateOnSubmit: "validateOnSubmit" }, providers: [
2276
- VALIDATE_MESSAGE_PROVIDER
2277
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2278
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormFunctionDirective, decorators: [{
2279
- type: i0.Directive,
2280
- args: [{
2281
- selector: '[fsFormFunction]',
2282
- providers: [
2283
- VALIDATE_MESSAGE_PROVIDER
2284
- ],
2285
- }]
2286
- }], propDecorators: { fsFormFunction: [{
2287
- type: i0.Input
2288
- }], fsFormFunctionData: [{
2289
- type: i0.Input
2290
- }], validateOnSubmit: [{
2291
- type: i0.Input
2292
- }] } });
2293
-
2294
- var FsFormGreaterDirective = /** @class */ (function (_super) {
2295
- __extends(FsFormGreaterDirective, _super);
2296
- function FsFormGreaterDirective() {
2297
- return _super !== null && _super.apply(this, arguments) || this;
2298
- }
2299
- Object.defineProperty(FsFormGreaterDirective.prototype, "validationMessage", {
2300
- set: function (value) {
2301
- this._validateMessages.greater = value;
2302
- },
2303
- enumerable: false,
2304
- configurable: true
2305
- });
2306
- FsFormGreaterDirective.prototype.ngOnChanges = function () {
2307
- this._control.updateValueAndValidity();
2308
- };
2309
- FsFormGreaterDirective.prototype.validate = function (control) {
2310
- var greater = parseFloat(this.fsFormGreater);
2311
- var value = parseFloat(this._control.value);
2312
- if (!isNaN(greater) && !isNaN(value) && value <= greater) {
2313
- return { greater: { greater: greater, actual: value } };
2314
- }
2315
- return FsValidators.numeric(this._control);
2316
- };
2317
- return FsFormGreaterDirective;
2318
- }(FsControlDirective));
2319
- FsFormGreaterDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormGreaterDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2320
- FsFormGreaterDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormGreaterDirective, selector: "[fsFormGreater]", inputs: { fsFormGreater: "fsFormGreater", validationMessage: ["fsFormGreaterMessage", "validationMessage"] }, providers: [
2321
- VALIDATE_MESSAGE_PROVIDER
2322
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2323
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormGreaterDirective, decorators: [{
2324
- type: i0.Directive,
2325
- args: [{
2326
- selector: '[fsFormGreater]',
2327
- providers: [
2328
- VALIDATE_MESSAGE_PROVIDER
2329
- ],
2330
- }]
2331
- }], propDecorators: { fsFormGreater: [{
2332
- type: i0.Input
2333
- }], validationMessage: [{
2334
- type: i0.Input,
2335
- args: ['fsFormGreaterMessage']
2336
- }] } });
2337
-
2338
- var FsFormDateRangeDirective = /** @class */ (function (_super) {
2339
- __extends(FsFormDateRangeDirective, _super);
2340
- function FsFormDateRangeDirective() {
2341
- return _super !== null && _super.apply(this, arguments) || this;
2342
- }
2343
- Object.defineProperty(FsFormDateRangeDirective.prototype, "validationMessage", {
2344
- set: function (value) {
2345
- this._validateMessages.dateRange = value;
2346
- },
2347
- enumerable: false,
2348
- configurable: true
2349
- });
2350
- FsFormDateRangeDirective.prototype.ngOnChanges = function () {
2351
- this._control.updateValueAndValidity();
2352
- };
2353
- FsFormDateRangeDirective.prototype.validate = function (control) {
2354
- if (isEnabled(this.fsFormDateRange)) {
2355
- return FsValidators.dateRange(this._control);
2356
- }
2357
- else {
2358
- return null;
2359
- }
2360
- };
2361
- return FsFormDateRangeDirective;
2362
- }(FsControlDirective));
2363
- FsFormDateRangeDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDateRangeDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2364
- FsFormDateRangeDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDateRangeDirective, selector: "[fsFormDateRange]", inputs: { fsFormDateRange: "fsFormDateRange", validationMessage: ["fsFormDateRangeMessage", "validationMessage"] }, providers: [
2365
- VALIDATE_MESSAGE_PROVIDER
2366
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2367
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDateRangeDirective, decorators: [{
2368
- type: i0.Directive,
2369
- args: [{
2370
- selector: '[fsFormDateRange]',
2371
- providers: [
2372
- VALIDATE_MESSAGE_PROVIDER
2373
- ],
2374
- }]
2375
- }], propDecorators: { fsFormDateRange: [{
2376
- type: i0.Input
2377
- }], validationMessage: [{
2378
- type: i0.Input,
2379
- args: ['fsFormDateRangeMessage']
2380
- }] } });
2381
-
2382
- var FsFormLesserDirective = /** @class */ (function (_super) {
2383
- __extends(FsFormLesserDirective, _super);
2384
- function FsFormLesserDirective() {
2385
- return _super !== null && _super.apply(this, arguments) || this;
2386
- }
2387
- Object.defineProperty(FsFormLesserDirective.prototype, "validationMessage", {
2388
- set: function (value) {
2389
- this._validateMessages.lesser = value;
2390
- },
2391
- enumerable: false,
2392
- configurable: true
2393
- });
2394
- FsFormLesserDirective.prototype.ngOnChanges = function () {
2395
- this._control.updateValueAndValidity();
2396
- };
2397
- FsFormLesserDirective.prototype.validate = function (control) {
2398
- var lesser = parseFloat(this.fsFormLesser);
2399
- var value = parseFloat(this._control.value);
2400
- if (!isNaN(lesser) && !isNaN(value) && value >= lesser) {
2401
- return { lesser: { lesser: lesser, actual: value } };
2402
- }
2403
- return FsValidators.numeric(this._control);
2404
- };
2405
- return FsFormLesserDirective;
2406
- }(FsControlDirective));
2407
- FsFormLesserDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormLesserDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2408
- FsFormLesserDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormLesserDirective, selector: "[fsFormLesser]", inputs: { fsFormLesser: "fsFormLesser", validationMessage: ["fsFormLesserMessage", "validationMessage"] }, providers: [
2409
- VALIDATE_MESSAGE_PROVIDER
2410
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2411
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormLesserDirective, decorators: [{
2412
- type: i0.Directive,
2413
- args: [{
2414
- selector: '[fsFormLesser]',
2415
- providers: [
2416
- VALIDATE_MESSAGE_PROVIDER
2417
- ],
2418
- }]
2419
- }], propDecorators: { fsFormLesser: [{
2420
- type: i0.Input
2421
- }], validationMessage: [{
2422
- type: i0.Input,
2423
- args: ['fsFormLesserMessage']
2424
- }] } });
2425
-
2426
- var FsFormUrlDirective = /** @class */ (function (_super) {
2427
- __extends(FsFormUrlDirective, _super);
2428
- function FsFormUrlDirective() {
2429
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2430
- _this.fsFormUrlProtocol = false;
2431
- return _this;
2432
- }
2433
- Object.defineProperty(FsFormUrlDirective.prototype, "validationMessage", {
2434
- set: function (value) {
2435
- this._validateMessages.url = value;
2436
- },
2437
- enumerable: false,
2438
- configurable: true
2439
- });
2440
- FsFormUrlDirective.prototype.ngOnChanges = function () {
2441
- this._control.updateValueAndValidity();
2442
- };
2443
- FsFormUrlDirective.prototype.validate = function (control) {
2444
- if (isEnabled(this.fsFormUrl)) {
2445
- return FsValidators.url(this._control, this.fsFormUrlProtocol);
2446
- }
2447
- else {
2448
- return null;
2449
- }
2450
- };
2451
- return FsFormUrlDirective;
2452
- }(FsControlDirective));
2453
- FsFormUrlDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormUrlDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2454
- FsFormUrlDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormUrlDirective, selector: "[fsFormUrl]", inputs: { fsFormUrl: "fsFormUrl", fsFormUrlProtocol: "fsFormUrlProtocol", validationMessage: ["fsFormUrlMessage", "validationMessage"] }, providers: [
2455
- VALIDATE_MESSAGE_PROVIDER
2456
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2457
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormUrlDirective, decorators: [{
2458
- type: i0.Directive,
2459
- args: [{
2460
- selector: '[fsFormUrl]',
2461
- providers: [
2462
- VALIDATE_MESSAGE_PROVIDER
2463
- ],
2464
- }]
2465
- }], propDecorators: { fsFormUrl: [{
2466
- type: i0.Input
2467
- }], fsFormUrlProtocol: [{
2468
- type: i0.Input
2469
- }], validationMessage: [{
2470
- type: i0.Input,
2471
- args: ['fsFormUrlMessage']
2472
- }] } });
2473
-
2474
- var FsButtonDirective = /** @class */ (function () {
2475
- function FsButtonDirective(_matButton, _form, _elementRef, _cdRef) {
2476
- this._matButton = _matButton;
2477
- this._form = _form;
2478
- this._elementRef = _elementRef;
2479
- this._cdRef = _cdRef;
2480
- this.dirtySubmit = true;
2481
- this.transitionStyle = null;
2482
- this.active = false;
2483
- this.submit = false;
2484
- this._previousDisabled = false;
2485
- this._destroy$ = new rxjs.Subject();
2486
- }
2487
- FsButtonDirective.prototype.ngOnInit = function () {
2488
- var _this = this;
2489
- this.submit = this._elementRef.nativeElement.getAttribute('type') === 'submit';
2490
- this.form = this.form || this._form;
2491
- if (this.form) {
2492
- this.form.addButton(this);
2493
- if (this.submit) {
2494
- rxjs.fromEvent(this.element, 'click')
2495
- .pipe(operators.takeUntil(this._destroy$))
2496
- .subscribe(function () {
2497
- _this.active = true;
2498
- });
2499
- if (this.dirtySubmit) {
2500
- if (this.form.dirtySubmitButton) {
2501
- if (!this.form.ngForm.dirty) {
2502
- this.disable();
2503
- }
2504
- }
2505
- }
2506
- this.transitionStyle = 'none';
2507
- setTimeout(function () {
2508
- _this.transitionStyle = null;
2509
- }, 500);
2510
- }
2511
- }
2512
- };
2513
- FsButtonDirective.prototype.disable = function () {
2514
- if (this._matButton && !this.active) {
2515
- this._previousDisabled = this._matButton.disabled;
2516
- this._matButton.disabled = true;
2517
- this._cdRef.markForCheck();
2518
- }
2519
- };
2520
- FsButtonDirective.prototype.enable = function () {
2521
- if (this._matButton) {
2522
- this._matButton.disabled = false;
2523
- this._matButton.disableRipple = true;
2524
- this._cdRef.markForCheck();
2525
- }
2526
- };
2527
- FsButtonDirective.prototype.process = function () {
2528
- this.setClass('process');
2529
- if (this._matButton) {
2530
- this._matButton.disableRipple = true;
2531
- }
2532
- };
2533
- FsButtonDirective.prototype.success = function () {
2534
- this.setClass('success');
2535
- if (this._matButton) {
2536
- this._matButton.disableRipple = false;
2537
- }
2538
- };
2539
- FsButtonDirective.prototype.error = function () {
2540
- this.setClass('error');
2541
- if (this._matButton) {
2542
- this._matButton.disableRipple = false;
2543
- }
2544
- };
2545
- FsButtonDirective.prototype.setClass = function (cls) {
2546
- var svg = this._getSvg(cls);
2547
- this._resetClass();
2548
- this._disableShadowAnimation();
2549
- this.element.classList.add("submit-" + cls);
2550
- this.element.append(svg);
2551
- };
2552
- Object.defineProperty(FsButtonDirective.prototype, "element", {
2553
- get: function () {
2554
- return this._elementRef.nativeElement;
2555
- },
2556
- enumerable: false,
2557
- configurable: true
2558
- });
2559
- FsButtonDirective.prototype.resetActive = function () {
2560
- this.active = false;
2561
- };
2562
- FsButtonDirective.prototype.reset = function () {
2563
- if (!this._previousDisabled) {
2564
- this.enable();
2565
- }
2566
- this.element.querySelectorAll('.svg-icon')
2567
- .forEach(function (el) {
2568
- el.remove();
2569
- });
2570
- if (this._matButton) {
2571
- this._matButton.disableRipple = false;
2572
- }
2573
- this._resetClass();
2574
- };
2575
- FsButtonDirective.prototype.ngOnDestroy = function () {
2576
- var _a;
2577
- this._destroy$.next();
2578
- this._destroy$.complete();
2579
- (_a = this.form) === null || _a === void 0 ? void 0 : _a.removeButton(this);
2580
- };
2581
- FsButtonDirective.prototype._disableShadowAnimation = function () {
2582
- // .mat-elevation-z2 removes the click shadow animation
2583
- //this.element.classList.add('mat-elevation-z2');
2584
- };
2585
- FsButtonDirective.prototype._resetClass = function () {
2586
- this.element.classList.remove('submit-success', 'submit-error', 'submit-process', 'mat-elevation-z2');
2587
- };
2588
- FsButtonDirective.prototype._getSvg = function (type) {
2589
- if (type === 'success') {
2590
- return new DOMParser().parseFromString("<svg class=\"svg-icon svg-icon-success\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" x=\"0px\" y=\"0px\" viewBox=\"0 0 38 38\" style=\"enable-background:new 0 0 38 38;\" xml:space=\"preserve\" width=\"38px\" height=\"38px\">\n <g>\n <g class=\"check\">\n <g>\n <path d=\"M29.6,11.9c-0.5-0.5-1.3-0.5-1.8,0L16.3,23.4l-6.1-6.1c-0.5-0.5-1.3-0.5-1.8,0s-0.5,1.3,0,1.8l7,7c0.3,0.3,0.6,0.4,0.9,0.4s0.7-0.1,0.9-0.4l12.4-12.4C30.1,13.2,30.1,12.4,29.6,11.9z\"/>\n </g>\n </g>\n </g>\n </svg>", 'text/xml').firstChild;
2591
- }
2592
- if (type === 'process') {
2593
- return new DOMParser().parseFromString("<svg class=\"svg-icon svg-icon-process\" width=\"38\" height=\"38\" viewBox=\"0 0 38 38\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(1 1)\" stroke-width=\"2\"><circle stroke-opacity=\".5\" cx=\"18\" cy=\"18\" r=\"18\"/>\n <path d=\"M36 18c0-9.94-8.06-18-18-18\"><animateTransform attributeName=\"transform\" type=\"rotate\" from=\"0 18 18\" to=\"360 18 18\" dur=\".7s\" repeatCount=\"indefinite\"/></path>\n </g>\n </g>\n </svg>", 'text/xml').firstChild;
2594
- }
2595
- if (type === 'error') {
2596
- 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;
2597
- }
2598
- };
2599
- return FsButtonDirective;
2600
- }());
2601
- FsButtonDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, deps: [{ token: i1__namespace$2.MatButton, host: true, optional: true }, { token: FsFormDirective, optional: true }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
2602
- FsButtonDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: { name: "name", dirtySubmit: "dirtySubmit", form: "form" }, host: { properties: { "style.transition": "this.transitionStyle" } }, ngImport: i0__namespace });
2603
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsButtonDirective, decorators: [{
2604
- type: i0.Directive,
2605
- args: [{
2606
- selector: '[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]',
2607
- }]
2608
- }], ctorParameters: function () {
2609
- return [{ type: i1__namespace$2.MatButton, decorators: [{
2610
- type: i0.Optional
2611
- }, {
2612
- type: i0.Host
2613
- }] }, { type: FsFormDirective, decorators: [{
2614
- type: i0.Optional
2615
- }] }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
2616
- }, propDecorators: { name: [{
2617
- type: i0.Input
2618
- }], dirtySubmit: [{
2619
- type: i0.Input
2620
- }], form: [{
2621
- type: i0.Input
2622
- }], transitionStyle: [{
2623
- type: i0.HostBinding,
2624
- args: ['style.transition']
2625
- }] } });
2626
-
2627
- var FsFormValidateDirective = /** @class */ (function (_super) {
2628
- __extends(FsFormValidateDirective, _super);
2629
- function FsFormValidateDirective() {
2630
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2631
- _this.validateOnSubmit = false;
2632
- return _this;
2633
- }
2634
- FsFormValidateDirective.prototype.ngOnChanges = function () {
2635
- this._control.updateValueAndValidity();
2636
- };
2637
- FsFormValidateDirective.prototype.validateAsync = function (control) {
2638
- if (this.validateOnSubmit && !this.formDirective.validating) {
2639
- return rxjs.of(null);
2640
- }
2641
- return FsValidators.func(this._control, this.validateFn, this.validateFnData);
2642
- };
2643
- return FsFormValidateDirective;
2644
- }(FsControlDirective));
2645
- FsFormValidateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormValidateDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2646
- FsFormValidateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsFormValidateDirective, selector: "[validate]", inputs: { validateFn: ["validate", "validateFn"], validateFnData: ["validateData", "validateFnData"], validateOnSubmit: "validateOnSubmit" }, providers: [
2647
- VALIDATE_MESSAGE_PROVIDER
2648
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2649
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormValidateDirective, decorators: [{
2650
- type: i0.Directive,
2651
- args: [{
2652
- selector: '[validate]',
2653
- providers: [
2654
- VALIDATE_MESSAGE_PROVIDER
2655
- ],
2656
- }]
2657
- }], propDecorators: { validateFn: [{
2658
- type: i0.Input,
2659
- args: ['validate']
2660
- }], validateFnData: [{
2661
- type: i0.Input,
2662
- args: ['validateData']
2663
- }], validateOnSubmit: [{
2664
- type: i0.Input
2665
- }] } });
2666
-
2667
- var FsFormDialogActionsComponent = /** @class */ (function () {
2668
- function FsFormDialogActionsComponent(_form, _dialogRef, _cdRef) {
2669
- this._form = _form;
2670
- this._dialogRef = _dialogRef;
2671
- this._cdRef = _cdRef;
2672
- this.save = true;
2673
- this.create = false;
2674
- this.close = false;
2675
- this.done = false;
2676
- this.closeData = null;
2677
- this.dirty = false;
2678
- this._destroy$ = new rxjs.Subject();
2679
- }
2680
- FsFormDialogActionsComponent.prototype.ngOnInit = function () {
2681
- var _this = this;
2682
- if (this._form) {
2683
- this._form.ngForm.valueChanges
2684
- .pipe(operators.filter(function () { return (!_this.dirty); }), operators.takeUntil(this._destroy$))
2685
- .subscribe(function () {
2686
- _this.dirty = _this._form.ngForm.dirty;
2687
- _this._cdRef.markForCheck();
2688
- });
2689
- this._form.submitted
2690
- .pipe(operators.delay(50), operators.takeUntil(this._destroy$))
2691
- .subscribe(function () {
2692
- _this.dirty = false;
2693
- _this._cdRef.markForCheck();
2694
- });
2695
- this._form.reseted
2696
- .pipe(operators.takeUntil(this._destroy$))
2697
- .subscribe(function () {
2698
- _this.dirty = false;
2699
- _this._cdRef.markForCheck();
2700
- });
2701
- }
2702
- };
2703
- FsFormDialogActionsComponent.prototype.closeClick = function () {
2704
- var _this = this;
2705
- if (this._form) {
2706
- this._form.triggerConfirm()
2707
- .pipe(operators.filter(function (confirmResult) { return (confirmResult !== exports.ConfirmResult.Review); }), operators.takeUntil(this._destroy$))
2708
- .subscribe(function () {
2709
- _this._dialogRef.close(_this.closeData);
2710
- });
2711
- }
2712
- else {
2713
- this._dialogRef.close(this.closeData);
2714
- }
2715
- };
2716
- FsFormDialogActionsComponent.prototype.ngOnDestroy = function () {
2717
- this._destroy$.next();
2718
- this._destroy$.complete();
2719
- };
2720
- return FsFormDialogActionsComponent;
2721
- }());
2722
- FsFormDialogActionsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogActionsComponent, deps: [{ token: FsFormDirective, optional: true }, { token: i2__namespace$1.MatDialogRef, optional: true }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
2723
- FsFormDialogActionsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsFormDialogActionsComponent, selector: "fs-form-dialog-actions", inputs: { save: "save", create: "create", close: "close", done: "done", closeData: "closeData", name: "name" }, ngImport: i0__namespace, 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 [disabled]=\"close && !dirty && !create\"\n [matDialogClose]=\"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 [matDialogClose]=\"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\"\n [color]=\"dirty ? 'basic' : 'primary'\"\n (click)=\"closeClick()\">\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{float:right}\n"], components: [{ type: i1__namespace$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FsButtonDirective, selector: "[mat-raised-button],[mat-button],[mat-flat-button],[mat-stroked-button]", inputs: ["name", "dirtySubmit", "form"] }, { type: i2__namespace$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }, { type: i4__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
2724
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormDialogActionsComponent, decorators: [{
2725
- type: i0.Component,
2726
- args: [{
2727
- selector: 'fs-form-dialog-actions',
2728
- templateUrl: './form-dialog-actions.component.html',
2729
- styleUrls: ['./form-dialog-actions.component.scss'],
2730
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2731
- }]
2732
- }], ctorParameters: function () {
2733
- return [{ type: FsFormDirective, decorators: [{
2734
- type: i0.Optional
2735
- }] }, { type: i2__namespace$1.MatDialogRef, decorators: [{
2736
- type: i0.Optional
2737
- }] }, { type: i0__namespace.ChangeDetectorRef }];
2738
- }, propDecorators: { save: [{
2739
- type: i0.Input
2740
- }], create: [{
2741
- type: i0.Input
2742
- }], close: [{
2743
- type: i0.Input
2744
- }], done: [{
2745
- type: i0.Input
2746
- }], closeData: [{
2747
- type: i0.Input
2748
- }], name: [{
2749
- type: i0.Input
2750
- }] } });
2751
-
2752
- /**
2753
- * This directive required for cases when we have custom Control like <fs-phone-field> but without any of our validators applied
2754
- *
2755
- * This directive required for automatic validation messages
2756
- */
2757
- var FsFormNoFsValidatorsDirective = /** @class */ (function (_super) {
2758
- __extends(FsFormNoFsValidatorsDirective, _super);
2759
- function FsFormNoFsValidatorsDirective() {
2760
- return _super !== null && _super.apply(this, arguments) || this;
2761
- }
2762
- FsFormNoFsValidatorsDirective.prototype.ngOnChanges = function () {
2763
- this._control.updateValueAndValidity();
2764
- };
2765
- FsFormNoFsValidatorsDirective.prototype._subscribeToStatusChagnes = function () {
2766
- if (!!this._control.validator || !!this._control.asyncValidator) {
2767
- _super.prototype._subscribeToStatusChagnes.call(this);
2768
- }
2769
- };
2770
- return FsFormNoFsValidatorsDirective;
2771
- }(FsControlDirective));
2772
- FsFormNoFsValidatorsDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormNoFsValidatorsDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2773
- FsFormNoFsValidatorsDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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: [
2774
- VALIDATE_MESSAGE_PROVIDER
2775
- ], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
2776
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormNoFsValidatorsDirective, decorators: [{
2777
- type: i0.Directive,
2778
- args: [{
2779
- selector: '[ngModel]' +
2780
- ':not([required])' +
2781
- ':not([fsFormRequired])' +
2782
- ':not([fsFormCompare])' +
2783
- ':not([fsFormDateRange])' +
2784
- ':not([fsFormEmail])' +
2785
- ':not([fsFormEmails])' +
2786
- ':not([fsFormFunction])' +
2787
- ':not([fsFormGreater])' +
2788
- ':not([fsFormInteger])' +
2789
- ':not([fsFormLesser])' +
2790
- ':not([fsFormMax])' +
2791
- ':not([fsFormMaxLength])' +
2792
- ':not([fsFormMin])' +
2793
- ':not([fsFormMinLength])' +
2794
- ':not([fsFormNumeric])' +
2795
- ':not([fsFormPattern])' +
2796
- ':not([fsFormPhone])' +
2797
- ':not([fsFormUrl])' +
2798
- ':not([validate])',
2799
- providers: [
2800
- VALIDATE_MESSAGE_PROVIDER
2801
- ],
2802
- }]
2803
- }] });
2804
-
2805
- var FsSubmitButtonDirective = /** @class */ (function (_super) {
2806
- __extends(FsSubmitButtonDirective, _super);
2807
- function FsSubmitButtonDirective() {
2808
- return _super !== null && _super.apply(this, arguments) || this;
2809
- }
2810
- return FsSubmitButtonDirective;
2811
- }(FsButtonDirective));
2812
- FsSubmitButtonDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsSubmitButtonDirective, deps: null, target: i0__namespace.ɵɵFactoryTarget.Directive });
2813
- FsSubmitButtonDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsSubmitButtonDirective, selector: "dummy-selector", usesInheritance: true, ngImport: i0__namespace });
2814
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsSubmitButtonDirective, decorators: [{
2815
- type: i0.Directive,
2816
- args: [{
2817
- selector: 'dummy-selector',
2818
- }]
2819
- }] });
2820
-
2821
- var FsFormModule = /** @class */ (function () {
2822
- function FsFormModule() {
2823
- }
2824
- FsFormModule.forRoot = function () {
2825
- /**
2826
- * Hack: https://github.com/angular/components/issues/20097
2827
- */
2828
- core.ErrorStateMatcher.prototype.isErrorState = function (control, form) {
2829
- 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);
2830
- };
2831
- return {
2832
- ngModule: FsFormModule,
2833
- };
2834
- };
2835
- return FsFormModule;
2836
- }());
2837
- FsFormModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2838
- FsFormModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormModule, declarations: [FsFormDirective,
2839
- FsControlDirective,
2840
- FsFormRequiredDirective,
2841
- FsFormMinDirective,
2842
- FsFormMaxDirective,
2843
- FsFormMinLengthDirective,
2844
- FsFormMaxLengthDirective,
2845
- FsFormEmailDirective,
2846
- FsFormEmailsDirective,
2847
- FsFormPhoneDirective,
2848
- FsFormCompareDirective,
2849
- FsFormIntegerDirective,
2850
- FsFormNumericDirective,
2851
- FsFormPatternDirective,
2852
- FsFormFunctionDirective,
2853
- FsFormDateRangeDirective,
2854
- FsFormGreaterDirective,
2855
- FsFormLesserDirective,
2856
- FsFormUrlDirective,
2857
- FsFormDialogCloseDirective,
2858
- FsFormValidateDirective,
2859
- FsFormDialogActionsComponent,
2860
- FsFormNoFsValidatorsDirective,
2861
- FsButtonDirective,
2862
- FsSubmitButtonDirective], imports: [i4.CommonModule,
2863
- i1$1.FormsModule,
2864
- i1$2.MatButtonModule,
2865
- i2$1.MatDialogModule], exports: [FsFormDirective,
2866
- FsControlDirective,
2867
- FsFormRequiredDirective,
2868
- FsFormMinDirective,
2869
- FsFormMaxDirective,
2870
- FsFormMinLengthDirective,
2871
- FsFormMaxLengthDirective,
2872
- FsFormEmailDirective,
2873
- FsFormEmailsDirective,
2874
- FsFormPhoneDirective,
2875
- FsFormCompareDirective,
2876
- FsFormIntegerDirective,
2877
- FsFormNumericDirective,
2878
- FsFormPatternDirective,
2879
- FsFormFunctionDirective,
2880
- FsFormDateRangeDirective,
2881
- FsFormGreaterDirective,
2882
- FsFormLesserDirective,
2883
- FsFormUrlDirective,
2884
- FsFormDialogCloseDirective,
2885
- FsFormValidateDirective,
2886
- FsFormDialogActionsComponent,
2887
- FsFormNoFsValidatorsDirective,
2888
- FsButtonDirective,
2889
- FsSubmitButtonDirective] });
2890
- FsFormModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormModule, providers: [
2891
- {
2892
- provide: core.ErrorStateMatcher,
2893
- useClass: core.ShowOnDirtyErrorStateMatcher,
2894
- },
2895
- ], imports: [[
2896
- i4.CommonModule,
2897
- i1$1.FormsModule,
2898
- i1$2.MatButtonModule,
2899
- i2$1.MatDialogModule,
2900
- ]] });
2901
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsFormModule, decorators: [{
2902
- type: i0.NgModule,
2903
- args: [{
2904
- imports: [
2905
- i4.CommonModule,
2906
- i1$1.FormsModule,
2907
- i1$2.MatButtonModule,
2908
- i2$1.MatDialogModule,
2909
- ],
2910
- declarations: [
2911
- FsFormDirective,
2912
- FsControlDirective,
2913
- FsFormRequiredDirective,
2914
- FsFormMinDirective,
2915
- FsFormMaxDirective,
2916
- FsFormMinLengthDirective,
2917
- FsFormMaxLengthDirective,
2918
- FsFormEmailDirective,
2919
- FsFormEmailsDirective,
2920
- FsFormPhoneDirective,
2921
- FsFormCompareDirective,
2922
- FsFormIntegerDirective,
2923
- FsFormNumericDirective,
2924
- FsFormPatternDirective,
2925
- FsFormFunctionDirective,
2926
- FsFormDateRangeDirective,
2927
- FsFormGreaterDirective,
2928
- FsFormLesserDirective,
2929
- FsFormUrlDirective,
2930
- FsFormDialogCloseDirective,
2931
- FsFormValidateDirective,
2932
- FsFormDialogActionsComponent,
2933
- FsFormNoFsValidatorsDirective,
2934
- FsButtonDirective,
2935
- FsSubmitButtonDirective,
2936
- ],
2937
- exports: [
2938
- FsFormDirective,
2939
- FsControlDirective,
2940
- FsFormRequiredDirective,
2941
- FsFormMinDirective,
2942
- FsFormMaxDirective,
2943
- FsFormMinLengthDirective,
2944
- FsFormMaxLengthDirective,
2945
- FsFormEmailDirective,
2946
- FsFormEmailsDirective,
2947
- FsFormPhoneDirective,
2948
- FsFormCompareDirective,
2949
- FsFormIntegerDirective,
2950
- FsFormNumericDirective,
2951
- FsFormPatternDirective,
2952
- FsFormFunctionDirective,
2953
- FsFormDateRangeDirective,
2954
- FsFormGreaterDirective,
2955
- FsFormLesserDirective,
2956
- FsFormUrlDirective,
2957
- FsFormDialogCloseDirective,
2958
- FsFormValidateDirective,
2959
- FsFormDialogActionsComponent,
2960
- FsFormNoFsValidatorsDirective,
2961
- FsButtonDirective,
2962
- FsSubmitButtonDirective,
2963
- ],
2964
- providers: [
2965
- {
2966
- provide: core.ErrorStateMatcher,
2967
- useClass: core.ShowOnDirtyErrorStateMatcher,
2968
- },
2969
- ],
2970
- }]
2971
- }] });
2972
-
2973
- // Modules
2974
-
2975
- /**
2976
- * Generated bundle index. Do not edit.
2977
- */
2978
-
2979
- exports.FormDeactivateGuard = FormDeactivateGuard;
2980
- exports.FsButtonDirective = FsButtonDirective;
2981
- exports.FsControlDirective = FsControlDirective;
2982
- exports.FsForm = FsForm;
2983
- exports.FsFormCompareDirective = FsFormCompareDirective;
2984
- exports.FsFormDateRangeDirective = FsFormDateRangeDirective;
2985
- exports.FsFormDialogActionsComponent = FsFormDialogActionsComponent;
2986
- exports.FsFormDialogCloseDirective = FsFormDialogCloseDirective;
2987
- exports.FsFormDirective = FsFormDirective;
2988
- exports.FsFormEmailDirective = FsFormEmailDirective;
2989
- exports.FsFormEmailsDirective = FsFormEmailsDirective;
2990
- exports.FsFormFunctionDirective = FsFormFunctionDirective;
2991
- exports.FsFormGreaterDirective = FsFormGreaterDirective;
2992
- exports.FsFormIntegerDirective = FsFormIntegerDirective;
2993
- exports.FsFormLesserDirective = FsFormLesserDirective;
2994
- exports.FsFormMaxDirective = FsFormMaxDirective;
2995
- exports.FsFormMaxLengthDirective = FsFormMaxLengthDirective;
2996
- exports.FsFormMinDirective = FsFormMinDirective;
2997
- exports.FsFormMinLengthDirective = FsFormMinLengthDirective;
2998
- exports.FsFormModule = FsFormModule;
2999
- exports.FsFormNoFsValidatorsDirective = FsFormNoFsValidatorsDirective;
3000
- exports.FsFormNumericDirective = FsFormNumericDirective;
3001
- exports.FsFormPatternDirective = FsFormPatternDirective;
3002
- exports.FsFormPhoneDirective = FsFormPhoneDirective;
3003
- exports.FsFormRequiredDirective = FsFormRequiredDirective;
3004
- exports.FsFormUrlDirective = FsFormUrlDirective;
3005
- exports.FsFormValidateDirective = FsFormValidateDirective;
3006
- exports.FsSubmitButtonDirective = FsSubmitButtonDirective;
3007
- exports.FsValidators = FsValidators;
3008
-
3009
- Object.defineProperty(exports, '__esModule', { value: true });
3010
-
3011
- }));
3012
- //# sourceMappingURL=firestitch-form.umd.js.map