monkey-front-components 0.0.180 → 0.0.181

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