monkey-front-components 0.0.180 → 0.0.184

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