monkey-front-components 0.0.174 → 0.0.178

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;
@@ -533,6 +541,10 @@
533
541
  BaseComponent.prototype.clearAllServiceData = function (clearData) {
534
542
  var context = this;
535
543
  Object.values(context).forEach(function (ctx) {
544
+ console.log('==========');
545
+ console.log(ctx);
546
+ console.log(ctx instanceof monkeyFrontCore.MonkeyEcxCommonsService);
547
+ console.log('==========');
536
548
  if (ctx instanceof monkeyFrontCore.MonkeyEcxCommonsService) {
537
549
  ctx.clear(clearData);
538
550
  }
@@ -543,8 +555,8 @@
543
555
  this.__paginationOptions = args === null || args === void 0 ? void 0 : args.paginationOptions;
544
556
  this.handlePagination();
545
557
  }
546
- if (args === null || args === void 0 ? void 0 : args.intercomControls) {
547
- this.handleIntercom(args === null || args === void 0 ? void 0 : args.intercomControls);
558
+ if (args === null || args === void 0 ? void 0 : args.supportControls) {
559
+ this.handleSupport(args === null || args === void 0 ? void 0 : args.supportControls);
548
560
  }
549
561
  if (args === null || args === void 0 ? void 0 : args.translateOptions) {
550
562
  this.handleTranslate(args === null || args === void 0 ? void 0 : args.translateOptions);
@@ -559,7 +571,7 @@
559
571
  };
560
572
  BaseComponent.prototype.handleErrorFromServices = function (error, f) {
561
573
  var _this = this;
562
- this.__monkeyexcFormErrors = null;
574
+ this.__monkeyecxFormErrors = null;
563
575
  if (error.type === 'Parameter_Error') {
564
576
  Object.entries(f.value).forEach(function (_a) {
565
577
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
@@ -572,7 +584,7 @@
572
584
  firstMessage: '',
573
585
  lastMessage: description
574
586
  };
575
- _this.__monkeyexcFormErrors = Object.assign(Object.assign({}, _this.__monkeyexcFormErrors), (_a = {}, _a[key] = msg, _a));
587
+ _this.__monkeyecxFormErrors = Object.assign(Object.assign({}, _this.__monkeyecxFormErrors), (_a = {}, _a[key] = msg, _a));
576
588
  f.controls[key].setErrors({
577
589
  incorrect: true
578
590
  });
@@ -590,6 +602,38 @@
590
602
  if (element)
591
603
  element.scrollIntoView();
592
604
  };
605
+ BaseComponent.prototype.getEmbeddedData = function (data, field) {
606
+ var _embedded = data._embedded;
607
+ return _embedded ? _embedded[field] : null;
608
+ };
609
+ BaseComponent.prototype.openWindow = function (url) {
610
+ window.open("" + url, '_blank');
611
+ };
612
+ BaseComponent.prototype.fillI18n = function (data) {
613
+ this.__i18n = data;
614
+ };
615
+ BaseComponent.prototype.getCountryPrefix = function (country) {
616
+ return {
617
+ br: 55,
618
+ cl: 56
619
+ }[country];
620
+ };
621
+ BaseComponent.prototype.getCountryCurrencyChartFormat = function (country) {
622
+ return {
623
+ br: 'R$ #,###,##0.00',
624
+ cl: 'CLP #,###,##0'
625
+ }[country];
626
+ };
627
+ BaseComponent.prototype.getCountryValidators = function (country) {
628
+ return {
629
+ br: {
630
+ governmentId: monkeyFrontCore.ValidateUtils.DocumentValidator
631
+ },
632
+ cl: {
633
+ governmentId: monkeyFrontCore.ValidateUtils.DocumentRutValidator
634
+ }
635
+ }[country];
636
+ };
593
637
  return BaseComponent;
594
638
  }());
595
639
  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 +1538,7 @@
1494
1538
  MECXDynamicFormComponent.prototype.onSubmit = function (callback) {
1495
1539
  var _form = this._form;
1496
1540
  // eslint-disable-next-line object-curly-newline
1497
- this.__monkeyexcFormErrors = {};
1541
+ this.__monkeyecxFormErrors = {};
1498
1542
  var isValid = this.validateForm(_form);
1499
1543
  this.cdr.detectChanges();
1500
1544
  this.onHandleSubmitFormReady.next({
@@ -1508,7 +1552,7 @@
1508
1552
  return MECXDynamicFormComponent;
1509
1553
  }(BaseDynamic));
1510
1554
  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 });
1555
+ 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
1556
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: MECXDynamicFormComponent, decorators: [{
1513
1557
  type: i0.Component,
1514
1558
  args: [{
@@ -1525,7 +1569,7 @@
1525
1569
  var _this = _super.call(this, fb) || this;
1526
1570
  _this.cdr = cdr;
1527
1571
  _this.unsubscribeAll = new rxjs.Subject();
1528
- _this.__monkeyexcFormErrors = [];
1572
+ _this.__monkeyecxFormErrors = [];
1529
1573
  return _this;
1530
1574
  }
1531
1575
  MECXDynamicFormArrayComponent.prototype.ngOnInit = function () {
@@ -1543,13 +1587,13 @@
1543
1587
  var _this = this;
1544
1588
  var _form = this._form;
1545
1589
  // eslint-disable-next-line object-curly-newline
1546
- this.__monkeyexcFormErrors = [];
1590
+ this.__monkeyecxFormErrors = [];
1547
1591
  var validate = {
1548
1592
  isValid: false
1549
1593
  };
1550
1594
  var hasErrors = false;
1551
1595
  if (this.formValues) {
1552
- this.__monkeyexcFormErrors = [this.formValues.length];
1596
+ this.__monkeyecxFormErrors = [this.formValues.length];
1553
1597
  this.formValues.controls.forEach(function (item, index) {
1554
1598
  if (item instanceof i1$1.FormGroup) {
1555
1599
  if (!_this.validateForm(item, index)) {
@@ -1579,7 +1623,7 @@
1579
1623
  return MECXDynamicFormArrayComponent;
1580
1624
  }(BaseDynamicArray));
1581
1625
  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=\"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]=\"__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 });
1626
+ 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
1627
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.14", ngImport: i0__namespace, type: MECXDynamicFormArrayComponent, decorators: [{
1584
1628
  type: i0.Component,
1585
1629
  args: [{