@rxap/forms 12.7.0 → 13.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/index.mjs +53 -0
- package/esm2020/lib/control-actions.mjs +77 -0
- package/esm2020/lib/control-value-accessor.mjs +14 -0
- package/esm2020/lib/decorators/control-async-validator.mjs +10 -0
- package/esm2020/lib/decorators/control-change.mjs +10 -0
- package/esm2020/lib/decorators/control-set-value.mjs +11 -0
- package/esm2020/lib/decorators/control-validator.mjs +10 -0
- package/esm2020/lib/decorators/form.mjs +7 -0
- package/esm2020/lib/decorators/metadata-keys.mjs +12 -0
- package/esm2020/lib/decorators/use-form-array.mjs +13 -0
- package/esm2020/lib/decorators/use-form-control.mjs +8 -0
- package/esm2020/lib/decorators/use-form-group.mjs +8 -0
- package/esm2020/lib/directives/form-control-error.directive.mjs +59 -0
- package/esm2020/lib/directives/form-control-mark-dirty.directive.mjs +31 -0
- package/esm2020/lib/directives/form-control-mark-pristine.directive.mjs +31 -0
- package/esm2020/lib/directives/form-control-mark-touched.directive.mjs +24 -0
- package/esm2020/lib/directives/form-control-mark-untouched.directive.mjs +31 -0
- package/esm2020/lib/directives/form-control-name.directive.mjs +64 -0
- package/esm2020/lib/directives/form-group-name.directive.mjs +61 -0
- package/esm2020/lib/directives/form-loaded.directive.mjs +41 -0
- package/esm2020/lib/directives/form-loading-error.directive.mjs +41 -0
- package/esm2020/lib/directives/form-loading.directive.mjs +41 -0
- package/esm2020/lib/directives/form-submit-failed.directive.mjs +41 -0
- package/esm2020/lib/directives/form-submit-invalid.directive.mjs +39 -0
- package/esm2020/lib/directives/form-submit-successful.directive.mjs +39 -0
- package/esm2020/lib/directives/form-submit.directive.mjs +74 -0
- package/esm2020/lib/directives/form-submitting.directive.mjs +41 -0
- package/esm2020/lib/directives/form.directive.mjs +541 -0
- package/esm2020/lib/directives/forms.module.mjs +100 -0
- package/esm2020/lib/directives/models.mjs +12 -0
- package/esm2020/lib/directives/parent-control-container.directive.mjs +25 -0
- package/esm2020/lib/directives/tokens.mjs +10 -0
- package/esm2020/lib/form-array.mjs +216 -0
- package/esm2020/lib/form-builder.mjs +374 -0
- package/esm2020/lib/form-control.mjs +169 -0
- package/esm2020/lib/form-group.mjs +181 -0
- package/esm2020/lib/model.mjs +2 -0
- package/esm2020/lib/tokens.mjs +4 -0
- package/esm2020/lib/types.mjs +2 -0
- package/esm2020/lib/validators/index.mjs +29 -0
- package/esm2020/lib/validators/is-array.mjs +18 -0
- package/esm2020/lib/validators/is-boolean.mjs +18 -0
- package/esm2020/lib/validators/is-complex.mjs +87 -0
- package/esm2020/lib/validators/is-date.mjs +18 -0
- package/esm2020/lib/validators/is-email.mjs +19 -0
- package/esm2020/lib/validators/is-enum.mjs +18 -0
- package/esm2020/lib/validators/is-int.mjs +19 -0
- package/esm2020/lib/validators/is-ip.mjs +19 -0
- package/esm2020/lib/validators/is-number.mjs +56 -0
- package/esm2020/lib/validators/is-object.mjs +18 -0
- package/esm2020/lib/validators/is-phone-number.mjs +19 -0
- package/esm2020/lib/validators/is-string.mjs +18 -0
- package/esm2020/lib/validators/is-url.mjs +19 -0
- package/esm2020/rxap-forms.mjs +5 -0
- package/fesm2015/rxap-forms.mjs +2713 -0
- package/fesm2015/rxap-forms.mjs.map +1 -0
- package/{fesm2015/rxap-forms.js → fesm2020/rxap-forms.mjs} +176 -144
- package/fesm2020/rxap-forms.mjs.map +1 -0
- package/lib/directives/form.directive.d.ts +2 -2
- package/package.json +35 -21
- package/src/schematics/ng-add/index.js +1 -1
- package/src/schematics/ng-add/index.js.map +1 -1
- package/bundles/rxap-forms.umd.js +0 -3473
- package/bundles/rxap-forms.umd.js.map +0 -1
- package/esm2015/index.js +0 -53
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/control-actions.js +0 -80
- package/esm2015/lib/control-actions.js.map +0 -1
- package/esm2015/lib/control-value-accessor.js +0 -14
- package/esm2015/lib/control-value-accessor.js.map +0 -1
- package/esm2015/lib/decorators/control-async-validator.js +0 -10
- package/esm2015/lib/decorators/control-async-validator.js.map +0 -1
- package/esm2015/lib/decorators/control-change.js +0 -10
- package/esm2015/lib/decorators/control-change.js.map +0 -1
- package/esm2015/lib/decorators/control-set-value.js +0 -8
- package/esm2015/lib/decorators/control-set-value.js.map +0 -1
- package/esm2015/lib/decorators/control-validator.js +0 -10
- package/esm2015/lib/decorators/control-validator.js.map +0 -1
- package/esm2015/lib/decorators/form.js +0 -7
- package/esm2015/lib/decorators/form.js.map +0 -1
- package/esm2015/lib/decorators/metadata-keys.js +0 -12
- package/esm2015/lib/decorators/metadata-keys.js.map +0 -1
- package/esm2015/lib/decorators/use-form-array.js +0 -13
- package/esm2015/lib/decorators/use-form-array.js.map +0 -1
- package/esm2015/lib/decorators/use-form-control.js +0 -8
- package/esm2015/lib/decorators/use-form-control.js.map +0 -1
- package/esm2015/lib/decorators/use-form-group.js +0 -8
- package/esm2015/lib/decorators/use-form-group.js.map +0 -1
- package/esm2015/lib/directives/form-control-error.directive.js +0 -61
- package/esm2015/lib/directives/form-control-error.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-dirty.directive.js +0 -31
- package/esm2015/lib/directives/form-control-mark-dirty.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-pristine.directive.js +0 -31
- package/esm2015/lib/directives/form-control-mark-pristine.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-touched.directive.js +0 -25
- package/esm2015/lib/directives/form-control-mark-touched.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-untouched.directive.js +0 -31
- package/esm2015/lib/directives/form-control-mark-untouched.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-name.directive.js +0 -64
- package/esm2015/lib/directives/form-control-name.directive.js.map +0 -1
- package/esm2015/lib/directives/form-group-name.directive.js +0 -61
- package/esm2015/lib/directives/form-group-name.directive.js.map +0 -1
- package/esm2015/lib/directives/form-loaded.directive.js +0 -42
- package/esm2015/lib/directives/form-loaded.directive.js.map +0 -1
- package/esm2015/lib/directives/form-loading-error.directive.js +0 -42
- package/esm2015/lib/directives/form-loading-error.directive.js.map +0 -1
- package/esm2015/lib/directives/form-loading.directive.js +0 -42
- package/esm2015/lib/directives/form-loading.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit-failed.directive.js +0 -42
- package/esm2015/lib/directives/form-submit-failed.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit-invalid.directive.js +0 -40
- package/esm2015/lib/directives/form-submit-invalid.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit-successful.directive.js +0 -40
- package/esm2015/lib/directives/form-submit-successful.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit.directive.js +0 -75
- package/esm2015/lib/directives/form-submit.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submitting.directive.js +0 -42
- package/esm2015/lib/directives/form-submitting.directive.js.map +0 -1
- package/esm2015/lib/directives/form.directive.js +0 -518
- package/esm2015/lib/directives/form.directive.js.map +0 -1
- package/esm2015/lib/directives/forms.module.js +0 -100
- package/esm2015/lib/directives/forms.module.js.map +0 -1
- package/esm2015/lib/directives/models.js +0 -12
- package/esm2015/lib/directives/models.js.map +0 -1
- package/esm2015/lib/directives/parent-control-container.directive.js +0 -25
- package/esm2015/lib/directives/parent-control-container.directive.js.map +0 -1
- package/esm2015/lib/directives/tokens.js +0 -10
- package/esm2015/lib/directives/tokens.js.map +0 -1
- package/esm2015/lib/form-array.js +0 -217
- package/esm2015/lib/form-array.js.map +0 -1
- package/esm2015/lib/form-builder.js +0 -349
- package/esm2015/lib/form-builder.js.map +0 -1
- package/esm2015/lib/form-control.js +0 -170
- package/esm2015/lib/form-control.js.map +0 -1
- package/esm2015/lib/form-group.js +0 -183
- package/esm2015/lib/form-group.js.map +0 -1
- package/esm2015/lib/model.js +0 -2
- package/esm2015/lib/model.js.map +0 -1
- package/esm2015/lib/tokens.js +0 -4
- package/esm2015/lib/tokens.js.map +0 -1
- package/esm2015/lib/types.js +0 -2
- package/esm2015/lib/types.js.map +0 -1
- package/esm2015/lib/validators/index.js +0 -29
- package/esm2015/lib/validators/index.js.map +0 -1
- package/esm2015/lib/validators/is-array.js +0 -18
- package/esm2015/lib/validators/is-array.js.map +0 -1
- package/esm2015/lib/validators/is-boolean.js +0 -18
- package/esm2015/lib/validators/is-boolean.js.map +0 -1
- package/esm2015/lib/validators/is-complex.js +0 -87
- package/esm2015/lib/validators/is-complex.js.map +0 -1
- package/esm2015/lib/validators/is-date.js +0 -18
- package/esm2015/lib/validators/is-date.js.map +0 -1
- package/esm2015/lib/validators/is-email.js +0 -19
- package/esm2015/lib/validators/is-email.js.map +0 -1
- package/esm2015/lib/validators/is-enum.js +0 -18
- package/esm2015/lib/validators/is-enum.js.map +0 -1
- package/esm2015/lib/validators/is-int.js +0 -19
- package/esm2015/lib/validators/is-int.js.map +0 -1
- package/esm2015/lib/validators/is-ip.js +0 -19
- package/esm2015/lib/validators/is-ip.js.map +0 -1
- package/esm2015/lib/validators/is-number.js +0 -57
- package/esm2015/lib/validators/is-number.js.map +0 -1
- package/esm2015/lib/validators/is-object.js +0 -18
- package/esm2015/lib/validators/is-object.js.map +0 -1
- package/esm2015/lib/validators/is-phone-number.js +0 -19
- package/esm2015/lib/validators/is-phone-number.js.map +0 -1
- package/esm2015/lib/validators/is-string.js +0 -18
- package/esm2015/lib/validators/is-string.js.map +0 -1
- package/esm2015/lib/validators/is-url.js +0 -19
- package/esm2015/lib/validators/is-url.js.map +0 -1
- package/esm2015/rxap-forms.js +0 -5
- package/esm2015/rxap-forms.js.map +0 -1
- package/fesm2015/rxap-forms.js.map +0 -1
|
@@ -1,3473 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/forms'), require('rxjs/operators'), require('rxjs'), require('@rxap/utilities'), require('@angular/core'), require('@rxap/definition'), require('@rxap/utilities/reflect-metadata'), require('@rxap/services'), require('@rxap/utilities/rxjs'), require('@angular/router'), require('@rxap/directives'), require('@rxap/validator')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@rxap/forms', ['exports', '@angular/forms', 'rxjs/operators', 'rxjs', '@rxap/utilities', '@angular/core', '@rxap/definition', '@rxap/utilities/reflect-metadata', '@rxap/services', '@rxap/utilities/rxjs', '@angular/router', '@rxap/directives', '@rxap/validator'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap.forms = {}), global.ng.forms, global.rxjs.operators, global.rxjs, global.utilities, global.ng.core, global.definition, global.reflectMetadata, global.i2, global.rxjs$1, global.ng.router, global.directives, global.validator));
|
|
5
|
-
}(this, (function (exports, i1, operators, rxjs, utilities, i0, definition, reflectMetadata, i2, rxjs$1, i2$1, directives, validator) { '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 () {
|
|
17
|
-
return e[k];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n['default'] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
28
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
29
|
-
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
30
|
-
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
|
31
|
-
|
|
32
|
-
/*! *****************************************************************************
|
|
33
|
-
Copyright (c) Microsoft Corporation.
|
|
34
|
-
|
|
35
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
36
|
-
purpose with or without fee is hereby granted.
|
|
37
|
-
|
|
38
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
39
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
40
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
41
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
42
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
43
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
44
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
45
|
-
***************************************************************************** */
|
|
46
|
-
/* global Reflect, Promise */
|
|
47
|
-
var extendStatics = function (d, b) {
|
|
48
|
-
extendStatics = Object.setPrototypeOf ||
|
|
49
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
50
|
-
function (d, b) { for (var p in b)
|
|
51
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
52
|
-
d[p] = b[p]; };
|
|
53
|
-
return extendStatics(d, b);
|
|
54
|
-
};
|
|
55
|
-
function __extends(d, b) {
|
|
56
|
-
if (typeof b !== "function" && b !== null)
|
|
57
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
58
|
-
extendStatics(d, b);
|
|
59
|
-
function __() { this.constructor = d; }
|
|
60
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
61
|
-
}
|
|
62
|
-
var __assign = function () {
|
|
63
|
-
__assign = Object.assign || function __assign(t) {
|
|
64
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
65
|
-
s = arguments[i];
|
|
66
|
-
for (var p in s)
|
|
67
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
68
|
-
t[p] = s[p];
|
|
69
|
-
}
|
|
70
|
-
return t;
|
|
71
|
-
};
|
|
72
|
-
return __assign.apply(this, arguments);
|
|
73
|
-
};
|
|
74
|
-
function __rest(s, e) {
|
|
75
|
-
var t = {};
|
|
76
|
-
for (var p in s)
|
|
77
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
78
|
-
t[p] = s[p];
|
|
79
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
80
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
81
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
82
|
-
t[p[i]] = s[p[i]];
|
|
83
|
-
}
|
|
84
|
-
return t;
|
|
85
|
-
}
|
|
86
|
-
function __decorate(decorators, target, key, desc) {
|
|
87
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
88
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
89
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
90
|
-
else
|
|
91
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
92
|
-
if (d = decorators[i])
|
|
93
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
94
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
95
|
-
}
|
|
96
|
-
function __param(paramIndex, decorator) {
|
|
97
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
98
|
-
}
|
|
99
|
-
function __metadata(metadataKey, metadataValue) {
|
|
100
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
101
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
102
|
-
}
|
|
103
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
104
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
105
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
106
|
-
function fulfilled(value) { try {
|
|
107
|
-
step(generator.next(value));
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
reject(e);
|
|
111
|
-
} }
|
|
112
|
-
function rejected(value) { try {
|
|
113
|
-
step(generator["throw"](value));
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
116
|
-
reject(e);
|
|
117
|
-
} }
|
|
118
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
119
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
function __generator(thisArg, body) {
|
|
123
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
124
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
125
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
126
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
127
|
-
function step(op) {
|
|
128
|
-
if (f)
|
|
129
|
-
throw new TypeError("Generator is already executing.");
|
|
130
|
-
while (_)
|
|
131
|
-
try {
|
|
132
|
-
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)
|
|
133
|
-
return t;
|
|
134
|
-
if (y = 0, t)
|
|
135
|
-
op = [op[0] & 2, t.value];
|
|
136
|
-
switch (op[0]) {
|
|
137
|
-
case 0:
|
|
138
|
-
case 1:
|
|
139
|
-
t = op;
|
|
140
|
-
break;
|
|
141
|
-
case 4:
|
|
142
|
-
_.label++;
|
|
143
|
-
return { value: op[1], done: false };
|
|
144
|
-
case 5:
|
|
145
|
-
_.label++;
|
|
146
|
-
y = op[1];
|
|
147
|
-
op = [0];
|
|
148
|
-
continue;
|
|
149
|
-
case 7:
|
|
150
|
-
op = _.ops.pop();
|
|
151
|
-
_.trys.pop();
|
|
152
|
-
continue;
|
|
153
|
-
default:
|
|
154
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
155
|
-
_ = 0;
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
159
|
-
_.label = op[1];
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
163
|
-
_.label = t[1];
|
|
164
|
-
t = op;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
if (t && _.label < t[2]) {
|
|
168
|
-
_.label = t[2];
|
|
169
|
-
_.ops.push(op);
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
if (t[2])
|
|
173
|
-
_.ops.pop();
|
|
174
|
-
_.trys.pop();
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
op = body.call(thisArg, _);
|
|
178
|
-
}
|
|
179
|
-
catch (e) {
|
|
180
|
-
op = [6, e];
|
|
181
|
-
y = 0;
|
|
182
|
-
}
|
|
183
|
-
finally {
|
|
184
|
-
f = t = 0;
|
|
185
|
-
}
|
|
186
|
-
if (op[0] & 5)
|
|
187
|
-
throw op[1];
|
|
188
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
192
|
-
if (k2 === undefined)
|
|
193
|
-
k2 = k;
|
|
194
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
195
|
-
}) : (function (o, m, k, k2) {
|
|
196
|
-
if (k2 === undefined)
|
|
197
|
-
k2 = k;
|
|
198
|
-
o[k2] = m[k];
|
|
199
|
-
});
|
|
200
|
-
function __exportStar(m, o) {
|
|
201
|
-
for (var p in m)
|
|
202
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
203
|
-
__createBinding(o, m, p);
|
|
204
|
-
}
|
|
205
|
-
function __values(o) {
|
|
206
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
207
|
-
if (m)
|
|
208
|
-
return m.call(o);
|
|
209
|
-
if (o && typeof o.length === "number")
|
|
210
|
-
return {
|
|
211
|
-
next: function () {
|
|
212
|
-
if (o && i >= o.length)
|
|
213
|
-
o = void 0;
|
|
214
|
-
return { value: o && o[i++], done: !o };
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
218
|
-
}
|
|
219
|
-
function __read(o, n) {
|
|
220
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
221
|
-
if (!m)
|
|
222
|
-
return o;
|
|
223
|
-
var i = m.call(o), r, ar = [], e;
|
|
224
|
-
try {
|
|
225
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
226
|
-
ar.push(r.value);
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
e = { error: error };
|
|
230
|
-
}
|
|
231
|
-
finally {
|
|
232
|
-
try {
|
|
233
|
-
if (r && !r.done && (m = i["return"]))
|
|
234
|
-
m.call(i);
|
|
235
|
-
}
|
|
236
|
-
finally {
|
|
237
|
-
if (e)
|
|
238
|
-
throw e.error;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return ar;
|
|
242
|
-
}
|
|
243
|
-
/** @deprecated */
|
|
244
|
-
function __spread() {
|
|
245
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
246
|
-
ar = ar.concat(__read(arguments[i]));
|
|
247
|
-
return ar;
|
|
248
|
-
}
|
|
249
|
-
/** @deprecated */
|
|
250
|
-
function __spreadArrays() {
|
|
251
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
252
|
-
s += arguments[i].length;
|
|
253
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
254
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
255
|
-
r[k] = a[j];
|
|
256
|
-
return r;
|
|
257
|
-
}
|
|
258
|
-
function __spreadArray(to, from) {
|
|
259
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
260
|
-
to[j] = from[i];
|
|
261
|
-
return to;
|
|
262
|
-
}
|
|
263
|
-
function __await(v) {
|
|
264
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
265
|
-
}
|
|
266
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
267
|
-
if (!Symbol.asyncIterator)
|
|
268
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
269
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
270
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
271
|
-
function verb(n) { if (g[n])
|
|
272
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
273
|
-
function resume(n, v) { try {
|
|
274
|
-
step(g[n](v));
|
|
275
|
-
}
|
|
276
|
-
catch (e) {
|
|
277
|
-
settle(q[0][3], e);
|
|
278
|
-
} }
|
|
279
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
280
|
-
function fulfill(value) { resume("next", value); }
|
|
281
|
-
function reject(value) { resume("throw", value); }
|
|
282
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
283
|
-
resume(q[0][0], q[0][1]); }
|
|
284
|
-
}
|
|
285
|
-
function __asyncDelegator(o) {
|
|
286
|
-
var i, p;
|
|
287
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
288
|
-
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; }
|
|
289
|
-
}
|
|
290
|
-
function __asyncValues(o) {
|
|
291
|
-
if (!Symbol.asyncIterator)
|
|
292
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
293
|
-
var m = o[Symbol.asyncIterator], i;
|
|
294
|
-
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);
|
|
295
|
-
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); }); }; }
|
|
296
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
297
|
-
}
|
|
298
|
-
function __makeTemplateObject(cooked, raw) {
|
|
299
|
-
if (Object.defineProperty) {
|
|
300
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
cooked.raw = raw;
|
|
304
|
-
}
|
|
305
|
-
return cooked;
|
|
306
|
-
}
|
|
307
|
-
;
|
|
308
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
309
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
310
|
-
}) : function (o, v) {
|
|
311
|
-
o["default"] = v;
|
|
312
|
-
};
|
|
313
|
-
function __importStar(mod) {
|
|
314
|
-
if (mod && mod.__esModule)
|
|
315
|
-
return mod;
|
|
316
|
-
var result = {};
|
|
317
|
-
if (mod != null)
|
|
318
|
-
for (var k in mod)
|
|
319
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
320
|
-
__createBinding(result, mod, k);
|
|
321
|
-
__setModuleDefault(result, mod);
|
|
322
|
-
return result;
|
|
323
|
-
}
|
|
324
|
-
function __importDefault(mod) {
|
|
325
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
326
|
-
}
|
|
327
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
328
|
-
if (kind === "a" && !f)
|
|
329
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
330
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
331
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
332
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
333
|
-
}
|
|
334
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
335
|
-
if (kind === "m")
|
|
336
|
-
throw new TypeError("Private method is not writable");
|
|
337
|
-
if (kind === "a" && !f)
|
|
338
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
339
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
340
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
341
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function getControlValue(control) {
|
|
345
|
-
if (control.getRawValue) {
|
|
346
|
-
return control.getRawValue();
|
|
347
|
-
}
|
|
348
|
-
return control.value;
|
|
349
|
-
}
|
|
350
|
-
function controlValueChanges$(control) {
|
|
351
|
-
return rxjs.merge(rxjs.defer(function () { return rxjs.of(getControlValue(control)); }), control.valueChanges.pipe(operators.map(function () { return getControlValue(control); })));
|
|
352
|
-
}
|
|
353
|
-
function controlDisabled$(control) {
|
|
354
|
-
var _a;
|
|
355
|
-
return rxjs.merge(rxjs.defer(function () { return rxjs.of(control.disabled); }), rxjs.merge(control.statusChanges, (_a = control.stateChanges) !== null && _a !== void 0 ? _a : rxjs.EMPTY).pipe(operators.map(function () { return control.disabled; }), operators.distinctUntilChanged()));
|
|
356
|
-
}
|
|
357
|
-
function controlEnabled$(control) {
|
|
358
|
-
var _a;
|
|
359
|
-
return rxjs.merge(rxjs.defer(function () { return rxjs.of(control.enabled); }), rxjs.merge(control.statusChanges, (_a = control.stateChanges) !== null && _a !== void 0 ? _a : rxjs.EMPTY).pipe(operators.map(function () { return control.enabled; }), operators.distinctUntilChanged()));
|
|
360
|
-
}
|
|
361
|
-
function controlReadonly$(control) {
|
|
362
|
-
var _a;
|
|
363
|
-
return rxjs.merge(rxjs.defer(function () { var _a; return rxjs.of((_a = control.readonly) !== null && _a !== void 0 ? _a : false); }), rxjs.merge(control.statusChanges, (_a = control.stateChanges) !== null && _a !== void 0 ? _a : rxjs.EMPTY).pipe(operators.map(function () { var _a; return (_a = control.readonly) !== null && _a !== void 0 ? _a : false; }), operators.distinctUntilChanged()));
|
|
364
|
-
}
|
|
365
|
-
function controlStatusChanges$(control) {
|
|
366
|
-
return rxjs.merge(rxjs.defer(function () { return rxjs.of(control.status); }), control.statusChanges.pipe(operators.map(function () { return control.status; }), operators.distinctUntilChanged()));
|
|
367
|
-
}
|
|
368
|
-
function controlErrorChanges$(control) {
|
|
369
|
-
return rxjs.merge(rxjs.defer(function () { return rxjs.of(control.errors); }), control.valueChanges.pipe(operators.map(function () { return control.errors; })), control.statusChanges.pipe(operators.map(function () { return control.errors; }))).pipe(operators.distinctUntilChanged(function (a, b) { return utilities.equals(a, b); }));
|
|
370
|
-
}
|
|
371
|
-
function enableControl(control, enabled, opts) {
|
|
372
|
-
if (enabled) {
|
|
373
|
-
control.enable(opts);
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
control.disable(opts);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
function disableControl(control, disabled, opts) {
|
|
380
|
-
enableControl(control, !disabled, opts);
|
|
381
|
-
}
|
|
382
|
-
function controlDisabledWhile(control, observable, opts) {
|
|
383
|
-
return observable.subscribe(function (isDisabled) { return disableControl(control, isDisabled, opts); });
|
|
384
|
-
}
|
|
385
|
-
function controlEnabledWhile(control, observable, opts) {
|
|
386
|
-
return observable.subscribe(function (isEnabled) { return enableControl(control, isEnabled, opts); });
|
|
387
|
-
}
|
|
388
|
-
function mergeControlValidators(control, validators) {
|
|
389
|
-
control.setValidators(__spreadArray(__spreadArray([], __read(utilities.coerceArray(control.validator))), __read(utilities.coerceArray(validators))));
|
|
390
|
-
control.updateValueAndValidity();
|
|
391
|
-
}
|
|
392
|
-
function validateControlOn(control, validation) {
|
|
393
|
-
return validation.subscribe(function (maybeError) {
|
|
394
|
-
control.setErrors(maybeError);
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
function hasErrorAndTouched(control, error, path) {
|
|
398
|
-
var hasError = control.hasError(error, !path || path.length === 0 ? undefined : path);
|
|
399
|
-
return hasError && control.touched;
|
|
400
|
-
}
|
|
401
|
-
function hasErrorAndDirty(control, error, path) {
|
|
402
|
-
var hasError = control.hasError(error, !path || path.length === 0 ? undefined : path);
|
|
403
|
-
return hasError && control.dirty;
|
|
404
|
-
}
|
|
405
|
-
function markAllDirty(control) {
|
|
406
|
-
control.markAsDirty({ onlySelf: true });
|
|
407
|
-
control._forEachChild(function (_control) { return _control.markAllAsDirty(); });
|
|
408
|
-
}
|
|
409
|
-
function markAllPristine(control) {
|
|
410
|
-
control.markAsPristine({ onlySelf: true });
|
|
411
|
-
control._forEachChild(function (_control) { return _control.markAllAsPristine(); });
|
|
412
|
-
}
|
|
413
|
-
function markAllUntouched(control) {
|
|
414
|
-
control.markAsUntouched({ onlySelf: true });
|
|
415
|
-
control._forEachChild(function (_control) { return _control.markAllAsUntouched(); });
|
|
416
|
-
}
|
|
417
|
-
function selectControlValue$(control, mapFn) {
|
|
418
|
-
return control.value$.pipe(operators.map(mapFn), operators.distinctUntilChanged());
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
var RxapFormArray = /** @class */ (function (_super) {
|
|
422
|
-
__extends(RxapFormArray, _super);
|
|
423
|
-
function RxapFormArray(controls, options) {
|
|
424
|
-
var _this = _super.call(this, controls, options) || this;
|
|
425
|
-
_this.controls = controls;
|
|
426
|
-
_this._readonly = false;
|
|
427
|
-
_this.value$ = controlValueChanges$(_this);
|
|
428
|
-
_this.disabled$ = controlDisabled$(_this);
|
|
429
|
-
_this.enabled$ = controlEnabled$(_this);
|
|
430
|
-
_this.status$ = controlStatusChanges$(_this);
|
|
431
|
-
_this.errors$ = controlErrorChanges$(_this);
|
|
432
|
-
_this.touchChanges = new rxjs.Subject();
|
|
433
|
-
_this.touch$ = _this.touchChanges
|
|
434
|
-
.asObservable()
|
|
435
|
-
.pipe(operators.distinctUntilChanged());
|
|
436
|
-
_this.dirtyChanges = new rxjs.Subject();
|
|
437
|
-
_this.dirty$ = _this.dirtyChanges
|
|
438
|
-
.asObservable()
|
|
439
|
-
.pipe(operators.distinctUntilChanged());
|
|
440
|
-
_this.controlId = options.controlId;
|
|
441
|
-
_this._builder = options.builder;
|
|
442
|
-
_this._controlInsertedFn = options.controlInsertedFn;
|
|
443
|
-
_this._controlRemovedFn = options.controlRemovedFn;
|
|
444
|
-
return _this;
|
|
445
|
-
}
|
|
446
|
-
Object.defineProperty(RxapFormArray.prototype, "readonly", {
|
|
447
|
-
get: function () {
|
|
448
|
-
var _a, _b;
|
|
449
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.readonly) !== null && _b !== void 0 ? _b : this._readonly;
|
|
450
|
-
},
|
|
451
|
-
set: function (value) {
|
|
452
|
-
this._readonly = value;
|
|
453
|
-
this.controls.forEach(function (control) { var _a; return (_a = control.stateChanges) === null || _a === void 0 ? void 0 : _a.next(); });
|
|
454
|
-
},
|
|
455
|
-
enumerable: false,
|
|
456
|
-
configurable: true
|
|
457
|
-
});
|
|
458
|
-
Object.defineProperty(RxapFormArray.prototype, "rxapFormDefinition", {
|
|
459
|
-
/**
|
|
460
|
-
* @internal
|
|
461
|
-
*/
|
|
462
|
-
get: function () {
|
|
463
|
-
return this.parent.rxapFormDefinition;
|
|
464
|
-
},
|
|
465
|
-
enumerable: false,
|
|
466
|
-
configurable: true
|
|
467
|
-
});
|
|
468
|
-
Object.defineProperty(RxapFormArray.prototype, "controlPath", {
|
|
469
|
-
get: function () {
|
|
470
|
-
var parent = this.parent;
|
|
471
|
-
if (parent) {
|
|
472
|
-
if (parent.controlPath) {
|
|
473
|
-
if (parent === this.root) {
|
|
474
|
-
return this.controlId;
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
return [parent.controlPath, this.controlId].join('.');
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return this.controlId;
|
|
482
|
-
},
|
|
483
|
-
enumerable: false,
|
|
484
|
-
configurable: true
|
|
485
|
-
});
|
|
486
|
-
Object.defineProperty(RxapFormArray.prototype, "fullControlPath", {
|
|
487
|
-
get: function () {
|
|
488
|
-
var parent = this.parent;
|
|
489
|
-
if (parent) {
|
|
490
|
-
if (parent.fullControlPath) {
|
|
491
|
-
return [parent.fullControlPath, this.controlId].join('.');
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return this.controlId;
|
|
495
|
-
},
|
|
496
|
-
enumerable: false,
|
|
497
|
-
configurable: true
|
|
498
|
-
});
|
|
499
|
-
RxapFormArray.prototype.select = function (mapFn) {
|
|
500
|
-
return this.value$.pipe(operators.map(mapFn), operators.distinctUntilChanged());
|
|
501
|
-
};
|
|
502
|
-
RxapFormArray.prototype.at = function (index) {
|
|
503
|
-
return _super.prototype.at.call(this, index);
|
|
504
|
-
};
|
|
505
|
-
RxapFormArray.prototype.getRawValue = function () {
|
|
506
|
-
return _super.prototype.getRawValue.call(this);
|
|
507
|
-
};
|
|
508
|
-
RxapFormArray.prototype.insert = function (index, control) {
|
|
509
|
-
console.warn('It is not recommend to use the FormArray.insert method');
|
|
510
|
-
return _super.prototype.insert.call(this, index, control);
|
|
511
|
-
};
|
|
512
|
-
/**
|
|
513
|
-
* inserts a new control at the specified index. If the index is undefined
|
|
514
|
-
* the new control will be added to the end.
|
|
515
|
-
*
|
|
516
|
-
* @param index (optional) the index where the control should be created
|
|
517
|
-
* @param state (optional) the initial state of the new control
|
|
518
|
-
*/
|
|
519
|
-
RxapFormArray.prototype.insertAt = function (index, state) {
|
|
520
|
-
var insertIndex = index !== null && index !== void 0 ? index : this.controls.length;
|
|
521
|
-
var controlOrDefinition = this._builder(state, {
|
|
522
|
-
controlId: insertIndex.toFixed(0),
|
|
523
|
-
});
|
|
524
|
-
this._controlInsertedFn(insertIndex, controlOrDefinition);
|
|
525
|
-
if (insertIndex < this.controls.length) {
|
|
526
|
-
// update the control ids for all controls, that are moved.
|
|
527
|
-
for (var i = insertIndex; i < this.controls.length; i++) {
|
|
528
|
-
Reflect.set(this.controls[i], 'controlId', (i + 1).toFixed(0));
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
// call the super insert after the update, bc the insert method will
|
|
532
|
-
// trigger a change detection
|
|
533
|
-
if (controlOrDefinition instanceof i1.AbstractControl) {
|
|
534
|
-
_super.prototype.insert.call(this, insertIndex, controlOrDefinition);
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
_super.prototype.insert.call(this, insertIndex, controlOrDefinition.rxapFormGroup);
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
RxapFormArray.prototype.disabledWhile = function (observable, options) {
|
|
541
|
-
return controlDisabledWhile(this, observable, options);
|
|
542
|
-
};
|
|
543
|
-
RxapFormArray.prototype.enabledWhile = function (observable, options) {
|
|
544
|
-
return controlEnabledWhile(this, observable, options);
|
|
545
|
-
};
|
|
546
|
-
RxapFormArray.prototype.mergeValidators = function (validators) {
|
|
547
|
-
mergeControlValidators(this, validators);
|
|
548
|
-
};
|
|
549
|
-
RxapFormArray.prototype.mergeAsyncValidators = function (validators) {
|
|
550
|
-
this.setAsyncValidators(__spreadArray(__spreadArray([], __read(utilities.coerceArray(this.asyncValidator))), __read(utilities.coerceArray(validators))));
|
|
551
|
-
this.updateValueAndValidity();
|
|
552
|
-
};
|
|
553
|
-
RxapFormArray.prototype.markAllAsDirty = function () {
|
|
554
|
-
markAllDirty(this);
|
|
555
|
-
};
|
|
556
|
-
RxapFormArray.prototype.markAllAsPristine = function () {
|
|
557
|
-
markAllPristine(this);
|
|
558
|
-
};
|
|
559
|
-
RxapFormArray.prototype.setValue = function (valueOrObservable, options) {
|
|
560
|
-
var _this = this;
|
|
561
|
-
if (rxjs.isObservable(valueOrObservable)) {
|
|
562
|
-
return valueOrObservable.subscribe(function (value) { return _super.prototype.setValue.call(_this, value, options); });
|
|
563
|
-
}
|
|
564
|
-
_super.prototype.setValue.call(this, valueOrObservable, options);
|
|
565
|
-
};
|
|
566
|
-
RxapFormArray.prototype.markAllAsUntouched = function () {
|
|
567
|
-
markAllUntouched(this);
|
|
568
|
-
};
|
|
569
|
-
RxapFormArray.prototype.validateOn = function (observableValidation) {
|
|
570
|
-
var _this = this;
|
|
571
|
-
return observableValidation.subscribe(function (maybeError) {
|
|
572
|
-
_this.setErrors(maybeError);
|
|
573
|
-
});
|
|
574
|
-
};
|
|
575
|
-
RxapFormArray.prototype.hasErrorAndTouched = function (errorCode, path) {
|
|
576
|
-
return hasErrorAndTouched(this, errorCode, path);
|
|
577
|
-
};
|
|
578
|
-
RxapFormArray.prototype.patchValue = function (valueOrObservable, options) {
|
|
579
|
-
var _this = this;
|
|
580
|
-
if (rxjs.isObservable(valueOrObservable)) {
|
|
581
|
-
return valueOrObservable.subscribe(function (value) {
|
|
582
|
-
_super.prototype.patchValue.call(_this, value, options);
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
_super.prototype.patchValue.call(this, valueOrObservable, options);
|
|
586
|
-
};
|
|
587
|
-
RxapFormArray.prototype.hasErrorAndDirty = function (errorCode, path) {
|
|
588
|
-
return hasErrorAndDirty(this, errorCode, path);
|
|
589
|
-
};
|
|
590
|
-
RxapFormArray.prototype.removeAt = function (index) {
|
|
591
|
-
console.warn('It is not recommend to use the FormArray.removeAt method');
|
|
592
|
-
_super.prototype.removeAt.call(this, index);
|
|
593
|
-
this._controlRemovedFn(index);
|
|
594
|
-
};
|
|
595
|
-
RxapFormArray.prototype.setEnable = function (enable, opts) {
|
|
596
|
-
if (enable === void 0) { enable = true; }
|
|
597
|
-
enableControl(this, enable, opts);
|
|
598
|
-
};
|
|
599
|
-
RxapFormArray.prototype.push = function (control) {
|
|
600
|
-
console.warn('It is not recommend to use the FormArray.push method');
|
|
601
|
-
return _super.prototype.push.call(this, control);
|
|
602
|
-
};
|
|
603
|
-
RxapFormArray.prototype.setDisable = function (disable, opts) {
|
|
604
|
-
if (disable === void 0) { disable = true; }
|
|
605
|
-
disableControl(this, disable, opts);
|
|
606
|
-
};
|
|
607
|
-
RxapFormArray.prototype.setControl = function (index, control) {
|
|
608
|
-
console.warn('It is not recommend to use the FormArray.setControl method');
|
|
609
|
-
return _super.prototype.setControl.call(this, index, control);
|
|
610
|
-
};
|
|
611
|
-
RxapFormArray.prototype.markAsTouched = function (opts) {
|
|
612
|
-
_super.prototype.markAsTouched.call(this, opts);
|
|
613
|
-
this.touchChanges.next(true);
|
|
614
|
-
};
|
|
615
|
-
RxapFormArray.prototype.markAsUntouched = function (opts) {
|
|
616
|
-
_super.prototype.markAsUntouched.call(this, opts);
|
|
617
|
-
this.touchChanges.next(false);
|
|
618
|
-
};
|
|
619
|
-
RxapFormArray.prototype.markAsPristine = function (opts) {
|
|
620
|
-
_super.prototype.markAsPristine.call(this, opts);
|
|
621
|
-
this.dirtyChanges.next(false);
|
|
622
|
-
};
|
|
623
|
-
RxapFormArray.prototype.markAsDirty = function (opts) {
|
|
624
|
-
_super.prototype.markAsDirty.call(this, opts);
|
|
625
|
-
this.dirtyChanges.next(true);
|
|
626
|
-
};
|
|
627
|
-
RxapFormArray.prototype.reset = function (value, options) {
|
|
628
|
-
_super.prototype.reset.call(this, value, options);
|
|
629
|
-
};
|
|
630
|
-
RxapFormArray.prototype.setValidators = function (newValidator, updateValueAndValidity) {
|
|
631
|
-
if (updateValueAndValidity === void 0) { updateValueAndValidity = true; }
|
|
632
|
-
_super.prototype.setValidators.call(this, newValidator);
|
|
633
|
-
if (updateValueAndValidity) {
|
|
634
|
-
_super.prototype.updateValueAndValidity.call(this);
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
RxapFormArray.prototype.setAsyncValidators = function (newValidator, updateValueAndValidity) {
|
|
638
|
-
if (updateValueAndValidity === void 0) { updateValueAndValidity = true; }
|
|
639
|
-
_super.prototype.setAsyncValidators.call(this, newValidator);
|
|
640
|
-
if (updateValueAndValidity) {
|
|
641
|
-
_super.prototype.updateValueAndValidity.call(this);
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
RxapFormArray.prototype.hasError = function (errorCode, path) {
|
|
645
|
-
return _super.prototype.hasError.call(this, errorCode, path);
|
|
646
|
-
};
|
|
647
|
-
RxapFormArray.prototype.setErrors = function (errors, opts) {
|
|
648
|
-
if (opts === void 0) { opts = {}; }
|
|
649
|
-
return _super.prototype.setErrors.call(this, errors, opts);
|
|
650
|
-
};
|
|
651
|
-
RxapFormArray.prototype.getError = function (errorCode, path) {
|
|
652
|
-
return _super.prototype.getError.call(this, errorCode, path);
|
|
653
|
-
};
|
|
654
|
-
return RxapFormArray;
|
|
655
|
-
}(i1.FormArray));
|
|
656
|
-
|
|
657
|
-
var MetadataKeys;
|
|
658
|
-
(function (MetadataKeys) {
|
|
659
|
-
MetadataKeys["CONTROL_VALIDATORS"] = "rxap/forms/control-validators";
|
|
660
|
-
MetadataKeys["CONTROL_ASYNC_VALIDATORS"] = "rxap/forms/control-async-validators";
|
|
661
|
-
MetadataKeys["CONTROL_CHANGES"] = "rxap/forms/control-changes";
|
|
662
|
-
MetadataKeys["CONTROL_SET_VALUE"] = "rxap/forms/control-set-value";
|
|
663
|
-
MetadataKeys["FORM_ARRAY_GROUPS"] = "rxap/forms/form-array-groups";
|
|
664
|
-
MetadataKeys["FORM_ARRAY_CONTROLS"] = "rxap/forms/form-array-controls";
|
|
665
|
-
MetadataKeys["FORM_GROUPS"] = "rxap/forms/form-groups";
|
|
666
|
-
MetadataKeys["FORM_CONTROLS"] = "rxap/forms/form-controls";
|
|
667
|
-
})(MetadataKeys || (MetadataKeys = {}));
|
|
668
|
-
|
|
669
|
-
var RxapFormGroup = /** @class */ (function (_super) {
|
|
670
|
-
__extends(RxapFormGroup, _super);
|
|
671
|
-
function RxapFormGroup(controls, options) {
|
|
672
|
-
var _this = _super.call(this, controls, options) || this;
|
|
673
|
-
_this.controls = controls;
|
|
674
|
-
_this._readonly = false;
|
|
675
|
-
_this.touchChanges = new rxjs.Subject();
|
|
676
|
-
_this.dirtyChanges = new rxjs.Subject();
|
|
677
|
-
_this.touch$ = _this.touchChanges.asObservable().pipe(operators.distinctUntilChanged());
|
|
678
|
-
_this.dirty$ = _this.dirtyChanges.asObservable().pipe(operators.distinctUntilChanged());
|
|
679
|
-
_this.value$ = controlValueChanges$(_this);
|
|
680
|
-
_this.disabled$ = controlDisabled$(_this);
|
|
681
|
-
_this.enabled$ = controlEnabled$(_this);
|
|
682
|
-
_this.status$ = controlStatusChanges$(_this);
|
|
683
|
-
_this.errors$ = controlErrorChanges$(_this);
|
|
684
|
-
_this.controlId = options.controlId;
|
|
685
|
-
return _this;
|
|
686
|
-
}
|
|
687
|
-
Object.defineProperty(RxapFormGroup.prototype, "rxapFormDefinition", {
|
|
688
|
-
/**
|
|
689
|
-
* @internal
|
|
690
|
-
*/
|
|
691
|
-
get: function () {
|
|
692
|
-
if (!this.parent) {
|
|
693
|
-
return this._rxapFormDefinition;
|
|
694
|
-
}
|
|
695
|
-
if (this._rxapFormDefinition) {
|
|
696
|
-
return this._rxapFormDefinition;
|
|
697
|
-
}
|
|
698
|
-
return this.parent.rxapFormDefinition;
|
|
699
|
-
},
|
|
700
|
-
enumerable: false,
|
|
701
|
-
configurable: true
|
|
702
|
-
});
|
|
703
|
-
Object.defineProperty(RxapFormGroup.prototype, "readonly", {
|
|
704
|
-
get: function () {
|
|
705
|
-
var _a, _b;
|
|
706
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.readonly) !== null && _b !== void 0 ? _b : this._readonly;
|
|
707
|
-
},
|
|
708
|
-
set: function (value) {
|
|
709
|
-
var _a;
|
|
710
|
-
this._readonly = value;
|
|
711
|
-
Object.values((_a = this.controls) !== null && _a !== void 0 ? _a : {}).forEach(function (control) { var _a; return (_a = control.stateChanges) === null || _a === void 0 ? void 0 : _a.next(); });
|
|
712
|
-
},
|
|
713
|
-
enumerable: false,
|
|
714
|
-
configurable: true
|
|
715
|
-
});
|
|
716
|
-
Object.defineProperty(RxapFormGroup.prototype, "controlPath", {
|
|
717
|
-
get: function () {
|
|
718
|
-
var parent = this.parent;
|
|
719
|
-
if (parent) {
|
|
720
|
-
if (parent.controlPath) {
|
|
721
|
-
if (parent === this.root) {
|
|
722
|
-
return this.controlId;
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
return [parent.controlPath, this.controlId].join('.');
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
return '';
|
|
730
|
-
},
|
|
731
|
-
enumerable: false,
|
|
732
|
-
configurable: true
|
|
733
|
-
});
|
|
734
|
-
Object.defineProperty(RxapFormGroup.prototype, "fullControlPath", {
|
|
735
|
-
get: function () {
|
|
736
|
-
var parent = this.parent;
|
|
737
|
-
if (parent) {
|
|
738
|
-
if (parent.fullControlPath) {
|
|
739
|
-
return [parent.fullControlPath, this.controlId].join('.');
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
return this.controlId;
|
|
743
|
-
},
|
|
744
|
-
enumerable: false,
|
|
745
|
-
configurable: true
|
|
746
|
-
});
|
|
747
|
-
RxapFormGroup.prototype.select = function (mapFn) {
|
|
748
|
-
return selectControlValue$(this, mapFn);
|
|
749
|
-
};
|
|
750
|
-
RxapFormGroup.prototype.getRawValue = function () {
|
|
751
|
-
return _super.prototype.getRawValue.call(this);
|
|
752
|
-
};
|
|
753
|
-
RxapFormGroup.prototype.get = function (path) {
|
|
754
|
-
return _super.prototype.get.call(this, path);
|
|
755
|
-
};
|
|
756
|
-
RxapFormGroup.prototype.getControl = function () {
|
|
757
|
-
var names = [];
|
|
758
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
759
|
-
names[_i] = arguments[_i];
|
|
760
|
-
}
|
|
761
|
-
return this.get(names.join('.'));
|
|
762
|
-
};
|
|
763
|
-
RxapFormGroup.prototype.addControl = function (name, control) {
|
|
764
|
-
_super.prototype.addControl.call(this, name, control);
|
|
765
|
-
};
|
|
766
|
-
RxapFormGroup.prototype.removeControl = function (name) {
|
|
767
|
-
_super.prototype.removeControl.call(this, name);
|
|
768
|
-
};
|
|
769
|
-
RxapFormGroup.prototype.contains = function (controlName) {
|
|
770
|
-
return _super.prototype.contains.call(this, controlName);
|
|
771
|
-
};
|
|
772
|
-
RxapFormGroup.prototype.setControl = function (name, control) {
|
|
773
|
-
_super.prototype.setControl.call(this, name, control);
|
|
774
|
-
};
|
|
775
|
-
RxapFormGroup.prototype.setValue = function (valueOrObservable, options) {
|
|
776
|
-
var _this = this;
|
|
777
|
-
if (rxjs.isObservable(valueOrObservable)) {
|
|
778
|
-
return valueOrObservable.subscribe(function (value) { return _super.prototype.setValue.call(_this, value, options); });
|
|
779
|
-
}
|
|
780
|
-
_super.prototype.setValue.call(this, valueOrObservable, options);
|
|
781
|
-
};
|
|
782
|
-
RxapFormGroup.prototype.patchValue = function (valueOrObservable, options) {
|
|
783
|
-
var _this = this;
|
|
784
|
-
if (rxjs.isObservable(valueOrObservable)) {
|
|
785
|
-
return valueOrObservable.subscribe(function (value) { return _super.prototype.patchValue.call(_this, value, options); });
|
|
786
|
-
}
|
|
787
|
-
_super.prototype.patchValue.call(this, valueOrObservable, options);
|
|
788
|
-
};
|
|
789
|
-
RxapFormGroup.prototype.disabledWhile = function (observable, options) {
|
|
790
|
-
return controlDisabledWhile(this, observable, options);
|
|
791
|
-
};
|
|
792
|
-
RxapFormGroup.prototype.enabledWhile = function (observable, options) {
|
|
793
|
-
return controlEnabledWhile(this, observable, options);
|
|
794
|
-
};
|
|
795
|
-
RxapFormGroup.prototype.mergeValidators = function (validators) {
|
|
796
|
-
mergeControlValidators(this, validators);
|
|
797
|
-
};
|
|
798
|
-
RxapFormGroup.prototype.mergeAsyncValidators = function (validators) {
|
|
799
|
-
this.setAsyncValidators(__spreadArray(__spreadArray([], __read(utilities.coerceArray(this.asyncValidator))), __read(utilities.coerceArray(validators))));
|
|
800
|
-
this.updateValueAndValidity();
|
|
801
|
-
};
|
|
802
|
-
RxapFormGroup.prototype.markAsTouched = function (opts) {
|
|
803
|
-
_super.prototype.markAsTouched.call(this, opts);
|
|
804
|
-
this.touchChanges.next(true);
|
|
805
|
-
};
|
|
806
|
-
RxapFormGroup.prototype.markAsUntouched = function (opts) {
|
|
807
|
-
_super.prototype.markAsUntouched.call(this, opts);
|
|
808
|
-
this.touchChanges.next(false);
|
|
809
|
-
};
|
|
810
|
-
RxapFormGroup.prototype.markAsPristine = function (opts) {
|
|
811
|
-
_super.prototype.markAsPristine.call(this, opts);
|
|
812
|
-
this.dirtyChanges.next(false);
|
|
813
|
-
};
|
|
814
|
-
RxapFormGroup.prototype.markAsDirty = function (opts) {
|
|
815
|
-
_super.prototype.markAsDirty.call(this, opts);
|
|
816
|
-
this.dirtyChanges.next(true);
|
|
817
|
-
};
|
|
818
|
-
RxapFormGroup.prototype.markAllAsDirty = function () {
|
|
819
|
-
markAllDirty(this);
|
|
820
|
-
};
|
|
821
|
-
RxapFormGroup.prototype.markAllAsPristine = function () {
|
|
822
|
-
markAllPristine(this);
|
|
823
|
-
};
|
|
824
|
-
RxapFormGroup.prototype.markAllAsUntouched = function () {
|
|
825
|
-
markAllUntouched(this);
|
|
826
|
-
};
|
|
827
|
-
RxapFormGroup.prototype.reset = function (formState, options) {
|
|
828
|
-
_super.prototype.reset.call(this, formState, options);
|
|
829
|
-
};
|
|
830
|
-
RxapFormGroup.prototype.setValidators = function (newValidator, updateValueAndValidity) {
|
|
831
|
-
if (updateValueAndValidity === void 0) { updateValueAndValidity = true; }
|
|
832
|
-
_super.prototype.setValidators.call(this, newValidator);
|
|
833
|
-
if (updateValueAndValidity) {
|
|
834
|
-
_super.prototype.updateValueAndValidity.call(this);
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
RxapFormGroup.prototype.setAsyncValidators = function (newValidator, updateValueAndValidity) {
|
|
838
|
-
if (updateValueAndValidity === void 0) { updateValueAndValidity = true; }
|
|
839
|
-
_super.prototype.setAsyncValidators.call(this, newValidator);
|
|
840
|
-
if (updateValueAndValidity) {
|
|
841
|
-
_super.prototype.updateValueAndValidity.call(this);
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
RxapFormGroup.prototype.validateOn = function (observableValidation) {
|
|
845
|
-
return validateControlOn(this, observableValidation);
|
|
846
|
-
};
|
|
847
|
-
RxapFormGroup.prototype.hasError = function (errorCode, path) {
|
|
848
|
-
return _super.prototype.hasError.call(this, errorCode, path);
|
|
849
|
-
};
|
|
850
|
-
RxapFormGroup.prototype.setErrors = function (errors, opts) {
|
|
851
|
-
if (opts === void 0) { opts = {}; }
|
|
852
|
-
return _super.prototype.setErrors.call(this, errors, opts);
|
|
853
|
-
};
|
|
854
|
-
RxapFormGroup.prototype.getError = function (errorCode, path) {
|
|
855
|
-
return _super.prototype.getError.call(this, errorCode, path);
|
|
856
|
-
};
|
|
857
|
-
RxapFormGroup.prototype.hasErrorAndTouched = function (error) {
|
|
858
|
-
var path = [];
|
|
859
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
860
|
-
path[_i - 1] = arguments[_i];
|
|
861
|
-
}
|
|
862
|
-
return hasErrorAndTouched.apply(void 0, __spreadArray([this, error], __read(path)));
|
|
863
|
-
};
|
|
864
|
-
RxapFormGroup.prototype.hasErrorAndDirty = function (error) {
|
|
865
|
-
var path = [];
|
|
866
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
867
|
-
path[_i - 1] = arguments[_i];
|
|
868
|
-
}
|
|
869
|
-
return hasErrorAndDirty.apply(void 0, __spreadArray([this, error], __read(path)));
|
|
870
|
-
};
|
|
871
|
-
RxapFormGroup.prototype.setEnable = function (enable, opts) {
|
|
872
|
-
if (enable === void 0) { enable = true; }
|
|
873
|
-
enableControl(this, enable, opts);
|
|
874
|
-
};
|
|
875
|
-
RxapFormGroup.prototype.setDisable = function (disable, opts) {
|
|
876
|
-
if (disable === void 0) { disable = true; }
|
|
877
|
-
disableControl(this, disable, opts);
|
|
878
|
-
};
|
|
879
|
-
return RxapFormGroup;
|
|
880
|
-
}(i1.FormGroup));
|
|
881
|
-
|
|
882
|
-
var RxapFormControl = /** @class */ (function (_super) {
|
|
883
|
-
__extends(RxapFormControl, _super);
|
|
884
|
-
function RxapFormControl(formState, options) {
|
|
885
|
-
var _this = _super.call(this, formState, options) || this;
|
|
886
|
-
_this._readonly = false;
|
|
887
|
-
_this.touchChanges = new rxjs.Subject();
|
|
888
|
-
_this.dirtyChanges = new rxjs.Subject();
|
|
889
|
-
_this.touch$ = _this.touchChanges
|
|
890
|
-
.asObservable()
|
|
891
|
-
.pipe(operators.distinctUntilChanged());
|
|
892
|
-
_this.dirty$ = _this.dirtyChanges
|
|
893
|
-
.asObservable()
|
|
894
|
-
.pipe(operators.distinctUntilChanged());
|
|
895
|
-
_this.value$ = controlValueChanges$(_this);
|
|
896
|
-
_this.disabled$ = controlDisabled$(_this);
|
|
897
|
-
_this.enabled$ = controlEnabled$(_this);
|
|
898
|
-
_this.status$ = controlStatusChanges$(_this);
|
|
899
|
-
_this.errors$ = controlErrorChanges$(_this);
|
|
900
|
-
_this._onSetValue = [];
|
|
901
|
-
_this.stateChanges = new rxjs.Subject();
|
|
902
|
-
_this.readonly$ = controlReadonly$(_this);
|
|
903
|
-
_this.controlId = options.controlId;
|
|
904
|
-
_this.initialState = formState;
|
|
905
|
-
return _this;
|
|
906
|
-
}
|
|
907
|
-
Object.defineProperty(RxapFormControl.prototype, "rxapFormDefinition", {
|
|
908
|
-
/**
|
|
909
|
-
* @internal
|
|
910
|
-
*/
|
|
911
|
-
get: function () {
|
|
912
|
-
return this.parent.rxapFormDefinition;
|
|
913
|
-
},
|
|
914
|
-
enumerable: false,
|
|
915
|
-
configurable: true
|
|
916
|
-
});
|
|
917
|
-
Object.defineProperty(RxapFormControl.prototype, "readonly", {
|
|
918
|
-
get: function () {
|
|
919
|
-
var _a, _b;
|
|
920
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.readonly) !== null && _b !== void 0 ? _b : this._readonly;
|
|
921
|
-
},
|
|
922
|
-
set: function (value) {
|
|
923
|
-
this._readonly = value;
|
|
924
|
-
this.stateChanges.next();
|
|
925
|
-
},
|
|
926
|
-
enumerable: false,
|
|
927
|
-
configurable: true
|
|
928
|
-
});
|
|
929
|
-
Object.defineProperty(RxapFormControl.prototype, "controlPath", {
|
|
930
|
-
get: function () {
|
|
931
|
-
var parent = this.parent;
|
|
932
|
-
if (parent) {
|
|
933
|
-
if (parent.controlPath) {
|
|
934
|
-
if (parent === this.root) {
|
|
935
|
-
return this.controlId;
|
|
936
|
-
}
|
|
937
|
-
else {
|
|
938
|
-
return [parent.controlPath, this.controlId].join('.');
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
return this.controlId;
|
|
943
|
-
},
|
|
944
|
-
enumerable: false,
|
|
945
|
-
configurable: true
|
|
946
|
-
});
|
|
947
|
-
Object.defineProperty(RxapFormControl.prototype, "fullControlPath", {
|
|
948
|
-
get: function () {
|
|
949
|
-
var parent = this.parent;
|
|
950
|
-
if (parent) {
|
|
951
|
-
if (parent.fullControlPath) {
|
|
952
|
-
return [parent.fullControlPath, this.controlId].join('.');
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
return this.controlId;
|
|
956
|
-
},
|
|
957
|
-
enumerable: false,
|
|
958
|
-
configurable: true
|
|
959
|
-
});
|
|
960
|
-
RxapFormControl.prototype.setValue = function (valueOrObservable, options) {
|
|
961
|
-
var _this = this;
|
|
962
|
-
if (rxjs.isObservable(valueOrObservable)) {
|
|
963
|
-
return valueOrObservable.subscribe(function (value) {
|
|
964
|
-
_super.prototype.setValue.call(_this, value, options);
|
|
965
|
-
_this._onSetValue.forEach(function (setValueFn) { return setValueFn(value, options); });
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
_super.prototype.setValue.call(this, valueOrObservable, options);
|
|
969
|
-
this._onSetValue.forEach(function (setValueFn) { return setValueFn(valueOrObservable, options); });
|
|
970
|
-
};
|
|
971
|
-
RxapFormControl.prototype.patchValue = function (valueOrObservable, options) {
|
|
972
|
-
var _this = this;
|
|
973
|
-
if (rxjs.isObservable(valueOrObservable)) {
|
|
974
|
-
return valueOrObservable.subscribe(function (value) { return _super.prototype.patchValue.call(_this, value, options); });
|
|
975
|
-
}
|
|
976
|
-
_super.prototype.patchValue.call(this, valueOrObservable, options);
|
|
977
|
-
};
|
|
978
|
-
RxapFormControl.prototype.disabledWhile = function (observable, options) {
|
|
979
|
-
return controlDisabledWhile(this, observable, options);
|
|
980
|
-
};
|
|
981
|
-
RxapFormControl.prototype.enabledWhile = function (observable, options) {
|
|
982
|
-
return controlEnabledWhile(this, observable, options);
|
|
983
|
-
};
|
|
984
|
-
RxapFormControl.prototype.mergeValidators = function (validators) {
|
|
985
|
-
mergeControlValidators(this, validators);
|
|
986
|
-
};
|
|
987
|
-
RxapFormControl.prototype.mergeAsyncValidators = function (validators) {
|
|
988
|
-
this.setAsyncValidators(__spreadArray([
|
|
989
|
-
// TODO : remove 'as any' if solution for the type overwrite issue is found (above)
|
|
990
|
-
this.asyncValidator
|
|
991
|
-
], __read(utilities.coerceArray(validators))));
|
|
992
|
-
this.updateValueAndValidity();
|
|
993
|
-
};
|
|
994
|
-
RxapFormControl.prototype.markAsTouched = function (opts) {
|
|
995
|
-
_super.prototype.markAsTouched.call(this, opts);
|
|
996
|
-
this.touchChanges.next(true);
|
|
997
|
-
};
|
|
998
|
-
RxapFormControl.prototype.markAsUntouched = function (opts) {
|
|
999
|
-
_super.prototype.markAsUntouched.call(this, opts);
|
|
1000
|
-
this.touchChanges.next(false);
|
|
1001
|
-
};
|
|
1002
|
-
RxapFormControl.prototype.markAsPristine = function (opts) {
|
|
1003
|
-
_super.prototype.markAsPristine.call(this, opts);
|
|
1004
|
-
this.dirtyChanges.next(false);
|
|
1005
|
-
};
|
|
1006
|
-
RxapFormControl.prototype.markAsDirty = function (opts) {
|
|
1007
|
-
_super.prototype.markAsDirty.call(this, opts);
|
|
1008
|
-
this.dirtyChanges.next(true);
|
|
1009
|
-
};
|
|
1010
|
-
RxapFormControl.prototype.markAllAsDirty = function () {
|
|
1011
|
-
this.markAsDirty({ onlySelf: true });
|
|
1012
|
-
};
|
|
1013
|
-
RxapFormControl.prototype.reset = function (formState, options) {
|
|
1014
|
-
var newState = formState !== null && formState !== void 0 ? formState : this.initialState;
|
|
1015
|
-
if (typeof newState === 'function') {
|
|
1016
|
-
_super.prototype.reset.call(this, newState(), options);
|
|
1017
|
-
}
|
|
1018
|
-
else {
|
|
1019
|
-
_super.prototype.reset.call(this, newState, options);
|
|
1020
|
-
}
|
|
1021
|
-
};
|
|
1022
|
-
RxapFormControl.prototype.setValidators = function (newValidator, updateValueAndValidity) {
|
|
1023
|
-
if (updateValueAndValidity === void 0) { updateValueAndValidity = true; }
|
|
1024
|
-
_super.prototype.setValidators.call(this, newValidator);
|
|
1025
|
-
if (updateValueAndValidity) {
|
|
1026
|
-
_super.prototype.updateValueAndValidity.call(this);
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
RxapFormControl.prototype.setAsyncValidators = function (newValidator, updateValueAndValidity) {
|
|
1030
|
-
if (updateValueAndValidity === void 0) { updateValueAndValidity = true; }
|
|
1031
|
-
_super.prototype.setAsyncValidators.call(this, newValidator);
|
|
1032
|
-
if (updateValueAndValidity) {
|
|
1033
|
-
_super.prototype.updateValueAndValidity.call(this);
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
RxapFormControl.prototype.validateOn = function (observableValidation) {
|
|
1037
|
-
return validateControlOn(this, observableValidation);
|
|
1038
|
-
};
|
|
1039
|
-
RxapFormControl.prototype.getError = function (errorCode) {
|
|
1040
|
-
return _super.prototype.getError.call(this, errorCode);
|
|
1041
|
-
};
|
|
1042
|
-
RxapFormControl.prototype.hasError = function (errorCode) {
|
|
1043
|
-
return _super.prototype.hasError.call(this, errorCode);
|
|
1044
|
-
};
|
|
1045
|
-
RxapFormControl.prototype.setErrors = function (errors, opts) {
|
|
1046
|
-
if (opts === void 0) { opts = {}; }
|
|
1047
|
-
return _super.prototype.setErrors.call(this, errors, opts);
|
|
1048
|
-
};
|
|
1049
|
-
RxapFormControl.prototype.setError = function (key, value, opts) {
|
|
1050
|
-
var _c;
|
|
1051
|
-
if (opts === void 0) { opts = {}; }
|
|
1052
|
-
_super.prototype.setErrors.call(this, (_c = {}, _c[key] = value, _c), opts);
|
|
1053
|
-
};
|
|
1054
|
-
RxapFormControl.prototype.hasErrorAndTouched = function (error) {
|
|
1055
|
-
return hasErrorAndTouched(this, error);
|
|
1056
|
-
};
|
|
1057
|
-
RxapFormControl.prototype.hasErrorAndDirty = function (error) {
|
|
1058
|
-
return hasErrorAndDirty(this, error);
|
|
1059
|
-
};
|
|
1060
|
-
RxapFormControl.prototype.setEnable = function (enable, opts) {
|
|
1061
|
-
if (enable === void 0) { enable = true; }
|
|
1062
|
-
enableControl(this, enable, opts);
|
|
1063
|
-
};
|
|
1064
|
-
RxapFormControl.prototype.setDisable = function (disable, opts) {
|
|
1065
|
-
if (disable === void 0) { disable = true; }
|
|
1066
|
-
disableControl(this, disable, opts);
|
|
1067
|
-
};
|
|
1068
|
-
RxapFormControl.prototype.registerOnSetValue = function (setValueFn) {
|
|
1069
|
-
this._onSetValue.push(setValueFn);
|
|
1070
|
-
};
|
|
1071
|
-
return RxapFormControl;
|
|
1072
|
-
}(i1.FormControl));
|
|
1073
|
-
|
|
1074
|
-
var FormArrayControlManager = /** @class */ (function () {
|
|
1075
|
-
function FormArrayControlManager(form, controlId) {
|
|
1076
|
-
this.form = form;
|
|
1077
|
-
this.controlId = controlId;
|
|
1078
|
-
}
|
|
1079
|
-
FormArrayControlManager.prototype.inserted = function (index, controlOrDefinition) {
|
|
1080
|
-
var controlContainer = this.form[this.controlId];
|
|
1081
|
-
if (Array.isArray(controlContainer)) {
|
|
1082
|
-
controlContainer.splice(index, 0, controlOrDefinition);
|
|
1083
|
-
}
|
|
1084
|
-
else {
|
|
1085
|
-
throw new Error('Could not register inserted control or definition. The control id does not points to an array of control or definition instance!');
|
|
1086
|
-
}
|
|
1087
|
-
};
|
|
1088
|
-
FormArrayControlManager.prototype.removed = function (index) {
|
|
1089
|
-
var controlContainer = this.form[this.controlId];
|
|
1090
|
-
if (Array.isArray(controlContainer)) {
|
|
1091
|
-
controlContainer.splice(index, 1);
|
|
1092
|
-
}
|
|
1093
|
-
else {
|
|
1094
|
-
throw new Error('Could not register inserted control or definition. The control id does not points to an array of control or definition instance!');
|
|
1095
|
-
}
|
|
1096
|
-
};
|
|
1097
|
-
return FormArrayControlManager;
|
|
1098
|
-
}());
|
|
1099
|
-
var RxapFormBuilder = /** @class */ (function () {
|
|
1100
|
-
function RxapFormBuilder(definition, injector, providers) {
|
|
1101
|
-
if (injector === void 0) { injector = i0.Injector.NULL; }
|
|
1102
|
-
if (providers === void 0) { providers = []; }
|
|
1103
|
-
var _a;
|
|
1104
|
-
this.definition = definition;
|
|
1105
|
-
this.injector = injector;
|
|
1106
|
-
this.formArrayGroups = this.extractArrayGroups();
|
|
1107
|
-
this.formArrayControls = this.extractArrayControls();
|
|
1108
|
-
this.formControls = this.extractControls();
|
|
1109
|
-
this.formGroups = this.extractGroups();
|
|
1110
|
-
this.validators = this.extractValidators();
|
|
1111
|
-
this.asyncValidators = this.extractAsyncValidators();
|
|
1112
|
-
this.controlChanges = this.extractControlChanges();
|
|
1113
|
-
this.controlSetValue = this.extractControlSetValue();
|
|
1114
|
-
var formOptions = (this.formOptions = this.extractFormOptions());
|
|
1115
|
-
// merge the providers from the from options with the providers from the
|
|
1116
|
-
// constructor. If the provider is defined in the form options and constructor
|
|
1117
|
-
// then the provider from the constructor will be used.
|
|
1118
|
-
this.providers = __spreadArray(__spreadArray([], __read(providers)), __read(((_a = formOptions.providers) !== null && _a !== void 0 ? _a : []))).filter(function (provider, index, self) { return provider.hasOwnProperty('provide') &&
|
|
1119
|
-
self.findIndex(function (selfProvider) { return selfProvider.hasOwnProperty('provide') &&
|
|
1120
|
-
selfProvider.provide === provider.provide; }) === index; });
|
|
1121
|
-
}
|
|
1122
|
-
RxapFormBuilder.prototype.build = function (state, options) {
|
|
1123
|
-
var e_1, _c, e_2, _d;
|
|
1124
|
-
if (state === void 0) { state = {}; }
|
|
1125
|
-
if (options === void 0) { options = {}; }
|
|
1126
|
-
var _a, _b;
|
|
1127
|
-
var injector = i0.Injector.create({
|
|
1128
|
-
name: "rxap/form-builder/" + this.formOptions.id,
|
|
1129
|
-
parent: this.injector,
|
|
1130
|
-
providers: this.providers
|
|
1131
|
-
});
|
|
1132
|
-
var form;
|
|
1133
|
-
// don't use the notFoundValue feature of the injector.
|
|
1134
|
-
// if used for each call of the get method an "empty" or "fallback"
|
|
1135
|
-
// instance is created
|
|
1136
|
-
try {
|
|
1137
|
-
form = injector.get(this.definition);
|
|
1138
|
-
}
|
|
1139
|
-
catch (e) {
|
|
1140
|
-
if (i0.isDevMode()) {
|
|
1141
|
-
console.error("Could not inject the definition instance. Fallback and call the constructor of the definition class: " + e.message);
|
|
1142
|
-
}
|
|
1143
|
-
form = new this.definition();
|
|
1144
|
-
}
|
|
1145
|
-
var controls = {};
|
|
1146
|
-
this.buildControls(state, form, controls);
|
|
1147
|
-
this.buildGroups(state, form, controls);
|
|
1148
|
-
this.buildArrayGroups(state, form, controls);
|
|
1149
|
-
this.buildArrayControls(state, form, controls);
|
|
1150
|
-
var formOptions = Object.assign(Object.assign(Object.assign({}, this.formOptions), { controlId: (_a = options.controlId) !== null && _a !== void 0 ? _a : (options.id ? options.id : this.formOptions.id) }), options);
|
|
1151
|
-
form.rxapFormGroup = new RxapFormGroup(controls, formOptions);
|
|
1152
|
-
Reflect.set(form.rxapFormGroup, '_rxapFormDefinition', form);
|
|
1153
|
-
form.rxapMetadata = this.formOptions;
|
|
1154
|
-
if (utilities.HasRxapOnInitMethod(form)) {
|
|
1155
|
-
form.rxapOnInit();
|
|
1156
|
-
}
|
|
1157
|
-
try {
|
|
1158
|
-
for (var _e = __values(Object.values(form.rxapFormGroup.controls)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1159
|
-
var control = _f.value;
|
|
1160
|
-
if (control.controlId) {
|
|
1161
|
-
var controlSetValueOnInit = Array.from((_b = this.controlSetValue.get(control.controlId)) !== null && _b !== void 0 ? _b : []).filter(function (controlSetValueOptions) { return controlSetValueOptions.initial; });
|
|
1162
|
-
try {
|
|
1163
|
-
for (var _g = (e_2 = void 0, __values(this.coerceToFnArray(form, controlSetValueOnInit))), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1164
|
-
var onSetValue = _h.value;
|
|
1165
|
-
onSetValue(control.value, { initial: true });
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1169
|
-
finally {
|
|
1170
|
-
try {
|
|
1171
|
-
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1172
|
-
}
|
|
1173
|
-
finally { if (e_2) throw e_2.error; }
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1179
|
-
finally {
|
|
1180
|
-
try {
|
|
1181
|
-
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
1182
|
-
}
|
|
1183
|
-
finally { if (e_1) throw e_1.error; }
|
|
1184
|
-
}
|
|
1185
|
-
return form;
|
|
1186
|
-
};
|
|
1187
|
-
RxapFormBuilder.prototype.buildArrayControls = function (builderFormState, form, controls) {
|
|
1188
|
-
var e_3, _c;
|
|
1189
|
-
try {
|
|
1190
|
-
for (var _d = __values(this.formArrayControls.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1191
|
-
var _f = __read(_e.value, 2), controlId = _f[0], options = _f[1];
|
|
1192
|
-
var formState = this.coerceToArrayFormState(controlId, [], builderFormState, options.state);
|
|
1193
|
-
utilities.assertIsArray(formState);
|
|
1194
|
-
var formControls = formState.map(function (fs, index) { return new RxapFormControl(fs, { controlId: index.toFixed(0) }); });
|
|
1195
|
-
var manager = new FormArrayControlManager(form, controlId);
|
|
1196
|
-
var formArray = (formControls.rxapFormArray =
|
|
1197
|
-
controls[controlId] =
|
|
1198
|
-
new RxapFormArray(
|
|
1199
|
-
// TODO : add the formControlOptions property. To definition the form control options
|
|
1200
|
-
formControls, Object.assign(Object.assign({}, options), { controlId: controlId, validators: [], asyncValidators: [], controlInsertedFn: manager.inserted.bind(manager), controlRemovedFn: manager.removed.bind(manager), builder: function (state, controlOptions) { return new RxapFormControl(state, controlOptions); } })));
|
|
1201
|
-
// TODO : add support for injectable validators
|
|
1202
|
-
formArray.setValidators(this.coerceToValidatorArray(form, options.validators, this.validators.get(controlId)), false);
|
|
1203
|
-
formArray.setAsyncValidators(this.coerceToValidatorArray(form, options.asyncValidators, this.asyncValidators.get(controlId)), false);
|
|
1204
|
-
Reflect.set(form, controlId, formControls);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1208
|
-
finally {
|
|
1209
|
-
try {
|
|
1210
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1211
|
-
}
|
|
1212
|
-
finally { if (e_3) throw e_3.error; }
|
|
1213
|
-
}
|
|
1214
|
-
};
|
|
1215
|
-
RxapFormBuilder.prototype.buildArrayGroups = function (builderFormState, form, controls) {
|
|
1216
|
-
var e_4, _c;
|
|
1217
|
-
var _loop_1 = function (controlId, options) {
|
|
1218
|
-
var formState = this_1.coerceToArrayFormState(controlId, [], builderFormState, options.state);
|
|
1219
|
-
utilities.assertIsArray(formState);
|
|
1220
|
-
var formGroupBuilder = new RxapFormBuilder(options.definition, this_1.injector, this_1.providers);
|
|
1221
|
-
// TODO : add the formGroupOptions property. To definition of the form group options
|
|
1222
|
-
var formGroupDefinitions = formState.map(function (fs, index) { return formGroupBuilder.build(fs, { id: index.toFixed(0) }); });
|
|
1223
|
-
var manager = new FormArrayControlManager(form, controlId);
|
|
1224
|
-
var formArray = (formGroupDefinitions.rxapFormArray =
|
|
1225
|
-
controls[controlId] =
|
|
1226
|
-
new RxapFormArray(formGroupDefinitions.map(function (fgd) { return fgd.rxapFormGroup; }), Object.assign(Object.assign({}, options), { builder: formGroupBuilder.build.bind(formGroupBuilder), controlId: controlId, validators: [], asyncValidators: [], controlInsertedFn: manager.inserted.bind(manager), controlRemovedFn: manager.removed.bind(manager) })));
|
|
1227
|
-
// TODO : add support for injectable validators
|
|
1228
|
-
formArray.setValidators(this_1.coerceToValidatorArray(form, options.validators, this_1.validators.get(controlId)), false);
|
|
1229
|
-
formArray.setAsyncValidators(this_1.coerceToValidatorArray(form, options.asyncValidators, this_1.asyncValidators.get(controlId)), false);
|
|
1230
|
-
Reflect.set(form, controlId, formGroupDefinitions);
|
|
1231
|
-
};
|
|
1232
|
-
var this_1 = this;
|
|
1233
|
-
try {
|
|
1234
|
-
for (var _d = __values(this.formArrayGroups.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1235
|
-
var _f = __read(_e.value, 2), controlId = _f[0], options = _f[1];
|
|
1236
|
-
_loop_1(controlId, options);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1240
|
-
finally {
|
|
1241
|
-
try {
|
|
1242
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1243
|
-
}
|
|
1244
|
-
finally { if (e_4) throw e_4.error; }
|
|
1245
|
-
}
|
|
1246
|
-
};
|
|
1247
|
-
RxapFormBuilder.prototype.buildGroups = function (builderFormState, form, controls) {
|
|
1248
|
-
var e_5, _c;
|
|
1249
|
-
try {
|
|
1250
|
-
for (var _d = __values(this.formGroups.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1251
|
-
var _f = __read(_e.value, 2), controlId = _f[0], options = _f[1];
|
|
1252
|
-
var formState = this.coerceToGroupFormState(controlId, {}, builderFormState, options.state);
|
|
1253
|
-
utilities.assertIsObject(formState);
|
|
1254
|
-
var formGroupDefinition = new RxapFormBuilder(options.definition, this.injector, this.providers).build(formState, Object.assign(Object.assign({}, options), { validators: [], asyncValidators: [] }));
|
|
1255
|
-
controls[controlId] = formGroupDefinition.rxapFormGroup;
|
|
1256
|
-
var formGroup = formGroupDefinition.rxapFormGroup;
|
|
1257
|
-
// TODO : add support for injectable validators
|
|
1258
|
-
formGroup.setValidators(this.coerceToValidatorArray(form, options.validators, this.validators.get(controlId)), false);
|
|
1259
|
-
formGroup.setAsyncValidators(this.coerceToValidatorArray(form, options.asyncValidators, this.asyncValidators.get(controlId)), false);
|
|
1260
|
-
// set the form group definition instance to the form definition instance
|
|
1261
|
-
Reflect.set(form, controlId, formGroupDefinition);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1265
|
-
finally {
|
|
1266
|
-
try {
|
|
1267
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1268
|
-
}
|
|
1269
|
-
finally { if (e_5) throw e_5.error; }
|
|
1270
|
-
}
|
|
1271
|
-
};
|
|
1272
|
-
RxapFormBuilder.prototype.buildControls = function (builderFormState, form, controls) {
|
|
1273
|
-
var e_6, _c;
|
|
1274
|
-
var _a, _b;
|
|
1275
|
-
var _loop_2 = function (controlId, options) {
|
|
1276
|
-
var e_7, _g;
|
|
1277
|
-
var control = (controls[controlId] = new ((_a = options.controlType) !== null && _a !== void 0 ? _a : RxapFormControl)(this_2.coerceToControlFormState(controlId, null, builderFormState, options.state), Object.assign(Object.assign({}, options), { controlId: controlId, validators: [], asyncValidators: [] })));
|
|
1278
|
-
var injectValidators = [];
|
|
1279
|
-
var injectAsyncValidators = [];
|
|
1280
|
-
try {
|
|
1281
|
-
for (var _h = (e_7 = void 0, __values((_b = options.injectValidators) !== null && _b !== void 0 ? _b : [])), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
1282
|
-
var injectValidator = _j.value;
|
|
1283
|
-
var injectableValidator = this_2.injector.get(injectValidator);
|
|
1284
|
-
if (injectableValidator.validate) {
|
|
1285
|
-
injectValidators.push(injectableValidator.validate.bind(injectableValidator));
|
|
1286
|
-
}
|
|
1287
|
-
if (injectableValidator.asyncValidate) {
|
|
1288
|
-
injectAsyncValidators.push(injectableValidator.asyncValidate.bind(injectableValidator));
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1293
|
-
finally {
|
|
1294
|
-
try {
|
|
1295
|
-
if (_j && !_j.done && (_g = _h.return)) _g.call(_h);
|
|
1296
|
-
}
|
|
1297
|
-
finally { if (e_7) throw e_7.error; }
|
|
1298
|
-
}
|
|
1299
|
-
control.setValidators(this_2.coerceToValidatorArray(form, options.validators, this_2.validators.get(controlId), injectValidators), false);
|
|
1300
|
-
control.setAsyncValidators(this_2.coerceToValidatorArray(form, options.asyncValidators, this_2.asyncValidators.get(controlId), injectAsyncValidators), false);
|
|
1301
|
-
// register all control on change function with the form control
|
|
1302
|
-
this_2.coerceToFnArray(form, this_2.controlChanges.get(controlId)).forEach(function (changeFn) { return control.registerOnChange(changeFn); });
|
|
1303
|
-
// register all control on set value function with the form control
|
|
1304
|
-
this_2.coerceToFnArray(form, this_2.controlSetValue.get(controlId)).forEach(function (setValueFn) { return control.registerOnSetValue(setValueFn); });
|
|
1305
|
-
if (Array.isArray(options.validators)) {
|
|
1306
|
-
if (options.validators.includes(i1.Validators.required) ||
|
|
1307
|
-
options.validators.includes(i1.Validators.requiredTrue)) {
|
|
1308
|
-
Reflect.set(control, 'hasRequiredValidator', true);
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
// set the form control instance to the form definition instance
|
|
1312
|
-
Reflect.set(form, controlId, control);
|
|
1313
|
-
};
|
|
1314
|
-
var this_2 = this;
|
|
1315
|
-
try {
|
|
1316
|
-
for (var _d = __values(this.formControls.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1317
|
-
var _f = __read(_e.value, 2), controlId = _f[0], options = _f[1];
|
|
1318
|
-
_loop_2(controlId, options);
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1322
|
-
finally {
|
|
1323
|
-
try {
|
|
1324
|
-
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1325
|
-
}
|
|
1326
|
-
finally { if (e_6) throw e_6.error; }
|
|
1327
|
-
}
|
|
1328
|
-
};
|
|
1329
|
-
/**
|
|
1330
|
-
* Coerce to a function array.
|
|
1331
|
-
*
|
|
1332
|
-
* @param form the current form definition instance
|
|
1333
|
-
* @param methodKeys A set of propertyKeys that points to form
|
|
1334
|
-
* definition instance methods
|
|
1335
|
-
*/
|
|
1336
|
-
RxapFormBuilder.prototype.coerceToFnArray = function (form, methodKeys) {
|
|
1337
|
-
var e_8, _c;
|
|
1338
|
-
var changes = [];
|
|
1339
|
-
if (methodKeys) {
|
|
1340
|
-
try {
|
|
1341
|
-
for (var methodKeys_1 = __values(methodKeys), methodKeys_1_1 = methodKeys_1.next(); !methodKeys_1_1.done; methodKeys_1_1 = methodKeys_1.next()) {
|
|
1342
|
-
var propertyKeyOrOptions = methodKeys_1_1.value;
|
|
1343
|
-
var propertyKey = typeof propertyKeyOrOptions === 'string'
|
|
1344
|
-
? propertyKeyOrOptions
|
|
1345
|
-
: propertyKeyOrOptions.propertyKey;
|
|
1346
|
-
utilities.assertIsFunction(form[propertyKey]);
|
|
1347
|
-
changes.push(form[propertyKey].bind(form));
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1351
|
-
finally {
|
|
1352
|
-
try {
|
|
1353
|
-
if (methodKeys_1_1 && !methodKeys_1_1.done && (_c = methodKeys_1.return)) _c.call(methodKeys_1);
|
|
1354
|
-
}
|
|
1355
|
-
finally { if (e_8) throw e_8.error; }
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
return changes;
|
|
1359
|
-
};
|
|
1360
|
-
/**
|
|
1361
|
-
* Coerce to a validator function array.
|
|
1362
|
-
*
|
|
1363
|
-
* @param form the current form definition instance
|
|
1364
|
-
* @param optionsValidators The options validator functions
|
|
1365
|
-
* @param validatorMethodKeys A set of propertyKeys that points to form
|
|
1366
|
-
* definition instance methods
|
|
1367
|
-
* @param injectValidators Injected validator functions
|
|
1368
|
-
*/
|
|
1369
|
-
RxapFormBuilder.prototype.coerceToValidatorArray = function (form, optionsValidators, validatorMethodKeys, injectValidators) {
|
|
1370
|
-
var validators = optionsValidators
|
|
1371
|
-
? Array.isArray(optionsValidators)
|
|
1372
|
-
? optionsValidators
|
|
1373
|
-
: [optionsValidators]
|
|
1374
|
-
: [];
|
|
1375
|
-
if (validatorMethodKeys) {
|
|
1376
|
-
validatorMethodKeys.forEach(function (propertyKey) {
|
|
1377
|
-
utilities.assertIsFunction(form[propertyKey]);
|
|
1378
|
-
validators.push(form[propertyKey].bind(form));
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
if (injectValidators) {
|
|
1382
|
-
validators.push.apply(validators, __spreadArray([], __read(injectValidators)));
|
|
1383
|
-
}
|
|
1384
|
-
return validators;
|
|
1385
|
-
};
|
|
1386
|
-
/**
|
|
1387
|
-
* Coerce to the form state for the specified controlId. If none form state is
|
|
1388
|
-
* found the default form state will be returned.
|
|
1389
|
-
*
|
|
1390
|
-
* @param controlId A control id
|
|
1391
|
-
* @param defaultFormState The default form state
|
|
1392
|
-
* @param builderFormState The form state provides as build state parameter
|
|
1393
|
-
* @param optionsFormState The form state set by the decorator in the form definition
|
|
1394
|
-
*/
|
|
1395
|
-
RxapFormBuilder.prototype.coerceToControlFormState = function (controlId, defaultFormState, builderFormState, optionsFormState) {
|
|
1396
|
-
var formState = defaultFormState;
|
|
1397
|
-
if (builderFormState && builderFormState[controlId] !== undefined) {
|
|
1398
|
-
formState = builderFormState[controlId];
|
|
1399
|
-
}
|
|
1400
|
-
else if (optionsFormState !== undefined) {
|
|
1401
|
-
formState = optionsFormState !== null && optionsFormState !== void 0 ? optionsFormState : null;
|
|
1402
|
-
}
|
|
1403
|
-
if (typeof formState === 'function') {
|
|
1404
|
-
formState = formState();
|
|
1405
|
-
}
|
|
1406
|
-
return formState;
|
|
1407
|
-
};
|
|
1408
|
-
/**
|
|
1409
|
-
* Coerce to the form state for the specified controlId. If none form state is
|
|
1410
|
-
* found the default form state will be returned.
|
|
1411
|
-
*
|
|
1412
|
-
* The difference to the method coerceToControlFormState is that null will be
|
|
1413
|
-
* handled as undefined and the defaultFormState is used
|
|
1414
|
-
*
|
|
1415
|
-
* @param controlId A control id
|
|
1416
|
-
* @param defaultFormState The default form state
|
|
1417
|
-
* @param builderFormState The form state provides as build state parameter
|
|
1418
|
-
* @param optionsFormState The form state set by the decorator in the form definition
|
|
1419
|
-
*/
|
|
1420
|
-
RxapFormBuilder.prototype.coerceToGroupFormState = function (controlId, defaultFormState, builderFormState, optionsFormState) {
|
|
1421
|
-
var formState = defaultFormState;
|
|
1422
|
-
if (builderFormState && builderFormState[controlId]) {
|
|
1423
|
-
formState = builderFormState[controlId];
|
|
1424
|
-
}
|
|
1425
|
-
else if (optionsFormState) {
|
|
1426
|
-
formState = optionsFormState;
|
|
1427
|
-
}
|
|
1428
|
-
if (typeof formState === 'function') {
|
|
1429
|
-
formState = formState();
|
|
1430
|
-
if (!formState) {
|
|
1431
|
-
throw new Error("The form state function for the form group '" + controlId + "' returns a empty value (null/undefined)");
|
|
1432
|
-
}
|
|
1433
|
-
if (typeof formState !== 'object') {
|
|
1434
|
-
throw new Error("The form state function for the form group '" + controlId + "' returns a non object like value instead '" + typeof formState + "'");
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
return formState;
|
|
1438
|
-
};
|
|
1439
|
-
/**
|
|
1440
|
-
* Coerce to the form state for the specified controlId. If none form state is
|
|
1441
|
-
* found the default form state will be returned.
|
|
1442
|
-
*
|
|
1443
|
-
* The difference to the method coerceToControlFormState is that null will be
|
|
1444
|
-
* handled as undefined and the defaultFormState is used
|
|
1445
|
-
*
|
|
1446
|
-
* @param controlId A control id
|
|
1447
|
-
* @param defaultFormState The default form state
|
|
1448
|
-
* @param builderFormState The form state provides as build state parameter
|
|
1449
|
-
* @param optionsFormState The form state set by the decorator in the form definition
|
|
1450
|
-
*/
|
|
1451
|
-
RxapFormBuilder.prototype.coerceToArrayFormState = function (controlId, defaultFormState, builderFormState, optionsFormState) {
|
|
1452
|
-
var formState = defaultFormState;
|
|
1453
|
-
if (builderFormState && builderFormState[controlId] && Array.isArray(builderFormState[controlId])) {
|
|
1454
|
-
formState = builderFormState[controlId];
|
|
1455
|
-
}
|
|
1456
|
-
else if (optionsFormState && Array.isArray(optionsFormState)) {
|
|
1457
|
-
formState = optionsFormState;
|
|
1458
|
-
}
|
|
1459
|
-
if (typeof formState === 'function') {
|
|
1460
|
-
formState = formState();
|
|
1461
|
-
if (!formState) {
|
|
1462
|
-
throw new Error("The form state function for the form array '" + controlId + "' returns a empty value (null/undefined)");
|
|
1463
|
-
}
|
|
1464
|
-
if (!Array.isArray(formState)) {
|
|
1465
|
-
throw new Error("The form state function for the form array '" + controlId + "' returns a non array like value instead '" + typeof formState + "'");
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
return formState;
|
|
1469
|
-
};
|
|
1470
|
-
RxapFormBuilder.prototype.extractControlChanges = function () {
|
|
1471
|
-
var _a;
|
|
1472
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.CONTROL_CHANGES, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1473
|
-
};
|
|
1474
|
-
RxapFormBuilder.prototype.extractControlSetValue = function () {
|
|
1475
|
-
var _a;
|
|
1476
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.CONTROL_SET_VALUE, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1477
|
-
};
|
|
1478
|
-
RxapFormBuilder.prototype.extractValidators = function () {
|
|
1479
|
-
var _a;
|
|
1480
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.CONTROL_VALIDATORS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1481
|
-
};
|
|
1482
|
-
RxapFormBuilder.prototype.extractAsyncValidators = function () {
|
|
1483
|
-
var _a;
|
|
1484
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.CONTROL_ASYNC_VALIDATORS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1485
|
-
};
|
|
1486
|
-
RxapFormBuilder.prototype.extractArrayGroups = function () {
|
|
1487
|
-
var _a;
|
|
1488
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.FORM_ARRAY_GROUPS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1489
|
-
};
|
|
1490
|
-
RxapFormBuilder.prototype.extractArrayControls = function () {
|
|
1491
|
-
var _a;
|
|
1492
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.FORM_ARRAY_CONTROLS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1493
|
-
};
|
|
1494
|
-
RxapFormBuilder.prototype.extractGroups = function () {
|
|
1495
|
-
var _a;
|
|
1496
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.FORM_GROUPS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1497
|
-
};
|
|
1498
|
-
RxapFormBuilder.prototype.extractControls = function () {
|
|
1499
|
-
var _a;
|
|
1500
|
-
return ((_a = reflectMetadata.getMetadata(MetadataKeys.FORM_CONTROLS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
1501
|
-
};
|
|
1502
|
-
RxapFormBuilder.prototype.extractFormOptions = function () {
|
|
1503
|
-
var options = definition.GetDefinitionMetadata(this.definition);
|
|
1504
|
-
if (!options || !options.hasOwnProperty('id')) {
|
|
1505
|
-
throw new Error('Ensure that the @UseForm decorator is used.');
|
|
1506
|
-
}
|
|
1507
|
-
if (!options.providers) {
|
|
1508
|
-
options.providers = [];
|
|
1509
|
-
}
|
|
1510
|
-
return options;
|
|
1511
|
-
};
|
|
1512
|
-
return RxapFormBuilder;
|
|
1513
|
-
}());
|
|
1514
|
-
|
|
1515
|
-
var ControlValueAccessor = /** @class */ (function () {
|
|
1516
|
-
function ControlValueAccessor() {
|
|
1517
|
-
this.onChange = function (value) { };
|
|
1518
|
-
this.onTouched = function () { };
|
|
1519
|
-
this.setDisabledState = function (isDisabled) { };
|
|
1520
|
-
}
|
|
1521
|
-
ControlValueAccessor.prototype.registerOnChange = function (fn) {
|
|
1522
|
-
this.onChange = fn;
|
|
1523
|
-
};
|
|
1524
|
-
ControlValueAccessor.prototype.registerOnTouched = function (fn) {
|
|
1525
|
-
this.onTouched = fn;
|
|
1526
|
-
};
|
|
1527
|
-
return ControlValueAccessor;
|
|
1528
|
-
}());
|
|
1529
|
-
|
|
1530
|
-
var RXAP_FORM_INITIAL_STATE = new i0.InjectionToken('rxap/forms/initial-state');
|
|
1531
|
-
var RXAP_FORM_CONTEXT = new i0.InjectionToken('rxap/forms/context');
|
|
1532
|
-
|
|
1533
|
-
function ControlAsyncValidator() {
|
|
1534
|
-
var controlIds = [];
|
|
1535
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1536
|
-
controlIds[_i] = arguments[_i];
|
|
1537
|
-
}
|
|
1538
|
-
return function (target, propertyKey) {
|
|
1539
|
-
var e_1, _a;
|
|
1540
|
-
try {
|
|
1541
|
-
for (var controlIds_1 = __values(controlIds), controlIds_1_1 = controlIds_1.next(); !controlIds_1_1.done; controlIds_1_1 = controlIds_1.next()) {
|
|
1542
|
-
var controlId = controlIds_1_1.value;
|
|
1543
|
-
reflectMetadata.setMetadataMapSet(controlId, propertyKey, MetadataKeys.CONTROL_ASYNC_VALIDATORS, target);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1547
|
-
finally {
|
|
1548
|
-
try {
|
|
1549
|
-
if (controlIds_1_1 && !controlIds_1_1.done && (_a = controlIds_1.return)) _a.call(controlIds_1);
|
|
1550
|
-
}
|
|
1551
|
-
finally { if (e_1) throw e_1.error; }
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
function ControlChange() {
|
|
1557
|
-
var controlIds = [];
|
|
1558
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1559
|
-
controlIds[_i] = arguments[_i];
|
|
1560
|
-
}
|
|
1561
|
-
return function (target, propertyKey) {
|
|
1562
|
-
var e_1, _a;
|
|
1563
|
-
try {
|
|
1564
|
-
for (var controlIds_1 = __values(controlIds), controlIds_1_1 = controlIds_1.next(); !controlIds_1_1.done; controlIds_1_1 = controlIds_1.next()) {
|
|
1565
|
-
var controlId = controlIds_1_1.value;
|
|
1566
|
-
reflectMetadata.setMetadataMapSet(controlId, propertyKey, MetadataKeys.CONTROL_CHANGES, target);
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1570
|
-
finally {
|
|
1571
|
-
try {
|
|
1572
|
-
if (controlIds_1_1 && !controlIds_1_1.done && (_a = controlIds_1.return)) _a.call(controlIds_1);
|
|
1573
|
-
}
|
|
1574
|
-
finally { if (e_1) throw e_1.error; }
|
|
1575
|
-
}
|
|
1576
|
-
};
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
function ControlSetValue(controlId, options) {
|
|
1580
|
-
if (options === void 0) { options = {}; }
|
|
1581
|
-
return function (target, propertyKey) {
|
|
1582
|
-
reflectMetadata.setMetadataMapSet(controlId, Object.assign(Object.assign({}, options), { propertyKey: propertyKey }), MetadataKeys.CONTROL_SET_VALUE, target);
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
function ControlValidator() {
|
|
1587
|
-
var controlIds = [];
|
|
1588
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1589
|
-
controlIds[_i] = arguments[_i];
|
|
1590
|
-
}
|
|
1591
|
-
return function (target, propertyKey) {
|
|
1592
|
-
var e_1, _a;
|
|
1593
|
-
try {
|
|
1594
|
-
for (var controlIds_1 = __values(controlIds), controlIds_1_1 = controlIds_1.next(); !controlIds_1_1.done; controlIds_1_1 = controlIds_1.next()) {
|
|
1595
|
-
var controlId = controlIds_1_1.value;
|
|
1596
|
-
reflectMetadata.setMetadataMapSet(controlId, propertyKey, MetadataKeys.CONTROL_VALIDATORS, target);
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1600
|
-
finally {
|
|
1601
|
-
try {
|
|
1602
|
-
if (controlIds_1_1 && !controlIds_1_1.done && (_a = controlIds_1.return)) _a.call(controlIds_1);
|
|
1603
|
-
}
|
|
1604
|
-
finally { if (e_1) throw e_1.error; }
|
|
1605
|
-
}
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
function UseFormArrayGroup(definition, options) {
|
|
1610
|
-
if (options === void 0) { options = {}; }
|
|
1611
|
-
return function (target, propertyKey) {
|
|
1612
|
-
reflectMetadata.setMetadataMap(propertyKey, Object.assign(Object.assign({}, options), { definition: definition }), MetadataKeys.FORM_ARRAY_GROUPS, target);
|
|
1613
|
-
};
|
|
1614
|
-
}
|
|
1615
|
-
function UseFormArrayControl(options) {
|
|
1616
|
-
if (options === void 0) { options = {}; }
|
|
1617
|
-
return function (target, propertyKey) {
|
|
1618
|
-
reflectMetadata.setMetadataMap(propertyKey, options, MetadataKeys.FORM_ARRAY_CONTROLS, target);
|
|
1619
|
-
};
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
function UseFormControl(options) {
|
|
1623
|
-
if (options === void 0) { options = {}; }
|
|
1624
|
-
return function (target, propertyKey) {
|
|
1625
|
-
reflectMetadata.setMetadataMap(propertyKey, options, MetadataKeys.FORM_CONTROLS, target);
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
function UseFormGroup(definition, options) {
|
|
1630
|
-
if (options === void 0) { options = {}; }
|
|
1631
|
-
return function (target, propertyKey) {
|
|
1632
|
-
reflectMetadata.setMetadataMap(propertyKey, Object.assign(Object.assign({}, options), { definition: definition }), MetadataKeys.FORM_GROUPS, target);
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
function RxapForm(optionsOrId, className, packageName) {
|
|
1637
|
-
if (className === void 0) { className = 'FormDefinition'; }
|
|
1638
|
-
if (packageName === void 0) { packageName = '@rxap/forms'; }
|
|
1639
|
-
return function (target) {
|
|
1640
|
-
definition.DefinitionMetadata(optionsOrId, className, packageName)(target);
|
|
1641
|
-
};
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
var RXAP_FORM_DEFINITION = new i0.InjectionToken('rxap/forms/definition');
|
|
1645
|
-
var RXAP_FORM_DEFINITION_BUILDER = new i0.InjectionToken('rxap/forms/definition-builder');
|
|
1646
|
-
var RXAP_FORM_SUBMIT_METHOD = new i0.InjectionToken('rxap/form/submit-method');
|
|
1647
|
-
var RXAP_FORM_SUBMIT_FAILED_METHOD = new i0.InjectionToken('rxap/form/submit-failed-method');
|
|
1648
|
-
var RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD = new i0.InjectionToken('rxap/form/submit-successful-method');
|
|
1649
|
-
var RXAP_FORM_LOAD_METHOD = new i0.InjectionToken('rxap/form/load-method');
|
|
1650
|
-
var RXAP_FORM_LOAD_FAILED_METHOD = new i0.InjectionToken('rxap/form/load-failed-method');
|
|
1651
|
-
var RXAP_FORM_LOAD_SUCCESSFUL_METHOD = new i0.InjectionToken('rxap/form/load-successful-method');
|
|
1652
|
-
|
|
1653
|
-
var FormDirective = /** @class */ (function (_super) {
|
|
1654
|
-
__extends(FormDirective, _super);
|
|
1655
|
-
function FormDirective(cdr, formDefinition,
|
|
1656
|
-
// skip self, bc the token is set to null
|
|
1657
|
-
submitMethod,
|
|
1658
|
-
// skip self, bc the token is set to null
|
|
1659
|
-
loadMethod,
|
|
1660
|
-
// skip self, bc the token is set to null
|
|
1661
|
-
loadFailedMethod,
|
|
1662
|
-
// skip self, bc the token is set to null
|
|
1663
|
-
loadSuccessfulMethod,
|
|
1664
|
-
// skip self, bc the token is set to null
|
|
1665
|
-
submitFailedMethod,
|
|
1666
|
-
// skip self, bc the token is set to null
|
|
1667
|
-
submitSuccessfulMethod,
|
|
1668
|
-
// skip self, bc the token is set to null
|
|
1669
|
-
formDefinitionBuilder, loadingIndicatorService) {
|
|
1670
|
-
if (formDefinition === void 0) { formDefinition = null; }
|
|
1671
|
-
if (submitMethod === void 0) { submitMethod = null; }
|
|
1672
|
-
if (loadMethod === void 0) { loadMethod = null; }
|
|
1673
|
-
if (loadFailedMethod === void 0) { loadFailedMethod = null; }
|
|
1674
|
-
if (loadSuccessfulMethod === void 0) { loadSuccessfulMethod = null; }
|
|
1675
|
-
if (submitFailedMethod === void 0) { submitFailedMethod = null; }
|
|
1676
|
-
if (submitSuccessfulMethod === void 0) { submitSuccessfulMethod = null; }
|
|
1677
|
-
if (formDefinitionBuilder === void 0) { formDefinitionBuilder = null; }
|
|
1678
|
-
if (loadingIndicatorService === void 0) { loadingIndicatorService = null; }
|
|
1679
|
-
var _this = this;
|
|
1680
|
-
var _a, _b;
|
|
1681
|
-
_this = _super.call(this, [], []) || this;
|
|
1682
|
-
_this.cdr = cdr;
|
|
1683
|
-
_this.loadMethod = loadMethod;
|
|
1684
|
-
_this.loadFailedMethod = loadFailedMethod;
|
|
1685
|
-
_this.loadSuccessfulMethod = loadSuccessfulMethod;
|
|
1686
|
-
_this.submitFailedMethod = submitFailedMethod;
|
|
1687
|
-
_this.submitSuccessfulMethod = submitSuccessfulMethod;
|
|
1688
|
-
_this.formDefinitionBuilder = formDefinitionBuilder;
|
|
1689
|
-
_this.loadingIndicatorService = loadingIndicatorService;
|
|
1690
|
-
/**
|
|
1691
|
-
* Emits when the submit method is executed without errors. The result of the
|
|
1692
|
-
* submit method is passed as event object.
|
|
1693
|
-
*
|
|
1694
|
-
* If no submit method is defined then emit infidelity after the submit button
|
|
1695
|
-
* is clicked.
|
|
1696
|
-
*/
|
|
1697
|
-
_this.rxapSubmit = new i0.EventEmitter();
|
|
1698
|
-
_this.invalidSubmit = new i0.EventEmitter();
|
|
1699
|
-
_this.submitSuccessful$ = new i0.EventEmitter();
|
|
1700
|
-
_this.submitting$ = new rxjs$1.ToggleSubject();
|
|
1701
|
-
_this.submitError$ = new rxjs.BehaviorSubject(null);
|
|
1702
|
-
_this.loading$ = new rxjs$1.ToggleSubject();
|
|
1703
|
-
_this.loaded$ = new rxjs$1.ToggleSubject();
|
|
1704
|
-
_this.loadingError$ = new rxjs.BehaviorSubject(null);
|
|
1705
|
-
_this.submitMethod = null;
|
|
1706
|
-
_this._autoSubmitSubscription = new rxjs.Subscription();
|
|
1707
|
-
if (submitMethod) {
|
|
1708
|
-
_this.submitMethod = submitMethod;
|
|
1709
|
-
}
|
|
1710
|
-
if (!formDefinition && formDefinitionBuilder) {
|
|
1711
|
-
formDefinition = formDefinitionBuilder.build();
|
|
1712
|
-
}
|
|
1713
|
-
if (formDefinition) {
|
|
1714
|
-
_this._formDefinition = formDefinition;
|
|
1715
|
-
_this.form = formDefinition.rxapFormGroup;
|
|
1716
|
-
}
|
|
1717
|
-
(_a = _this.loadingIndicatorService) === null || _a === void 0 ? void 0 : _a.attachLoading(_this.loading$);
|
|
1718
|
-
(_b = _this.loadingIndicatorService) === null || _b === void 0 ? void 0 : _b.attachLoading(_this.submitting$);
|
|
1719
|
-
return _this;
|
|
1720
|
-
}
|
|
1721
|
-
Object.defineProperty(FormDirective.prototype, "submitting", {
|
|
1722
|
-
get: function () {
|
|
1723
|
-
return this.submitting$.value;
|
|
1724
|
-
},
|
|
1725
|
-
enumerable: false,
|
|
1726
|
-
configurable: true
|
|
1727
|
-
});
|
|
1728
|
-
Object.defineProperty(FormDirective.prototype, "submitError", {
|
|
1729
|
-
get: function () {
|
|
1730
|
-
return this.submitError$.value;
|
|
1731
|
-
},
|
|
1732
|
-
enumerable: false,
|
|
1733
|
-
configurable: true
|
|
1734
|
-
});
|
|
1735
|
-
Object.defineProperty(FormDirective.prototype, "loading", {
|
|
1736
|
-
get: function () {
|
|
1737
|
-
return this.loading$.value;
|
|
1738
|
-
},
|
|
1739
|
-
enumerable: false,
|
|
1740
|
-
configurable: true
|
|
1741
|
-
});
|
|
1742
|
-
Object.defineProperty(FormDirective.prototype, "loaded", {
|
|
1743
|
-
get: function () {
|
|
1744
|
-
return this.loaded$.value;
|
|
1745
|
-
},
|
|
1746
|
-
enumerable: false,
|
|
1747
|
-
configurable: true
|
|
1748
|
-
});
|
|
1749
|
-
Object.defineProperty(FormDirective.prototype, "loadingError", {
|
|
1750
|
-
get: function () {
|
|
1751
|
-
return this.loadingError$.value;
|
|
1752
|
-
},
|
|
1753
|
-
enumerable: false,
|
|
1754
|
-
configurable: true
|
|
1755
|
-
});
|
|
1756
|
-
Object.defineProperty(FormDirective.prototype, "useFormDefinition", {
|
|
1757
|
-
set: function (value) {
|
|
1758
|
-
if (value) {
|
|
1759
|
-
this._formDefinition = value;
|
|
1760
|
-
this.form = value.rxapFormGroup;
|
|
1761
|
-
}
|
|
1762
|
-
},
|
|
1763
|
-
enumerable: false,
|
|
1764
|
-
configurable: true
|
|
1765
|
-
});
|
|
1766
|
-
Object.defineProperty(FormDirective.prototype, "formDefinition", {
|
|
1767
|
-
get: function () {
|
|
1768
|
-
return this._formDefinition;
|
|
1769
|
-
},
|
|
1770
|
-
enumerable: false,
|
|
1771
|
-
configurable: true
|
|
1772
|
-
});
|
|
1773
|
-
FormDirective.prototype.ngOnChanges = function (changes) {
|
|
1774
|
-
_super.prototype.ngOnChanges.call(this, changes);
|
|
1775
|
-
var formChange = changes.form;
|
|
1776
|
-
if (formChange && !formChange.firstChange) {
|
|
1777
|
-
this.loadInitialState(formChange.currentValue);
|
|
1778
|
-
}
|
|
1779
|
-
};
|
|
1780
|
-
FormDirective.prototype.ngOnInit = function () {
|
|
1781
|
-
var _this = this;
|
|
1782
|
-
if (!this.form) {
|
|
1783
|
-
// TODO : replace with rxap error
|
|
1784
|
-
throw new Error('The form definition instance is not defined');
|
|
1785
|
-
}
|
|
1786
|
-
this.loadInitialState(this.form);
|
|
1787
|
-
function HasNgOnInitMethod(obj) {
|
|
1788
|
-
return obj && typeof obj.ngOnInit === 'function';
|
|
1789
|
-
}
|
|
1790
|
-
if (HasNgOnInitMethod(this._formDefinition)) {
|
|
1791
|
-
this._formDefinition.ngOnInit();
|
|
1792
|
-
}
|
|
1793
|
-
if (this._formDefinition.rxapMetadata.autoSubmit) {
|
|
1794
|
-
var debounce = typeof this._formDefinition.rxapMetadata.autoSubmit === 'number'
|
|
1795
|
-
? this._formDefinition.rxapMetadata.autoSubmit
|
|
1796
|
-
: 5000;
|
|
1797
|
-
this._autoSubmitSubscription = this.form.valueChanges
|
|
1798
|
-
.pipe(operators.debounceTime(debounce), operators.filter(function () { return _this.form.valid; }), operators.tap(function (value) { return console.debug("Auto submit form '" + _this._formDefinition.rxapMetadata.id + "'", value); }), operators.tap(function () { return _this.submit(); }))
|
|
1799
|
-
.subscribe();
|
|
1800
|
-
}
|
|
1801
|
-
};
|
|
1802
|
-
FormDirective.prototype.onSubmit = function ($event) {
|
|
1803
|
-
$event.preventDefault();
|
|
1804
|
-
_super.prototype.onSubmit.call(this, $event);
|
|
1805
|
-
if (this.form.valid) {
|
|
1806
|
-
this.submit();
|
|
1807
|
-
}
|
|
1808
|
-
else {
|
|
1809
|
-
if (i0.isDevMode()) {
|
|
1810
|
-
console.log('Form submit is not valid for: ' + this.form.controlId, this.form.errors);
|
|
1811
|
-
function printErrorControls(control) {
|
|
1812
|
-
var e_1, _c, e_2, _d;
|
|
1813
|
-
if (!control.valid) {
|
|
1814
|
-
console.group(control.controlId);
|
|
1815
|
-
if (control.controls) {
|
|
1816
|
-
if (Array.isArray(control.controls)) {
|
|
1817
|
-
for (var i = 0; i < control.controls.length; i++) {
|
|
1818
|
-
var child = control.controls[i];
|
|
1819
|
-
if (!child.valid) {
|
|
1820
|
-
console.group("index: " + i);
|
|
1821
|
-
printErrorControls(child);
|
|
1822
|
-
console.groupEnd();
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
else {
|
|
1827
|
-
try {
|
|
1828
|
-
for (var _e = __values(Object.values(control.controls)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1829
|
-
var child = _f.value;
|
|
1830
|
-
printErrorControls(child);
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1834
|
-
finally {
|
|
1835
|
-
try {
|
|
1836
|
-
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
1837
|
-
}
|
|
1838
|
-
finally { if (e_1) throw e_1.error; }
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
else {
|
|
1843
|
-
if (control.errors) {
|
|
1844
|
-
try {
|
|
1845
|
-
for (var _g = __values(Object.entries(control.errors)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1846
|
-
var _j = __read(_h.value, 2), key = _j[0], value = _j[1];
|
|
1847
|
-
console.group(key);
|
|
1848
|
-
console.log(value);
|
|
1849
|
-
console.groupEnd();
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1853
|
-
finally {
|
|
1854
|
-
try {
|
|
1855
|
-
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
|
1856
|
-
}
|
|
1857
|
-
finally { if (e_2) throw e_2.error; }
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
console.log('value: ', control.value);
|
|
1861
|
-
}
|
|
1862
|
-
console.groupEnd();
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
printErrorControls(this.form);
|
|
1866
|
-
}
|
|
1867
|
-
this.invalidSubmit.emit();
|
|
1868
|
-
}
|
|
1869
|
-
return false;
|
|
1870
|
-
};
|
|
1871
|
-
FormDirective.prototype.loadInitialState = function (form) {
|
|
1872
|
-
var _this = this;
|
|
1873
|
-
if (this.initial) {
|
|
1874
|
-
if (i0.isDevMode()) {
|
|
1875
|
-
console.log('use the value from input initial');
|
|
1876
|
-
}
|
|
1877
|
-
form.patchValue(this.initial);
|
|
1878
|
-
}
|
|
1879
|
-
else {
|
|
1880
|
-
if (this.loadMethod) {
|
|
1881
|
-
this.loading$.enable();
|
|
1882
|
-
try {
|
|
1883
|
-
var resultOrPromise = this.loadMethod.call();
|
|
1884
|
-
if (utilities.isPromise(resultOrPromise)) {
|
|
1885
|
-
resultOrPromise
|
|
1886
|
-
.then(function (value) {
|
|
1887
|
-
form.patchValue(value);
|
|
1888
|
-
_this.loaded$.enable();
|
|
1889
|
-
_this.loadSuccessful(value);
|
|
1890
|
-
})
|
|
1891
|
-
.catch(function (error) {
|
|
1892
|
-
_this.loadingError$.next(error);
|
|
1893
|
-
_this.loadFailed(error);
|
|
1894
|
-
})
|
|
1895
|
-
.finally(function () {
|
|
1896
|
-
_this.loading$.disable();
|
|
1897
|
-
_this.cdr.detectChanges();
|
|
1898
|
-
});
|
|
1899
|
-
}
|
|
1900
|
-
else if (utilities.isObject(resultOrPromise)) {
|
|
1901
|
-
form.patchValue(resultOrPromise);
|
|
1902
|
-
this.loaded$.enable();
|
|
1903
|
-
this.loadSuccessful(resultOrPromise);
|
|
1904
|
-
this.loading$.disable();
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
catch (error) {
|
|
1908
|
-
this.loaded$.disable();
|
|
1909
|
-
this.loadingError$.next(error);
|
|
1910
|
-
this.loadFailed(error);
|
|
1911
|
-
this.loading$.disable();
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
else {
|
|
1915
|
-
if (i0.isDevMode()) {
|
|
1916
|
-
console.warn('The form loading method is not defined for: ' + this.form.controlId);
|
|
1917
|
-
}
|
|
1918
|
-
this.loaded$.enable();
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
};
|
|
1922
|
-
FormDirective.prototype.loadSuccessful = function (value) {
|
|
1923
|
-
if (this.loadSuccessfulMethod) {
|
|
1924
|
-
this.loadSuccessfulMethod.call(value);
|
|
1925
|
-
}
|
|
1926
|
-
else if (i0.isDevMode()) {
|
|
1927
|
-
console.warn('The load successful is not defined for: ' + this.form.controlId);
|
|
1928
|
-
}
|
|
1929
|
-
};
|
|
1930
|
-
FormDirective.prototype.loadFailed = function (error) {
|
|
1931
|
-
var _a;
|
|
1932
|
-
console.debug('Load Error:', error);
|
|
1933
|
-
console.error('Load Error:', error.message);
|
|
1934
|
-
if (this.loadFailedMethod) {
|
|
1935
|
-
(_a = this.loadFailedMethod) === null || _a === void 0 ? void 0 : _a.call(error);
|
|
1936
|
-
}
|
|
1937
|
-
else if (i0.isDevMode()) {
|
|
1938
|
-
console.warn('The form loading failed for: ' + this.form.controlId);
|
|
1939
|
-
}
|
|
1940
|
-
};
|
|
1941
|
-
FormDirective.prototype.getSubmitValue = function () {
|
|
1942
|
-
var value = undefined;
|
|
1943
|
-
if (typeof this._formDefinition['getSubmitValue'] === 'function') {
|
|
1944
|
-
value = this._formDefinition.getSubmitValue();
|
|
1945
|
-
}
|
|
1946
|
-
else if (typeof this._formDefinition['toJSON'] === 'function') {
|
|
1947
|
-
value = this._formDefinition.toJSON();
|
|
1948
|
-
}
|
|
1949
|
-
value = value !== null && value !== void 0 ? value : this.form.value;
|
|
1950
|
-
return utilities.clone(value);
|
|
1951
|
-
};
|
|
1952
|
-
FormDirective.prototype.submit = function () {
|
|
1953
|
-
var _this = this;
|
|
1954
|
-
var value = this.getSubmitValue();
|
|
1955
|
-
if (this.submitMethod) {
|
|
1956
|
-
Reflect.set(this, 'submitted', false);
|
|
1957
|
-
this.submitting$.enable();
|
|
1958
|
-
this.submitError$.next(null);
|
|
1959
|
-
try {
|
|
1960
|
-
var resultOrPromise = this.submitMethod.call(value);
|
|
1961
|
-
if (utilities.isPromise(resultOrPromise)) {
|
|
1962
|
-
resultOrPromise
|
|
1963
|
-
.then(function (result) {
|
|
1964
|
-
Reflect.set(_this, 'submitted', true);
|
|
1965
|
-
_this.rxapSubmit.emit(result);
|
|
1966
|
-
_this.submitSuccessful(result);
|
|
1967
|
-
})
|
|
1968
|
-
.catch(function (error) {
|
|
1969
|
-
_this.submitError$.next(error);
|
|
1970
|
-
_this.submitFailed(error);
|
|
1971
|
-
})
|
|
1972
|
-
.finally(function () {
|
|
1973
|
-
_this.submitting$.disable();
|
|
1974
|
-
_this.cdr.detectChanges();
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
else {
|
|
1978
|
-
Reflect.set(this, 'submitted', true);
|
|
1979
|
-
this.rxapSubmit.emit(resultOrPromise);
|
|
1980
|
-
this.submitSuccessful(resultOrPromise);
|
|
1981
|
-
this.submitting$.disable();
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
catch (error) {
|
|
1985
|
-
this.submitting$.disable();
|
|
1986
|
-
this.submitError$.next(error);
|
|
1987
|
-
this.submitFailed(error);
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
else {
|
|
1991
|
-
if (i0.isDevMode()) {
|
|
1992
|
-
console.warn('The form submit method is not defined for: ' + this.form.controlId);
|
|
1993
|
-
}
|
|
1994
|
-
this.rxapSubmit.emit(value);
|
|
1995
|
-
this.submitSuccessful(value);
|
|
1996
|
-
}
|
|
1997
|
-
};
|
|
1998
|
-
FormDirective.prototype.submitFailed = function (error) {
|
|
1999
|
-
console.debug('Submit Error:', error);
|
|
2000
|
-
console.error('Submit Error:', error.message);
|
|
2001
|
-
if (this.submitFailedMethod) {
|
|
2002
|
-
this.submitFailedMethod.call(error);
|
|
2003
|
-
}
|
|
2004
|
-
else if (i0.isDevMode()) {
|
|
2005
|
-
console.warn('The form submit failed method is not defined for: ' +
|
|
2006
|
-
this.form.controlId);
|
|
2007
|
-
}
|
|
2008
|
-
};
|
|
2009
|
-
FormDirective.prototype.submitSuccessful = function (value) {
|
|
2010
|
-
this.submitSuccessful$.next(value);
|
|
2011
|
-
if (this.submitSuccessfulMethod) {
|
|
2012
|
-
this.submitSuccessfulMethod.call(value);
|
|
2013
|
-
}
|
|
2014
|
-
else if (i0.isDevMode()) {
|
|
2015
|
-
console.warn('The form submit successful method is not defined for: ' +
|
|
2016
|
-
this.form.controlId);
|
|
2017
|
-
}
|
|
2018
|
-
};
|
|
2019
|
-
FormDirective.prototype.ngOnDestroy = function () {
|
|
2020
|
-
var _a;
|
|
2021
|
-
_super.prototype.ngOnDestroy.call(this);
|
|
2022
|
-
(_a = this._autoSubmitSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2023
|
-
function HasNgOnDestroyMethod(obj) {
|
|
2024
|
-
return obj && typeof obj.ngOnDestroy === 'function';
|
|
2025
|
-
}
|
|
2026
|
-
if (HasNgOnDestroyMethod(this._formDefinition)) {
|
|
2027
|
-
this._formDefinition.ngOnDestroy();
|
|
2028
|
-
}
|
|
2029
|
-
};
|
|
2030
|
-
return FormDirective;
|
|
2031
|
-
}(i1.FormGroupDirective));
|
|
2032
|
-
FormDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: RXAP_FORM_DEFINITION, optional: true }, { token: RXAP_FORM_SUBMIT_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_LOAD_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_LOAD_FAILED_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_LOAD_SUCCESSFUL_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_SUBMIT_FAILED_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_DEFINITION_BUILDER, optional: true, skipSelf: true }, { token: i2.LoadingIndicatorService, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2033
|
-
FormDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormDirective, selector: "form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]", inputs: { initial: "initial", useFormDefinition: ["rxapForm", "useFormDefinition"], submitMethod: "submitMethod" }, outputs: { ngSubmit: "ngSubmit", rxapSubmit: "rxapSubmit", invalidSubmit: "invalidSubmit", submitSuccessful$: "submitSuccessful" }, host: { listeners: { "reset": "onReset()" }, properties: { "class.rxap-submitting": "this.submitting", "class.rxap-submit-error": "this.submitError", "class.rxap-loading": "this.loading", "class.rxap-loaded": "this.loaded", "class.rxap-loading-error": "this.loadingError" } }, providers: [
|
|
2034
|
-
{
|
|
2035
|
-
provide: i1.ControlContainer,
|
|
2036
|
-
// ignore coverage
|
|
2037
|
-
useExisting: i0.forwardRef(function () { return FormDirective; })
|
|
2038
|
-
},
|
|
2039
|
-
// region form provider clear
|
|
2040
|
-
// form provider that are directly associated with the current form
|
|
2041
|
-
// are cleared to prevent that inner forms can access this providers
|
|
2042
|
-
// Example: The parent form has a submit method provider and the inner should
|
|
2043
|
-
// not have a submit method provider. If the parent submit method provider is
|
|
2044
|
-
// not cleared then the inner form uses the parent submit method provider on
|
|
2045
|
-
// submit
|
|
2046
|
-
{
|
|
2047
|
-
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
2048
|
-
useValue: null,
|
|
2049
|
-
},
|
|
2050
|
-
{
|
|
2051
|
-
provide: RXAP_FORM_LOAD_METHOD,
|
|
2052
|
-
useValue: null,
|
|
2053
|
-
},
|
|
2054
|
-
{
|
|
2055
|
-
provide: RXAP_FORM_LOAD_FAILED_METHOD,
|
|
2056
|
-
useValue: null,
|
|
2057
|
-
},
|
|
2058
|
-
{
|
|
2059
|
-
provide: RXAP_FORM_LOAD_SUCCESSFUL_METHOD,
|
|
2060
|
-
useValue: null,
|
|
2061
|
-
},
|
|
2062
|
-
{
|
|
2063
|
-
provide: RXAP_FORM_SUBMIT_FAILED_METHOD,
|
|
2064
|
-
useValue: null,
|
|
2065
|
-
},
|
|
2066
|
-
{
|
|
2067
|
-
provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
|
|
2068
|
-
useValue: null,
|
|
2069
|
-
},
|
|
2070
|
-
{
|
|
2071
|
-
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
2072
|
-
useValue: null,
|
|
2073
|
-
},
|
|
2074
|
-
// endregion
|
|
2075
|
-
], exportAs: ["rxapForm"], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace });
|
|
2076
|
-
__decorate([
|
|
2077
|
-
utilities.Required,
|
|
2078
|
-
__metadata("design:type", Object)
|
|
2079
|
-
], FormDirective.prototype, "_formDefinition", void 0);
|
|
2080
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormDirective, decorators: [{
|
|
2081
|
-
type: i0.Directive,
|
|
2082
|
-
args: [{
|
|
2083
|
-
selector: 'form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]',
|
|
2084
|
-
providers: [
|
|
2085
|
-
{
|
|
2086
|
-
provide: i1.ControlContainer,
|
|
2087
|
-
// ignore coverage
|
|
2088
|
-
useExisting: i0.forwardRef(function () { return FormDirective; })
|
|
2089
|
-
},
|
|
2090
|
-
// region form provider clear
|
|
2091
|
-
// form provider that are directly associated with the current form
|
|
2092
|
-
// are cleared to prevent that inner forms can access this providers
|
|
2093
|
-
// Example: The parent form has a submit method provider and the inner should
|
|
2094
|
-
// not have a submit method provider. If the parent submit method provider is
|
|
2095
|
-
// not cleared then the inner form uses the parent submit method provider on
|
|
2096
|
-
// submit
|
|
2097
|
-
{
|
|
2098
|
-
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
2099
|
-
useValue: null,
|
|
2100
|
-
},
|
|
2101
|
-
{
|
|
2102
|
-
provide: RXAP_FORM_LOAD_METHOD,
|
|
2103
|
-
useValue: null,
|
|
2104
|
-
},
|
|
2105
|
-
{
|
|
2106
|
-
provide: RXAP_FORM_LOAD_FAILED_METHOD,
|
|
2107
|
-
useValue: null,
|
|
2108
|
-
},
|
|
2109
|
-
{
|
|
2110
|
-
provide: RXAP_FORM_LOAD_SUCCESSFUL_METHOD,
|
|
2111
|
-
useValue: null,
|
|
2112
|
-
},
|
|
2113
|
-
{
|
|
2114
|
-
provide: RXAP_FORM_SUBMIT_FAILED_METHOD,
|
|
2115
|
-
useValue: null,
|
|
2116
|
-
},
|
|
2117
|
-
{
|
|
2118
|
-
provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
|
|
2119
|
-
useValue: null,
|
|
2120
|
-
},
|
|
2121
|
-
{
|
|
2122
|
-
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
2123
|
-
useValue: null,
|
|
2124
|
-
},
|
|
2125
|
-
// endregion
|
|
2126
|
-
],
|
|
2127
|
-
host: { '(reset)': 'onReset()' },
|
|
2128
|
-
outputs: ['ngSubmit'],
|
|
2129
|
-
exportAs: 'rxapForm',
|
|
2130
|
-
}]
|
|
2131
|
-
}], ctorParameters: function () {
|
|
2132
|
-
return [{ type: i0__namespace.ChangeDetectorRef, decorators: [{
|
|
2133
|
-
type: i0.Inject,
|
|
2134
|
-
args: [i0.ChangeDetectorRef]
|
|
2135
|
-
}] }, { type: undefined, decorators: [{
|
|
2136
|
-
type: i0.Optional
|
|
2137
|
-
}, {
|
|
2138
|
-
type: i0.Inject,
|
|
2139
|
-
args: [RXAP_FORM_DEFINITION]
|
|
2140
|
-
}] }, { type: undefined, decorators: [{
|
|
2141
|
-
type: i0.SkipSelf
|
|
2142
|
-
}, {
|
|
2143
|
-
type: i0.Optional
|
|
2144
|
-
}, {
|
|
2145
|
-
type: i0.Inject,
|
|
2146
|
-
args: [RXAP_FORM_SUBMIT_METHOD]
|
|
2147
|
-
}] }, { type: undefined, decorators: [{
|
|
2148
|
-
type: i0.SkipSelf
|
|
2149
|
-
}, {
|
|
2150
|
-
type: i0.Optional
|
|
2151
|
-
}, {
|
|
2152
|
-
type: i0.Inject,
|
|
2153
|
-
args: [RXAP_FORM_LOAD_METHOD]
|
|
2154
|
-
}] }, { type: undefined, decorators: [{
|
|
2155
|
-
type: i0.SkipSelf
|
|
2156
|
-
}, {
|
|
2157
|
-
type: i0.Optional
|
|
2158
|
-
}, {
|
|
2159
|
-
type: i0.Inject,
|
|
2160
|
-
args: [RXAP_FORM_LOAD_FAILED_METHOD]
|
|
2161
|
-
}] }, { type: undefined, decorators: [{
|
|
2162
|
-
type: i0.SkipSelf
|
|
2163
|
-
}, {
|
|
2164
|
-
type: i0.Optional
|
|
2165
|
-
}, {
|
|
2166
|
-
type: i0.Inject,
|
|
2167
|
-
args: [RXAP_FORM_LOAD_SUCCESSFUL_METHOD]
|
|
2168
|
-
}] }, { type: undefined, decorators: [{
|
|
2169
|
-
type: i0.SkipSelf
|
|
2170
|
-
}, {
|
|
2171
|
-
type: i0.Optional
|
|
2172
|
-
}, {
|
|
2173
|
-
type: i0.Inject,
|
|
2174
|
-
args: [RXAP_FORM_SUBMIT_FAILED_METHOD]
|
|
2175
|
-
}] }, { type: undefined, decorators: [{
|
|
2176
|
-
type: i0.SkipSelf
|
|
2177
|
-
}, {
|
|
2178
|
-
type: i0.Optional
|
|
2179
|
-
}, {
|
|
2180
|
-
type: i0.Inject,
|
|
2181
|
-
args: [RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD]
|
|
2182
|
-
}] }, { type: RxapFormBuilder, decorators: [{
|
|
2183
|
-
type: i0.SkipSelf
|
|
2184
|
-
}, {
|
|
2185
|
-
type: i0.Optional
|
|
2186
|
-
}, {
|
|
2187
|
-
type: i0.Inject,
|
|
2188
|
-
args: [RXAP_FORM_DEFINITION_BUILDER]
|
|
2189
|
-
}] }, { type: i2__namespace.LoadingIndicatorService, decorators: [{
|
|
2190
|
-
type: i0.Optional
|
|
2191
|
-
}, {
|
|
2192
|
-
type: i0.Inject,
|
|
2193
|
-
args: [i2.LoadingIndicatorService]
|
|
2194
|
-
}] }];
|
|
2195
|
-
}, propDecorators: { initial: [{
|
|
2196
|
-
type: i0.Input
|
|
2197
|
-
}], rxapSubmit: [{
|
|
2198
|
-
type: i0.Output
|
|
2199
|
-
}], invalidSubmit: [{
|
|
2200
|
-
type: i0.Output
|
|
2201
|
-
}], submitSuccessful$: [{
|
|
2202
|
-
type: i0.Output,
|
|
2203
|
-
args: ['submitSuccessful']
|
|
2204
|
-
}], submitting: [{
|
|
2205
|
-
type: i0.HostBinding,
|
|
2206
|
-
args: ['class.rxap-submitting']
|
|
2207
|
-
}], submitError: [{
|
|
2208
|
-
type: i0.HostBinding,
|
|
2209
|
-
args: ['class.rxap-submit-error']
|
|
2210
|
-
}], loading: [{
|
|
2211
|
-
type: i0.HostBinding,
|
|
2212
|
-
args: ['class.rxap-loading']
|
|
2213
|
-
}], loaded: [{
|
|
2214
|
-
type: i0.HostBinding,
|
|
2215
|
-
args: ['class.rxap-loaded']
|
|
2216
|
-
}], loadingError: [{
|
|
2217
|
-
type: i0.HostBinding,
|
|
2218
|
-
args: ['class.rxap-loading-error']
|
|
2219
|
-
}], useFormDefinition: [{
|
|
2220
|
-
type: i0.Input,
|
|
2221
|
-
args: ['rxapForm']
|
|
2222
|
-
}], _formDefinition: [], submitMethod: [{
|
|
2223
|
-
type: i0.Input
|
|
2224
|
-
}] } });
|
|
2225
|
-
|
|
2226
|
-
var FormSubmitFailedDirective = /** @class */ (function () {
|
|
2227
|
-
function FormSubmitFailedDirective(formDirective, template, viewContainerRef) {
|
|
2228
|
-
this.formDirective = formDirective;
|
|
2229
|
-
this.template = template;
|
|
2230
|
-
this.viewContainerRef = viewContainerRef;
|
|
2231
|
-
}
|
|
2232
|
-
FormSubmitFailedDirective.prototype.ngAfterViewInit = function () {
|
|
2233
|
-
var _this = this;
|
|
2234
|
-
this.subscription = this.formDirective.submitError$.pipe(operators.tap(function (error) {
|
|
2235
|
-
_this.viewContainerRef.clear();
|
|
2236
|
-
if (error !== null) {
|
|
2237
|
-
_this.viewContainerRef.createEmbeddedView(_this.template, { $implicit: error });
|
|
2238
|
-
}
|
|
2239
|
-
})).subscribe();
|
|
2240
|
-
};
|
|
2241
|
-
FormSubmitFailedDirective.prototype.ngOnDestroy = function () {
|
|
2242
|
-
var _a;
|
|
2243
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2244
|
-
};
|
|
2245
|
-
return FormSubmitFailedDirective;
|
|
2246
|
-
}());
|
|
2247
|
-
FormSubmitFailedDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitFailedDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2248
|
-
FormSubmitFailedDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmitFailedDirective, selector: "[rxapFormSubmitFailed]", ngImport: i0__namespace });
|
|
2249
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitFailedDirective, decorators: [{
|
|
2250
|
-
type: i0.Directive,
|
|
2251
|
-
args: [{
|
|
2252
|
-
selector: '[rxapFormSubmitFailed]'
|
|
2253
|
-
}]
|
|
2254
|
-
}], ctorParameters: function () {
|
|
2255
|
-
return [{ type: FormDirective, decorators: [{
|
|
2256
|
-
type: i0.Inject,
|
|
2257
|
-
args: [FormDirective]
|
|
2258
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2259
|
-
type: i0.Inject,
|
|
2260
|
-
args: [i0.TemplateRef]
|
|
2261
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2262
|
-
type: i0.Inject,
|
|
2263
|
-
args: [i0.ViewContainerRef]
|
|
2264
|
-
}] }];
|
|
2265
|
-
} });
|
|
2266
|
-
|
|
2267
|
-
var FormLoadingDirective = /** @class */ (function () {
|
|
2268
|
-
function FormLoadingDirective(formDirective, template, viewContainerRef) {
|
|
2269
|
-
this.formDirective = formDirective;
|
|
2270
|
-
this.template = template;
|
|
2271
|
-
this.viewContainerRef = viewContainerRef;
|
|
2272
|
-
}
|
|
2273
|
-
FormLoadingDirective.prototype.ngAfterViewInit = function () {
|
|
2274
|
-
var _this = this;
|
|
2275
|
-
this.subscription = this.formDirective.loading$.pipe(operators.distinctUntilChanged(), operators.tap(function (loading) {
|
|
2276
|
-
_this.viewContainerRef.clear();
|
|
2277
|
-
if (loading) {
|
|
2278
|
-
_this.viewContainerRef.createEmbeddedView(_this.template);
|
|
2279
|
-
}
|
|
2280
|
-
})).subscribe();
|
|
2281
|
-
};
|
|
2282
|
-
FormLoadingDirective.prototype.ngOnDestroy = function () {
|
|
2283
|
-
var _a;
|
|
2284
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2285
|
-
};
|
|
2286
|
-
return FormLoadingDirective;
|
|
2287
|
-
}());
|
|
2288
|
-
FormLoadingDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormLoadingDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2289
|
-
FormLoadingDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormLoadingDirective, selector: "[rxapFormLoading]", ngImport: i0__namespace });
|
|
2290
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormLoadingDirective, decorators: [{
|
|
2291
|
-
type: i0.Directive,
|
|
2292
|
-
args: [{
|
|
2293
|
-
selector: '[rxapFormLoading]'
|
|
2294
|
-
}]
|
|
2295
|
-
}], ctorParameters: function () {
|
|
2296
|
-
return [{ type: FormDirective, decorators: [{
|
|
2297
|
-
type: i0.Inject,
|
|
2298
|
-
args: [FormDirective]
|
|
2299
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2300
|
-
type: i0.Inject,
|
|
2301
|
-
args: [i0.TemplateRef]
|
|
2302
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2303
|
-
type: i0.Inject,
|
|
2304
|
-
args: [i0.ViewContainerRef]
|
|
2305
|
-
}] }];
|
|
2306
|
-
} });
|
|
2307
|
-
|
|
2308
|
-
var FormSubmittingDirective = /** @class */ (function () {
|
|
2309
|
-
function FormSubmittingDirective(formDirective, template, viewContainerRef) {
|
|
2310
|
-
this.formDirective = formDirective;
|
|
2311
|
-
this.template = template;
|
|
2312
|
-
this.viewContainerRef = viewContainerRef;
|
|
2313
|
-
}
|
|
2314
|
-
FormSubmittingDirective.prototype.ngAfterViewInit = function () {
|
|
2315
|
-
var _this = this;
|
|
2316
|
-
this.subscription = this.formDirective.submitting$.pipe(operators.distinctUntilChanged(), operators.tap(function (loading) {
|
|
2317
|
-
_this.viewContainerRef.clear();
|
|
2318
|
-
if (loading) {
|
|
2319
|
-
_this.viewContainerRef.createEmbeddedView(_this.template);
|
|
2320
|
-
}
|
|
2321
|
-
})).subscribe();
|
|
2322
|
-
};
|
|
2323
|
-
FormSubmittingDirective.prototype.ngOnDestroy = function () {
|
|
2324
|
-
var _a;
|
|
2325
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2326
|
-
};
|
|
2327
|
-
return FormSubmittingDirective;
|
|
2328
|
-
}());
|
|
2329
|
-
FormSubmittingDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmittingDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2330
|
-
FormSubmittingDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmittingDirective, selector: "[rxapFormSubmitting]", ngImport: i0__namespace });
|
|
2331
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmittingDirective, decorators: [{
|
|
2332
|
-
type: i0.Directive,
|
|
2333
|
-
args: [{
|
|
2334
|
-
selector: '[rxapFormSubmitting]'
|
|
2335
|
-
}]
|
|
2336
|
-
}], ctorParameters: function () {
|
|
2337
|
-
return [{ type: FormDirective, decorators: [{
|
|
2338
|
-
type: i0.Inject,
|
|
2339
|
-
args: [FormDirective]
|
|
2340
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2341
|
-
type: i0.Inject,
|
|
2342
|
-
args: [i0.TemplateRef]
|
|
2343
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2344
|
-
type: i0.Inject,
|
|
2345
|
-
args: [i0.ViewContainerRef]
|
|
2346
|
-
}] }];
|
|
2347
|
-
} });
|
|
2348
|
-
|
|
2349
|
-
var FormLoadedDirective = /** @class */ (function () {
|
|
2350
|
-
function FormLoadedDirective(formDirective, template, viewContainerRef) {
|
|
2351
|
-
this.formDirective = formDirective;
|
|
2352
|
-
this.template = template;
|
|
2353
|
-
this.viewContainerRef = viewContainerRef;
|
|
2354
|
-
}
|
|
2355
|
-
FormLoadedDirective.prototype.ngAfterViewInit = function () {
|
|
2356
|
-
var _this = this;
|
|
2357
|
-
this.subscription = this.formDirective.loaded$.pipe(operators.distinctUntilChanged(), operators.tap(function (loading) {
|
|
2358
|
-
_this.viewContainerRef.clear();
|
|
2359
|
-
if (loading) {
|
|
2360
|
-
_this.viewContainerRef.createEmbeddedView(_this.template);
|
|
2361
|
-
}
|
|
2362
|
-
})).subscribe();
|
|
2363
|
-
};
|
|
2364
|
-
FormLoadedDirective.prototype.ngOnDestroy = function () {
|
|
2365
|
-
var _a;
|
|
2366
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2367
|
-
};
|
|
2368
|
-
return FormLoadedDirective;
|
|
2369
|
-
}());
|
|
2370
|
-
FormLoadedDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormLoadedDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2371
|
-
FormLoadedDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormLoadedDirective, selector: "[rxapFormLoaded]", ngImport: i0__namespace });
|
|
2372
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormLoadedDirective, decorators: [{
|
|
2373
|
-
type: i0.Directive,
|
|
2374
|
-
args: [{
|
|
2375
|
-
selector: '[rxapFormLoaded]'
|
|
2376
|
-
}]
|
|
2377
|
-
}], ctorParameters: function () {
|
|
2378
|
-
return [{ type: FormDirective, decorators: [{
|
|
2379
|
-
type: i0.Inject,
|
|
2380
|
-
args: [FormDirective]
|
|
2381
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2382
|
-
type: i0.Inject,
|
|
2383
|
-
args: [i0.TemplateRef]
|
|
2384
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2385
|
-
type: i0.Inject,
|
|
2386
|
-
args: [i0.ViewContainerRef]
|
|
2387
|
-
}] }];
|
|
2388
|
-
} });
|
|
2389
|
-
|
|
2390
|
-
var FormLoadingErrorDirective = /** @class */ (function () {
|
|
2391
|
-
function FormLoadingErrorDirective(formDirective, template, viewContainerRef) {
|
|
2392
|
-
this.formDirective = formDirective;
|
|
2393
|
-
this.template = template;
|
|
2394
|
-
this.viewContainerRef = viewContainerRef;
|
|
2395
|
-
}
|
|
2396
|
-
FormLoadingErrorDirective.prototype.ngAfterViewInit = function () {
|
|
2397
|
-
var _this = this;
|
|
2398
|
-
this.subscription = this.formDirective.loadingError$.pipe(operators.tap(function (error) {
|
|
2399
|
-
_this.viewContainerRef.clear();
|
|
2400
|
-
if (error !== null) {
|
|
2401
|
-
_this.viewContainerRef.createEmbeddedView(_this.template, { $implicit: error });
|
|
2402
|
-
}
|
|
2403
|
-
})).subscribe();
|
|
2404
|
-
};
|
|
2405
|
-
FormLoadingErrorDirective.prototype.ngOnDestroy = function () {
|
|
2406
|
-
var _a;
|
|
2407
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2408
|
-
};
|
|
2409
|
-
return FormLoadingErrorDirective;
|
|
2410
|
-
}());
|
|
2411
|
-
FormLoadingErrorDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormLoadingErrorDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2412
|
-
FormLoadingErrorDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormLoadingErrorDirective, selector: "[rxapFormLoadingError]", ngImport: i0__namespace });
|
|
2413
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormLoadingErrorDirective, decorators: [{
|
|
2414
|
-
type: i0.Directive,
|
|
2415
|
-
args: [{
|
|
2416
|
-
selector: '[rxapFormLoadingError]'
|
|
2417
|
-
}]
|
|
2418
|
-
}], ctorParameters: function () {
|
|
2419
|
-
return [{ type: FormDirective, decorators: [{
|
|
2420
|
-
type: i0.Inject,
|
|
2421
|
-
args: [FormDirective]
|
|
2422
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2423
|
-
type: i0.Inject,
|
|
2424
|
-
args: [i0.TemplateRef]
|
|
2425
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2426
|
-
type: i0.Inject,
|
|
2427
|
-
args: [i0.ViewContainerRef]
|
|
2428
|
-
}] }];
|
|
2429
|
-
} });
|
|
2430
|
-
|
|
2431
|
-
/**
|
|
2432
|
-
* @deprecated removed
|
|
2433
|
-
*/
|
|
2434
|
-
var FormControlErrorDirective = /** @class */ (function () {
|
|
2435
|
-
function FormControlErrorDirective(template, parent, viewContainerRef) {
|
|
2436
|
-
this.template = template;
|
|
2437
|
-
this.parent = parent;
|
|
2438
|
-
this.viewContainerRef = viewContainerRef;
|
|
2439
|
-
}
|
|
2440
|
-
FormControlErrorDirective.prototype.ngOnInit = function () {
|
|
2441
|
-
var _this = this;
|
|
2442
|
-
var _a;
|
|
2443
|
-
var control = (_a = this.parent.control) === null || _a === void 0 ? void 0 : _a.get(this.name);
|
|
2444
|
-
if (!control) {
|
|
2445
|
-
throw new Error('Could not extract form control instance');
|
|
2446
|
-
}
|
|
2447
|
-
this.subscription = control.statusChanges.pipe(operators.startWith(control.status), operators.filter(function (status) { return status === 'INVALID'; }), operators.tap(function () {
|
|
2448
|
-
_this.viewContainerRef.clear();
|
|
2449
|
-
if (control.hasError(_this.errorKey)) {
|
|
2450
|
-
_this.viewContainerRef.createEmbeddedView(_this.template, { $implicit: control.getError(_this.errorKey) });
|
|
2451
|
-
}
|
|
2452
|
-
})).subscribe();
|
|
2453
|
-
};
|
|
2454
|
-
FormControlErrorDirective.prototype.ngOnDestroy = function () {
|
|
2455
|
-
var _a;
|
|
2456
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2457
|
-
};
|
|
2458
|
-
return FormControlErrorDirective;
|
|
2459
|
-
}());
|
|
2460
|
-
FormControlErrorDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlErrorDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: i1__namespace.ControlContainer, host: true, skipSelf: true }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2461
|
-
FormControlErrorDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormControlErrorDirective, selector: "[rxapFormControlError]", inputs: { name: ["rxapFormControlErrorFrom", "name"], errorKey: ["rxapFormControlErrorIf", "errorKey"] }, ngImport: i0__namespace });
|
|
2462
|
-
__decorate([
|
|
2463
|
-
utilities.Required,
|
|
2464
|
-
__metadata("design:type", String)
|
|
2465
|
-
], FormControlErrorDirective.prototype, "name", void 0);
|
|
2466
|
-
__decorate([
|
|
2467
|
-
utilities.Required,
|
|
2468
|
-
__metadata("design:type", String)
|
|
2469
|
-
], FormControlErrorDirective.prototype, "errorKey", void 0);
|
|
2470
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlErrorDirective, decorators: [{
|
|
2471
|
-
type: i0.Directive,
|
|
2472
|
-
args: [{
|
|
2473
|
-
selector: '[rxapFormControlError]'
|
|
2474
|
-
}]
|
|
2475
|
-
}], ctorParameters: function () {
|
|
2476
|
-
return [{ type: i0__namespace.TemplateRef }, { type: i1__namespace.ControlContainer, decorators: [{
|
|
2477
|
-
type: i0.Host
|
|
2478
|
-
}, {
|
|
2479
|
-
type: i0.SkipSelf
|
|
2480
|
-
}] }, { type: i0__namespace.ViewContainerRef }];
|
|
2481
|
-
}, propDecorators: { name: [{
|
|
2482
|
-
type: i0.Input,
|
|
2483
|
-
args: ['rxapFormControlErrorFrom']
|
|
2484
|
-
}], errorKey: [{
|
|
2485
|
-
type: i0.Input,
|
|
2486
|
-
args: ['rxapFormControlErrorIf']
|
|
2487
|
-
}] } });
|
|
2488
|
-
|
|
2489
|
-
var FormControlMarkDirtyDirective = /** @class */ (function () {
|
|
2490
|
-
function FormControlMarkDirtyDirective(parent) {
|
|
2491
|
-
this.parent = parent;
|
|
2492
|
-
}
|
|
2493
|
-
FormControlMarkDirtyDirective.prototype.onClick = function () {
|
|
2494
|
-
var control = this.parent.control;
|
|
2495
|
-
if (control && utilities.hasIndexSignature(control) && typeof control['markAllAsDirty'] === 'function') {
|
|
2496
|
-
control.markAllAsDirty();
|
|
2497
|
-
}
|
|
2498
|
-
else {
|
|
2499
|
-
control === null || control === void 0 ? void 0 : control.markAsDirty();
|
|
2500
|
-
}
|
|
2501
|
-
};
|
|
2502
|
-
return FormControlMarkDirtyDirective;
|
|
2503
|
-
}());
|
|
2504
|
-
FormControlMarkDirtyDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkDirtyDirective, deps: [{ token: i1__namespace.ControlContainer }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2505
|
-
FormControlMarkDirtyDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormControlMarkDirtyDirective, selector: "[rxapFormControlMarkDirty]", host: { listeners: { "click": "onClick()" } }, ngImport: i0__namespace });
|
|
2506
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkDirtyDirective, decorators: [{
|
|
2507
|
-
type: i0.Directive,
|
|
2508
|
-
args: [{
|
|
2509
|
-
selector: '[rxapFormControlMarkDirty]'
|
|
2510
|
-
}]
|
|
2511
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2512
|
-
type: i0.HostListener,
|
|
2513
|
-
args: ['click']
|
|
2514
|
-
}] } });
|
|
2515
|
-
|
|
2516
|
-
var FormControlMarkTouchedDirective = /** @class */ (function () {
|
|
2517
|
-
function FormControlMarkTouchedDirective(parent) {
|
|
2518
|
-
this.parent = parent;
|
|
2519
|
-
}
|
|
2520
|
-
FormControlMarkTouchedDirective.prototype.onClick = function () {
|
|
2521
|
-
var _a;
|
|
2522
|
-
(_a = this.parent.control) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
|
|
2523
|
-
};
|
|
2524
|
-
return FormControlMarkTouchedDirective;
|
|
2525
|
-
}());
|
|
2526
|
-
FormControlMarkTouchedDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkTouchedDirective, deps: [{ token: i1__namespace.ControlContainer }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2527
|
-
FormControlMarkTouchedDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormControlMarkTouchedDirective, selector: "[rxapFormControlMarkTouched]", host: { listeners: { "click": "onClick()" } }, ngImport: i0__namespace });
|
|
2528
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkTouchedDirective, decorators: [{
|
|
2529
|
-
type: i0.Directive,
|
|
2530
|
-
args: [{
|
|
2531
|
-
selector: '[rxapFormControlMarkTouched]'
|
|
2532
|
-
}]
|
|
2533
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2534
|
-
type: i0.HostListener,
|
|
2535
|
-
args: ['click']
|
|
2536
|
-
}] } });
|
|
2537
|
-
|
|
2538
|
-
var FormControlMarkUntouchedDirective = /** @class */ (function () {
|
|
2539
|
-
function FormControlMarkUntouchedDirective(parent) {
|
|
2540
|
-
this.parent = parent;
|
|
2541
|
-
}
|
|
2542
|
-
FormControlMarkUntouchedDirective.prototype.onClick = function () {
|
|
2543
|
-
var control = this.parent.control;
|
|
2544
|
-
if (control && utilities.hasIndexSignature(control) && typeof control['markAllAsUntouched'] === 'function') {
|
|
2545
|
-
control.markAllAsUntouched();
|
|
2546
|
-
}
|
|
2547
|
-
else {
|
|
2548
|
-
control === null || control === void 0 ? void 0 : control.markAsUntouched();
|
|
2549
|
-
}
|
|
2550
|
-
};
|
|
2551
|
-
return FormControlMarkUntouchedDirective;
|
|
2552
|
-
}());
|
|
2553
|
-
FormControlMarkUntouchedDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkUntouchedDirective, deps: [{ token: i1__namespace.ControlContainer }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2554
|
-
FormControlMarkUntouchedDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormControlMarkUntouchedDirective, selector: "[rxapFormControlMarkUntouched]", host: { listeners: { "click": "onClick()" } }, ngImport: i0__namespace });
|
|
2555
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkUntouchedDirective, decorators: [{
|
|
2556
|
-
type: i0.Directive,
|
|
2557
|
-
args: [{
|
|
2558
|
-
selector: '[rxapFormControlMarkUntouched]'
|
|
2559
|
-
}]
|
|
2560
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2561
|
-
type: i0.HostListener,
|
|
2562
|
-
args: ['click']
|
|
2563
|
-
}] } });
|
|
2564
|
-
|
|
2565
|
-
var FormControlMarkPristineDirective = /** @class */ (function () {
|
|
2566
|
-
function FormControlMarkPristineDirective(parent) {
|
|
2567
|
-
this.parent = parent;
|
|
2568
|
-
}
|
|
2569
|
-
FormControlMarkPristineDirective.prototype.onClick = function () {
|
|
2570
|
-
var control = this.parent.control;
|
|
2571
|
-
if (control && utilities.hasIndexSignature(control) && typeof control['markAllAsPristine'] === 'function') {
|
|
2572
|
-
control.markAllAsPristine();
|
|
2573
|
-
}
|
|
2574
|
-
else {
|
|
2575
|
-
control === null || control === void 0 ? void 0 : control.markAsPristine();
|
|
2576
|
-
}
|
|
2577
|
-
};
|
|
2578
|
-
return FormControlMarkPristineDirective;
|
|
2579
|
-
}());
|
|
2580
|
-
FormControlMarkPristineDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkPristineDirective, deps: [{ token: i1__namespace.ControlContainer }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2581
|
-
FormControlMarkPristineDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormControlMarkPristineDirective, selector: "[rxapFormControlMarkPristine]", host: { listeners: { "click": "onClick()" } }, ngImport: i0__namespace });
|
|
2582
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlMarkPristineDirective, decorators: [{
|
|
2583
|
-
type: i0.Directive,
|
|
2584
|
-
args: [{
|
|
2585
|
-
selector: '[rxapFormControlMarkPristine]'
|
|
2586
|
-
}]
|
|
2587
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2588
|
-
type: i0.HostListener,
|
|
2589
|
-
args: ['click']
|
|
2590
|
-
}] } });
|
|
2591
|
-
|
|
2592
|
-
var FormSubmitDirective = /** @class */ (function (_super) {
|
|
2593
|
-
__extends(FormSubmitDirective, _super);
|
|
2594
|
-
function FormSubmitDirective(formDirective, router) {
|
|
2595
|
-
if (router === void 0) { router = null; }
|
|
2596
|
-
var _this = _super.call(this) || this;
|
|
2597
|
-
_this.formDirective = formDirective;
|
|
2598
|
-
_this.router = router;
|
|
2599
|
-
_this.type = 'button';
|
|
2600
|
-
_this.afterSubmit = new i0.EventEmitter();
|
|
2601
|
-
_this._resetAfterSubmit = false;
|
|
2602
|
-
return _this;
|
|
2603
|
-
}
|
|
2604
|
-
Object.defineProperty(FormSubmitDirective.prototype, "resetAfterSubmit", {
|
|
2605
|
-
set: function (value) {
|
|
2606
|
-
this._resetAfterSubmit = utilities.coerceBoolean(value);
|
|
2607
|
-
},
|
|
2608
|
-
enumerable: false,
|
|
2609
|
-
configurable: true
|
|
2610
|
-
});
|
|
2611
|
-
FormSubmitDirective.prototype.execute = function () {
|
|
2612
|
-
var _this = this;
|
|
2613
|
-
this.subscription = this.formDirective.rxapSubmit.pipe(operators.take(1), operators.tap(function (event) {
|
|
2614
|
-
_this.afterSubmit.emit(event);
|
|
2615
|
-
if (_this._resetAfterSubmit) {
|
|
2616
|
-
_this.formDirective.reset();
|
|
2617
|
-
}
|
|
2618
|
-
if (_this.navigateAfterSubmit) {
|
|
2619
|
-
if (!_this.router) {
|
|
2620
|
-
throw new Error('Could not resolve the router!');
|
|
2621
|
-
}
|
|
2622
|
-
return _this.router.navigate(_this.navigateAfterSubmit);
|
|
2623
|
-
}
|
|
2624
|
-
return Promise.resolve();
|
|
2625
|
-
})).subscribe();
|
|
2626
|
-
this.formDirective.onSubmit(new Event('submit'));
|
|
2627
|
-
};
|
|
2628
|
-
FormSubmitDirective.prototype.ngOnDestroy = function () {
|
|
2629
|
-
var _a;
|
|
2630
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2631
|
-
};
|
|
2632
|
-
return FormSubmitDirective;
|
|
2633
|
-
}(directives.ConfirmClick));
|
|
2634
|
-
FormSubmitDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitDirective, deps: [{ token: FormDirective }, { token: i2$1.Router, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2635
|
-
FormSubmitDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmitDirective, selector: "[rxapFormSubmit]", inputs: { type: "type", resetAfterSubmit: "resetAfterSubmit", navigateAfterSubmit: "navigateAfterSubmit" }, outputs: { afterSubmit: "afterSubmit" }, host: { listeners: { "click": "onClick()", "confirmed": "onConfirm()" }, properties: { "type": "this.type" } }, usesInheritance: true, ngImport: i0__namespace });
|
|
2636
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitDirective, decorators: [{
|
|
2637
|
-
type: i0.Directive,
|
|
2638
|
-
args: [{
|
|
2639
|
-
selector: '[rxapFormSubmit]',
|
|
2640
|
-
host: {
|
|
2641
|
-
'(click)': 'onClick()',
|
|
2642
|
-
'(confirmed)': 'onConfirm()',
|
|
2643
|
-
}
|
|
2644
|
-
}]
|
|
2645
|
-
}], ctorParameters: function () {
|
|
2646
|
-
return [{ type: FormDirective, decorators: [{
|
|
2647
|
-
type: i0.Inject,
|
|
2648
|
-
args: [FormDirective]
|
|
2649
|
-
}] }, { type: i2__namespace$1.Router, decorators: [{
|
|
2650
|
-
type: i0.Optional
|
|
2651
|
-
}, {
|
|
2652
|
-
type: i0.Inject,
|
|
2653
|
-
args: [i2$1.Router]
|
|
2654
|
-
}] }];
|
|
2655
|
-
}, propDecorators: { type: [{
|
|
2656
|
-
type: i0.HostBinding,
|
|
2657
|
-
args: ['type']
|
|
2658
|
-
}, {
|
|
2659
|
-
type: i0.Input
|
|
2660
|
-
}], resetAfterSubmit: [{
|
|
2661
|
-
type: i0.Input,
|
|
2662
|
-
args: ['resetAfterSubmit']
|
|
2663
|
-
}], navigateAfterSubmit: [{
|
|
2664
|
-
type: i0.Input
|
|
2665
|
-
}], afterSubmit: [{
|
|
2666
|
-
type: i0.Output
|
|
2667
|
-
}] } });
|
|
2668
|
-
|
|
2669
|
-
/**
|
|
2670
|
-
* A full exertion of FormGroupName from @angular/forms. The only change is the
|
|
2671
|
-
* ability to access the control container outside of the current component
|
|
2672
|
-
*
|
|
2673
|
-
* @deprecated use the ParentControlContainerDirective
|
|
2674
|
-
*/
|
|
2675
|
-
var FormGroupNameDirective = /** @class */ (function (_super) {
|
|
2676
|
-
__extends(FormGroupNameDirective, _super);
|
|
2677
|
-
function FormGroupNameDirective(parent, validators, asyncValidators) {
|
|
2678
|
-
return _super.call(this, parent, validators, asyncValidators) || this;
|
|
2679
|
-
}
|
|
2680
|
-
Object.defineProperty(FormGroupNameDirective.prototype, "control", {
|
|
2681
|
-
get: function () {
|
|
2682
|
-
// TODO : add type check
|
|
2683
|
-
return this.formDirective.getFormGroup(this);
|
|
2684
|
-
},
|
|
2685
|
-
enumerable: false,
|
|
2686
|
-
configurable: true
|
|
2687
|
-
});
|
|
2688
|
-
return FormGroupNameDirective;
|
|
2689
|
-
}(i1.FormGroupName));
|
|
2690
|
-
FormGroupNameDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormGroupNameDirective, deps: [{ token: i1__namespace.ControlContainer, optional: true, skipSelf: true }, { token: i1.NG_VALIDATORS, optional: true, self: true }, { token: i1.NG_ASYNC_VALIDATORS, optional: true, self: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2691
|
-
FormGroupNameDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormGroupNameDirective, selector: "[rxapFormGroupName]", inputs: { name: ["rxapFormGroupName", "name"] }, providers: [
|
|
2692
|
-
{
|
|
2693
|
-
provide: i1.ControlContainer,
|
|
2694
|
-
useExisting: i0.forwardRef(function () { return FormGroupNameDirective; })
|
|
2695
|
-
}
|
|
2696
|
-
], exportAs: ["rxapFormGroup"], usesInheritance: true, ngImport: i0__namespace });
|
|
2697
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormGroupNameDirective, decorators: [{
|
|
2698
|
-
type: i0.Directive,
|
|
2699
|
-
args: [{
|
|
2700
|
-
selector: '[rxapFormGroupName]',
|
|
2701
|
-
providers: [
|
|
2702
|
-
{
|
|
2703
|
-
provide: i1.ControlContainer,
|
|
2704
|
-
useExisting: i0.forwardRef(function () { return FormGroupNameDirective; })
|
|
2705
|
-
}
|
|
2706
|
-
],
|
|
2707
|
-
exportAs: 'rxapFormGroup'
|
|
2708
|
-
}]
|
|
2709
|
-
}], ctorParameters: function () {
|
|
2710
|
-
return [{ type: i1__namespace.ControlContainer, decorators: [{
|
|
2711
|
-
type: i0.Optional
|
|
2712
|
-
}, {
|
|
2713
|
-
type: i0.SkipSelf
|
|
2714
|
-
}] }, { type: undefined, decorators: [{
|
|
2715
|
-
type: i0.Optional
|
|
2716
|
-
}, {
|
|
2717
|
-
type: i0.Self
|
|
2718
|
-
}, {
|
|
2719
|
-
type: i0.Inject,
|
|
2720
|
-
args: [i1.NG_VALIDATORS]
|
|
2721
|
-
}] }, { type: undefined, decorators: [{
|
|
2722
|
-
type: i0.Optional
|
|
2723
|
-
}, {
|
|
2724
|
-
type: i0.Self
|
|
2725
|
-
}, {
|
|
2726
|
-
type: i0.Inject,
|
|
2727
|
-
args: [i1.NG_ASYNC_VALIDATORS]
|
|
2728
|
-
}] }];
|
|
2729
|
-
}, propDecorators: { name: [{
|
|
2730
|
-
type: i0.Input,
|
|
2731
|
-
args: ['rxapFormGroupName']
|
|
2732
|
-
}] } });
|
|
2733
|
-
|
|
2734
|
-
/**
|
|
2735
|
-
* A full exertion of FormControlName from @angular/forms. The only change is the
|
|
2736
|
-
* ability to access the control container outside of the current component
|
|
2737
|
-
*
|
|
2738
|
-
* @deprecated use the ParentControlContainerDirective
|
|
2739
|
-
*/
|
|
2740
|
-
var FormControlNameDirective = /** @class */ (function (_super) {
|
|
2741
|
-
__extends(FormControlNameDirective, _super);
|
|
2742
|
-
function FormControlNameDirective(parent, validators, asyncValidators, valueAccessors) {
|
|
2743
|
-
return _super.call(this, parent, validators, asyncValidators, valueAccessors, null) || this;
|
|
2744
|
-
}
|
|
2745
|
-
return FormControlNameDirective;
|
|
2746
|
-
}(i1.FormControlName));
|
|
2747
|
-
FormControlNameDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlNameDirective, deps: [{ token: i1__namespace.ControlContainer, optional: true, skipSelf: true }, { token: i1.NG_VALIDATORS, optional: true, self: true }, { token: i1.NG_ASYNC_VALIDATORS, optional: true, self: true }, { token: i1.NG_VALUE_ACCESSOR, optional: true, self: true }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2748
|
-
FormControlNameDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormControlNameDirective, selector: "[rxapFormControlName]", inputs: { name: ["rxapFormControlName", "name"] }, providers: [
|
|
2749
|
-
{
|
|
2750
|
-
provide: i1.NgControl,
|
|
2751
|
-
useExisting: i0.forwardRef(function () { return FormControlNameDirective; })
|
|
2752
|
-
}
|
|
2753
|
-
], exportAs: ["rxapFormControl"], usesInheritance: true, ngImport: i0__namespace });
|
|
2754
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormControlNameDirective, decorators: [{
|
|
2755
|
-
type: i0.Directive,
|
|
2756
|
-
args: [{
|
|
2757
|
-
selector: '[rxapFormControlName]',
|
|
2758
|
-
providers: [
|
|
2759
|
-
{
|
|
2760
|
-
provide: i1.NgControl,
|
|
2761
|
-
useExisting: i0.forwardRef(function () { return FormControlNameDirective; })
|
|
2762
|
-
}
|
|
2763
|
-
],
|
|
2764
|
-
exportAs: 'rxapFormControl'
|
|
2765
|
-
}]
|
|
2766
|
-
}], ctorParameters: function () {
|
|
2767
|
-
return [{ type: i1__namespace.ControlContainer, decorators: [{
|
|
2768
|
-
type: i0.Optional
|
|
2769
|
-
}, {
|
|
2770
|
-
type: i0.SkipSelf
|
|
2771
|
-
}] }, { type: Array, decorators: [{
|
|
2772
|
-
type: i0.Optional
|
|
2773
|
-
}, {
|
|
2774
|
-
type: i0.Self
|
|
2775
|
-
}, {
|
|
2776
|
-
type: i0.Inject,
|
|
2777
|
-
args: [i1.NG_VALIDATORS]
|
|
2778
|
-
}] }, { type: Array, decorators: [{
|
|
2779
|
-
type: i0.Optional
|
|
2780
|
-
}, {
|
|
2781
|
-
type: i0.Self
|
|
2782
|
-
}, {
|
|
2783
|
-
type: i0.Inject,
|
|
2784
|
-
args: [i1.NG_ASYNC_VALIDATORS]
|
|
2785
|
-
}] }, { type: undefined, decorators: [{
|
|
2786
|
-
type: i0.Optional
|
|
2787
|
-
}, {
|
|
2788
|
-
type: i0.Self
|
|
2789
|
-
}, {
|
|
2790
|
-
type: i0.Inject,
|
|
2791
|
-
args: [i1.NG_VALUE_ACCESSOR]
|
|
2792
|
-
}] }];
|
|
2793
|
-
}, propDecorators: { name: [{
|
|
2794
|
-
type: i0.Input,
|
|
2795
|
-
args: ['rxapFormControlName']
|
|
2796
|
-
}] } });
|
|
2797
|
-
|
|
2798
|
-
var ParentControlContainerDirective = /** @class */ (function () {
|
|
2799
|
-
function ParentControlContainerDirective() {
|
|
2800
|
-
}
|
|
2801
|
-
return ParentControlContainerDirective;
|
|
2802
|
-
}());
|
|
2803
|
-
ParentControlContainerDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ParentControlContainerDirective, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2804
|
-
ParentControlContainerDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: ParentControlContainerDirective, selector: "[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]", providers: [
|
|
2805
|
-
{
|
|
2806
|
-
provide: i1.ControlContainer,
|
|
2807
|
-
useExisting: i1.ControlContainer
|
|
2808
|
-
}
|
|
2809
|
-
], ngImport: i0__namespace });
|
|
2810
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: ParentControlContainerDirective, decorators: [{
|
|
2811
|
-
type: i0.Directive,
|
|
2812
|
-
args: [{
|
|
2813
|
-
selector: '[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]',
|
|
2814
|
-
providers: [
|
|
2815
|
-
{
|
|
2816
|
-
provide: i1.ControlContainer,
|
|
2817
|
-
useExisting: i1.ControlContainer
|
|
2818
|
-
}
|
|
2819
|
-
]
|
|
2820
|
-
}]
|
|
2821
|
-
}] });
|
|
2822
|
-
|
|
2823
|
-
var FormSubmitSuccessfulDirective = /** @class */ (function () {
|
|
2824
|
-
function FormSubmitSuccessfulDirective(formDirective, template, viewContainerRef) {
|
|
2825
|
-
this.formDirective = formDirective;
|
|
2826
|
-
this.template = template;
|
|
2827
|
-
this.viewContainerRef = viewContainerRef;
|
|
2828
|
-
}
|
|
2829
|
-
FormSubmitSuccessfulDirective.prototype.ngAfterViewInit = function () {
|
|
2830
|
-
var _this = this;
|
|
2831
|
-
this.subscription = this.formDirective.submitSuccessful$.pipe(operators.tap(function (result) {
|
|
2832
|
-
_this.viewContainerRef.clear();
|
|
2833
|
-
_this.viewContainerRef.createEmbeddedView(_this.template, { $implicit: result });
|
|
2834
|
-
})).subscribe();
|
|
2835
|
-
};
|
|
2836
|
-
FormSubmitSuccessfulDirective.prototype.ngOnDestroy = function () {
|
|
2837
|
-
var _a;
|
|
2838
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2839
|
-
};
|
|
2840
|
-
return FormSubmitSuccessfulDirective;
|
|
2841
|
-
}());
|
|
2842
|
-
FormSubmitSuccessfulDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitSuccessfulDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2843
|
-
FormSubmitSuccessfulDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmitSuccessfulDirective, selector: "[rxapFormSubmitSuccessful]", ngImport: i0__namespace });
|
|
2844
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitSuccessfulDirective, decorators: [{
|
|
2845
|
-
type: i0.Directive,
|
|
2846
|
-
args: [{
|
|
2847
|
-
selector: '[rxapFormSubmitSuccessful]'
|
|
2848
|
-
}]
|
|
2849
|
-
}], ctorParameters: function () {
|
|
2850
|
-
return [{ type: FormDirective, decorators: [{
|
|
2851
|
-
type: i0.Inject,
|
|
2852
|
-
args: [FormDirective]
|
|
2853
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2854
|
-
type: i0.Inject,
|
|
2855
|
-
args: [i0.TemplateRef]
|
|
2856
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2857
|
-
type: i0.Inject,
|
|
2858
|
-
args: [i0.ViewContainerRef]
|
|
2859
|
-
}] }];
|
|
2860
|
-
} });
|
|
2861
|
-
|
|
2862
|
-
var FormSubmitInvalidDirective = /** @class */ (function () {
|
|
2863
|
-
function FormSubmitInvalidDirective(formDirective, template, viewContainerRef) {
|
|
2864
|
-
this.formDirective = formDirective;
|
|
2865
|
-
this.template = template;
|
|
2866
|
-
this.viewContainerRef = viewContainerRef;
|
|
2867
|
-
}
|
|
2868
|
-
FormSubmitInvalidDirective.prototype.ngAfterViewInit = function () {
|
|
2869
|
-
var _this = this;
|
|
2870
|
-
this.subscription = this.formDirective.invalidSubmit.pipe(operators.tap(function (result) {
|
|
2871
|
-
_this.viewContainerRef.clear();
|
|
2872
|
-
_this.viewContainerRef.createEmbeddedView(_this.template, { $implicit: result });
|
|
2873
|
-
})).subscribe();
|
|
2874
|
-
};
|
|
2875
|
-
FormSubmitInvalidDirective.prototype.ngOnDestroy = function () {
|
|
2876
|
-
var _a;
|
|
2877
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2878
|
-
};
|
|
2879
|
-
return FormSubmitInvalidDirective;
|
|
2880
|
-
}());
|
|
2881
|
-
FormSubmitInvalidDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitInvalidDirective, deps: [{ token: FormDirective }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
2882
|
-
FormSubmitInvalidDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmitInvalidDirective, selector: "[rxapFormSubmitInvalid]", ngImport: i0__namespace });
|
|
2883
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: FormSubmitInvalidDirective, decorators: [{
|
|
2884
|
-
type: i0.Directive,
|
|
2885
|
-
args: [{
|
|
2886
|
-
selector: '[rxapFormSubmitInvalid]'
|
|
2887
|
-
}]
|
|
2888
|
-
}], ctorParameters: function () {
|
|
2889
|
-
return [{ type: FormDirective, decorators: [{
|
|
2890
|
-
type: i0.Inject,
|
|
2891
|
-
args: [FormDirective]
|
|
2892
|
-
}] }, { type: i0__namespace.TemplateRef, decorators: [{
|
|
2893
|
-
type: i0.Inject,
|
|
2894
|
-
args: [i0.TemplateRef]
|
|
2895
|
-
}] }, { type: i0__namespace.ViewContainerRef, decorators: [{
|
|
2896
|
-
type: i0.Inject,
|
|
2897
|
-
args: [i0.ViewContainerRef]
|
|
2898
|
-
}] }];
|
|
2899
|
-
} });
|
|
2900
|
-
|
|
2901
|
-
var RxapFormsModule = /** @class */ (function () {
|
|
2902
|
-
function RxapFormsModule() {
|
|
2903
|
-
}
|
|
2904
|
-
return RxapFormsModule;
|
|
2905
|
-
}());
|
|
2906
|
-
RxapFormsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RxapFormsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2907
|
-
RxapFormsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RxapFormsModule, declarations: [FormDirective,
|
|
2908
|
-
FormSubmitFailedDirective,
|
|
2909
|
-
FormLoadingDirective,
|
|
2910
|
-
FormSubmittingDirective,
|
|
2911
|
-
FormLoadingErrorDirective,
|
|
2912
|
-
FormLoadedDirective,
|
|
2913
|
-
FormControlErrorDirective,
|
|
2914
|
-
FormControlMarkDirtyDirective,
|
|
2915
|
-
FormControlMarkTouchedDirective,
|
|
2916
|
-
FormControlMarkUntouchedDirective,
|
|
2917
|
-
FormControlMarkPristineDirective,
|
|
2918
|
-
FormSubmitDirective,
|
|
2919
|
-
FormGroupNameDirective,
|
|
2920
|
-
FormControlNameDirective,
|
|
2921
|
-
ParentControlContainerDirective,
|
|
2922
|
-
FormSubmitSuccessfulDirective,
|
|
2923
|
-
FormSubmitInvalidDirective], exports: [FormDirective,
|
|
2924
|
-
FormSubmitFailedDirective,
|
|
2925
|
-
FormLoadingDirective,
|
|
2926
|
-
FormSubmittingDirective,
|
|
2927
|
-
FormLoadingErrorDirective,
|
|
2928
|
-
FormLoadedDirective,
|
|
2929
|
-
FormControlErrorDirective,
|
|
2930
|
-
FormControlMarkDirtyDirective,
|
|
2931
|
-
FormControlMarkTouchedDirective,
|
|
2932
|
-
FormControlMarkUntouchedDirective,
|
|
2933
|
-
FormControlMarkPristineDirective,
|
|
2934
|
-
FormSubmitDirective,
|
|
2935
|
-
FormGroupNameDirective,
|
|
2936
|
-
FormControlNameDirective,
|
|
2937
|
-
ParentControlContainerDirective,
|
|
2938
|
-
FormSubmitSuccessfulDirective,
|
|
2939
|
-
FormSubmitInvalidDirective] });
|
|
2940
|
-
RxapFormsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RxapFormsModule });
|
|
2941
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: RxapFormsModule, decorators: [{
|
|
2942
|
-
type: i0.NgModule,
|
|
2943
|
-
args: [{
|
|
2944
|
-
declarations: [
|
|
2945
|
-
FormDirective,
|
|
2946
|
-
FormSubmitFailedDirective,
|
|
2947
|
-
FormLoadingDirective,
|
|
2948
|
-
FormSubmittingDirective,
|
|
2949
|
-
FormLoadingErrorDirective,
|
|
2950
|
-
FormLoadedDirective,
|
|
2951
|
-
FormControlErrorDirective,
|
|
2952
|
-
FormControlMarkDirtyDirective,
|
|
2953
|
-
FormControlMarkTouchedDirective,
|
|
2954
|
-
FormControlMarkUntouchedDirective,
|
|
2955
|
-
FormControlMarkPristineDirective,
|
|
2956
|
-
FormSubmitDirective,
|
|
2957
|
-
FormGroupNameDirective,
|
|
2958
|
-
FormControlNameDirective,
|
|
2959
|
-
ParentControlContainerDirective,
|
|
2960
|
-
FormSubmitSuccessfulDirective,
|
|
2961
|
-
FormSubmitInvalidDirective,
|
|
2962
|
-
],
|
|
2963
|
-
exports: [
|
|
2964
|
-
FormDirective,
|
|
2965
|
-
FormSubmitFailedDirective,
|
|
2966
|
-
FormLoadingDirective,
|
|
2967
|
-
FormSubmittingDirective,
|
|
2968
|
-
FormLoadingErrorDirective,
|
|
2969
|
-
FormLoadedDirective,
|
|
2970
|
-
FormControlErrorDirective,
|
|
2971
|
-
FormControlMarkDirtyDirective,
|
|
2972
|
-
FormControlMarkTouchedDirective,
|
|
2973
|
-
FormControlMarkUntouchedDirective,
|
|
2974
|
-
FormControlMarkPristineDirective,
|
|
2975
|
-
FormSubmitDirective,
|
|
2976
|
-
FormGroupNameDirective,
|
|
2977
|
-
FormControlNameDirective,
|
|
2978
|
-
ParentControlContainerDirective,
|
|
2979
|
-
FormSubmitSuccessfulDirective,
|
|
2980
|
-
FormSubmitInvalidDirective,
|
|
2981
|
-
]
|
|
2982
|
-
}]
|
|
2983
|
-
}] });
|
|
2984
|
-
|
|
2985
|
-
function ToFormMethod(call) {
|
|
2986
|
-
return { call: call };
|
|
2987
|
-
}
|
|
2988
|
-
/**
|
|
2989
|
-
* @deprecated use ToFormMethod instead
|
|
2990
|
-
*
|
|
2991
|
-
* @param call the call method implementation
|
|
2992
|
-
*/
|
|
2993
|
-
function ToFormSubmitMethod(call) {
|
|
2994
|
-
return ToFormMethod(call);
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
/**
|
|
2998
|
-
* Checks if a given value is a number.
|
|
2999
|
-
*/
|
|
3000
|
-
function isNumber(value, options) {
|
|
3001
|
-
if (options === void 0) { options = {}; }
|
|
3002
|
-
var _a, _b;
|
|
3003
|
-
if (typeof value !== 'number') {
|
|
3004
|
-
return false;
|
|
3005
|
-
}
|
|
3006
|
-
if (value === Infinity || value === -Infinity) {
|
|
3007
|
-
return (_a = options.allowInfinity) !== null && _a !== void 0 ? _a : false;
|
|
3008
|
-
}
|
|
3009
|
-
if (Number.isNaN(value)) {
|
|
3010
|
-
return (_b = options.allowNaN) !== null && _b !== void 0 ? _b : false;
|
|
3011
|
-
}
|
|
3012
|
-
if (options.maxDecimalPlaces !== undefined) {
|
|
3013
|
-
var decimalPlaces = 0;
|
|
3014
|
-
if (value % 1 !== 0) {
|
|
3015
|
-
decimalPlaces = value.toString().split('.')[1].length;
|
|
3016
|
-
}
|
|
3017
|
-
if (decimalPlaces > options.maxDecimalPlaces) {
|
|
3018
|
-
return false;
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
return Number.isFinite(value);
|
|
3022
|
-
}
|
|
3023
|
-
/**
|
|
3024
|
-
* @deprecated use RxapValidators.isNumber() instead
|
|
3025
|
-
* @param control
|
|
3026
|
-
* @constructor
|
|
3027
|
-
*/
|
|
3028
|
-
function IsNumber(control) {
|
|
3029
|
-
if (control.value === null) {
|
|
3030
|
-
return null;
|
|
3031
|
-
}
|
|
3032
|
-
if (isNaN(Number(control.value))) {
|
|
3033
|
-
return { isNumber: { expected: 'A number or a string representing a number', actual: control.value } };
|
|
3034
|
-
}
|
|
3035
|
-
return null;
|
|
3036
|
-
}
|
|
3037
|
-
function _IsNumber(_c) {
|
|
3038
|
-
var _d = _c === void 0 ? {} : _c, message = _d.message, options = _d.options;
|
|
3039
|
-
return function (control) {
|
|
3040
|
-
if (control.value === null) {
|
|
3041
|
-
return null;
|
|
3042
|
-
}
|
|
3043
|
-
if (!isNumber(!(options === null || options === void 0 ? void 0 : options.strict) && typeof control.value === 'string' ? Number(control.value) : control.value, options)) {
|
|
3044
|
-
return {
|
|
3045
|
-
isNumber: {
|
|
3046
|
-
expected: 'A number value',
|
|
3047
|
-
actual: control.value,
|
|
3048
|
-
message: message
|
|
3049
|
-
}
|
|
3050
|
-
};
|
|
3051
|
-
}
|
|
3052
|
-
return null;
|
|
3053
|
-
};
|
|
3054
|
-
}
|
|
3055
|
-
|
|
3056
|
-
function IsBoolean(_a) {
|
|
3057
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message;
|
|
3058
|
-
return function (control) {
|
|
3059
|
-
if (control.value === null) {
|
|
3060
|
-
return null;
|
|
3061
|
-
}
|
|
3062
|
-
if (!(control.value instanceof Boolean || typeof control.value === 'boolean')) {
|
|
3063
|
-
return {
|
|
3064
|
-
isBoolean: {
|
|
3065
|
-
expected: 'A boolean value',
|
|
3066
|
-
actual: control.value,
|
|
3067
|
-
message: message
|
|
3068
|
-
}
|
|
3069
|
-
};
|
|
3070
|
-
}
|
|
3071
|
-
return null;
|
|
3072
|
-
};
|
|
3073
|
-
}
|
|
3074
|
-
|
|
3075
|
-
function IsObject(_a) {
|
|
3076
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message;
|
|
3077
|
-
return function (control) {
|
|
3078
|
-
if (control.value === null) {
|
|
3079
|
-
return null;
|
|
3080
|
-
}
|
|
3081
|
-
if (!(control.value !== undefined && (typeof control.value === 'object' || typeof control.value === 'function') && !Array.isArray(control.value))) {
|
|
3082
|
-
return {
|
|
3083
|
-
isObject: {
|
|
3084
|
-
expected: 'A object value',
|
|
3085
|
-
actual: control.value,
|
|
3086
|
-
message: message
|
|
3087
|
-
}
|
|
3088
|
-
};
|
|
3089
|
-
}
|
|
3090
|
-
return null;
|
|
3091
|
-
};
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
|
-
function IsString(_a) {
|
|
3095
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message;
|
|
3096
|
-
return function (control) {
|
|
3097
|
-
if (control.value === null) {
|
|
3098
|
-
return null;
|
|
3099
|
-
}
|
|
3100
|
-
if (!(control.value instanceof String || typeof control.value === 'string')) {
|
|
3101
|
-
return {
|
|
3102
|
-
isString: {
|
|
3103
|
-
expected: 'A string value',
|
|
3104
|
-
actual: control.value,
|
|
3105
|
-
message: message
|
|
3106
|
-
}
|
|
3107
|
-
};
|
|
3108
|
-
}
|
|
3109
|
-
return null;
|
|
3110
|
-
};
|
|
3111
|
-
}
|
|
3112
|
-
|
|
3113
|
-
function IsInt(_a) {
|
|
3114
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message, options = _b.options;
|
|
3115
|
-
return function (control) {
|
|
3116
|
-
if (control.value === null) {
|
|
3117
|
-
return null;
|
|
3118
|
-
}
|
|
3119
|
-
if (!isNumber(control.value, options) || Number.isInteger(control.value)) {
|
|
3120
|
-
return {
|
|
3121
|
-
isInt: {
|
|
3122
|
-
expected: 'A int value',
|
|
3123
|
-
actual: control.value,
|
|
3124
|
-
message: message
|
|
3125
|
-
}
|
|
3126
|
-
};
|
|
3127
|
-
}
|
|
3128
|
-
return null;
|
|
3129
|
-
};
|
|
3130
|
-
}
|
|
3131
|
-
|
|
3132
|
-
function IsEnum(_a) {
|
|
3133
|
-
var message = _a.message, entity = _a.entity;
|
|
3134
|
-
return function (control) {
|
|
3135
|
-
if (control.value === null) {
|
|
3136
|
-
return null;
|
|
3137
|
-
}
|
|
3138
|
-
if (Object.keys(entity).map(function (k) { return entity[k]; }).indexOf(control.value) === -1) {
|
|
3139
|
-
return {
|
|
3140
|
-
isEnum: {
|
|
3141
|
-
expected: 'A enum value',
|
|
3142
|
-
actual: control.value,
|
|
3143
|
-
message: message
|
|
3144
|
-
}
|
|
3145
|
-
};
|
|
3146
|
-
}
|
|
3147
|
-
return null;
|
|
3148
|
-
};
|
|
3149
|
-
}
|
|
3150
|
-
|
|
3151
|
-
function IsDate(_a) {
|
|
3152
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message;
|
|
3153
|
-
return function (control) {
|
|
3154
|
-
if (control.value === null) {
|
|
3155
|
-
return null;
|
|
3156
|
-
}
|
|
3157
|
-
if (!(control.value instanceof Date && !isNaN(control.value.getTime()))) {
|
|
3158
|
-
return {
|
|
3159
|
-
isDate: {
|
|
3160
|
-
expected: 'A date value',
|
|
3161
|
-
actual: control.value,
|
|
3162
|
-
message: message
|
|
3163
|
-
}
|
|
3164
|
-
};
|
|
3165
|
-
}
|
|
3166
|
-
return null;
|
|
3167
|
-
};
|
|
3168
|
-
}
|
|
3169
|
-
|
|
3170
|
-
function IsArray(_a) {
|
|
3171
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message;
|
|
3172
|
-
return function (control) {
|
|
3173
|
-
if (control.value === null) {
|
|
3174
|
-
return null;
|
|
3175
|
-
}
|
|
3176
|
-
if (!Array.isArray(control.value)) {
|
|
3177
|
-
return {
|
|
3178
|
-
isArray: {
|
|
3179
|
-
expected: 'A array value',
|
|
3180
|
-
actual: control.value,
|
|
3181
|
-
message: message
|
|
3182
|
-
}
|
|
3183
|
-
};
|
|
3184
|
-
}
|
|
3185
|
-
return null;
|
|
3186
|
-
};
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
|
-
var regexOptions = {
|
|
3190
|
-
uppercase: '.*[A-Z]',
|
|
3191
|
-
special: '.*[^A-Za-z0-9]',
|
|
3192
|
-
digit: '.*[0-9]',
|
|
3193
|
-
lowercase: '.*[a-z]',
|
|
3194
|
-
upperLower: '.*[a-zA-Z]',
|
|
3195
|
-
alphaNumeric: '.*[a-zA-Z0-9]'
|
|
3196
|
-
};
|
|
3197
|
-
var lengthOptions = {
|
|
3198
|
-
min: '.{n,}',
|
|
3199
|
-
max: '.{0,n}',
|
|
3200
|
-
range: '.{min,max}',
|
|
3201
|
-
exact: '.{n}',
|
|
3202
|
-
no_limit: '.*'
|
|
3203
|
-
};
|
|
3204
|
-
function inOperator(k, o) {
|
|
3205
|
-
return k in o;
|
|
3206
|
-
}
|
|
3207
|
-
function create(options) {
|
|
3208
|
-
var e_1, _a;
|
|
3209
|
-
var regex = '^';
|
|
3210
|
-
try {
|
|
3211
|
-
for (var _b = __values(Object.entries(regexOptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3212
|
-
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
3213
|
-
if (inOperator(key, options) && isNumber(options[key])) {
|
|
3214
|
-
regex += '(?=' + value.repeat(options[key]) + ')';
|
|
3215
|
-
}
|
|
3216
|
-
}
|
|
3217
|
-
}
|
|
3218
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3219
|
-
finally {
|
|
3220
|
-
try {
|
|
3221
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3222
|
-
}
|
|
3223
|
-
finally { if (e_1) throw e_1.error; }
|
|
3224
|
-
}
|
|
3225
|
-
if (isNumber(options.min) && isNumber(options.max)) {
|
|
3226
|
-
regex += lengthOptions.range.replace('min', options.min.toFixed(0)).replace('max', options.max.toFixed(0));
|
|
3227
|
-
}
|
|
3228
|
-
else if (isNumber(options.max)) {
|
|
3229
|
-
regex += lengthOptions.max.replace('n', options.max.toFixed(0));
|
|
3230
|
-
}
|
|
3231
|
-
else if (isNumber(options.min)) {
|
|
3232
|
-
regex += lengthOptions.min.replace('n', options.min.toFixed(0));
|
|
3233
|
-
}
|
|
3234
|
-
else if (isNumber(options.exact)) {
|
|
3235
|
-
regex += lengthOptions.exact.replace('n', options.exact.toFixed(0));
|
|
3236
|
-
}
|
|
3237
|
-
else {
|
|
3238
|
-
regex += lengthOptions.no_limit;
|
|
3239
|
-
}
|
|
3240
|
-
regex += '$';
|
|
3241
|
-
return regex;
|
|
3242
|
-
}
|
|
3243
|
-
function check(str, regexStringOrOptions) {
|
|
3244
|
-
var regex;
|
|
3245
|
-
var regexString;
|
|
3246
|
-
if (typeof regexStringOrOptions === 'object') {
|
|
3247
|
-
regexString = create(regexStringOrOptions);
|
|
3248
|
-
}
|
|
3249
|
-
else {
|
|
3250
|
-
regexString = regexStringOrOptions;
|
|
3251
|
-
}
|
|
3252
|
-
regex = new RegExp(regexString);
|
|
3253
|
-
return regex.test(str);
|
|
3254
|
-
}
|
|
3255
|
-
function checkError(str, options) {
|
|
3256
|
-
var e_2, _a, _b;
|
|
3257
|
-
var returnObject = {};
|
|
3258
|
-
try {
|
|
3259
|
-
for (var _c = __values(Object.entries(options)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3260
|
-
var _e = __read(_d.value, 2), key = _e[0], value = _e[1];
|
|
3261
|
-
returnObject[key] = check(str, (_b = {}, _b[key] = value, _b));
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3264
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3265
|
-
finally {
|
|
3266
|
-
try {
|
|
3267
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
3268
|
-
}
|
|
3269
|
-
finally { if (e_2) throw e_2.error; }
|
|
3270
|
-
}
|
|
3271
|
-
return returnObject;
|
|
3272
|
-
}
|
|
3273
|
-
function IsComplex(_a) {
|
|
3274
|
-
var message = _a.message, options = _a.options;
|
|
3275
|
-
return function (control) {
|
|
3276
|
-
if (control.value === null) {
|
|
3277
|
-
return null;
|
|
3278
|
-
}
|
|
3279
|
-
var isNotString = IsString({ message: message })(control);
|
|
3280
|
-
if (isNotString !== null) {
|
|
3281
|
-
return isNotString;
|
|
3282
|
-
}
|
|
3283
|
-
var errors = checkError(control.value, options);
|
|
3284
|
-
if (Object.keys(errors).length && Object.values(errors).some(function (item) { return !item; })) {
|
|
3285
|
-
return {
|
|
3286
|
-
isComplex: {
|
|
3287
|
-
expected: options,
|
|
3288
|
-
actual: errors,
|
|
3289
|
-
message: message
|
|
3290
|
-
}
|
|
3291
|
-
};
|
|
3292
|
-
}
|
|
3293
|
-
return null;
|
|
3294
|
-
};
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
|
-
function IsPhoneNumber(_a) {
|
|
3298
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message, locale = _b.locale, options = _b.options;
|
|
3299
|
-
return function (control) {
|
|
3300
|
-
if (control.value === null) {
|
|
3301
|
-
return null;
|
|
3302
|
-
}
|
|
3303
|
-
if (!validator.isMobilePhone(control.value, locale, options)) {
|
|
3304
|
-
return {
|
|
3305
|
-
isPhoneNumber: {
|
|
3306
|
-
expected: 'A phone number value',
|
|
3307
|
-
actual: control.value,
|
|
3308
|
-
message: message
|
|
3309
|
-
}
|
|
3310
|
-
};
|
|
3311
|
-
}
|
|
3312
|
-
return null;
|
|
3313
|
-
};
|
|
3314
|
-
}
|
|
3315
|
-
|
|
3316
|
-
function IsEmail(_a) {
|
|
3317
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message, options = _b.options;
|
|
3318
|
-
return function (control) {
|
|
3319
|
-
if (control.value === null) {
|
|
3320
|
-
return null;
|
|
3321
|
-
}
|
|
3322
|
-
if (!(typeof control.value === 'string' && validator.isEmail(control.value, options))) {
|
|
3323
|
-
return {
|
|
3324
|
-
isEmail: {
|
|
3325
|
-
expected: 'A email value',
|
|
3326
|
-
actual: control.value,
|
|
3327
|
-
message: message
|
|
3328
|
-
}
|
|
3329
|
-
};
|
|
3330
|
-
}
|
|
3331
|
-
return null;
|
|
3332
|
-
};
|
|
3333
|
-
}
|
|
3334
|
-
|
|
3335
|
-
function IsUrl(_a) {
|
|
3336
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message, options = _b.options;
|
|
3337
|
-
return function (control) {
|
|
3338
|
-
if (control.value === null) {
|
|
3339
|
-
return null;
|
|
3340
|
-
}
|
|
3341
|
-
if (!(typeof control.value === 'string' && validator.isURL(control.value, options))) {
|
|
3342
|
-
return {
|
|
3343
|
-
isURL: {
|
|
3344
|
-
expected: 'A url value',
|
|
3345
|
-
actual: control.value,
|
|
3346
|
-
message: message
|
|
3347
|
-
}
|
|
3348
|
-
};
|
|
3349
|
-
}
|
|
3350
|
-
return null;
|
|
3351
|
-
};
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
function IsIP(_a) {
|
|
3355
|
-
var _b = _a === void 0 ? {} : _a, message = _b.message, version = _b.version;
|
|
3356
|
-
return function (control) {
|
|
3357
|
-
if (control.value === null) {
|
|
3358
|
-
return null;
|
|
3359
|
-
}
|
|
3360
|
-
if (!(typeof control.value === 'string' && validator.isIP(control.value, version))) {
|
|
3361
|
-
return {
|
|
3362
|
-
isIp: {
|
|
3363
|
-
expected: "A valid IPv" + (version !== null && version !== void 0 ? version : '4') + " value",
|
|
3364
|
-
actual: control.value,
|
|
3365
|
-
message: message
|
|
3366
|
-
}
|
|
3367
|
-
};
|
|
3368
|
-
}
|
|
3369
|
-
return null;
|
|
3370
|
-
};
|
|
3371
|
-
}
|
|
3372
|
-
|
|
3373
|
-
var RxapValidators = {
|
|
3374
|
-
IsNumber: _IsNumber,
|
|
3375
|
-
IsBoolean: IsBoolean,
|
|
3376
|
-
IsArray: IsArray,
|
|
3377
|
-
IsDate: IsDate,
|
|
3378
|
-
IsEnum: IsEnum,
|
|
3379
|
-
IsInt: IsInt,
|
|
3380
|
-
IsObject: IsObject,
|
|
3381
|
-
IsString: IsString,
|
|
3382
|
-
IsComplex: IsComplex,
|
|
3383
|
-
IsPhoneNumber: IsPhoneNumber,
|
|
3384
|
-
IsEmail: IsEmail,
|
|
3385
|
-
IsUrl: IsUrl,
|
|
3386
|
-
IsIP: IsIP
|
|
3387
|
-
};
|
|
3388
|
-
|
|
3389
|
-
// endregion
|
|
3390
|
-
|
|
3391
|
-
/**
|
|
3392
|
-
* Generated bundle index. Do not edit.
|
|
3393
|
-
*/
|
|
3394
|
-
|
|
3395
|
-
exports.ControlAsyncValidator = ControlAsyncValidator;
|
|
3396
|
-
exports.ControlChange = ControlChange;
|
|
3397
|
-
exports.ControlSetValue = ControlSetValue;
|
|
3398
|
-
exports.ControlValidator = ControlValidator;
|
|
3399
|
-
exports.ControlValueAccessor = ControlValueAccessor;
|
|
3400
|
-
exports.FormArrayControlManager = FormArrayControlManager;
|
|
3401
|
-
exports.FormControlErrorDirective = FormControlErrorDirective;
|
|
3402
|
-
exports.FormControlMarkDirtyDirective = FormControlMarkDirtyDirective;
|
|
3403
|
-
exports.FormControlMarkPristineDirective = FormControlMarkPristineDirective;
|
|
3404
|
-
exports.FormControlMarkTouchedDirective = FormControlMarkTouchedDirective;
|
|
3405
|
-
exports.FormControlMarkUntouchedDirective = FormControlMarkUntouchedDirective;
|
|
3406
|
-
exports.FormControlNameDirective = FormControlNameDirective;
|
|
3407
|
-
exports.FormDirective = FormDirective;
|
|
3408
|
-
exports.FormGroupNameDirective = FormGroupNameDirective;
|
|
3409
|
-
exports.FormLoadedDirective = FormLoadedDirective;
|
|
3410
|
-
exports.FormLoadingDirective = FormLoadingDirective;
|
|
3411
|
-
exports.FormLoadingErrorDirective = FormLoadingErrorDirective;
|
|
3412
|
-
exports.FormSubmitDirective = FormSubmitDirective;
|
|
3413
|
-
exports.FormSubmitFailedDirective = FormSubmitFailedDirective;
|
|
3414
|
-
exports.FormSubmitInvalidDirective = FormSubmitInvalidDirective;
|
|
3415
|
-
exports.FormSubmitSuccessfulDirective = FormSubmitSuccessfulDirective;
|
|
3416
|
-
exports.FormSubmittingDirective = FormSubmittingDirective;
|
|
3417
|
-
exports.IsArray = IsArray;
|
|
3418
|
-
exports.IsBoolean = IsBoolean;
|
|
3419
|
-
exports.IsDate = IsDate;
|
|
3420
|
-
exports.IsEnum = IsEnum;
|
|
3421
|
-
exports.IsInt = IsInt;
|
|
3422
|
-
exports.IsNumber = IsNumber;
|
|
3423
|
-
exports.IsObject = IsObject;
|
|
3424
|
-
exports.IsString = IsString;
|
|
3425
|
-
exports.ParentControlContainerDirective = ParentControlContainerDirective;
|
|
3426
|
-
exports.RXAP_FORM_CONTEXT = RXAP_FORM_CONTEXT;
|
|
3427
|
-
exports.RXAP_FORM_DEFINITION = RXAP_FORM_DEFINITION;
|
|
3428
|
-
exports.RXAP_FORM_DEFINITION_BUILDER = RXAP_FORM_DEFINITION_BUILDER;
|
|
3429
|
-
exports.RXAP_FORM_INITIAL_STATE = RXAP_FORM_INITIAL_STATE;
|
|
3430
|
-
exports.RXAP_FORM_LOAD_FAILED_METHOD = RXAP_FORM_LOAD_FAILED_METHOD;
|
|
3431
|
-
exports.RXAP_FORM_LOAD_METHOD = RXAP_FORM_LOAD_METHOD;
|
|
3432
|
-
exports.RXAP_FORM_LOAD_SUCCESSFUL_METHOD = RXAP_FORM_LOAD_SUCCESSFUL_METHOD;
|
|
3433
|
-
exports.RXAP_FORM_SUBMIT_FAILED_METHOD = RXAP_FORM_SUBMIT_FAILED_METHOD;
|
|
3434
|
-
exports.RXAP_FORM_SUBMIT_METHOD = RXAP_FORM_SUBMIT_METHOD;
|
|
3435
|
-
exports.RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD = RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD;
|
|
3436
|
-
exports.RxapForm = RxapForm;
|
|
3437
|
-
exports.RxapFormArray = RxapFormArray;
|
|
3438
|
-
exports.RxapFormBuilder = RxapFormBuilder;
|
|
3439
|
-
exports.RxapFormControl = RxapFormControl;
|
|
3440
|
-
exports.RxapFormGroup = RxapFormGroup;
|
|
3441
|
-
exports.RxapFormsModule = RxapFormsModule;
|
|
3442
|
-
exports.RxapValidators = RxapValidators;
|
|
3443
|
-
exports.ToFormMethod = ToFormMethod;
|
|
3444
|
-
exports.ToFormSubmitMethod = ToFormSubmitMethod;
|
|
3445
|
-
exports.UseFormArrayControl = UseFormArrayControl;
|
|
3446
|
-
exports.UseFormArrayGroup = UseFormArrayGroup;
|
|
3447
|
-
exports.UseFormControl = UseFormControl;
|
|
3448
|
-
exports.UseFormGroup = UseFormGroup;
|
|
3449
|
-
exports._IsNumber = _IsNumber;
|
|
3450
|
-
exports.controlDisabled$ = controlDisabled$;
|
|
3451
|
-
exports.controlDisabledWhile = controlDisabledWhile;
|
|
3452
|
-
exports.controlEnabled$ = controlEnabled$;
|
|
3453
|
-
exports.controlEnabledWhile = controlEnabledWhile;
|
|
3454
|
-
exports.controlErrorChanges$ = controlErrorChanges$;
|
|
3455
|
-
exports.controlReadonly$ = controlReadonly$;
|
|
3456
|
-
exports.controlStatusChanges$ = controlStatusChanges$;
|
|
3457
|
-
exports.controlValueChanges$ = controlValueChanges$;
|
|
3458
|
-
exports.disableControl = disableControl;
|
|
3459
|
-
exports.enableControl = enableControl;
|
|
3460
|
-
exports.hasErrorAndDirty = hasErrorAndDirty;
|
|
3461
|
-
exports.hasErrorAndTouched = hasErrorAndTouched;
|
|
3462
|
-
exports.isNumber = isNumber;
|
|
3463
|
-
exports.markAllDirty = markAllDirty;
|
|
3464
|
-
exports.markAllPristine = markAllPristine;
|
|
3465
|
-
exports.markAllUntouched = markAllUntouched;
|
|
3466
|
-
exports.mergeControlValidators = mergeControlValidators;
|
|
3467
|
-
exports.selectControlValue$ = selectControlValue$;
|
|
3468
|
-
exports.validateControlOn = validateControlOn;
|
|
3469
|
-
|
|
3470
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3471
|
-
|
|
3472
|
-
})));
|
|
3473
|
-
//# sourceMappingURL=rxap-forms.umd.js.map
|