monkey-front-components 0.0.179 → 0.0.183
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/lib/components/base/base-component.mjs +291 -0
- package/esm2020/lib/components/base/base-dynamic-array.mjs +221 -0
- package/esm2020/lib/components/base/base-dynamic.mjs +99 -0
- package/{esm2015/lib/components/base/base-validators.js → esm2020/lib/components/base/base-validators.mjs} +1 -1
- package/{esm2015/lib/components/base/index.js → esm2020/lib/components/base/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/button/button.component.mjs +52 -0
- package/{esm2015/lib/components/dynamic/button/index.js → esm2020/lib/components/dynamic/button/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/dynamic-directive.mjs +95 -0
- package/{esm2015/lib/components/dynamic/dynamic.module.js → esm2020/lib/components/dynamic/dynamic.module.mjs} +5 -5
- package/esm2020/lib/components/dynamic/file-upload/file-upload.component.mjs +52 -0
- package/{esm2015/lib/components/dynamic/file-upload/index.js → esm2020/lib/components/dynamic/file-upload/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/form/dynamic-form-array.component.mjs +72 -0
- package/esm2020/lib/components/dynamic/form/dynamic-form.component.mjs +46 -0
- package/{esm2015/lib/components/dynamic/form/index.js → esm2020/lib/components/dynamic/form/index.mjs} +0 -0
- package/{esm2015/lib/components/dynamic/index.js → esm2020/lib/components/dynamic/index.mjs} +0 -0
- package/{esm2015/lib/components/dynamic/input/index.js → esm2020/lib/components/dynamic/input/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/input/input.component.mjs +65 -0
- package/{esm2015/lib/components/dynamic/input-phone/index.js → esm2020/lib/components/dynamic/input-phone/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/input-phone/input-phone.component.mjs +65 -0
- package/{esm2015/lib/components/dynamic/radio/index.js → esm2020/lib/components/dynamic/radio/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/radio/radio.component.mjs +33 -0
- package/{esm2015/lib/components/dynamic/select/index.js → esm2020/lib/components/dynamic/select/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/select/select.component.mjs +80 -0
- package/{esm2015/lib/components/dynamic/select-search/index.js → esm2020/lib/components/dynamic/select-search/index.mjs} +0 -0
- package/esm2020/lib/components/dynamic/select-search/select-search.component.mjs +80 -0
- package/{esm2015/lib/components/index.js → esm2020/lib/components/index.mjs} +2 -1
- package/esm2020/lib/components/shared/index.mjs +3 -0
- package/esm2020/lib/components/shared/password-strength/index.mjs +3 -0
- package/esm2020/lib/components/shared/password-strength/password-strength.component.mjs +83 -0
- package/esm2020/lib/components/shared/password-strength/password-strength.mjs +2 -0
- package/esm2020/lib/components/shared/password-strength/password-strength.module.mjs +50 -0
- package/esm2020/lib/components/shared/progress-bar/index.mjs +4 -0
- package/esm2020/lib/components/shared/progress-bar/progress-bar.component.mjs +28 -0
- package/esm2020/lib/components/shared/progress-bar/progress-bar.module.mjs +18 -0
- package/esm2020/lib/components/shared/progress-bar/progress-bar.service.mjs +49 -0
- package/{esm2015/lib/interfaces/field-config.js → esm2020/lib/interfaces/field-config.mjs} +0 -0
- package/{esm2015/lib/interfaces/index.js → esm2020/lib/interfaces/index.mjs} +0 -0
- package/{esm2015/monkey-front-components.js → esm2020/monkey-front-components.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/monkey-front-components.mjs +1487 -0
- package/fesm2015/monkey-front-components.mjs.map +1 -0
- package/fesm2020/monkey-front-components.mjs +1471 -0
- package/fesm2020/monkey-front-components.mjs.map +1 -0
- package/lib/components/base/base-component.d.ts +1 -1
- package/lib/components/base/base-dynamic-array.d.ts +1 -1
- package/lib/components/base/base-dynamic.d.ts +1 -1
- package/lib/components/base/base-validators.d.ts +1 -14
- package/lib/components/dynamic/button/button.component.d.ts +2 -2
- package/lib/components/dynamic/dynamic-directive.d.ts +2 -2
- package/lib/components/dynamic/input/input.component.d.ts +3 -3
- package/lib/components/dynamic/input-phone/input-phone.component.d.ts +3 -3
- package/lib/components/dynamic/radio/radio.component.d.ts +2 -2
- package/lib/components/dynamic/select/select.component.d.ts +2 -2
- package/lib/components/dynamic/select-search/select-search.component.d.ts +2 -2
- package/lib/components/index.d.ts +1 -0
- package/lib/components/shared/index.d.ts +2 -0
- package/lib/components/shared/password-strength/index.d.ts +2 -0
- package/lib/components/shared/password-strength/password-strength.component.d.ts +22 -0
- package/lib/components/shared/password-strength/password-strength.d.ts +5 -0
- package/lib/components/shared/password-strength/password-strength.module.d.ts +12 -0
- package/lib/components/shared/progress-bar/index.d.ts +3 -0
- package/lib/components/shared/progress-bar/progress-bar.component.d.ts +12 -0
- package/lib/components/shared/progress-bar/progress-bar.module.d.ts +8 -0
- package/lib/components/shared/progress-bar/progress-bar.service.d.ts +14 -0
- package/monkey-front-components-0.0.183.tgz +0 -0
- package/package.json +27 -13
- package/bundles/monkey-front-components.umd.js +0 -1729
- package/bundles/monkey-front-components.umd.js.map +0 -1
- package/esm2015/lib/components/base/base-component.js +0 -288
- package/esm2015/lib/components/base/base-dynamic-array.js +0 -215
- package/esm2015/lib/components/base/base-dynamic.js +0 -98
- package/esm2015/lib/components/dynamic/button/button.component.js +0 -57
- package/esm2015/lib/components/dynamic/dynamic-directive.js +0 -95
- package/esm2015/lib/components/dynamic/file-upload/file-upload.component.js +0 -57
- package/esm2015/lib/components/dynamic/form/dynamic-form-array.component.js +0 -77
- package/esm2015/lib/components/dynamic/form/dynamic-form.component.js +0 -51
- package/esm2015/lib/components/dynamic/input/input.component.js +0 -66
- package/esm2015/lib/components/dynamic/input-phone/input-phone.component.js +0 -66
- package/esm2015/lib/components/dynamic/radio/radio.component.js +0 -36
- package/esm2015/lib/components/dynamic/select/select.component.js +0 -81
- package/esm2015/lib/components/dynamic/select-search/select-search.component.js +0 -81
- package/fesm2015/monkey-front-components.js +0 -1290
- package/fesm2015/monkey-front-components.js.map +0 -1
- package/monkey-front-components-0.0.179.tgz +0 -0
|
@@ -0,0 +1,1487 @@
|
|
|
1
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, EventEmitter, Input, Output, Component, ViewEncapsulation, HostBinding, ViewChild, NgModule, Injectable } from '@angular/core';
|
|
4
|
+
import { takeUntil, filter } from 'rxjs/operators';
|
|
5
|
+
import * as i1$1 from 'monkey-style-guide';
|
|
6
|
+
import { MonkeyUtils, MonkeyInputModule, MonkeySelectModule, MonkeyRadioButtonModule, MonkeyOptionModule, MonkeyFileUploadModule, MonkeyButtonModule, MonkeyInputPhoneModule, MonkeyIconModule } from 'monkey-style-guide';
|
|
7
|
+
import * as i1$2 from 'monkey-front-core';
|
|
8
|
+
import { MonkeyEcxCommonsService, ValidateUtils, Validators as Validators$1, MonkeyEcxUtils, MonkeyEcxPipesModule, MonkeyEcxDirectivesModule } from 'monkey-front-core';
|
|
9
|
+
import * as i1 from '@angular/forms';
|
|
10
|
+
import { Validators, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
11
|
+
import * as i3 from '@angular/common';
|
|
12
|
+
import { CommonModule } from '@angular/common';
|
|
13
|
+
import * as i4 from '@ngx-translate/core';
|
|
14
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
15
|
+
import * as i1$3 from '@angular/router';
|
|
16
|
+
import { NavigationStart, NavigationEnd, NavigationError, NavigationCancel } from '@angular/router';
|
|
17
|
+
|
|
18
|
+
class BaseComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.__paginationOptions = null;
|
|
21
|
+
this.__isMobile = this.isMobile();
|
|
22
|
+
this.__locales = ['pt-BR', 'es-CL'];
|
|
23
|
+
this.__unsubscribeAll = new Subject();
|
|
24
|
+
}
|
|
25
|
+
isMobile() {
|
|
26
|
+
const isMobileWidth = (window.screen.width <= 640) ||
|
|
27
|
+
(window.matchMedia &&
|
|
28
|
+
window.matchMedia('only screen and (max-width: 640px)').matches);
|
|
29
|
+
return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile/i.test(navigator.userAgent)) || isMobileWidth;
|
|
30
|
+
}
|
|
31
|
+
handlePagination(create = true) {
|
|
32
|
+
const { __paginationOptions } = this;
|
|
33
|
+
if (__paginationOptions) {
|
|
34
|
+
const { mainElement, service } = __paginationOptions;
|
|
35
|
+
const element = document.getElementById(mainElement);
|
|
36
|
+
if (element) {
|
|
37
|
+
element.scroll = null;
|
|
38
|
+
element.onscroll = null;
|
|
39
|
+
if (create) {
|
|
40
|
+
element.onscroll = () => {
|
|
41
|
+
const { scrollTop, scrollHeight, offsetHeight } = element;
|
|
42
|
+
const contentHeight = scrollHeight - offsetHeight;
|
|
43
|
+
if (contentHeight <= scrollTop) {
|
|
44
|
+
service.doPagination();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
handleSupport(supportControls) {
|
|
52
|
+
const { service, show } = supportControls;
|
|
53
|
+
const method = show ? 'show' : 'hide';
|
|
54
|
+
service[method.toLowerCase()]();
|
|
55
|
+
}
|
|
56
|
+
handleTranslate(translateOptions) {
|
|
57
|
+
const { service } = translateOptions;
|
|
58
|
+
service.__oni18nDataChanged$
|
|
59
|
+
.pipe(takeUntil(this.__unsubscribeAll))
|
|
60
|
+
.subscribe(() => {
|
|
61
|
+
const data = service.__i18n;
|
|
62
|
+
if (data) {
|
|
63
|
+
this.__i18n = data;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
getErrorFirstMessageTranslated(formControl = null) {
|
|
68
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('required'))
|
|
69
|
+
return 'FIELD-REQUIRED';
|
|
70
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalid'))
|
|
71
|
+
return 'FIELD-INVALID';
|
|
72
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('email'))
|
|
73
|
+
return 'INVALID-EMAIL';
|
|
74
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('minlength'))
|
|
75
|
+
return 'MIN-LENGTH';
|
|
76
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('maxlength'))
|
|
77
|
+
return 'MAX-LENGTH';
|
|
78
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('max'))
|
|
79
|
+
return 'MAX';
|
|
80
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('min'))
|
|
81
|
+
return 'MIN';
|
|
82
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('passwordsNotMatching'))
|
|
83
|
+
return 'MATCH-PASSWORD';
|
|
84
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidDate'))
|
|
85
|
+
return 'INVALID-DATE';
|
|
86
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidTrue'))
|
|
87
|
+
return 'INVALID-TRUE';
|
|
88
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidCpfCnpj'))
|
|
89
|
+
return 'INVALID-DOCUMENT';
|
|
90
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidZipCode'))
|
|
91
|
+
return 'INVALID-ZIPCODE';
|
|
92
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidCombo'))
|
|
93
|
+
return 'INVALID-COMBO';
|
|
94
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidUrl'))
|
|
95
|
+
return 'INVALID-URL';
|
|
96
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('invalidUnlockRegister')) {
|
|
97
|
+
return 'INVALID-UNLOCK-REGISTER';
|
|
98
|
+
}
|
|
99
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('dateStartMustBeLessThanAnd')) {
|
|
100
|
+
return 'DATE-START-MUST-BE-LESS-THAN-AND';
|
|
101
|
+
}
|
|
102
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('dateEndMustBeGreaterThanStart')) {
|
|
103
|
+
return 'DATE-END-MUST-BE-GREATER-THAN-SART';
|
|
104
|
+
}
|
|
105
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('phone'))
|
|
106
|
+
return 'INVALID-PHONE';
|
|
107
|
+
return 'FIELD-INVALID';
|
|
108
|
+
}
|
|
109
|
+
getErrorLastMessageNotTranslated(formControl = null) {
|
|
110
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('minlength')) {
|
|
111
|
+
return `${formControl === null || formControl === void 0 ? void 0 : formControl.getError('minlength').requiredLength} caracteres.`;
|
|
112
|
+
}
|
|
113
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('maxlength')) {
|
|
114
|
+
return `${formControl === null || formControl === void 0 ? void 0 : formControl.getError('maxlength').requiredLength} caracteres.`;
|
|
115
|
+
}
|
|
116
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('max')) {
|
|
117
|
+
return `${formControl === null || formControl === void 0 ? void 0 : formControl.getError('max').max}`;
|
|
118
|
+
}
|
|
119
|
+
if (formControl === null || formControl === void 0 ? void 0 : formControl.hasError('min')) {
|
|
120
|
+
return `${formControl === null || formControl === void 0 ? void 0 : formControl.getError('min').min}`;
|
|
121
|
+
}
|
|
122
|
+
return '';
|
|
123
|
+
}
|
|
124
|
+
validateFormWithTranslate(f, index) {
|
|
125
|
+
const formErrors = f.value;
|
|
126
|
+
if (f.status === 'VALID')
|
|
127
|
+
return true;
|
|
128
|
+
if (!formErrors)
|
|
129
|
+
return true;
|
|
130
|
+
Object.entries(formErrors).forEach(([key, value]) => {
|
|
131
|
+
const control = f.get(key);
|
|
132
|
+
formErrors[key] = '';
|
|
133
|
+
if (control && !control.valid) {
|
|
134
|
+
const msg = {
|
|
135
|
+
first: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
|
|
136
|
+
last: this.getErrorLastMessageNotTranslated(f.get(key))
|
|
137
|
+
};
|
|
138
|
+
formErrors[key] = msg;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (MonkeyUtils.persistNullEmptyUndefined(index)) {
|
|
142
|
+
this.__monkeyecxFormErrors[index || 0] = formErrors;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.__monkeyecxFormErrors = formErrors;
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
copyToClipboard(val) {
|
|
150
|
+
const selBox = document.createElement('textarea');
|
|
151
|
+
selBox.style.position = 'fixed';
|
|
152
|
+
selBox.style.left = '0';
|
|
153
|
+
selBox.style.top = '0';
|
|
154
|
+
selBox.style.opacity = '0';
|
|
155
|
+
selBox.value = val;
|
|
156
|
+
document.body.appendChild(selBox);
|
|
157
|
+
selBox.focus();
|
|
158
|
+
selBox.select();
|
|
159
|
+
document.execCommand('copy');
|
|
160
|
+
document.body.removeChild(selBox);
|
|
161
|
+
}
|
|
162
|
+
validateForm(f, index, alias) {
|
|
163
|
+
const formErrors = f.value;
|
|
164
|
+
if (f.status === 'VALID')
|
|
165
|
+
return true;
|
|
166
|
+
if (!formErrors)
|
|
167
|
+
return true;
|
|
168
|
+
Object.entries(formErrors).forEach(([key, value]) => {
|
|
169
|
+
const control = f.get(key);
|
|
170
|
+
formErrors[key] = '';
|
|
171
|
+
if (control && !control.valid) {
|
|
172
|
+
const msg = {
|
|
173
|
+
firstMessage: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
|
|
174
|
+
lastMessage: this.getErrorLastMessageNotTranslated(f.get(key))
|
|
175
|
+
};
|
|
176
|
+
formErrors[key] = msg;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
if (MonkeyUtils.persistNullEmptyUndefined(index)) {
|
|
180
|
+
this.__monkeyecxFormErrors[index || 0] = formErrors;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
let obj;
|
|
184
|
+
if (alias) {
|
|
185
|
+
obj = {
|
|
186
|
+
[alias]: Object.assign({}, formErrors)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
obj = formErrors;
|
|
191
|
+
}
|
|
192
|
+
this.__monkeyecxFormErrors = Object.assign(Object.assign({}, this.__monkeyecxFormErrors), obj);
|
|
193
|
+
}
|
|
194
|
+
f.markAllAsTouched();
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
clearAllServiceData(clearData) {
|
|
198
|
+
const context = this;
|
|
199
|
+
Object.values(context).forEach((ctx) => {
|
|
200
|
+
if (ctx instanceof MonkeyEcxCommonsService) {
|
|
201
|
+
ctx.clear(clearData);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
ngOnInit(args) {
|
|
206
|
+
if (args === null || args === void 0 ? void 0 : args.paginationOptions) {
|
|
207
|
+
this.__paginationOptions = args === null || args === void 0 ? void 0 : args.paginationOptions;
|
|
208
|
+
this.handlePagination();
|
|
209
|
+
}
|
|
210
|
+
if (args === null || args === void 0 ? void 0 : args.supportControls) {
|
|
211
|
+
this.handleSupport(args === null || args === void 0 ? void 0 : args.supportControls);
|
|
212
|
+
}
|
|
213
|
+
if (args === null || args === void 0 ? void 0 : args.translateOptions) {
|
|
214
|
+
this.handleTranslate(args === null || args === void 0 ? void 0 : args.translateOptions);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
ngOnDestroy(clearData = true) {
|
|
218
|
+
this.__unsubscribeAll.next();
|
|
219
|
+
this.__unsubscribeAll.complete();
|
|
220
|
+
this.clearAllServiceData(clearData);
|
|
221
|
+
this.handlePagination(false);
|
|
222
|
+
}
|
|
223
|
+
handleErrorFromServices(error, f) {
|
|
224
|
+
this.__monkeyecxFormErrors = null;
|
|
225
|
+
if (error.type === 'Parameter_Error') {
|
|
226
|
+
Object.entries(f.value).forEach(([key, value]) => {
|
|
227
|
+
error.notifications.forEach((_) => {
|
|
228
|
+
const field = _.split(':')[0];
|
|
229
|
+
const description = _.split(':')[1];
|
|
230
|
+
if (field === key) {
|
|
231
|
+
const msg = {
|
|
232
|
+
firstMessage: '',
|
|
233
|
+
lastMessage: description
|
|
234
|
+
};
|
|
235
|
+
this.__monkeyecxFormErrors = Object.assign(Object.assign({}, this.__monkeyecxFormErrors), { [key]: msg });
|
|
236
|
+
f.controls[key].setErrors({
|
|
237
|
+
incorrect: true
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
f.markAllAsTouched();
|
|
244
|
+
}
|
|
245
|
+
goBack() {
|
|
246
|
+
window.history.back();
|
|
247
|
+
}
|
|
248
|
+
goScroll(id) {
|
|
249
|
+
const element = document.getElementById(id);
|
|
250
|
+
if (element)
|
|
251
|
+
element.scrollIntoView();
|
|
252
|
+
}
|
|
253
|
+
getEmbeddedData(data, field) {
|
|
254
|
+
const { _embedded } = data;
|
|
255
|
+
return _embedded ? _embedded[field] : null;
|
|
256
|
+
}
|
|
257
|
+
openWindow(url) {
|
|
258
|
+
window.open(`${url}`, '_blank');
|
|
259
|
+
}
|
|
260
|
+
fillI18n(data) {
|
|
261
|
+
this.__i18n = data;
|
|
262
|
+
}
|
|
263
|
+
getCountryPrefix(country) {
|
|
264
|
+
return {
|
|
265
|
+
br: 55,
|
|
266
|
+
cl: 56
|
|
267
|
+
}[country];
|
|
268
|
+
}
|
|
269
|
+
getCountryCurrencyChartFormat(country) {
|
|
270
|
+
return {
|
|
271
|
+
br: 'R$ #,###,##0.00',
|
|
272
|
+
cl: 'CLP #,###,##0'
|
|
273
|
+
}[country];
|
|
274
|
+
}
|
|
275
|
+
getCountryValidators(country) {
|
|
276
|
+
return {
|
|
277
|
+
br: {
|
|
278
|
+
governmentId: ValidateUtils.DocumentValidator
|
|
279
|
+
},
|
|
280
|
+
cl: {
|
|
281
|
+
governmentId: ValidateUtils.DocumentRutValidator
|
|
282
|
+
}
|
|
283
|
+
}[country];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
287
|
+
BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: BaseComponent, selector: "[baseComponent]", ngImport: i0 });
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BaseComponent, decorators: [{
|
|
289
|
+
type: Directive,
|
|
290
|
+
args: [{
|
|
291
|
+
selector: '[baseComponent]'
|
|
292
|
+
}]
|
|
293
|
+
}], ctorParameters: function () { return []; } });
|
|
294
|
+
|
|
295
|
+
const validators = {
|
|
296
|
+
required: Validators.required,
|
|
297
|
+
email: Validators$1.email,
|
|
298
|
+
governmentId: Validators$1.documentBR,
|
|
299
|
+
governmentIdRut: Validators$1.documentCL,
|
|
300
|
+
documentBR: Validators$1.documentBR,
|
|
301
|
+
documentCL: Validators$1.documentCL,
|
|
302
|
+
date: Validators$1.date,
|
|
303
|
+
zipCode: Validators$1.zipCode,
|
|
304
|
+
minLength: (param) => {
|
|
305
|
+
return Validators.minLength(param);
|
|
306
|
+
},
|
|
307
|
+
maxLength: (param) => {
|
|
308
|
+
return Validators.maxLength(param);
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
class BaseDynamic extends BaseComponent {
|
|
313
|
+
constructor(fb) {
|
|
314
|
+
super();
|
|
315
|
+
this.fb = fb;
|
|
316
|
+
this.onHandleSubmit = new EventEmitter();
|
|
317
|
+
this.onHandleUpdateForm = new EventEmitter();
|
|
318
|
+
this.onHandleSubmitFormReady = new EventEmitter();
|
|
319
|
+
this.fields = [];
|
|
320
|
+
this.disabled = false;
|
|
321
|
+
this._form = null;
|
|
322
|
+
}
|
|
323
|
+
createControl() {
|
|
324
|
+
const { fields } = this;
|
|
325
|
+
if (!fields)
|
|
326
|
+
return null;
|
|
327
|
+
// eslint-disable-next-line object-curly-newline
|
|
328
|
+
const group = this.fb.group({});
|
|
329
|
+
fields.forEach((field) => {
|
|
330
|
+
const { fieldType, validations, name, disabled } = field;
|
|
331
|
+
let { value } = field;
|
|
332
|
+
if (fieldType === 'button')
|
|
333
|
+
return;
|
|
334
|
+
if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
|
|
335
|
+
value = '';
|
|
336
|
+
}
|
|
337
|
+
const control = this.fb.control(value, this.bindValidations(validations || []));
|
|
338
|
+
if (disabled || this.disabled)
|
|
339
|
+
control.disable();
|
|
340
|
+
group.addControl(name, control);
|
|
341
|
+
});
|
|
342
|
+
return group;
|
|
343
|
+
}
|
|
344
|
+
bindValidations(validations) {
|
|
345
|
+
if (validations.length > 0) {
|
|
346
|
+
const validList = [];
|
|
347
|
+
validations.forEach((valid) => {
|
|
348
|
+
const validated = valid.param
|
|
349
|
+
? validators[valid.name](valid.param)
|
|
350
|
+
: validators[valid.name];
|
|
351
|
+
validList.push(validated);
|
|
352
|
+
});
|
|
353
|
+
return Validators.compose(validList);
|
|
354
|
+
}
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
fillValues() {
|
|
358
|
+
const { data } = this;
|
|
359
|
+
if (!data || !this._form)
|
|
360
|
+
return;
|
|
361
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
362
|
+
var _a, _b, _c;
|
|
363
|
+
if (MonkeyUtils.persistNullEmptyUndefined(value) && ((_a = this._form) === null || _a === void 0 ? void 0 : _a.controls[key])) {
|
|
364
|
+
(_c = (_b = this._form) === null || _b === void 0 ? void 0 : _b.controls[key]) === null || _c === void 0 ? void 0 : _c.setValue(value);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
ngOnInit() {
|
|
369
|
+
this._form = this.createControl();
|
|
370
|
+
this.fillValues();
|
|
371
|
+
this.onHandleUpdateForm.subscribe(() => {
|
|
372
|
+
this.fillValues();
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
ngOnChanges() {
|
|
376
|
+
if (!this._form) {
|
|
377
|
+
this._form = this.createControl();
|
|
378
|
+
}
|
|
379
|
+
this.fillValues();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
BaseDynamic.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BaseDynamic, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Directive });
|
|
383
|
+
BaseDynamic.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: BaseDynamic, selector: "[baseDynamic]", inputs: { onHandleSubmit: "onHandleSubmit", onHandleUpdateForm: "onHandleUpdateForm", self: "self", fields: "fields", data: "data", disabled: "disabled" }, outputs: { onHandleSubmitFormReady: "onHandleSubmitFormReady" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
384
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BaseDynamic, decorators: [{
|
|
385
|
+
type: Directive,
|
|
386
|
+
args: [{
|
|
387
|
+
selector: '[baseDynamic]'
|
|
388
|
+
}]
|
|
389
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { onHandleSubmit: [{
|
|
390
|
+
type: Input
|
|
391
|
+
}], onHandleUpdateForm: [{
|
|
392
|
+
type: Input
|
|
393
|
+
}], onHandleSubmitFormReady: [{
|
|
394
|
+
type: Output
|
|
395
|
+
}], self: [{
|
|
396
|
+
type: Input
|
|
397
|
+
}], fields: [{
|
|
398
|
+
type: Input
|
|
399
|
+
}], data: [{
|
|
400
|
+
type: Input
|
|
401
|
+
}], disabled: [{
|
|
402
|
+
type: Input
|
|
403
|
+
}] } });
|
|
404
|
+
|
|
405
|
+
class BaseDynamicArray extends BaseComponent {
|
|
406
|
+
constructor(fb) {
|
|
407
|
+
super();
|
|
408
|
+
this.fb = fb;
|
|
409
|
+
this.onHandleSubmit = new EventEmitter();
|
|
410
|
+
this.onHandleUpdateForm = new EventEmitter();
|
|
411
|
+
this.onHandleSubmitFormReady = new EventEmitter();
|
|
412
|
+
this.fields = [];
|
|
413
|
+
this.qtd = 1;
|
|
414
|
+
this.disabled = false;
|
|
415
|
+
this._form = null;
|
|
416
|
+
// eslint-disable-next-line object-curly-newline
|
|
417
|
+
this._plusValidations = [];
|
|
418
|
+
this.changesUnsubscribe = new Subject();
|
|
419
|
+
this.formBase = () => {
|
|
420
|
+
// return this.fb.group(this.createControl());
|
|
421
|
+
return this.createControl();
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
handleInternalPlusValidation(mainField, data) {
|
|
425
|
+
const { operator, field, value } = mainField;
|
|
426
|
+
const validators = {
|
|
427
|
+
e: (val1, val2) => { return val1 === val2; },
|
|
428
|
+
lt: (val1, val2) => { return val1 < val2; },
|
|
429
|
+
gt: (val1, val2) => { return val1 > val2; }
|
|
430
|
+
};
|
|
431
|
+
return validators[operator]((data === null || data === void 0 ? void 0 : data[field]) || data, value);
|
|
432
|
+
}
|
|
433
|
+
makeInternalPlusValidation(data, sourceField, settings, rowIndex) {
|
|
434
|
+
const changeFields = (show) => {
|
|
435
|
+
const saved = [...this.fields];
|
|
436
|
+
saved.map((val) => {
|
|
437
|
+
var _a;
|
|
438
|
+
const valSaved = Object.assign({}, val);
|
|
439
|
+
if (val.name === sourceField) {
|
|
440
|
+
this._plusValidations[rowIndex] = {
|
|
441
|
+
[sourceField]: Object.assign(Object.assign({}, valSaved), { alwaysShow: show })
|
|
442
|
+
};
|
|
443
|
+
this.createOneControl(val.name, (_a = this.formValues) === null || _a === void 0 ? void 0 : _a.controls[rowIndex], show);
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
this._plusValidations[rowIndex] = Object.assign({}, valSaved);
|
|
447
|
+
}
|
|
448
|
+
return null;
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
const validated = this.handleInternalPlusValidation(settings, data);
|
|
452
|
+
changeFields(validated);
|
|
453
|
+
}
|
|
454
|
+
createOneControl(fieldName, ctrl, create = true) {
|
|
455
|
+
const { fields } = this;
|
|
456
|
+
if (!fields)
|
|
457
|
+
return;
|
|
458
|
+
fields.forEach((field) => {
|
|
459
|
+
const { fieldType, validations, name, disabled } = field;
|
|
460
|
+
if (name !== fieldName)
|
|
461
|
+
return;
|
|
462
|
+
let { value } = field;
|
|
463
|
+
if (fieldType === 'button')
|
|
464
|
+
return;
|
|
465
|
+
if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
|
|
466
|
+
value = '';
|
|
467
|
+
}
|
|
468
|
+
if (create) {
|
|
469
|
+
const control = this.fb.control(value, this.bindValidations(validations || []));
|
|
470
|
+
if (disabled || this.disabled)
|
|
471
|
+
control.disable();
|
|
472
|
+
ctrl.addControl(name, control);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
ctrl.removeControl(name);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
createControl(data) {
|
|
480
|
+
const { fields } = this;
|
|
481
|
+
if (!fields)
|
|
482
|
+
return null;
|
|
483
|
+
// eslint-disable-next-line object-curly-newline
|
|
484
|
+
const group = this.fb.group({});
|
|
485
|
+
fields.forEach((field) => {
|
|
486
|
+
const { fieldType, validations, name, disabled, alwaysShow } = field;
|
|
487
|
+
let { value } = field;
|
|
488
|
+
if (field.alwaysShowPlusValidation) {
|
|
489
|
+
if (!this.handleInternalPlusValidation(field.alwaysShowPlusValidation, data))
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
else if (!alwaysShow)
|
|
493
|
+
return;
|
|
494
|
+
if (fieldType === 'button')
|
|
495
|
+
return;
|
|
496
|
+
if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
|
|
497
|
+
value = '';
|
|
498
|
+
}
|
|
499
|
+
const control = this.fb.control(value, this.bindValidations(validations || []));
|
|
500
|
+
if (disabled || this.disabled)
|
|
501
|
+
control.disable();
|
|
502
|
+
group.addControl(name, control);
|
|
503
|
+
});
|
|
504
|
+
return group;
|
|
505
|
+
}
|
|
506
|
+
bindValidations(validations) {
|
|
507
|
+
if (validations.length > 0) {
|
|
508
|
+
const validList = [];
|
|
509
|
+
validations.forEach((valid) => {
|
|
510
|
+
const validated = valid.param
|
|
511
|
+
? validators[valid.name](valid.param)
|
|
512
|
+
: validators[valid.name];
|
|
513
|
+
validList.push(validated);
|
|
514
|
+
});
|
|
515
|
+
return Validators.compose(validList);
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
519
|
+
buildForm() {
|
|
520
|
+
var _a;
|
|
521
|
+
const form = this.fb.group({
|
|
522
|
+
fields: this.fb.array([])
|
|
523
|
+
});
|
|
524
|
+
(_a = form === null || form === void 0 ? void 0 : form.controls.fields) === null || _a === void 0 ? void 0 : _a.valueChanges.subscribe((_) => {
|
|
525
|
+
this.watchForChanges();
|
|
526
|
+
});
|
|
527
|
+
return form;
|
|
528
|
+
}
|
|
529
|
+
watchForChanges() {
|
|
530
|
+
var _a, _b;
|
|
531
|
+
const { fields, changesUnsubscribe } = this;
|
|
532
|
+
changesUnsubscribe.next();
|
|
533
|
+
(_b = (_a = this.formValues) === null || _a === void 0 ? void 0 : _a.controls) === null || _b === void 0 ? void 0 : _b.map((control, index) => {
|
|
534
|
+
fields.forEach((fieldConfig) => {
|
|
535
|
+
var _a;
|
|
536
|
+
const { name, alwaysShowPlusValidation } = fieldConfig;
|
|
537
|
+
if (!alwaysShowPlusValidation)
|
|
538
|
+
return;
|
|
539
|
+
const { field } = alwaysShowPlusValidation;
|
|
540
|
+
if (field) {
|
|
541
|
+
(_a = control.controls[field]) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(takeUntil(changesUnsubscribe)).subscribe((_) => {
|
|
542
|
+
this.makeInternalPlusValidation(_, name, alwaysShowPlusValidation, index);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
return null;
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
get formValues() {
|
|
550
|
+
return this._form ? this._form.get('fields') : null;
|
|
551
|
+
}
|
|
552
|
+
fillValues() {
|
|
553
|
+
const { data, qtd } = this;
|
|
554
|
+
if ((!this._form) && qtd)
|
|
555
|
+
return;
|
|
556
|
+
if (qtd > 0) {
|
|
557
|
+
Array(qtd)
|
|
558
|
+
.fill(null)
|
|
559
|
+
.map((_, index) => {
|
|
560
|
+
var _a;
|
|
561
|
+
let form = this.createControl();
|
|
562
|
+
if (data && data[index]) {
|
|
563
|
+
form = this.createControl(data[index]);
|
|
564
|
+
const handledData = data[index];
|
|
565
|
+
Object.entries(handledData).forEach(([key, value]) => {
|
|
566
|
+
if (MonkeyUtils.persistNullEmptyUndefined(value) && (form === null || form === void 0 ? void 0 : form.controls[key])) {
|
|
567
|
+
form === null || form === void 0 ? void 0 : form.controls[key].setValue(value);
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
(_a = this.formValues) === null || _a === void 0 ? void 0 : _a.push(form);
|
|
572
|
+
return null;
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
ngOnInit() {
|
|
577
|
+
this._form = this.buildForm();
|
|
578
|
+
this.fillValues();
|
|
579
|
+
this.onHandleUpdateForm.subscribe(() => {
|
|
580
|
+
this.fillValues();
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
ngOnChanges() {
|
|
584
|
+
if (!this._form) {
|
|
585
|
+
this._form = this.buildForm();
|
|
586
|
+
}
|
|
587
|
+
this.fillValues();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
BaseDynamicArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BaseDynamicArray, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Directive });
|
|
591
|
+
BaseDynamicArray.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: BaseDynamicArray, selector: "[baseDynamicArray]", inputs: { onHandleSubmit: "onHandleSubmit", onHandleUpdateForm: "onHandleUpdateForm", self: "self", fields: "fields", data: "data", qtd: "qtd", disabled: "disabled" }, outputs: { onHandleSubmitFormReady: "onHandleSubmitFormReady" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BaseDynamicArray, decorators: [{
|
|
593
|
+
type: Directive,
|
|
594
|
+
args: [{
|
|
595
|
+
selector: '[baseDynamicArray]'
|
|
596
|
+
}]
|
|
597
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { onHandleSubmit: [{
|
|
598
|
+
type: Input
|
|
599
|
+
}], onHandleUpdateForm: [{
|
|
600
|
+
type: Input
|
|
601
|
+
}], onHandleSubmitFormReady: [{
|
|
602
|
+
type: Output
|
|
603
|
+
}], self: [{
|
|
604
|
+
type: Input
|
|
605
|
+
}], fields: [{
|
|
606
|
+
type: Input
|
|
607
|
+
}], data: [{
|
|
608
|
+
type: Input
|
|
609
|
+
}], qtd: [{
|
|
610
|
+
type: Input
|
|
611
|
+
}], disabled: [{
|
|
612
|
+
type: Input
|
|
613
|
+
}] } });
|
|
614
|
+
|
|
615
|
+
class MECXDynamicFileUploadComponent {
|
|
616
|
+
constructor(cdr) {
|
|
617
|
+
this.cdr = cdr;
|
|
618
|
+
// eslint-disable-next-line object-curly-newline
|
|
619
|
+
this._formErrors = {};
|
|
620
|
+
this._function = (file, callback) => {
|
|
621
|
+
var _a, _b, _c, _d, _e;
|
|
622
|
+
if ((_a = this._form) === null || _a === void 0 ? void 0 : _a.disabled)
|
|
623
|
+
return;
|
|
624
|
+
if (!((_c = (_b = this._field) === null || _b === void 0 ? void 0 : _b.functions) === null || _c === void 0 ? void 0 : _c.onHandleUpload)) {
|
|
625
|
+
console.error('onHandleUpload not declared');
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
const { func, type } = (_e = (_d = this._field) === null || _d === void 0 ? void 0 : _d.functions) === null || _e === void 0 ? void 0 : _e.onHandleUpload;
|
|
629
|
+
if (!func || !this.self[func]) {
|
|
630
|
+
console.error('onHandleUpload not declared');
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
this.self[func](file, type, callback);
|
|
634
|
+
};
|
|
635
|
+
// not to do
|
|
636
|
+
}
|
|
637
|
+
get className() {
|
|
638
|
+
var _a, _b;
|
|
639
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
640
|
+
}
|
|
641
|
+
ngOnChanges() {
|
|
642
|
+
this.cdr.detectChanges();
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
MECXDynamicFileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicFileUploadComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
646
|
+
MECXDynamicFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicFileUploadComponent, selector: "mecx-dynamic-file-upload", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, usesOnChanges: true, ngImport: i0, template: "<monkey-file-upload\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [icon]=\"_field?.icon\" [formControl]=\"_form.controls[_field?.name]\"\n [placeholder]=\"_field?.placeholder | translate\"\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\n [maxSize]=\"_field?.maxSize || 5242880\" [fileUpload]=\"_function\"\n [maxSizeErrorMessage]=\"'FIELD.FILE.MAX-FILE' | translate\"\n [allowedExtensionErrorMessage]=\"'FIELD.FILE.ALLOWED-EXTENSION' | translate\"\n [allowedExtensions]=\"_field?.allowedExtensions || []\" *ngIf=\"_field\">\n</monkey-file-upload>", components: [{ type: i1$1.MonkeyFileUploadComponent, selector: "monkey-file-upload", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "infoMessage", "uploadOngoingMessage", "errorMessage", "listenFiles", "maxSize", "allowedExtensions", "maxSizeErrorMessage", "allowedExtensionErrorMessage", "fileUpload", "value"], outputs: ["onChange", "onHandleFilesReady"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicFileUploadComponent, decorators: [{
|
|
648
|
+
type: Component,
|
|
649
|
+
args: [{ selector: 'mecx-dynamic-file-upload', encapsulation: ViewEncapsulation.None, template: "<monkey-file-upload\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [icon]=\"_field?.icon\" [formControl]=\"_form.controls[_field?.name]\"\n [placeholder]=\"_field?.placeholder | translate\"\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\n [maxSize]=\"_field?.maxSize || 5242880\" [fileUpload]=\"_function\"\n [maxSizeErrorMessage]=\"'FIELD.FILE.MAX-FILE' | translate\"\n [allowedExtensionErrorMessage]=\"'FIELD.FILE.ALLOWED-EXTENSION' | translate\"\n [allowedExtensions]=\"_field?.allowedExtensions || []\" *ngIf=\"_field\">\n</monkey-file-upload>" }]
|
|
650
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
|
|
651
|
+
type: Input
|
|
652
|
+
}], _form: [{
|
|
653
|
+
type: Input
|
|
654
|
+
}], _formErrors: [{
|
|
655
|
+
type: Input
|
|
656
|
+
}], self: [{
|
|
657
|
+
type: Input
|
|
658
|
+
}], className: [{
|
|
659
|
+
type: HostBinding,
|
|
660
|
+
args: ['class']
|
|
661
|
+
}] } });
|
|
662
|
+
|
|
663
|
+
class MECXDynamicButtonComponent {
|
|
664
|
+
constructor(cdr) {
|
|
665
|
+
this.cdr = cdr;
|
|
666
|
+
this._field = null;
|
|
667
|
+
this._form = null;
|
|
668
|
+
// eslint-disable-next-line object-curly-newline
|
|
669
|
+
this._formErrors = {};
|
|
670
|
+
// not to do
|
|
671
|
+
}
|
|
672
|
+
get className() {
|
|
673
|
+
var _a, _b;
|
|
674
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
675
|
+
}
|
|
676
|
+
ngOnChanges() {
|
|
677
|
+
this.cdr.detectChanges();
|
|
678
|
+
}
|
|
679
|
+
onClick() {
|
|
680
|
+
var _a;
|
|
681
|
+
const { _form, _field, self } = this;
|
|
682
|
+
if ((_form === null || _form === void 0 ? void 0 : _form.disabled) || !_field)
|
|
683
|
+
return;
|
|
684
|
+
const { name, value } = _field;
|
|
685
|
+
const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onClick;
|
|
686
|
+
if (func) {
|
|
687
|
+
self[func]({
|
|
688
|
+
name,
|
|
689
|
+
value,
|
|
690
|
+
form: _form
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
MECXDynamicButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicButtonComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
696
|
+
MECXDynamicButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicButtonComponent, selector: "mecx-dynamic-button", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, usesOnChanges: true, ngImport: i0, template: "<monkey-button [icon]=\"_field?.icon\" [type]=\"_field?.type\" [color]=\"_field?.color\"\n (click)=\"onClick()\">\n {{ _field?.label | translate }}\n</monkey-button>", styles: ["mecx-dynamic-button monkey-button button{height:40px}\n"], components: [{ type: i1$1.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicButtonComponent, decorators: [{
|
|
698
|
+
type: Component,
|
|
699
|
+
args: [{ selector: 'mecx-dynamic-button', encapsulation: ViewEncapsulation.None, template: "<monkey-button [icon]=\"_field?.icon\" [type]=\"_field?.type\" [color]=\"_field?.color\"\n (click)=\"onClick()\">\n {{ _field?.label | translate }}\n</monkey-button>", styles: ["mecx-dynamic-button monkey-button button{height:40px}\n"] }]
|
|
700
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
|
|
701
|
+
type: Input
|
|
702
|
+
}], _form: [{
|
|
703
|
+
type: Input
|
|
704
|
+
}], _formErrors: [{
|
|
705
|
+
type: Input
|
|
706
|
+
}], self: [{
|
|
707
|
+
type: Input
|
|
708
|
+
}], className: [{
|
|
709
|
+
type: HostBinding,
|
|
710
|
+
args: ['class']
|
|
711
|
+
}] } });
|
|
712
|
+
|
|
713
|
+
class MECXDynamicInputComponent {
|
|
714
|
+
constructor(cdr) {
|
|
715
|
+
this.cdr = cdr;
|
|
716
|
+
this._field = null;
|
|
717
|
+
this._form = null;
|
|
718
|
+
// eslint-disable-next-line object-curly-newline
|
|
719
|
+
this._formErrors = {};
|
|
720
|
+
this.inputElement = null;
|
|
721
|
+
// not to do
|
|
722
|
+
}
|
|
723
|
+
get className() {
|
|
724
|
+
var _a, _b;
|
|
725
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
726
|
+
}
|
|
727
|
+
ngOnInit() {
|
|
728
|
+
this.cdr.detectChanges();
|
|
729
|
+
}
|
|
730
|
+
ngOnChanges() {
|
|
731
|
+
this.cdr.detectChanges();
|
|
732
|
+
}
|
|
733
|
+
onChange(event) {
|
|
734
|
+
var _a, _b, _c;
|
|
735
|
+
const { _form, _field, self } = this;
|
|
736
|
+
if (!_field || !_form)
|
|
737
|
+
return;
|
|
738
|
+
const { name } = _field;
|
|
739
|
+
const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
|
|
740
|
+
const isValid = (_b = _form === null || _form === void 0 ? void 0 : _form.get(_field === null || _field === void 0 ? void 0 : _field.name)) === null || _b === void 0 ? void 0 : _b.valid;
|
|
741
|
+
if (func) {
|
|
742
|
+
self[func]({
|
|
743
|
+
name,
|
|
744
|
+
isValid,
|
|
745
|
+
event,
|
|
746
|
+
ctrl: _form.get((_c = this._field) === null || _c === void 0 ? void 0 : _c.name),
|
|
747
|
+
form: _form
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
MECXDynamicInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
753
|
+
MECXDynamicInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicInputComponent, selector: "mecx-dynamic-input", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<monkey-input\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [mask]=\"_field?.mask\" [prefix]=\"_field?.prefix\" [name]=\"_field?.name\"\r\n [formControl]=\"_form.controls[_field?.name]\" [placeholder]=\"_field?.placeholder | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\r\n [type]=\"_field?.type\" #inputElement (onChange)=\"onChange($event)\"\r\n [onlyNumber]=\"_field?.onlyNumber\" [currency]=\"_field?.currency\" [maxLength]=\"_field?.maxLength\"\r\n [maxDateToday]=\"_field?.maxDateToday\">\r\n</monkey-input>", components: [{ type: i1$1.MonkeyInputComponent, selector: "monkey-input", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "type", "infoMessage", "errorMessage", "mask", "prefix", "maxLength", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "percent", "maxDateToday", "value"], outputs: ["onChange"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
754
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicInputComponent, decorators: [{
|
|
755
|
+
type: Component,
|
|
756
|
+
args: [{ selector: 'mecx-dynamic-input', encapsulation: ViewEncapsulation.None, template: "<monkey-input\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [mask]=\"_field?.mask\" [prefix]=\"_field?.prefix\" [name]=\"_field?.name\"\r\n [formControl]=\"_form.controls[_field?.name]\" [placeholder]=\"_field?.placeholder | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\r\n [type]=\"_field?.type\" #inputElement (onChange)=\"onChange($event)\"\r\n [onlyNumber]=\"_field?.onlyNumber\" [currency]=\"_field?.currency\" [maxLength]=\"_field?.maxLength\"\r\n [maxDateToday]=\"_field?.maxDateToday\">\r\n</monkey-input>" }]
|
|
757
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
|
|
758
|
+
type: Input
|
|
759
|
+
}], _form: [{
|
|
760
|
+
type: Input
|
|
761
|
+
}], _formErrors: [{
|
|
762
|
+
type: Input
|
|
763
|
+
}], self: [{
|
|
764
|
+
type: Input
|
|
765
|
+
}], inputElement: [{
|
|
766
|
+
type: ViewChild,
|
|
767
|
+
args: ['inputElement', {
|
|
768
|
+
static: true
|
|
769
|
+
}]
|
|
770
|
+
}], className: [{
|
|
771
|
+
type: HostBinding,
|
|
772
|
+
args: ['class']
|
|
773
|
+
}] } });
|
|
774
|
+
|
|
775
|
+
class MECXDynamicInputPhoneComponent {
|
|
776
|
+
constructor(cdr) {
|
|
777
|
+
this.cdr = cdr;
|
|
778
|
+
this._field = null;
|
|
779
|
+
this._form = null;
|
|
780
|
+
// eslint-disable-next-line object-curly-newline
|
|
781
|
+
this._formErrors = {};
|
|
782
|
+
this.inputElement = null;
|
|
783
|
+
// not to do
|
|
784
|
+
}
|
|
785
|
+
get className() {
|
|
786
|
+
var _a, _b;
|
|
787
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
788
|
+
}
|
|
789
|
+
ngOnInit() {
|
|
790
|
+
this.cdr.detectChanges();
|
|
791
|
+
}
|
|
792
|
+
ngOnChanges() {
|
|
793
|
+
this.cdr.detectChanges();
|
|
794
|
+
}
|
|
795
|
+
onChange(event) {
|
|
796
|
+
var _a, _b, _c;
|
|
797
|
+
const { _form, _field, self } = this;
|
|
798
|
+
if (!_field || !_form)
|
|
799
|
+
return;
|
|
800
|
+
const { name } = _field;
|
|
801
|
+
const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
|
|
802
|
+
const isValid = (_b = _form === null || _form === void 0 ? void 0 : _form.get(_field === null || _field === void 0 ? void 0 : _field.name)) === null || _b === void 0 ? void 0 : _b.valid;
|
|
803
|
+
if (func) {
|
|
804
|
+
self[func]({
|
|
805
|
+
name,
|
|
806
|
+
isValid,
|
|
807
|
+
event,
|
|
808
|
+
ctrl: _form.get((_c = this._field) === null || _c === void 0 ? void 0 : _c.name),
|
|
809
|
+
form: _form
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
MECXDynamicInputPhoneComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicInputPhoneComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
815
|
+
MECXDynamicInputPhoneComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicInputPhoneComponent, selector: "mecx-dynamic-input-phone", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<monkey-input-phone [name]=\"_field?.name\" [label]=\"_field?.label | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\"\r\n [placeholder]=\"_field?.placeholder | translate\" [icon]=\"_field?.icon\"\r\n (onChange)=\"onChange($event)\" [internationalNumber]=\"_field?.internationalNumber\"\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [maxLength]=\"_field?.maxLength\" [formControl]=\"_form.controls[_field?.name]\" #inputElement>\r\n</monkey-input-phone>", components: [{ type: i1$1.MonkeyInputPhoneComponent, selector: "monkey-input-phone", inputs: ["name", "label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "maxLength", "internationalNumber", "value"], outputs: ["onChange"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicInputPhoneComponent, decorators: [{
|
|
817
|
+
type: Component,
|
|
818
|
+
args: [{ selector: 'mecx-dynamic-input-phone', encapsulation: ViewEncapsulation.None, template: "<monkey-input-phone [name]=\"_field?.name\" [label]=\"_field?.label | translate\"\r\n [helperMessage]=\"_field?.helperMessage | translate\"\r\n [placeholder]=\"_field?.placeholder | translate\" [icon]=\"_field?.icon\"\r\n (onChange)=\"onChange($event)\" [internationalNumber]=\"_field?.internationalNumber\"\r\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\r\n [maxLength]=\"_field?.maxLength\" [formControl]=\"_form.controls[_field?.name]\" #inputElement>\r\n</monkey-input-phone>" }]
|
|
819
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
|
|
820
|
+
type: Input
|
|
821
|
+
}], _form: [{
|
|
822
|
+
type: Input
|
|
823
|
+
}], _formErrors: [{
|
|
824
|
+
type: Input
|
|
825
|
+
}], self: [{
|
|
826
|
+
type: Input
|
|
827
|
+
}], inputElement: [{
|
|
828
|
+
type: ViewChild,
|
|
829
|
+
args: ['inputElement', {
|
|
830
|
+
static: true
|
|
831
|
+
}]
|
|
832
|
+
}], className: [{
|
|
833
|
+
type: HostBinding,
|
|
834
|
+
args: ['class']
|
|
835
|
+
}] } });
|
|
836
|
+
|
|
837
|
+
class MECXDynamicRadioComponent {
|
|
838
|
+
constructor() {
|
|
839
|
+
this._field = null;
|
|
840
|
+
this._form = null;
|
|
841
|
+
// eslint-disable-next-line object-curly-newline
|
|
842
|
+
this._formErrors = {};
|
|
843
|
+
}
|
|
844
|
+
get className() {
|
|
845
|
+
var _a, _b;
|
|
846
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
MECXDynamicRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
850
|
+
MECXDynamicRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicRadioComponent, selector: "mecx-dynamic-radio", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<monkey-radiobutton\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\">\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-radiobutton>", components: [{ type: i1$1.MonkeyRadioButtonComponent, selector: "monkey-radiobutton", inputs: ["label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "value"], outputs: ["onChange"] }, { type: i1$1.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
851
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicRadioComponent, decorators: [{
|
|
852
|
+
type: Component,
|
|
853
|
+
args: [{ selector: 'mecx-dynamic-radio', encapsulation: ViewEncapsulation.None, template: "<monkey-radiobutton\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\">\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-radiobutton>" }]
|
|
854
|
+
}], propDecorators: { _field: [{
|
|
855
|
+
type: Input
|
|
856
|
+
}], _form: [{
|
|
857
|
+
type: Input
|
|
858
|
+
}], _formErrors: [{
|
|
859
|
+
type: Input
|
|
860
|
+
}], className: [{
|
|
861
|
+
type: HostBinding,
|
|
862
|
+
args: ['class']
|
|
863
|
+
}] } });
|
|
864
|
+
|
|
865
|
+
class MECXDynamicSelectComponent {
|
|
866
|
+
constructor() {
|
|
867
|
+
this._field = null;
|
|
868
|
+
this._form = null;
|
|
869
|
+
// eslint-disable-next-line object-curly-newline
|
|
870
|
+
this._formErrors = {};
|
|
871
|
+
this._onHandleOptions = new EventEmitter();
|
|
872
|
+
}
|
|
873
|
+
get className() {
|
|
874
|
+
var _a, _b;
|
|
875
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
876
|
+
}
|
|
877
|
+
onHandleGenericLoad() {
|
|
878
|
+
var _a, _b, _c;
|
|
879
|
+
const { _form, _field, self } = this;
|
|
880
|
+
if ((_form === null || _form === void 0 ? void 0 : _form.disabled) || !_field || !((_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onHandleGenericLoad))
|
|
881
|
+
return;
|
|
882
|
+
const { name } = _field;
|
|
883
|
+
if ((_b = _field === null || _field === void 0 ? void 0 : _field.value) === null || _b === void 0 ? void 0 : _b.length)
|
|
884
|
+
return;
|
|
885
|
+
const { func, url } = (_c = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _c === void 0 ? void 0 : _c.onHandleGenericLoad;
|
|
886
|
+
if (!func || !self[func]) {
|
|
887
|
+
console.error('onHandleGenericLoad not declared');
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
_form === null || _form === void 0 ? void 0 : _form.disable();
|
|
891
|
+
self[func]({
|
|
892
|
+
name,
|
|
893
|
+
url,
|
|
894
|
+
form: _form,
|
|
895
|
+
callback: (data) => {
|
|
896
|
+
var _a;
|
|
897
|
+
if (this._field) {
|
|
898
|
+
this._field.value = data;
|
|
899
|
+
}
|
|
900
|
+
(_a = this._form) === null || _a === void 0 ? void 0 : _a.enable();
|
|
901
|
+
this._onHandleOptions.next(null);
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
onChange(event) {
|
|
906
|
+
var _a, _b, _c;
|
|
907
|
+
const { _form, _field, self } = this;
|
|
908
|
+
if (!_field || !_form)
|
|
909
|
+
return;
|
|
910
|
+
const { name } = _field;
|
|
911
|
+
const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
|
|
912
|
+
const isValid = (_b = _form === null || _form === void 0 ? void 0 : _form.get(_field.name)) === null || _b === void 0 ? void 0 : _b.valid;
|
|
913
|
+
if (func) {
|
|
914
|
+
self[func]({
|
|
915
|
+
name,
|
|
916
|
+
isValid,
|
|
917
|
+
event,
|
|
918
|
+
ctrl: _form === null || _form === void 0 ? void 0 : _form.get((_c = this._field) === null || _c === void 0 ? void 0 : _c.name),
|
|
919
|
+
form: _form,
|
|
920
|
+
value: _field.value
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
MECXDynamicSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
926
|
+
MECXDynamicSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicSelectComponent, selector: "mecx-dynamic-select", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<monkey-select\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select>", components: [{ type: i1$1.MonkeySelectComponent, selector: "monkey-select", inputs: ["label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "labelSelect", "onHandleOptions", "value"], outputs: ["onChange"] }, { type: i1$1.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicSelectComponent, decorators: [{
|
|
928
|
+
type: Component,
|
|
929
|
+
args: [{ selector: 'mecx-dynamic-select', encapsulation: ViewEncapsulation.None, template: "<monkey-select\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select>" }]
|
|
930
|
+
}], propDecorators: { _field: [{
|
|
931
|
+
type: Input
|
|
932
|
+
}], _form: [{
|
|
933
|
+
type: Input
|
|
934
|
+
}], _formErrors: [{
|
|
935
|
+
type: Input
|
|
936
|
+
}], self: [{
|
|
937
|
+
type: Input
|
|
938
|
+
}], className: [{
|
|
939
|
+
type: HostBinding,
|
|
940
|
+
args: ['class']
|
|
941
|
+
}] } });
|
|
942
|
+
|
|
943
|
+
class MECXDynamicSelectSearchComponent {
|
|
944
|
+
constructor() {
|
|
945
|
+
this._field = null;
|
|
946
|
+
this._form = null;
|
|
947
|
+
// eslint-disable-next-line object-curly-newline
|
|
948
|
+
this._formErrors = {};
|
|
949
|
+
this._onHandleOptions = new EventEmitter();
|
|
950
|
+
}
|
|
951
|
+
get className() {
|
|
952
|
+
var _a, _b;
|
|
953
|
+
return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
|
|
954
|
+
}
|
|
955
|
+
onHandleGenericLoad() {
|
|
956
|
+
var _a, _b, _c;
|
|
957
|
+
const { _form, _field, self } = this;
|
|
958
|
+
if ((_form === null || _form === void 0 ? void 0 : _form.disabled) || !_field || !((_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onHandleGenericLoad))
|
|
959
|
+
return;
|
|
960
|
+
const { name } = _field;
|
|
961
|
+
if ((_b = _field === null || _field === void 0 ? void 0 : _field.value) === null || _b === void 0 ? void 0 : _b.length)
|
|
962
|
+
return;
|
|
963
|
+
const { func, url } = (_c = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _c === void 0 ? void 0 : _c.onHandleGenericLoad;
|
|
964
|
+
if (!func || !self[func]) {
|
|
965
|
+
console.error('onHandleGenericLoad not declared');
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
_form === null || _form === void 0 ? void 0 : _form.disable();
|
|
969
|
+
self[func]({
|
|
970
|
+
name,
|
|
971
|
+
url,
|
|
972
|
+
form: _form,
|
|
973
|
+
callback: (data) => {
|
|
974
|
+
var _a;
|
|
975
|
+
if (this._field) {
|
|
976
|
+
this._field.value = data;
|
|
977
|
+
}
|
|
978
|
+
(_a = this._form) === null || _a === void 0 ? void 0 : _a.enable();
|
|
979
|
+
this._onHandleOptions.next(null);
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
onChange(event) {
|
|
984
|
+
var _a, _b, _c;
|
|
985
|
+
const { _form, _field, self } = this;
|
|
986
|
+
if (!_field || !_form)
|
|
987
|
+
return;
|
|
988
|
+
const { name } = _field;
|
|
989
|
+
const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
|
|
990
|
+
const isValid = (_b = _form === null || _form === void 0 ? void 0 : _form.get(_field === null || _field === void 0 ? void 0 : _field.name)) === null || _b === void 0 ? void 0 : _b.valid;
|
|
991
|
+
if (func) {
|
|
992
|
+
self[func]({
|
|
993
|
+
name,
|
|
994
|
+
isValid,
|
|
995
|
+
event,
|
|
996
|
+
ctrl: _form.get((_c = this._field) === null || _c === void 0 ? void 0 : _c.name),
|
|
997
|
+
form: _form,
|
|
998
|
+
value: _field.value
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
MECXDynamicSelectSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicSelectSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1004
|
+
MECXDynamicSelectSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicSelectSearchComponent, selector: "mecx-dynamic-select-search", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<monkey-select-search\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [fieldToCompare]=\"_field?.fieldToCompare\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select-search>", components: [{ type: i1$1.MonkeySelectSearchComponent, selector: "monkey-select-search", inputs: ["label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage", "labelSelect", "fieldToCompare", "onHandleOptions", "value"], outputs: ["onChange", "onSearch"] }, { type: i1$1.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "label", "value", "selectAll", "selected", "enableClick"], outputs: ["onSelectOption"] }], directives: [{ type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
1005
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicSelectSearchComponent, decorators: [{
|
|
1006
|
+
type: Component,
|
|
1007
|
+
args: [{ selector: 'mecx-dynamic-select-search', encapsulation: ViewEncapsulation.None, template: "<monkey-select-search\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [fieldToCompare]=\"_field?.fieldToCompare\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\"\n [placeholder]=\"_field?.placeholder | translate\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select-search>" }]
|
|
1008
|
+
}], propDecorators: { _field: [{
|
|
1009
|
+
type: Input
|
|
1010
|
+
}], _form: [{
|
|
1011
|
+
type: Input
|
|
1012
|
+
}], _formErrors: [{
|
|
1013
|
+
type: Input
|
|
1014
|
+
}], self: [{
|
|
1015
|
+
type: Input
|
|
1016
|
+
}], className: [{
|
|
1017
|
+
type: HostBinding,
|
|
1018
|
+
args: ['class']
|
|
1019
|
+
}] } });
|
|
1020
|
+
|
|
1021
|
+
const componentMapper = {
|
|
1022
|
+
input: MECXDynamicInputComponent,
|
|
1023
|
+
'input-phone': MECXDynamicInputPhoneComponent,
|
|
1024
|
+
radiobutton: MECXDynamicRadioComponent,
|
|
1025
|
+
select: MECXDynamicSelectComponent,
|
|
1026
|
+
'select-search': MECXDynamicSelectSearchComponent,
|
|
1027
|
+
'file-upload': MECXDynamicFileUploadComponent,
|
|
1028
|
+
button: MECXDynamicButtonComponent
|
|
1029
|
+
};
|
|
1030
|
+
class MECXDynamicDirective {
|
|
1031
|
+
constructor(resolver, container, cdr) {
|
|
1032
|
+
this.resolver = resolver;
|
|
1033
|
+
this.container = container;
|
|
1034
|
+
this.cdr = cdr;
|
|
1035
|
+
this.field = null;
|
|
1036
|
+
this.form = null;
|
|
1037
|
+
// not to do
|
|
1038
|
+
}
|
|
1039
|
+
handleInternalPlusValidation() {
|
|
1040
|
+
var _a, _b, _c, _d;
|
|
1041
|
+
if (!((_a = this.field) === null || _a === void 0 ? void 0 : _a.alwaysShowPlusValidation))
|
|
1042
|
+
return false;
|
|
1043
|
+
const { operator, value, field } = (_b = this.field) === null || _b === void 0 ? void 0 : _b.alwaysShowPlusValidation;
|
|
1044
|
+
const validators = {
|
|
1045
|
+
e: (val1, val2) => { return val1 === val2; },
|
|
1046
|
+
lt: (val1, val2) => { return val1 < val2; },
|
|
1047
|
+
gt: (val1, val2) => { return val1 > val2; }
|
|
1048
|
+
};
|
|
1049
|
+
const data = (_d = (_c = this.form) === null || _c === void 0 ? void 0 : _c.controls[field]) === null || _d === void 0 ? void 0 : _d.value;
|
|
1050
|
+
return validators[operator](data, value);
|
|
1051
|
+
}
|
|
1052
|
+
buildComponent() {
|
|
1053
|
+
var _a, _b;
|
|
1054
|
+
if ((_a = this.componentRef) === null || _a === void 0 ? void 0 : _a.instance)
|
|
1055
|
+
return;
|
|
1056
|
+
const factory = this.resolver.resolveComponentFactory(componentMapper[(_b = this.field) === null || _b === void 0 ? void 0 : _b.fieldType]);
|
|
1057
|
+
this.componentRef = this.container.createComponent(factory);
|
|
1058
|
+
this.componentRef.instance._field = this.field;
|
|
1059
|
+
this.componentRef.instance._form = this.form;
|
|
1060
|
+
// eslint-disable-next-line object-curly-newline
|
|
1061
|
+
this.componentRef.instance._formErrors = this.formErrors || {};
|
|
1062
|
+
this.componentRef.instance.self = this.self;
|
|
1063
|
+
}
|
|
1064
|
+
ngOnInit() {
|
|
1065
|
+
var _a;
|
|
1066
|
+
if (!((_a = this.field) === null || _a === void 0 ? void 0 : _a.alwaysShow) && !this.handleInternalPlusValidation())
|
|
1067
|
+
return;
|
|
1068
|
+
this.buildComponent();
|
|
1069
|
+
}
|
|
1070
|
+
ngOnChanges() {
|
|
1071
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1072
|
+
if (this.plusValidations && this.plusValidations[(_a = this.field) === null || _a === void 0 ? void 0 : _a.name]) {
|
|
1073
|
+
if (!((_b = this.field) === null || _b === void 0 ? void 0 : _b.alwaysShow) && this.plusValidations[(_c = this.field) === null || _c === void 0 ? void 0 : _c.name].alwaysShow) {
|
|
1074
|
+
setTimeout(() => {
|
|
1075
|
+
this.buildComponent();
|
|
1076
|
+
this.cdr.detectChanges();
|
|
1077
|
+
}, 1);
|
|
1078
|
+
}
|
|
1079
|
+
if (((_d = this.componentRef) === null || _d === void 0 ? void 0 : _d.instance) &&
|
|
1080
|
+
!this.plusValidations[(_e = this.field) === null || _e === void 0 ? void 0 : _e.name].alwaysShow) {
|
|
1081
|
+
this.componentRef.destroy();
|
|
1082
|
+
this.componentRef = null;
|
|
1083
|
+
(_h = (_f = this.form) === null || _f === void 0 ? void 0 : _f.controls[(_g = this.field) === null || _g === void 0 ? void 0 : _g.name]) === null || _h === void 0 ? void 0 : _h.setValue(null);
|
|
1084
|
+
(_l = (_j = this.form) === null || _j === void 0 ? void 0 : _j.controls[(_k = this.field) === null || _k === void 0 ? void 0 : _k.name]) === null || _l === void 0 ? void 0 : _l.clearValidators();
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
if (!((_m = this.componentRef) === null || _m === void 0 ? void 0 : _m.instance))
|
|
1088
|
+
return;
|
|
1089
|
+
this.componentRef.instance._formErrors = this.formErrors || {};
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
MECXDynamicDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicDirective, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1093
|
+
MECXDynamicDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: { field: "field", form: "form", formErrors: "formErrors", self: "self", plusValidations: "plusValidations" }, usesOnChanges: true, ngImport: i0 });
|
|
1094
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicDirective, decorators: [{
|
|
1095
|
+
type: Directive,
|
|
1096
|
+
args: [{
|
|
1097
|
+
selector: '[MECXDynamic]'
|
|
1098
|
+
}]
|
|
1099
|
+
}], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { field: [{
|
|
1100
|
+
type: Input
|
|
1101
|
+
}], form: [{
|
|
1102
|
+
type: Input
|
|
1103
|
+
}], formErrors: [{
|
|
1104
|
+
type: Input
|
|
1105
|
+
}], self: [{
|
|
1106
|
+
type: Input
|
|
1107
|
+
}], plusValidations: [{
|
|
1108
|
+
type: Input
|
|
1109
|
+
}] } });
|
|
1110
|
+
|
|
1111
|
+
class MECXDynamicFormComponent extends BaseDynamic {
|
|
1112
|
+
constructor(fb, cdr) {
|
|
1113
|
+
super(fb);
|
|
1114
|
+
this.cdr = cdr;
|
|
1115
|
+
this.unsubscribeAll = new Subject();
|
|
1116
|
+
}
|
|
1117
|
+
ngOnInit() {
|
|
1118
|
+
super.ngOnInit();
|
|
1119
|
+
this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func) => {
|
|
1120
|
+
this.onSubmit(func);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
ngOnDestroy() {
|
|
1124
|
+
this.unsubscribeAll.next();
|
|
1125
|
+
this.unsubscribeAll.complete();
|
|
1126
|
+
}
|
|
1127
|
+
onSubmit(callback) {
|
|
1128
|
+
const { _form } = this;
|
|
1129
|
+
// eslint-disable-next-line object-curly-newline
|
|
1130
|
+
this.__monkeyecxFormErrors = {};
|
|
1131
|
+
const isValid = this.validateForm(_form);
|
|
1132
|
+
this.cdr.detectChanges();
|
|
1133
|
+
this.onHandleSubmitFormReady.next({
|
|
1134
|
+
validate: {
|
|
1135
|
+
isValid
|
|
1136
|
+
},
|
|
1137
|
+
callback,
|
|
1138
|
+
form: _form
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
MECXDynamicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicFormComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1143
|
+
MECXDynamicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicFormComponent, selector: "mecx-dynamic-form", usesInheritance: true, ngImport: i0, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div class=\"row\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"_form\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors\" [style.display]=\"'none'\">\n </div>\n </div>\n</form>", directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
1144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicFormComponent, decorators: [{
|
|
1145
|
+
type: Component,
|
|
1146
|
+
args: [{ selector: 'mecx-dynamic-form', styles: [], encapsulation: ViewEncapsulation.None, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div class=\"row\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"_form\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors\" [style.display]=\"'none'\">\n </div>\n </div>\n</form>" }]
|
|
1147
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; } });
|
|
1148
|
+
|
|
1149
|
+
class MECXDynamicFormArrayComponent extends BaseDynamicArray {
|
|
1150
|
+
constructor(fb, cdr) {
|
|
1151
|
+
super(fb);
|
|
1152
|
+
this.cdr = cdr;
|
|
1153
|
+
this.unsubscribeAll = new Subject();
|
|
1154
|
+
this.__monkeyecxFormErrors = [];
|
|
1155
|
+
}
|
|
1156
|
+
ngOnInit() {
|
|
1157
|
+
super.ngOnInit();
|
|
1158
|
+
this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func) => {
|
|
1159
|
+
this.onSubmit(func);
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
ngOnDestroy() {
|
|
1163
|
+
this.unsubscribeAll.next();
|
|
1164
|
+
this.unsubscribeAll.complete();
|
|
1165
|
+
}
|
|
1166
|
+
onSubmit(callback) {
|
|
1167
|
+
const { _form } = this;
|
|
1168
|
+
// eslint-disable-next-line object-curly-newline
|
|
1169
|
+
this.__monkeyecxFormErrors = [];
|
|
1170
|
+
let validate = {
|
|
1171
|
+
isValid: false
|
|
1172
|
+
};
|
|
1173
|
+
let hasErrors = false;
|
|
1174
|
+
if (this.formValues) {
|
|
1175
|
+
this.__monkeyecxFormErrors = [this.formValues.length];
|
|
1176
|
+
this.formValues.controls.forEach((item, index) => {
|
|
1177
|
+
if (item instanceof FormGroup) {
|
|
1178
|
+
if (!this.validateForm(item, index)) {
|
|
1179
|
+
hasErrors = true;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
validate = {
|
|
1185
|
+
isValid: !hasErrors
|
|
1186
|
+
};
|
|
1187
|
+
this.cdr.detectChanges();
|
|
1188
|
+
this.onHandleSubmitFormReady.next({
|
|
1189
|
+
validate,
|
|
1190
|
+
callback,
|
|
1191
|
+
form: _form
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
onHandleAdd() {
|
|
1195
|
+
var _a;
|
|
1196
|
+
(_a = this.formValues) === null || _a === void 0 ? void 0 : _a.push(this.formBase());
|
|
1197
|
+
this.cdr.detectChanges();
|
|
1198
|
+
}
|
|
1199
|
+
onHandleRemove(index) {
|
|
1200
|
+
var _a;
|
|
1201
|
+
(_a = this.formValues) === null || _a === void 0 ? void 0 : _a.removeAt(index);
|
|
1202
|
+
this._plusValidations.splice(index, 1);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
MECXDynamicFormArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicFormArrayComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1206
|
+
MECXDynamicFormArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXDynamicFormArrayComponent, selector: "mecx-dynamic-form-array", usesInheritance: true, ngImport: i0, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div formArrayName=\"fields\">\n <div *ngFor=\"let item of formValues.controls; let indForm=index\" [formGroupName]=\"indForm\">\n <monkey-button type=\"secondary\" color=\"error\" icon=\"close-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.REMOVE' | translate\" (click)=\"onHandleRemove(indForm)\"\n *ngIf=\"formValues.controls.length > 1 && !disabled\">\n </monkey-button>\n <div class=\"row mt-3\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"item\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors[indForm]\"\n [plusValidations]=\"_plusValidations[indForm]\" [style.display]=\"'none'\">\n </div>\n </div>\n </div>\n </div>\n</form>\n<monkey-button type=\"secondary\" color=\"theme\" icon=\"more-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.ADD' | translate\" (click)=\"onHandleAdd()\" *ngIf=\"!disabled\">\n</monkey-button>", styles: ["mecx-dynamic-form-array monkey-button{width:100%}mecx-dynamic-form-array monkey-button button{width:100%;height:40px}\n"], components: [{ type: i1$1.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
1207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicFormArrayComponent, decorators: [{
|
|
1208
|
+
type: Component,
|
|
1209
|
+
args: [{ selector: 'mecx-dynamic-form-array', encapsulation: ViewEncapsulation.None, template: "<form name=\"form\" [formGroup]=\"_form\" *ngIf=\"_form\">\n <div formArrayName=\"fields\">\n <div *ngFor=\"let item of formValues.controls; let indForm=index\" [formGroupName]=\"indForm\">\n <monkey-button type=\"secondary\" color=\"error\" icon=\"close-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.REMOVE' | translate\" (click)=\"onHandleRemove(indForm)\"\n *ngIf=\"formValues.controls.length > 1 && !disabled\">\n </monkey-button>\n <div class=\"row mt-3\">\n <div *ngFor=\"let field of fields;\" MECXDynamic [field]=\"field\" [form]=\"item\" [self]=\"self\"\n [formErrors]=\"__monkeyecxFormErrors[indForm]\"\n [plusValidations]=\"_plusValidations[indForm]\" [style.display]=\"'none'\">\n </div>\n </div>\n </div>\n </div>\n</form>\n<monkey-button type=\"secondary\" color=\"theme\" icon=\"more-20\" iconPosition=\"right\"\n [label]=\"'BUTTONS.ADD' | translate\" (click)=\"onHandleAdd()\" *ngIf=\"!disabled\">\n</monkey-button>", styles: ["mecx-dynamic-form-array monkey-button{width:100%}mecx-dynamic-form-array monkey-button button{width:100%;height:40px}\n"] }]
|
|
1210
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; } });
|
|
1211
|
+
|
|
1212
|
+
class MECXDynamicModule {
|
|
1213
|
+
}
|
|
1214
|
+
MECXDynamicModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1215
|
+
MECXDynamicModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicModule, declarations: [MECXDynamicButtonComponent,
|
|
1216
|
+
MECXDynamicFileUploadComponent,
|
|
1217
|
+
MECXDynamicFormComponent,
|
|
1218
|
+
MECXDynamicFormArrayComponent,
|
|
1219
|
+
MECXDynamicInputComponent,
|
|
1220
|
+
MECXDynamicInputPhoneComponent,
|
|
1221
|
+
MECXDynamicRadioComponent,
|
|
1222
|
+
MECXDynamicSelectComponent,
|
|
1223
|
+
MECXDynamicSelectSearchComponent,
|
|
1224
|
+
MECXDynamicDirective], imports: [CommonModule,
|
|
1225
|
+
FormsModule,
|
|
1226
|
+
ReactiveFormsModule,
|
|
1227
|
+
MonkeyInputModule,
|
|
1228
|
+
MonkeySelectModule,
|
|
1229
|
+
MonkeyRadioButtonModule,
|
|
1230
|
+
MonkeyOptionModule,
|
|
1231
|
+
MonkeyFileUploadModule,
|
|
1232
|
+
MonkeyButtonModule,
|
|
1233
|
+
MonkeyInputPhoneModule, i4.TranslateModule], exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent] });
|
|
1234
|
+
MECXDynamicModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicModule, imports: [[
|
|
1235
|
+
CommonModule,
|
|
1236
|
+
FormsModule,
|
|
1237
|
+
ReactiveFormsModule,
|
|
1238
|
+
MonkeyInputModule,
|
|
1239
|
+
MonkeySelectModule,
|
|
1240
|
+
MonkeyRadioButtonModule,
|
|
1241
|
+
MonkeyOptionModule,
|
|
1242
|
+
MonkeyFileUploadModule,
|
|
1243
|
+
MonkeyButtonModule,
|
|
1244
|
+
MonkeyInputPhoneModule,
|
|
1245
|
+
TranslateModule.forChild()
|
|
1246
|
+
]] });
|
|
1247
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXDynamicModule, decorators: [{
|
|
1248
|
+
type: NgModule,
|
|
1249
|
+
args: [{
|
|
1250
|
+
declarations: [
|
|
1251
|
+
MECXDynamicButtonComponent,
|
|
1252
|
+
MECXDynamicFileUploadComponent,
|
|
1253
|
+
MECXDynamicFormComponent,
|
|
1254
|
+
MECXDynamicFormArrayComponent,
|
|
1255
|
+
MECXDynamicInputComponent,
|
|
1256
|
+
MECXDynamicInputPhoneComponent,
|
|
1257
|
+
MECXDynamicRadioComponent,
|
|
1258
|
+
MECXDynamicSelectComponent,
|
|
1259
|
+
MECXDynamicSelectSearchComponent,
|
|
1260
|
+
MECXDynamicDirective
|
|
1261
|
+
],
|
|
1262
|
+
imports: [
|
|
1263
|
+
CommonModule,
|
|
1264
|
+
FormsModule,
|
|
1265
|
+
ReactiveFormsModule,
|
|
1266
|
+
MonkeyInputModule,
|
|
1267
|
+
MonkeySelectModule,
|
|
1268
|
+
MonkeyRadioButtonModule,
|
|
1269
|
+
MonkeyOptionModule,
|
|
1270
|
+
MonkeyFileUploadModule,
|
|
1271
|
+
MonkeyButtonModule,
|
|
1272
|
+
MonkeyInputPhoneModule,
|
|
1273
|
+
TranslateModule.forChild()
|
|
1274
|
+
],
|
|
1275
|
+
exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent],
|
|
1276
|
+
entryComponents: [MECXDynamicInputComponent]
|
|
1277
|
+
}]
|
|
1278
|
+
}] });
|
|
1279
|
+
|
|
1280
|
+
class MECXPasswordStrengthComponent {
|
|
1281
|
+
constructor(configService) {
|
|
1282
|
+
this.configService = configService;
|
|
1283
|
+
this.passwordToCheck = null;
|
|
1284
|
+
this.onHandleSubmitReady = new EventEmitter();
|
|
1285
|
+
this._validatorsPasswordPass = [];
|
|
1286
|
+
this._stepPassword = 0;
|
|
1287
|
+
this.validatorsPassword = new Map();
|
|
1288
|
+
// not do
|
|
1289
|
+
}
|
|
1290
|
+
handleColor(score) {
|
|
1291
|
+
let idx = 0;
|
|
1292
|
+
if (score > 50)
|
|
1293
|
+
idx = 1;
|
|
1294
|
+
if (score === 100)
|
|
1295
|
+
idx = 2;
|
|
1296
|
+
this._stepPassword = idx;
|
|
1297
|
+
}
|
|
1298
|
+
passwordStrengthValidator(pass) {
|
|
1299
|
+
this._validatorsPasswordPass = [];
|
|
1300
|
+
let score = 0;
|
|
1301
|
+
this.validatorsPassword.forEach((key, value) => {
|
|
1302
|
+
this._validatorsPasswordPass.push({
|
|
1303
|
+
regex: `${value}`,
|
|
1304
|
+
validate: `${key.VALIDATE}` === String(RegExp(`${key.REGEX}`).test(pass)),
|
|
1305
|
+
percent: 100 / this.validatorsPassword.size
|
|
1306
|
+
});
|
|
1307
|
+
});
|
|
1308
|
+
this._validatorsPasswordPass.forEach((check) => {
|
|
1309
|
+
if (check.validate) {
|
|
1310
|
+
score += check.percent;
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
return Math.trunc(score);
|
|
1314
|
+
}
|
|
1315
|
+
onHandleReady() {
|
|
1316
|
+
var _a;
|
|
1317
|
+
const validate = (_a = this._validatorsPasswordPass) === null || _a === void 0 ? void 0 : _a.find(({ validate }) => { return !validate; });
|
|
1318
|
+
this.onHandleSubmitReady.next(!validate);
|
|
1319
|
+
}
|
|
1320
|
+
onHandleChages() {
|
|
1321
|
+
const password = this.passwordToCheck;
|
|
1322
|
+
this.handleColor(this.passwordStrengthValidator(password));
|
|
1323
|
+
this.onHandleReady();
|
|
1324
|
+
}
|
|
1325
|
+
onHandlePasswordStrengthKeys(params) {
|
|
1326
|
+
var _a, _b, _c;
|
|
1327
|
+
const ps = (_c = (_b = (_a = params === null || params === void 0 ? void 0 : params.program) === null || _a === void 0 ? void 0 : _a.screens) === null || _b === void 0 ? void 0 : _b.login) === null || _c === void 0 ? void 0 : _c.passwordStrength;
|
|
1328
|
+
if (ps) {
|
|
1329
|
+
Object.entries(ps)
|
|
1330
|
+
.forEach(([key, value]) => {
|
|
1331
|
+
if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
|
|
1332
|
+
this.validatorsPassword.set(key, value);
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
this.onHandleChages();
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
ngOnInit() {
|
|
1339
|
+
this.configService.config().subscribe((_) => {
|
|
1340
|
+
this.onHandlePasswordStrengthKeys(_);
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
ngOnChanges() {
|
|
1344
|
+
this.onHandleChages();
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
MECXPasswordStrengthComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXPasswordStrengthComponent, deps: [{ token: i1$2.MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1348
|
+
MECXPasswordStrengthComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXPasswordStrengthComponent, selector: "mecx-password-strength", inputs: { passwordToCheck: "passwordToCheck" }, outputs: { onHandleSubmitReady: "onHandleSubmitReady" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"_validatorsPasswordPass?.length\">\n <div id=\"strength\" class=\"d-flex full-width flex-column justify-content-center align-items-center\"\n #strength>\n <div id=\"strengthBar\" class=\"strength-bar d-flex full-width flex-row\">\n <div class=\"d-flex full-width align-items-center\">\n <div class=\"bar-label\">\n <small>{{ 'SCREENS.LOGIN.REGISTER.PASSWORD-STRENGTH.TITLE' | translate }}</small>\n </div>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.error]=\"_stepPassword === 0\" [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\">\n </div>\n <ng-container *ngIf=\"_stepPassword === 0\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 1\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 2\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"callbacks mt-2 row\">\n <div class=\"col-sm-6 mt-2 d-flex justify-content-start\"\n *ngFor=\"let validators of _validatorsPasswordPass\">\n <monkey-icon *ngIf=\"validators.validate\" icon=\"check-circle-20\"></monkey-icon>\n <monkey-icon *ngIf=\"!validators.validate\" icon=\"error-20\"></monkey-icon>\n <span class=\"ml-2\">\n {{ 'SCREENS.LOGIN.REGISTER.PASSWORD-STRENGTH.TYPES.' + validators.regex | translate }}\n </span>\n </div>\n </div>\n</ng-container>\n<ng-template #stepPasswordLabel>\n <div class=\"name-point mt-1\" [class.error]=\"_stepPassword === 0\"\n [class.warning]=\"_stepPassword === 1\" [class.success]=\"_stepPassword === 2\">\n {{ 'SCREENS.LOGIN.REGISTER.PASSWORD-STRENGTH.LABELS.' + _stepPassword | translate }}\n </div>\n</ng-template>", styles: ["mecx-password-strength{margin-bottom:8px}mecx-password-strength .strength-bar{display:inline;list-style:none;padding:0;vertical-align:2px;gap:.5rem}mecx-password-strength .strength-bar .bar-label{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#4b4a53}mecx-password-strength .strength-bar .point:last-child{margin:0}mecx-password-strength .callbacks{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#72717e}mecx-password-strength .point{background:#ebebeb;border-radius:8px;display:inline-block;height:8px;margin-right:4px;width:100%}mecx-password-strength .point.success{background:var(--mecx-color-success-main)}mecx-password-strength .point.warning{background:var(--mecx-color-warning-main)}mecx-password-strength .point.error{background:var(--mecx-color-error-main)}mecx-password-strength .name-point.success{color:var(--mecx-color-success-main)}mecx-password-strength .name-point.warning{color:var(--mecx-color-warning-main)}mecx-password-strength .name-point.error{color:var(--mecx-color-error-main)}\n"], components: [{ type: i1$1.MonkeyIconComponent, selector: "monkey-icon", inputs: ["icon", "color", "contrast", "disabled"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
|
|
1349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXPasswordStrengthComponent, decorators: [{
|
|
1350
|
+
type: Component,
|
|
1351
|
+
args: [{ selector: 'mecx-password-strength', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"_validatorsPasswordPass?.length\">\n <div id=\"strength\" class=\"d-flex full-width flex-column justify-content-center align-items-center\"\n #strength>\n <div id=\"strengthBar\" class=\"strength-bar d-flex full-width flex-row\">\n <div class=\"d-flex full-width align-items-center\">\n <div class=\"bar-label\">\n <small>{{ 'SCREENS.LOGIN.REGISTER.PASSWORD-STRENGTH.TITLE' | translate }}</small>\n </div>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.error]=\"_stepPassword === 0\" [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\">\n </div>\n <ng-container *ngIf=\"_stepPassword === 0\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.warning]=\"_stepPassword === 1\"\n [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 1\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n <div class=\"d-flex full-width align-items-center flex-column\">\n <div class=\"point\" [class.success]=\"_stepPassword === 2\"></div>\n <ng-container *ngIf=\"_stepPassword === 2\">\n <ng-container *ngTemplateOutlet=\"stepPasswordLabel\"></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"callbacks mt-2 row\">\n <div class=\"col-sm-6 mt-2 d-flex justify-content-start\"\n *ngFor=\"let validators of _validatorsPasswordPass\">\n <monkey-icon *ngIf=\"validators.validate\" icon=\"check-circle-20\"></monkey-icon>\n <monkey-icon *ngIf=\"!validators.validate\" icon=\"error-20\"></monkey-icon>\n <span class=\"ml-2\">\n {{ 'SCREENS.LOGIN.REGISTER.PASSWORD-STRENGTH.TYPES.' + validators.regex | translate }}\n </span>\n </div>\n </div>\n</ng-container>\n<ng-template #stepPasswordLabel>\n <div class=\"name-point mt-1\" [class.error]=\"_stepPassword === 0\"\n [class.warning]=\"_stepPassword === 1\" [class.success]=\"_stepPassword === 2\">\n {{ 'SCREENS.LOGIN.REGISTER.PASSWORD-STRENGTH.LABELS.' + _stepPassword | translate }}\n </div>\n</ng-template>", styles: ["mecx-password-strength{margin-bottom:8px}mecx-password-strength .strength-bar{display:inline;list-style:none;padding:0;vertical-align:2px;gap:.5rem}mecx-password-strength .strength-bar .bar-label{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#4b4a53}mecx-password-strength .strength-bar .point:last-child{margin:0}mecx-password-strength .callbacks{font-style:normal;font-weight:400;font-size:14px;line-height:16px;color:#72717e}mecx-password-strength .point{background:#ebebeb;border-radius:8px;display:inline-block;height:8px;margin-right:4px;width:100%}mecx-password-strength .point.success{background:var(--mecx-color-success-main)}mecx-password-strength .point.warning{background:var(--mecx-color-warning-main)}mecx-password-strength .point.error{background:var(--mecx-color-error-main)}mecx-password-strength .name-point.success{color:var(--mecx-color-success-main)}mecx-password-strength .name-point.warning{color:var(--mecx-color-warning-main)}mecx-password-strength .name-point.error{color:var(--mecx-color-error-main)}\n"] }]
|
|
1352
|
+
}], ctorParameters: function () { return [{ type: i1$2.MonkeyEcxConfigService }]; }, propDecorators: { passwordToCheck: [{
|
|
1353
|
+
type: Input
|
|
1354
|
+
}], onHandleSubmitReady: [{
|
|
1355
|
+
type: Output
|
|
1356
|
+
}] } });
|
|
1357
|
+
|
|
1358
|
+
class MECXPasswordStrengthModule {
|
|
1359
|
+
}
|
|
1360
|
+
MECXPasswordStrengthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXPasswordStrengthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1361
|
+
MECXPasswordStrengthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXPasswordStrengthModule, declarations: [MECXPasswordStrengthComponent], imports: [CommonModule,
|
|
1362
|
+
FormsModule,
|
|
1363
|
+
ReactiveFormsModule,
|
|
1364
|
+
MonkeyEcxPipesModule,
|
|
1365
|
+
MonkeyEcxDirectivesModule,
|
|
1366
|
+
MonkeyButtonModule,
|
|
1367
|
+
MonkeyInputModule,
|
|
1368
|
+
MonkeyIconModule, i4.TranslateModule], exports: [MECXPasswordStrengthComponent] });
|
|
1369
|
+
MECXPasswordStrengthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXPasswordStrengthModule, imports: [[
|
|
1370
|
+
CommonModule,
|
|
1371
|
+
FormsModule,
|
|
1372
|
+
ReactiveFormsModule,
|
|
1373
|
+
MonkeyEcxPipesModule,
|
|
1374
|
+
MonkeyEcxDirectivesModule,
|
|
1375
|
+
MonkeyButtonModule,
|
|
1376
|
+
MonkeyInputModule,
|
|
1377
|
+
MonkeyIconModule,
|
|
1378
|
+
TranslateModule.forChild()
|
|
1379
|
+
]] });
|
|
1380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXPasswordStrengthModule, decorators: [{
|
|
1381
|
+
type: NgModule,
|
|
1382
|
+
args: [{
|
|
1383
|
+
declarations: [MECXPasswordStrengthComponent],
|
|
1384
|
+
imports: [
|
|
1385
|
+
CommonModule,
|
|
1386
|
+
FormsModule,
|
|
1387
|
+
ReactiveFormsModule,
|
|
1388
|
+
MonkeyEcxPipesModule,
|
|
1389
|
+
MonkeyEcxDirectivesModule,
|
|
1390
|
+
MonkeyButtonModule,
|
|
1391
|
+
MonkeyInputModule,
|
|
1392
|
+
MonkeyIconModule,
|
|
1393
|
+
TranslateModule.forChild()
|
|
1394
|
+
],
|
|
1395
|
+
exports: [MECXPasswordStrengthComponent]
|
|
1396
|
+
}]
|
|
1397
|
+
}] });
|
|
1398
|
+
|
|
1399
|
+
class MECXProgressBarService {
|
|
1400
|
+
constructor(router) {
|
|
1401
|
+
this.router = router;
|
|
1402
|
+
this.visible = new BehaviorSubject(false);
|
|
1403
|
+
this.init();
|
|
1404
|
+
}
|
|
1405
|
+
init() {
|
|
1406
|
+
this.router.events
|
|
1407
|
+
.pipe(filter((event) => {
|
|
1408
|
+
return event instanceof NavigationStart;
|
|
1409
|
+
}))
|
|
1410
|
+
.subscribe(() => {
|
|
1411
|
+
this.show();
|
|
1412
|
+
});
|
|
1413
|
+
this.router.events
|
|
1414
|
+
.pipe(filter((event) => {
|
|
1415
|
+
return (event instanceof NavigationEnd ||
|
|
1416
|
+
event instanceof NavigationError ||
|
|
1417
|
+
event instanceof NavigationCancel);
|
|
1418
|
+
}))
|
|
1419
|
+
.subscribe(() => {
|
|
1420
|
+
this.hide();
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
show() {
|
|
1424
|
+
this.visible.next(true);
|
|
1425
|
+
}
|
|
1426
|
+
hide() {
|
|
1427
|
+
this.visible.next(false);
|
|
1428
|
+
}
|
|
1429
|
+
visibleConfig() {
|
|
1430
|
+
return this.visible.asObservable();
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
MECXProgressBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarService, deps: [{ token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1434
|
+
MECXProgressBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarService, providedIn: 'root' });
|
|
1435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarService, decorators: [{
|
|
1436
|
+
type: Injectable,
|
|
1437
|
+
args: [{
|
|
1438
|
+
providedIn: 'root'
|
|
1439
|
+
}]
|
|
1440
|
+
}], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
|
|
1441
|
+
|
|
1442
|
+
class MECXProgressBarComponent extends BaseComponent {
|
|
1443
|
+
constructor(progressBarService) {
|
|
1444
|
+
super();
|
|
1445
|
+
this.progressBarService = progressBarService;
|
|
1446
|
+
this.visible = false;
|
|
1447
|
+
}
|
|
1448
|
+
ngOnInit() {
|
|
1449
|
+
this.progressBarService
|
|
1450
|
+
.visibleConfig()
|
|
1451
|
+
.pipe(takeUntil(this.__unsubscribeAll))
|
|
1452
|
+
.subscribe((visible) => {
|
|
1453
|
+
this.visible = visible;
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
MECXProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarComponent, deps: [{ token: MECXProgressBarService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1458
|
+
MECXProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MECXProgressBarComponent, selector: "mecx-progress-bar", usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"visible\">\n <progress class=\"monkey-progress monkey-progress__theme\"></progress>\n</ng-container>", styles: ["app-progress-bar{position:absolute;width:100%;margin-top:-9.5px;z-index:99998}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
1459
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarComponent, decorators: [{
|
|
1460
|
+
type: Component,
|
|
1461
|
+
args: [{ selector: 'mecx-progress-bar', encapsulation: ViewEncapsulation.None, template: "<ng-container *ngIf=\"visible\">\n <progress class=\"monkey-progress monkey-progress__theme\"></progress>\n</ng-container>", styles: ["app-progress-bar{position:absolute;width:100%;margin-top:-9.5px;z-index:99998}\n"] }]
|
|
1462
|
+
}], ctorParameters: function () { return [{ type: MECXProgressBarService }]; } });
|
|
1463
|
+
|
|
1464
|
+
class MECXProgressBarModule {
|
|
1465
|
+
}
|
|
1466
|
+
MECXProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1467
|
+
MECXProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarModule, declarations: [MECXProgressBarComponent], imports: [CommonModule], exports: [MECXProgressBarComponent] });
|
|
1468
|
+
MECXProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarModule, imports: [[CommonModule]] });
|
|
1469
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MECXProgressBarModule, decorators: [{
|
|
1470
|
+
type: NgModule,
|
|
1471
|
+
args: [{
|
|
1472
|
+
declarations: [MECXProgressBarComponent],
|
|
1473
|
+
imports: [CommonModule],
|
|
1474
|
+
exports: [MECXProgressBarComponent]
|
|
1475
|
+
}]
|
|
1476
|
+
}] });
|
|
1477
|
+
|
|
1478
|
+
/*
|
|
1479
|
+
* Public API Surface of monkey-front-components
|
|
1480
|
+
*/
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Generated bundle index. Do not edit.
|
|
1484
|
+
*/
|
|
1485
|
+
|
|
1486
|
+
export { BaseComponent, BaseDynamic, BaseDynamicArray, MECXDynamicDirective, MECXDynamicFileUploadComponent, MECXDynamicFormArrayComponent, MECXDynamicFormComponent, MECXDynamicInputComponent, MECXDynamicInputPhoneComponent, MECXDynamicModule, MECXDynamicRadioComponent, MECXDynamicSelectComponent, MECXPasswordStrengthComponent, MECXPasswordStrengthModule, MECXProgressBarComponent, MECXProgressBarModule, MECXProgressBarService, validators };
|
|
1487
|
+
//# sourceMappingURL=monkey-front-components.mjs.map
|