monkey-front-components 0.0.173 → 0.0.177

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.
@@ -348,8 +348,16 @@
348
348
 
349
349
  var BaseComponent = /** @class */ (function () {
350
350
  function BaseComponent() {
351
+ this.__isMobile = this.isMobile();
352
+ this.__locales = ['pt-BR', 'es-CL'];
351
353
  this.__unsubscribeAll = new rxjs.Subject();
352
354
  }
355
+ BaseComponent.prototype.isMobile = function () {
356
+ var isMobileWidth = (window.screen.width <= 640) ||
357
+ (window.matchMedia &&
358
+ window.matchMedia('only screen and (max-width: 640px)').matches);
359
+ return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile/i.test(navigator.userAgent)) || isMobileWidth;
360
+ };
353
361
  BaseComponent.prototype.handlePagination = function (create) {
354
362
  var _this = this;
355
363
  if (create === void 0) { create = true; }
@@ -378,8 +386,8 @@
378
386
  }, 200);
379
387
  }
380
388
  };
381
- BaseComponent.prototype.handleIntercom = function (intercomControls) {
382
- var service = intercomControls.service, show = intercomControls.show;
389
+ BaseComponent.prototype.handleSupport = function (supportControls) {
390
+ var service = supportControls.service, show = supportControls.show;
383
391
  var method = show ? 'show' : 'hide';
384
392
  service[method.toLowerCase()]();
385
393
  };
@@ -472,10 +480,10 @@
472
480
  }
473
481
  });
474
482
  if (i1.MonkeyUtils.persistNullEmptyUndefined(index)) {
475
- this.__monkeyexcFormErrors[index] = formErrors;
483
+ this.__monkeyecxFormErrors[index] = formErrors;
476
484
  }
477
485
  else {
478
- this.__monkeyexcFormErrors = formErrors;
486
+ this.__monkeyecxFormErrors = formErrors;
479
487
  }
480
488
  return false;
481
489
  };
@@ -513,7 +521,7 @@
513
521
  }
514
522
  });
515
523
  if (i1.MonkeyUtils.persistNullEmptyUndefined(index)) {
516
- this.__monkeyexcFormErrors[index] = formErrors;
524
+ this.__monkeyecxFormErrors[index] = formErrors;
517
525
  }
518
526
  else {
519
527
  var obj = void 0;
@@ -525,7 +533,7 @@
525
533
  else {
526
534
  obj = formErrors;
527
535
  }
528
- this.__monkeyexcFormErrors = Object.assign(Object.assign({}, this.__monkeyexcFormErrors), obj);
536
+ this.__monkeyecxFormErrors = Object.assign(Object.assign({}, this.__monkeyecxFormErrors), obj);
529
537
  }
530
538
  f.markAllAsTouched();
531
539
  return false;
@@ -543,8 +551,8 @@
543
551
  this.__paginationOptions = args === null || args === void 0 ? void 0 : args.paginationOptions;
544
552
  this.handlePagination();
545
553
  }
546
- if (args === null || args === void 0 ? void 0 : args.intercomControls) {
547
- this.handleIntercom(args === null || args === void 0 ? void 0 : args.intercomControls);
554
+ if (args === null || args === void 0 ? void 0 : args.supportControls) {
555
+ this.handleSupport(args === null || args === void 0 ? void 0 : args.supportControls);
548
556
  }
549
557
  if (args === null || args === void 0 ? void 0 : args.translateOptions) {
550
558
  this.handleTranslate(args === null || args === void 0 ? void 0 : args.translateOptions);
@@ -559,7 +567,7 @@
559
567
  };
560
568
  BaseComponent.prototype.handleErrorFromServices = function (error, f) {
561
569
  var _this = this;
562
- this.__monkeyexcFormErrors = null;
570
+ this.__monkeyecxFormErrors = null;
563
571
  if (error.type === 'Parameter_Error') {
564
572
  Object.entries(f.value).forEach(function (_a) {
565
573
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
@@ -572,7 +580,7 @@
572
580
  firstMessage: '',
573
581
  lastMessage: description
574
582
  };
575
- _this.__monkeyexcFormErrors = Object.assign(Object.assign({}, _this.__monkeyexcFormErrors), (_a = {}, _a[key] = msg, _a));
583
+ _this.__monkeyecxFormErrors = Object.assign(Object.assign({}, _this.__monkeyecxFormErrors), (_a = {}, _a[key] = msg, _a));
576
584
  f.controls[key].setErrors({
577
585
  incorrect: true
578
586
  });
@@ -590,6 +598,38 @@
590
598
  if (element)
591
599
  element.scrollIntoView();
592
600
  };
601
+ BaseComponent.prototype.getEmbeddedData = function (data, field) {
602
+ var _embedded = data._embedded;
603
+ return _embedded ? _embedded[field] : null;
604
+ };
605
+ BaseComponent.prototype.openWindow = function (url) {
606
+ window.open("" + url, '_blank');
607
+ };
608
+ BaseComponent.prototype.fillI18n = function (data) {
609
+ this.__i18n = data;
610
+ };
611
+ BaseComponent.prototype.getCountryPrefix = function (country) {
612
+ return {
613
+ br: 55,
614
+ cl: 56
615
+ }[country];
616
+ };
617
+ BaseComponent.prototype.getCountryCurrencyChartFormat = function (country) {
618
+ return {
619
+ br: 'R$ #,###,##0.00',
620
+ cl: 'CLP #,###,##0'
621
+ }[country];
622
+ };
623
+ BaseComponent.prototype.getCountryValidators = function (country) {
624
+ return {
625
+ br: {
626
+ governmentId: monkeyFrontCore.ValidateUtils.DocumentValidator
627
+ },
628
+ cl: {
629
+ governmentId: monkeyFrontCore.ValidateUtils.DocumentRutValidator
630
+ }
631
+ }[country];
632
+ };
593
633
  return BaseComponent;
594
634
  }());
595
635
  BaseComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: BaseComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Directive });
@@ -1494,7 +1534,7 @@
1494
1534
  MECXDynamicFormComponent.prototype.onSubmit = function (callback) {
1495
1535
  var _form = this._form;
1496
1536
  // eslint-disable-next-line object-curly-newline
1497
- this.__monkeyexcFormErrors = {};
1537
+ this.__monkeyecxFormErrors = {};
1498
1538
  var isValid = this.validateForm(_form);
1499
1539
  this.cdr.detectChanges();
1500
1540
  this.onHandleSubmitFormReady.next({
@@ -1508,7 +1548,7 @@
1508
1548
  return MECXDynamicFormComponent;
1509
1549
  }(BaseDynamic));
1510
1550
  MECXDynamicFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: MECXDynamicFormComponent, deps: [{ token: i1__namespace.FormBuilder }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1511
- MECXDynamicFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", type: MECXDynamicFormComponent, selector: "mecx-dynamic-form", usesInheritance: true, ngImport: i0__namespace, 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]=\"__monkeyexcFormErrors\" [style.display]=\"'none'\">\n </div>\n </div>\n</form>", directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], encapsulation: i0__namespace.ViewEncapsulation.None });
1551
+ MECXDynamicFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", type: MECXDynamicFormComponent, selector: "mecx-dynamic-form", usesInheritance: true, ngImport: i0__namespace, 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__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], encapsulation: i0__namespace.ViewEncapsulation.None });
1512
1552
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: MECXDynamicFormComponent, decorators: [{
1513
1553
  type: i0.Component,
1514
1554
  args: [{
@@ -1525,7 +1565,7 @@
1525
1565
  var _this = _super.call(this, fb) || this;
1526
1566
  _this.cdr = cdr;
1527
1567
  _this.unsubscribeAll = new rxjs.Subject();
1528
- _this.__monkeyexcFormErrors = [];
1568
+ _this.__monkeyecxFormErrors = [];
1529
1569
  return _this;
1530
1570
  }
1531
1571
  MECXDynamicFormArrayComponent.prototype.ngOnInit = function () {
@@ -1543,13 +1583,13 @@
1543
1583
  var _this = this;
1544
1584
  var _form = this._form;
1545
1585
  // eslint-disable-next-line object-curly-newline
1546
- this.__monkeyexcFormErrors = [];
1586
+ this.__monkeyecxFormErrors = [];
1547
1587
  var validate = {
1548
1588
  isValid: false
1549
1589
  };
1550
1590
  var hasErrors = false;
1551
1591
  if (this.formValues) {
1552
- this.__monkeyexcFormErrors = [this.formValues.length];
1592
+ this.__monkeyecxFormErrors = [this.formValues.length];
1553
1593
  this.formValues.controls.forEach(function (item, index) {
1554
1594
  if (item instanceof i1$1.FormGroup) {
1555
1595
  if (!_this.validateForm(item, index)) {
@@ -1579,7 +1619,7 @@
1579
1619
  return MECXDynamicFormArrayComponent;
1580
1620
  }(BaseDynamicArray));
1581
1621
  MECXDynamicFormArrayComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: MECXDynamicFormArrayComponent, deps: [{ token: i1__namespace.FormBuilder }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1582
- MECXDynamicFormArrayComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", type: MECXDynamicFormArrayComponent, selector: "mecx-dynamic-form-array", usesInheritance: true, ngImport: i0__namespace, 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=\"indForm > 0 && !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]=\"__monkeyexcFormErrors[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__namespace$1.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1__namespace.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], pipes: { "translate": i3__namespace.TranslatePipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
1622
+ MECXDynamicFormArrayComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.14", type: MECXDynamicFormArrayComponent, selector: "mecx-dynamic-form-array", usesInheritance: true, ngImport: i0__namespace, 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__namespace$1.MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1__namespace.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: ["field", "form", "formErrors", "self", "plusValidations"] }], pipes: { "translate": i3__namespace.TranslatePipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
1583
1623
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: MECXDynamicFormArrayComponent, decorators: [{
1584
1624
  type: i0.Component,
1585
1625
  args: [{