monkey-front-components 0.0.178 → 0.0.182

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 (84) 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} +2 -1
  27. package/esm2020/lib/components/shared/index.mjs +3 -0
  28. package/esm2020/lib/components/shared/password-strength/index.mjs +3 -0
  29. package/esm2020/lib/components/shared/password-strength/password-strength.component.mjs +83 -0
  30. package/esm2020/lib/components/shared/password-strength/password-strength.mjs +2 -0
  31. package/esm2020/lib/components/shared/password-strength/password-strength.module.mjs +50 -0
  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/index.d.ts +1 -0
  56. package/lib/components/shared/index.d.ts +2 -0
  57. package/lib/components/shared/password-strength/index.d.ts +2 -0
  58. package/lib/components/shared/password-strength/password-strength.component.d.ts +22 -0
  59. package/lib/components/shared/password-strength/password-strength.d.ts +5 -0
  60. package/lib/components/shared/password-strength/password-strength.module.d.ts +12 -0
  61. package/lib/components/shared/progress-bar/index.d.ts +3 -0
  62. package/lib/components/shared/progress-bar/progress-bar.component.d.ts +12 -0
  63. package/lib/components/shared/progress-bar/progress-bar.module.d.ts +8 -0
  64. package/lib/components/shared/progress-bar/progress-bar.service.d.ts +14 -0
  65. package/monkey-front-components-0.0.182.tgz +0 -0
  66. package/package.json +25 -11
  67. package/bundles/monkey-front-components.umd.js +0 -1733
  68. package/bundles/monkey-front-components.umd.js.map +0 -1
  69. package/esm2015/lib/components/base/base-component.js +0 -292
  70. package/esm2015/lib/components/base/base-dynamic-array.js +0 -215
  71. package/esm2015/lib/components/base/base-dynamic.js +0 -98
  72. package/esm2015/lib/components/dynamic/button/button.component.js +0 -57
  73. package/esm2015/lib/components/dynamic/dynamic-directive.js +0 -95
  74. package/esm2015/lib/components/dynamic/file-upload/file-upload.component.js +0 -57
  75. package/esm2015/lib/components/dynamic/form/dynamic-form-array.component.js +0 -77
  76. package/esm2015/lib/components/dynamic/form/dynamic-form.component.js +0 -51
  77. package/esm2015/lib/components/dynamic/input/input.component.js +0 -66
  78. package/esm2015/lib/components/dynamic/input-phone/input-phone.component.js +0 -66
  79. package/esm2015/lib/components/dynamic/radio/radio.component.js +0 -36
  80. package/esm2015/lib/components/dynamic/select/select.component.js +0 -81
  81. package/esm2015/lib/components/dynamic/select-search/select-search.component.js +0 -81
  82. package/fesm2015/monkey-front-components.js +0 -1294
  83. package/fesm2015/monkey-front-components.js.map +0 -1
  84. package/monkey-front-components-0.0.178.tgz +0 -0
@@ -1,1294 +0,0 @@
1
- import { Subject } from 'rxjs';
2
- import * as i0 from '@angular/core';
3
- import { Directive, EventEmitter, Input, Output, Component, ViewEncapsulation, HostBinding, ViewChild, NgModule } from '@angular/core';
4
- import { takeUntil } from 'rxjs/operators';
5
- import * as i1$1 from 'monkey-style-guide';
6
- import { MonkeyUtils, MonkeyInputModule, MonkeySelectModule, MonkeyRadioButtonModule, MonkeyOptionModule, MonkeyFileUploadModule, MonkeyButtonModule, MonkeyInputPhoneModule } from 'monkey-style-guide';
7
- import { MonkeyEcxCommonsService, ValidateUtils, Validators as Validators$1 } from 'monkey-front-core';
8
- import * as i1 from '@angular/forms';
9
- import { Validators, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
10
- import * as i3 from '@ngx-translate/core';
11
- import { TranslateModule } from '@ngx-translate/core';
12
- import * as i3$1 from '@angular/common';
13
- import { CommonModule } from '@angular/common';
14
-
15
- class BaseComponent {
16
- constructor() {
17
- this.__isMobile = this.isMobile();
18
- this.__locales = ['pt-BR', 'es-CL'];
19
- this.__unsubscribeAll = new Subject();
20
- }
21
- isMobile() {
22
- const isMobileWidth = (window.screen.width <= 640) ||
23
- (window.matchMedia &&
24
- window.matchMedia('only screen and (max-width: 640px)').matches);
25
- return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile/i.test(navigator.userAgent)) || isMobileWidth;
26
- }
27
- handlePagination(create = true) {
28
- const { __paginationOptions } = this;
29
- if (__paginationOptions) {
30
- const { mainElement, service } = __paginationOptions;
31
- setTimeout(() => {
32
- const element = document.getElementById(mainElement);
33
- if (element) {
34
- element.scroll = null;
35
- element.onscroll = null;
36
- if (create) {
37
- this.paginationFunc = () => {
38
- const { scrollTop, scrollHeight, offsetHeight } = element;
39
- const contentHeight = scrollHeight - offsetHeight;
40
- if (contentHeight <= scrollTop) {
41
- service.__onDoPagination$.next(null);
42
- }
43
- };
44
- element.addEventListener('scroll', this.paginationFunc);
45
- }
46
- else {
47
- element.removeEventListener('scroll', this.paginationFunc);
48
- }
49
- }
50
- }, 200);
51
- }
52
- }
53
- handleSupport(supportControls) {
54
- const { service, show } = supportControls;
55
- const method = show ? 'show' : 'hide';
56
- service[method.toLowerCase()]();
57
- }
58
- handleTranslate(translateOptions) {
59
- const { service } = translateOptions;
60
- service.__oni18nDataChanged$
61
- .pipe(takeUntil(this.__unsubscribeAll))
62
- .subscribe(() => {
63
- const data = service.__i18n;
64
- if (data) {
65
- this.__i18n = data;
66
- }
67
- });
68
- }
69
- getErrorFirstMessageTranslated(formControl) {
70
- if (formControl.hasError('required'))
71
- return 'FIELD-REQUIRED';
72
- if (formControl.hasError('invalid'))
73
- return 'FIELD-INVALID';
74
- if (formControl.hasError('email'))
75
- return 'INVALID-EMAIL';
76
- if (formControl.hasError('minlength'))
77
- return 'MIN-LENGTH';
78
- if (formControl.hasError('maxlength'))
79
- return 'MAX-LENGTH';
80
- if (formControl.hasError('max'))
81
- return 'MAX';
82
- if (formControl.hasError('min'))
83
- return 'MIN';
84
- if (formControl.hasError('passwordsNotMatching'))
85
- return 'MATCH-PASSWORD';
86
- if (formControl.hasError('invalidDate'))
87
- return 'INVALID-DATE';
88
- if (formControl.hasError('invalidTrue'))
89
- return 'INVALID-TRUE';
90
- if (formControl.hasError('invalidCpfCnpj'))
91
- return 'INVALID-DOCUMENT';
92
- if (formControl.hasError('invalidZipCode'))
93
- return 'INVALID-ZIPCODE';
94
- if (formControl.hasError('invalidCombo'))
95
- return 'INVALID-COMBO';
96
- if (formControl.hasError('invalidUrl'))
97
- return 'INVALID-URL';
98
- if (formControl.hasError('invalidUnlockRegister')) {
99
- return 'INVALID-UNLOCK-REGISTER';
100
- }
101
- if (formControl.hasError('dateStartMustBeLessThanAnd')) {
102
- return 'DATE-START-MUST-BE-LESS-THAN-AND';
103
- }
104
- if (formControl.hasError('dateEndMustBeGreaterThanStart')) {
105
- return 'DATE-END-MUST-BE-GREATER-THAN-SART';
106
- }
107
- if (formControl.hasError('phone'))
108
- return 'INVALID-PHONE';
109
- return 'FIELD-INVALID';
110
- }
111
- getErrorLastMessageNotTranslated(formControl) {
112
- if (formControl.hasError('minlength')) {
113
- return `${formControl.getError('minlength').requiredLength} caracteres.`;
114
- }
115
- if (formControl.hasError('maxlength')) {
116
- return `${formControl.getError('maxlength').requiredLength} caracteres.`;
117
- }
118
- if (formControl.hasError('max')) {
119
- return `${formControl.getError('max').max}`;
120
- }
121
- if (formControl.hasError('min')) {
122
- return `${formControl.getError('min').min}`;
123
- }
124
- return '';
125
- }
126
- validateFormWithTranslate(f, index) {
127
- const formErrors = f.value;
128
- if (f.status === 'VALID')
129
- return true;
130
- if (!formErrors)
131
- return true;
132
- Object.entries(formErrors).forEach(([key, value]) => {
133
- const control = f.get(key);
134
- formErrors[key] = '';
135
- if (control && !control.valid) {
136
- const msg = {
137
- first: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
138
- last: this.getErrorLastMessageNotTranslated(f.get(key))
139
- };
140
- formErrors[key] = msg;
141
- }
142
- });
143
- if (MonkeyUtils.persistNullEmptyUndefined(index)) {
144
- this.__monkeyecxFormErrors[index] = formErrors;
145
- }
146
- else {
147
- this.__monkeyecxFormErrors = formErrors;
148
- }
149
- return false;
150
- }
151
- copyToClipboard(val) {
152
- const selBox = document.createElement('textarea');
153
- selBox.style.position = 'fixed';
154
- selBox.style.left = '0';
155
- selBox.style.top = '0';
156
- selBox.style.opacity = '0';
157
- selBox.value = val;
158
- document.body.appendChild(selBox);
159
- selBox.focus();
160
- selBox.select();
161
- document.execCommand('copy');
162
- document.body.removeChild(selBox);
163
- }
164
- validateForm(f, index, alias) {
165
- const formErrors = f.value;
166
- if (f.status === 'VALID')
167
- return true;
168
- if (!formErrors)
169
- return true;
170
- Object.entries(formErrors).forEach(([key, value]) => {
171
- const control = f.get(key);
172
- formErrors[key] = '';
173
- if (control && !control.valid) {
174
- const msg = {
175
- firstMessage: `ERRORS.${this.getErrorFirstMessageTranslated(f.get(key))}`,
176
- lastMessage: this.getErrorLastMessageNotTranslated(f.get(key))
177
- };
178
- formErrors[key] = msg;
179
- }
180
- });
181
- if (MonkeyUtils.persistNullEmptyUndefined(index)) {
182
- this.__monkeyecxFormErrors[index] = formErrors;
183
- }
184
- else {
185
- let obj;
186
- if (alias) {
187
- obj = {
188
- [alias]: Object.assign({}, formErrors)
189
- };
190
- }
191
- else {
192
- obj = formErrors;
193
- }
194
- this.__monkeyecxFormErrors = Object.assign(Object.assign({}, this.__monkeyecxFormErrors), obj);
195
- }
196
- f.markAllAsTouched();
197
- return false;
198
- }
199
- clearAllServiceData(clearData) {
200
- const context = this;
201
- Object.values(context).forEach((ctx) => {
202
- console.log('==========');
203
- console.log(ctx);
204
- console.log(ctx instanceof MonkeyEcxCommonsService);
205
- console.log('==========');
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: "12.2.14", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
293
- BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.14", type: BaseComponent, selector: "[baseComponent]", ngImport: i0 });
294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", 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
- }
328
- createControl() {
329
- const { fields } = this;
330
- if (!fields)
331
- return null;
332
- // eslint-disable-next-line object-curly-newline
333
- const group = this.fb.group({});
334
- fields.forEach((field) => {
335
- const { fieldType, validations, name, disabled } = field;
336
- let { value } = field;
337
- if (fieldType === 'button')
338
- return;
339
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
340
- value = '';
341
- }
342
- const control = this.fb.control(value, this.bindValidations(validations || []));
343
- if (disabled || this.disabled)
344
- control.disable();
345
- group.addControl(name, control);
346
- });
347
- return group;
348
- }
349
- bindValidations(validations) {
350
- if (validations.length > 0) {
351
- const validList = [];
352
- validations.forEach((valid) => {
353
- const validated = valid.param
354
- ? validators[valid.name](valid.param)
355
- : validators[valid.name];
356
- validList.push(validated);
357
- });
358
- return Validators.compose(validList);
359
- }
360
- return null;
361
- }
362
- fillValues() {
363
- const { data } = this;
364
- if (!data || !this._form)
365
- return;
366
- Object.entries(data).forEach(([key, value]) => {
367
- if (MonkeyUtils.persistNullEmptyUndefined(value) && this._form.controls[key]) {
368
- this._form.controls[key].setValue(value);
369
- }
370
- });
371
- }
372
- ngOnInit() {
373
- this._form = this.createControl();
374
- this.fillValues();
375
- this.onHandleUpdateForm.subscribe(() => {
376
- this.fillValues();
377
- });
378
- }
379
- ngOnChanges() {
380
- if (!this._form) {
381
- this._form = this.createControl();
382
- }
383
- this.fillValues();
384
- }
385
- }
386
- BaseDynamic.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: BaseDynamic, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Directive });
387
- BaseDynamic.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.14", 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 });
388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: BaseDynamic, decorators: [{
389
- type: Directive,
390
- args: [{
391
- selector: '[baseDynamic]'
392
- }]
393
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { onHandleSubmit: [{
394
- type: Input
395
- }], onHandleUpdateForm: [{
396
- type: Input
397
- }], onHandleSubmitFormReady: [{
398
- type: Output
399
- }], self: [{
400
- type: Input
401
- }], fields: [{
402
- type: Input
403
- }], data: [{
404
- type: Input
405
- }], disabled: [{
406
- type: Input
407
- }] } });
408
-
409
- class BaseDynamicArray extends BaseComponent {
410
- constructor(fb) {
411
- super();
412
- this.fb = fb;
413
- this.onHandleSubmit = new EventEmitter();
414
- this.onHandleUpdateForm = new EventEmitter();
415
- this.onHandleSubmitFormReady = new EventEmitter();
416
- this.fields = [];
417
- this.qtd = 1;
418
- this.disabled = false;
419
- // eslint-disable-next-line object-curly-newline
420
- this._plusValidations = [];
421
- this.changesUnsubscribe = new Subject();
422
- this.formBase = () => {
423
- // return this.fb.group(this.createControl());
424
- return this.createControl();
425
- };
426
- }
427
- handleInternalPlusValidation(mainField, data) {
428
- const { operator, field, value } = mainField;
429
- const validators = {
430
- e: (val1, val2) => { return val1 === val2; },
431
- lt: (val1, val2) => { return val1 < val2; },
432
- gt: (val1, val2) => { return val1 > val2; }
433
- };
434
- return validators[operator]((data === null || data === void 0 ? void 0 : data[field]) || data, value);
435
- }
436
- makeInternalPlusValidation(data, sourceField, settings, rowIndex) {
437
- const changeFields = (show) => {
438
- const saved = [...this.fields];
439
- saved.map((val) => {
440
- const valSaved = Object.assign({}, val);
441
- if (val.name === sourceField) {
442
- this._plusValidations[rowIndex] = {
443
- [sourceField]: Object.assign(Object.assign({}, valSaved), { alwaysShow: show })
444
- };
445
- this.createOneControl(val.name, this.formValues.controls[rowIndex], show);
446
- }
447
- else {
448
- this._plusValidations[rowIndex] = Object.assign({}, valSaved);
449
- }
450
- return null;
451
- });
452
- };
453
- const validated = this.handleInternalPlusValidation(settings, data);
454
- changeFields(validated);
455
- }
456
- createOneControl(fieldName, ctrl, create = true) {
457
- const { fields } = this;
458
- if (!fields)
459
- return;
460
- fields.forEach((field) => {
461
- const { fieldType, validations, name, disabled } = field;
462
- if (name !== fieldName)
463
- return;
464
- let { value } = field;
465
- if (fieldType === 'button')
466
- return;
467
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
468
- value = '';
469
- }
470
- if (create) {
471
- const control = this.fb.control(value, this.bindValidations(validations || []));
472
- if (disabled || this.disabled)
473
- control.disable();
474
- ctrl.addControl(name, control);
475
- }
476
- else {
477
- ctrl.removeControl(name);
478
- }
479
- });
480
- }
481
- createControl(data) {
482
- const { fields } = this;
483
- if (!fields)
484
- return null;
485
- // eslint-disable-next-line object-curly-newline
486
- const group = this.fb.group({});
487
- fields.forEach((field) => {
488
- const { fieldType, validations, name, disabled, alwaysShow } = field;
489
- let { value } = field;
490
- if (field.alwaysShowPlusValidation) {
491
- if (!this.handleInternalPlusValidation(field.alwaysShowPlusValidation, data))
492
- return;
493
- }
494
- else if (!alwaysShow)
495
- return;
496
- if (fieldType === 'button')
497
- return;
498
- if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
499
- value = '';
500
- }
501
- const control = this.fb.control(value, this.bindValidations(validations || []));
502
- if (disabled || this.disabled)
503
- control.disable();
504
- group.addControl(name, control);
505
- });
506
- return group;
507
- }
508
- bindValidations(validations) {
509
- if (validations.length > 0) {
510
- const validList = [];
511
- validations.forEach((valid) => {
512
- const validated = valid.param
513
- ? validators[valid.name](valid.param)
514
- : validators[valid.name];
515
- validList.push(validated);
516
- });
517
- return Validators.compose(validList);
518
- }
519
- return null;
520
- }
521
- buildForm() {
522
- var _a;
523
- const form = this.fb.group({
524
- fields: this.fb.array([])
525
- });
526
- (_a = form === null || form === void 0 ? void 0 : form.controls.fields) === null || _a === void 0 ? void 0 : _a.valueChanges.subscribe((_) => {
527
- this.watchForChanges();
528
- });
529
- return form;
530
- }
531
- watchForChanges() {
532
- const { fields, changesUnsubscribe } = this;
533
- changesUnsubscribe.next();
534
- this.formValues.controls.map((control, index) => {
535
- fields.forEach((fieldConfig) => {
536
- var _a;
537
- const { name, alwaysShowPlusValidation } = fieldConfig;
538
- if (!alwaysShowPlusValidation)
539
- return;
540
- const { field } = alwaysShowPlusValidation;
541
- if (field) {
542
- (_a = control.controls[field]) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(takeUntil(changesUnsubscribe)).subscribe((_) => {
543
- this.makeInternalPlusValidation(_, name, alwaysShowPlusValidation, index);
544
- });
545
- }
546
- });
547
- return null;
548
- });
549
- }
550
- get formValues() {
551
- return this._form ? this._form.get('fields') : null;
552
- }
553
- fillValues() {
554
- const { data, qtd } = this;
555
- if ((!this._form) && qtd)
556
- return;
557
- if (qtd > 0) {
558
- Array(qtd)
559
- .fill(null)
560
- .map((_, index) => {
561
- let form = this.createControl();
562
- if (data && data[index]) {
563
- form = this.createControl(data[index]);
564
- const handledData = data[index];
565
- Object.entries(handledData).forEach(([key, value]) => {
566
- if (MonkeyUtils.persistNullEmptyUndefined(value) && form.controls[key]) {
567
- form.controls[key].setValue(value);
568
- }
569
- });
570
- }
571
- this.formValues.push(form);
572
- return null;
573
- });
574
- }
575
- }
576
- ngOnInit() {
577
- this._form = this.buildForm();
578
- this.fillValues();
579
- this.onHandleUpdateForm.subscribe(() => {
580
- this.fillValues();
581
- });
582
- }
583
- ngOnChanges() {
584
- if (!this._form) {
585
- this._form = this.buildForm();
586
- }
587
- this.fillValues();
588
- }
589
- }
590
- BaseDynamicArray.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: BaseDynamicArray, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Directive });
591
- BaseDynamicArray.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.14", type: BaseDynamicArray, selector: "[baseDynamicArray]", inputs: { onHandleSubmit: "onHandleSubmit", onHandleUpdateForm: "onHandleUpdateForm", self: "self", fields: "fields", data: "data", qtd: "qtd", disabled: "disabled" }, outputs: { onHandleSubmitFormReady: "onHandleSubmitFormReady" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
592
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: BaseDynamicArray, decorators: [{
593
- type: Directive,
594
- args: [{
595
- selector: '[baseDynamicArray]'
596
- }]
597
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { onHandleSubmit: [{
598
- type: Input
599
- }], onHandleUpdateForm: [{
600
- type: Input
601
- }], onHandleSubmitFormReady: [{
602
- type: Output
603
- }], self: [{
604
- type: Input
605
- }], fields: [{
606
- type: Input
607
- }], data: [{
608
- type: Input
609
- }], qtd: [{
610
- type: Input
611
- }], disabled: [{
612
- type: Input
613
- }] } });
614
-
615
- class MECXDynamicFileUploadComponent {
616
- constructor(cdr) {
617
- this.cdr = cdr;
618
- // eslint-disable-next-line object-curly-newline
619
- this._formErrors = {};
620
- this._function = (file, callback) => {
621
- var _a, _b, _c, _d;
622
- if (this._form.disabled)
623
- return;
624
- if (!((_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.functions) === null || _b === void 0 ? void 0 : _b.onHandleUpload)) {
625
- console.error('onHandleUpload not declared');
626
- return;
627
- }
628
- const { func, type } = (_d = (_c = this._field) === null || _c === void 0 ? void 0 : _c.functions) === null || _d === void 0 ? void 0 : _d.onHandleUpload;
629
- if (!func || !this.self[func]) {
630
- console.error('onHandleUpload not declared');
631
- return;
632
- }
633
- this.self[func](file, type, callback);
634
- };
635
- // not to do
636
- }
637
- get className() {
638
- var _a, _b;
639
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
640
- }
641
- ngOnChanges() {
642
- this.cdr.detectChanges();
643
- }
644
- }
645
- MECXDynamicFileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicFileUploadComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
646
- MECXDynamicFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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 || []\">\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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicFileUploadComponent, decorators: [{
648
- type: Component,
649
- args: [{
650
- selector: 'mecx-dynamic-file-upload',
651
- templateUrl: './file-upload.component.html',
652
- encapsulation: ViewEncapsulation.None
653
- }]
654
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
655
- type: Input
656
- }], _form: [{
657
- type: Input
658
- }], _formErrors: [{
659
- type: Input
660
- }], self: [{
661
- type: Input
662
- }], className: [{
663
- type: HostBinding,
664
- args: ['class']
665
- }] } });
666
-
667
- class MECXDynamicButtonComponent {
668
- constructor(cdr) {
669
- this.cdr = cdr;
670
- // eslint-disable-next-line object-curly-newline
671
- this._formErrors = {};
672
- // not to do
673
- }
674
- get className() {
675
- var _a, _b;
676
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
677
- }
678
- ngOnChanges() {
679
- this.cdr.detectChanges();
680
- }
681
- onClick() {
682
- var _a;
683
- const { _form, _field, self } = this;
684
- if (_form.disabled)
685
- return;
686
- const { name, value } = _field;
687
- const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onClick;
688
- if (func) {
689
- self[func]({
690
- name,
691
- value,
692
- form: _form
693
- });
694
- }
695
- }
696
- }
697
- MECXDynamicButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicButtonComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
698
- MECXDynamicButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
699
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicButtonComponent, decorators: [{
700
- type: Component,
701
- args: [{
702
- selector: 'mecx-dynamic-button',
703
- templateUrl: './button.component.html',
704
- styleUrls: ['./button.component.scss'],
705
- encapsulation: ViewEncapsulation.None
706
- }]
707
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
708
- type: Input
709
- }], _form: [{
710
- type: Input
711
- }], _formErrors: [{
712
- type: Input
713
- }], self: [{
714
- type: Input
715
- }], className: [{
716
- type: HostBinding,
717
- args: ['class']
718
- }] } });
719
-
720
- class MECXDynamicInputComponent {
721
- constructor(cdr) {
722
- this.cdr = cdr;
723
- // eslint-disable-next-line object-curly-newline
724
- this._formErrors = {};
725
- // not to do
726
- }
727
- get className() {
728
- var _a, _b;
729
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
730
- }
731
- ngOnInit() {
732
- this.cdr.detectChanges();
733
- }
734
- ngOnChanges() {
735
- this.cdr.detectChanges();
736
- }
737
- onChange(event) {
738
- var _a;
739
- const { _form, _field, self } = this;
740
- const { name } = _field;
741
- const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
742
- const isValid = _form.get(_field.name).valid;
743
- if (func) {
744
- self[func]({
745
- name,
746
- isValid,
747
- event,
748
- ctrl: _form.get(this._field.name),
749
- form: _form
750
- });
751
- }
752
- }
753
- }
754
- MECXDynamicInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
755
- MECXDynamicInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicInputComponent, decorators: [{
757
- type: Component,
758
- args: [{
759
- selector: 'mecx-dynamic-input',
760
- templateUrl: './input.component.html',
761
- encapsulation: ViewEncapsulation.None
762
- }]
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
- // eslint-disable-next-line object-curly-newline
785
- this._formErrors = {};
786
- // not to do
787
- }
788
- get className() {
789
- var _a, _b;
790
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
791
- }
792
- ngOnInit() {
793
- this.cdr.detectChanges();
794
- }
795
- ngOnChanges() {
796
- this.cdr.detectChanges();
797
- }
798
- onChange(event) {
799
- var _a;
800
- const { _form, _field, self } = this;
801
- const { name } = _field;
802
- const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.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: "12.2.14", ngImport: i0, type: MECXDynamicInputPhoneComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
816
- MECXDynamicInputPhoneComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
817
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicInputPhoneComponent, decorators: [{
818
- type: Component,
819
- args: [{
820
- selector: 'mecx-dynamic-input-phone',
821
- templateUrl: './input-phone.component.html',
822
- encapsulation: ViewEncapsulation.None
823
- }]
824
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { _field: [{
825
- type: Input
826
- }], _form: [{
827
- type: Input
828
- }], _formErrors: [{
829
- type: Input
830
- }], self: [{
831
- type: Input
832
- }], inputElement: [{
833
- type: ViewChild,
834
- args: ['inputElement', {
835
- static: true
836
- }]
837
- }], className: [{
838
- type: HostBinding,
839
- args: ['class']
840
- }] } });
841
-
842
- class MECXDynamicRadioComponent {
843
- constructor() {
844
- // eslint-disable-next-line object-curly-newline
845
- this._formErrors = {};
846
- }
847
- get className() {
848
- var _a, _b;
849
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
850
- }
851
- }
852
- MECXDynamicRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
853
- MECXDynamicRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
854
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicRadioComponent, decorators: [{
855
- type: Component,
856
- args: [{
857
- selector: 'mecx-dynamic-radio',
858
- templateUrl: './radio.component.html',
859
- encapsulation: ViewEncapsulation.None
860
- }]
861
- }], propDecorators: { _field: [{
862
- type: Input
863
- }], _form: [{
864
- type: Input
865
- }], _formErrors: [{
866
- type: Input
867
- }], className: [{
868
- type: HostBinding,
869
- args: ['class']
870
- }] } });
871
-
872
- class MECXDynamicSelectComponent {
873
- constructor() {
874
- // eslint-disable-next-line object-curly-newline
875
- this._formErrors = {};
876
- this._onHandleOptions = new EventEmitter();
877
- }
878
- get className() {
879
- var _a, _b;
880
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
881
- }
882
- onHandleGenericLoad() {
883
- var _a, _b;
884
- const { _form, _field, self } = this;
885
- if (_form.disabled)
886
- return;
887
- const { name } = _field;
888
- if ((_a = _field === null || _field === void 0 ? void 0 : _field.value) === null || _a === void 0 ? void 0 : _a.length)
889
- return;
890
- const { func, url } = (_b = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _b === void 0 ? void 0 : _b.onHandleGenericLoad;
891
- if (!func || !self[func]) {
892
- console.error('onHandleGenericLoad not declared');
893
- return;
894
- }
895
- _form.disable();
896
- self[func]({
897
- name,
898
- url,
899
- form: _form,
900
- callback: (data) => {
901
- this._field.value = data;
902
- this._form.enable();
903
- this._onHandleOptions.next(null);
904
- }
905
- });
906
- }
907
- onChange(event) {
908
- var _a;
909
- const { _form, _field, self } = this;
910
- const { name } = _field;
911
- const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
912
- const isValid = _form.get(_field.name).valid;
913
- if (func) {
914
- self[func]({
915
- name,
916
- isValid,
917
- event,
918
- ctrl: _form.get(this._field.name),
919
- form: _form,
920
- value: _field.value
921
- });
922
- }
923
- }
924
- }
925
- MECXDynamicSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
926
- MECXDynamicSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicSelectComponent, decorators: [{
928
- type: Component,
929
- args: [{
930
- selector: 'mecx-dynamic-select',
931
- templateUrl: './select.component.html',
932
- encapsulation: ViewEncapsulation.None
933
- }]
934
- }], propDecorators: { _field: [{
935
- type: Input
936
- }], _form: [{
937
- type: Input
938
- }], _formErrors: [{
939
- type: Input
940
- }], self: [{
941
- type: Input
942
- }], className: [{
943
- type: HostBinding,
944
- args: ['class']
945
- }] } });
946
-
947
- class MECXDynamicSelectSearchComponent {
948
- constructor() {
949
- // eslint-disable-next-line object-curly-newline
950
- this._formErrors = {};
951
- this._onHandleOptions = new EventEmitter();
952
- }
953
- get className() {
954
- var _a, _b;
955
- return (_b = (_a = this._field) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.class;
956
- }
957
- onHandleGenericLoad() {
958
- var _a, _b;
959
- const { _form, _field, self } = this;
960
- if (_form.disabled)
961
- return;
962
- const { name } = _field;
963
- if ((_a = _field === null || _field === void 0 ? void 0 : _field.value) === null || _a === void 0 ? void 0 : _a.length)
964
- return;
965
- const { func, url } = (_b = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _b === void 0 ? void 0 : _b.onHandleGenericLoad;
966
- if (!func || !self[func]) {
967
- console.error('onHandleGenericLoad not declared');
968
- return;
969
- }
970
- _form.disable();
971
- self[func]({
972
- name,
973
- url,
974
- form: _form,
975
- callback: (data) => {
976
- this._field.value = data;
977
- this._form.enable();
978
- this._onHandleOptions.next(null);
979
- }
980
- });
981
- }
982
- onChange(event) {
983
- var _a;
984
- const { _form, _field, self } = this;
985
- const { name } = _field;
986
- const func = (_a = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _a === void 0 ? void 0 : _a.onChange;
987
- const isValid = _form.get(_field.name).valid;
988
- if (func) {
989
- self[func]({
990
- name,
991
- isValid,
992
- event,
993
- ctrl: _form.get(this._field.name),
994
- form: _form,
995
- value: _field.value
996
- });
997
- }
998
- }
999
- }
1000
- MECXDynamicSelectSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicSelectSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1001
- MECXDynamicSelectSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1002
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicSelectSearchComponent, decorators: [{
1003
- type: Component,
1004
- args: [{
1005
- selector: 'mecx-dynamic-select-search',
1006
- templateUrl: './select-search.component.html',
1007
- encapsulation: ViewEncapsulation.None
1008
- }]
1009
- }], propDecorators: { _field: [{
1010
- type: Input
1011
- }], _form: [{
1012
- type: Input
1013
- }], _formErrors: [{
1014
- type: Input
1015
- }], self: [{
1016
- type: Input
1017
- }], className: [{
1018
- type: HostBinding,
1019
- args: ['class']
1020
- }] } });
1021
-
1022
- const componentMapper = {
1023
- input: MECXDynamicInputComponent,
1024
- 'input-phone': MECXDynamicInputPhoneComponent,
1025
- radiobutton: MECXDynamicRadioComponent,
1026
- select: MECXDynamicSelectComponent,
1027
- 'select-search': MECXDynamicSelectSearchComponent,
1028
- 'file-upload': MECXDynamicFileUploadComponent,
1029
- button: MECXDynamicButtonComponent
1030
- };
1031
- class MECXDynamicDirective {
1032
- constructor(resolver, container, cdr) {
1033
- this.resolver = resolver;
1034
- this.container = container;
1035
- this.cdr = cdr;
1036
- // not to do
1037
- }
1038
- handleInternalPlusValidation() {
1039
- var _a, _b;
1040
- if (!((_a = this.field) === null || _a === void 0 ? void 0 : _a.alwaysShowPlusValidation))
1041
- return false;
1042
- const { operator, value, field } = (_b = this.field) === null || _b === void 0 ? void 0 : _b.alwaysShowPlusValidation;
1043
- const validators = {
1044
- e: (val1, val2) => { return val1 === val2; },
1045
- lt: (val1, val2) => { return val1 < val2; },
1046
- gt: (val1, val2) => { return val1 > val2; }
1047
- };
1048
- const data = this.form.controls[field].value;
1049
- return validators[operator](data, value);
1050
- }
1051
- buildComponent() {
1052
- var _a;
1053
- if ((_a = this.componentRef) === null || _a === void 0 ? void 0 : _a.instance)
1054
- return;
1055
- const factory = this.resolver.resolveComponentFactory(componentMapper[this.field.fieldType]);
1056
- this.componentRef = this.container.createComponent(factory);
1057
- this.componentRef.instance._field = this.field;
1058
- this.componentRef.instance._form = this.form;
1059
- // eslint-disable-next-line object-curly-newline
1060
- this.componentRef.instance._formErrors = this.formErrors || {};
1061
- this.componentRef.instance.self = this.self;
1062
- }
1063
- ngOnInit() {
1064
- if (!this.field.alwaysShow && !this.handleInternalPlusValidation())
1065
- return;
1066
- this.buildComponent();
1067
- }
1068
- ngOnChanges() {
1069
- var _a, _b, _c, _d;
1070
- if (this.plusValidations && this.plusValidations[this.field.name]) {
1071
- if (!this.field.alwaysShow && this.plusValidations[this.field.name].alwaysShow) {
1072
- setTimeout(() => {
1073
- this.buildComponent();
1074
- this.cdr.detectChanges();
1075
- }, 1);
1076
- }
1077
- if (((_a = this.componentRef) === null || _a === void 0 ? void 0 : _a.instance) && !this.plusValidations[this.field.name].alwaysShow) {
1078
- this.componentRef.destroy();
1079
- this.componentRef = null;
1080
- (_b = this.form.controls[this.field.name]) === null || _b === void 0 ? void 0 : _b.setValue(null);
1081
- (_c = this.form.controls[this.field.name]) === null || _c === void 0 ? void 0 : _c.clearValidators();
1082
- }
1083
- }
1084
- if (!((_d = this.componentRef) === null || _d === void 0 ? void 0 : _d.instance))
1085
- return;
1086
- this.componentRef.instance._formErrors = this.formErrors || {};
1087
- }
1088
- }
1089
- MECXDynamicDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicDirective, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1090
- MECXDynamicDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.14", type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: { field: "field", form: "form", formErrors: "formErrors", self: "self", plusValidations: "plusValidations" }, usesOnChanges: true, ngImport: i0 });
1091
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicDirective, decorators: [{
1092
- type: Directive,
1093
- args: [{
1094
- selector: '[MECXDynamic]'
1095
- }]
1096
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { field: [{
1097
- type: Input
1098
- }], form: [{
1099
- type: Input
1100
- }], formErrors: [{
1101
- type: Input
1102
- }], self: [{
1103
- type: Input
1104
- }], plusValidations: [{
1105
- type: Input
1106
- }] } });
1107
-
1108
- class MECXDynamicFormComponent extends BaseDynamic {
1109
- constructor(fb, cdr) {
1110
- super(fb);
1111
- this.cdr = cdr;
1112
- this.unsubscribeAll = new Subject();
1113
- }
1114
- ngOnInit() {
1115
- super.ngOnInit();
1116
- this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func) => {
1117
- this.onSubmit(func);
1118
- });
1119
- }
1120
- ngOnDestroy() {
1121
- this.unsubscribeAll.next();
1122
- this.unsubscribeAll.complete();
1123
- }
1124
- onSubmit(callback) {
1125
- const { _form } = this;
1126
- // eslint-disable-next-line object-curly-newline
1127
- this.__monkeyecxFormErrors = {};
1128
- const isValid = this.validateForm(_form);
1129
- this.cdr.detectChanges();
1130
- this.onHandleSubmitFormReady.next({
1131
- validate: {
1132
- isValid
1133
- },
1134
- callback,
1135
- form: _form
1136
- });
1137
- }
1138
- }
1139
- MECXDynamicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicFormComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1140
- MECXDynamicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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$1.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$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], encapsulation: i0.ViewEncapsulation.None });
1141
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicFormComponent, decorators: [{
1142
- type: Component,
1143
- args: [{
1144
- selector: 'mecx-dynamic-form',
1145
- templateUrl: './dynamic-form.component.html',
1146
- styles: [],
1147
- encapsulation: ViewEncapsulation.None
1148
- }]
1149
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; } });
1150
-
1151
- class MECXDynamicFormArrayComponent extends BaseDynamicArray {
1152
- constructor(fb, cdr) {
1153
- super(fb);
1154
- this.cdr = cdr;
1155
- this.unsubscribeAll = new Subject();
1156
- this.__monkeyecxFormErrors = [];
1157
- }
1158
- ngOnInit() {
1159
- super.ngOnInit();
1160
- this.onHandleSubmit.pipe(takeUntil(this.unsubscribeAll)).subscribe((func) => {
1161
- this.onSubmit(func);
1162
- });
1163
- }
1164
- ngOnDestroy() {
1165
- this.unsubscribeAll.next();
1166
- this.unsubscribeAll.complete();
1167
- }
1168
- onSubmit(callback) {
1169
- const { _form } = this;
1170
- // eslint-disable-next-line object-curly-newline
1171
- this.__monkeyecxFormErrors = [];
1172
- let validate = {
1173
- isValid: false
1174
- };
1175
- let hasErrors = false;
1176
- if (this.formValues) {
1177
- this.__monkeyecxFormErrors = [this.formValues.length];
1178
- this.formValues.controls.forEach((item, index) => {
1179
- if (item instanceof FormGroup) {
1180
- if (!this.validateForm(item, index)) {
1181
- hasErrors = true;
1182
- }
1183
- }
1184
- });
1185
- }
1186
- validate = {
1187
- isValid: !hasErrors
1188
- };
1189
- this.cdr.detectChanges();
1190
- this.onHandleSubmitFormReady.next({
1191
- validate,
1192
- callback,
1193
- form: _form
1194
- });
1195
- }
1196
- onHandleAdd() {
1197
- this.formValues.push(this.formBase());
1198
- this.cdr.detectChanges();
1199
- }
1200
- onHandleRemove(index) {
1201
- this.formValues.removeAt(index);
1202
- this._plusValidations.splice(index, 1);
1203
- }
1204
- }
1205
- MECXDynamicFormArrayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicFormArrayComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1206
- MECXDynamicFormArrayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", 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$1.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$1.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": i3.TranslatePipe }, encapsulation: i0.ViewEncapsulation.None });
1207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicFormArrayComponent, decorators: [{
1208
- type: Component,
1209
- args: [{
1210
- selector: 'mecx-dynamic-form-array',
1211
- templateUrl: './dynamic-form-array.component.html',
1212
- styleUrls: ['./dynamic-form-array.component.scss'],
1213
- encapsulation: ViewEncapsulation.None
1214
- }]
1215
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; } });
1216
-
1217
- class MECXDynamicModule {
1218
- }
1219
- MECXDynamicModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1220
- MECXDynamicModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicModule, declarations: [MECXDynamicButtonComponent,
1221
- MECXDynamicFileUploadComponent,
1222
- MECXDynamicFormComponent,
1223
- MECXDynamicFormArrayComponent,
1224
- MECXDynamicInputComponent,
1225
- MECXDynamicInputPhoneComponent,
1226
- MECXDynamicRadioComponent,
1227
- MECXDynamicSelectComponent,
1228
- MECXDynamicSelectSearchComponent,
1229
- MECXDynamicDirective], imports: [CommonModule,
1230
- FormsModule,
1231
- ReactiveFormsModule,
1232
- MonkeyInputModule,
1233
- MonkeySelectModule,
1234
- MonkeyRadioButtonModule,
1235
- MonkeyOptionModule,
1236
- MonkeyFileUploadModule,
1237
- MonkeyButtonModule,
1238
- MonkeyInputPhoneModule, i3.TranslateModule], exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent] });
1239
- MECXDynamicModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicModule, imports: [[
1240
- CommonModule,
1241
- FormsModule,
1242
- ReactiveFormsModule,
1243
- MonkeyInputModule,
1244
- MonkeySelectModule,
1245
- MonkeyRadioButtonModule,
1246
- MonkeyOptionModule,
1247
- MonkeyFileUploadModule,
1248
- MonkeyButtonModule,
1249
- MonkeyInputPhoneModule,
1250
- TranslateModule.forChild()
1251
- ]] });
1252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0, type: MECXDynamicModule, decorators: [{
1253
- type: NgModule,
1254
- args: [{
1255
- declarations: [
1256
- MECXDynamicButtonComponent,
1257
- MECXDynamicFileUploadComponent,
1258
- MECXDynamicFormComponent,
1259
- MECXDynamicFormArrayComponent,
1260
- MECXDynamicInputComponent,
1261
- MECXDynamicInputPhoneComponent,
1262
- MECXDynamicRadioComponent,
1263
- MECXDynamicSelectComponent,
1264
- MECXDynamicSelectSearchComponent,
1265
- MECXDynamicDirective
1266
- ],
1267
- imports: [
1268
- CommonModule,
1269
- FormsModule,
1270
- ReactiveFormsModule,
1271
- MonkeyInputModule,
1272
- MonkeySelectModule,
1273
- MonkeyRadioButtonModule,
1274
- MonkeyOptionModule,
1275
- MonkeyFileUploadModule,
1276
- MonkeyButtonModule,
1277
- MonkeyInputPhoneModule,
1278
- TranslateModule.forChild()
1279
- ],
1280
- exports: [MECXDynamicDirective, MECXDynamicFormComponent, MECXDynamicFormArrayComponent],
1281
- entryComponents: [MECXDynamicInputComponent]
1282
- }]
1283
- }] });
1284
-
1285
- /*
1286
- * Public API Surface of monkey-front-components
1287
- */
1288
-
1289
- /**
1290
- * Generated bundle index. Do not edit.
1291
- */
1292
-
1293
- export { BaseComponent, BaseDynamic, BaseDynamicArray, MECXDynamicDirective, MECXDynamicFileUploadComponent, MECXDynamicFormArrayComponent, MECXDynamicFormComponent, MECXDynamicInputComponent, MECXDynamicInputPhoneComponent, MECXDynamicModule, MECXDynamicRadioComponent, MECXDynamicSelectComponent, validators };
1294
- //# sourceMappingURL=monkey-front-components.js.map