monkey-front-core 0.0.208 → 0.0.211

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.
@@ -1886,7 +1886,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
1886
1886
  }] } });
1887
1887
 
1888
1888
  class MonkeyEcxPopoverDirective {
1889
- constructor(tpl, vcr, el, zone, _viewContainerRef, _cd, overlay, overlayPositionBuilder, options) {
1889
+ constructor(tpl, vcr, el, zone, _viewContainerRef, _cd, overlay, overlayPositionBuilder, router, options) {
1890
1890
  this.tpl = tpl;
1891
1891
  this.vcr = vcr;
1892
1892
  this.el = el;
@@ -1895,6 +1895,7 @@ class MonkeyEcxPopoverDirective {
1895
1895
  this._cd = _cd;
1896
1896
  this.overlay = overlay;
1897
1897
  this.overlayPositionBuilder = overlayPositionBuilder;
1898
+ this.router = router;
1898
1899
  this.options = options;
1899
1900
  this.minwidth = false;
1900
1901
  this.backdrop = true;
@@ -1902,7 +1903,14 @@ class MonkeyEcxPopoverDirective {
1902
1903
  this.dir = 'ltr';
1903
1904
  this.contextmenu = false;
1904
1905
  this.subs = new Subscription();
1905
- // not to do
1906
+ this.eventsSubs = new Subscription();
1907
+ this.eventsSubs = this.router.events
1908
+ .pipe(filter((event) => {
1909
+ return event instanceof NavigationStart;
1910
+ }))
1911
+ .subscribe(() => {
1912
+ this.popover = false;
1913
+ });
1906
1914
  }
1907
1915
  get popover() {
1908
1916
  return this._popover;
@@ -2034,16 +2042,17 @@ class MonkeyEcxPopoverDirective {
2034
2042
  ngOnDestroy() {
2035
2043
  this.popover = false;
2036
2044
  this.subs.unsubscribe();
2045
+ this.eventsSubs.unsubscribe();
2037
2046
  }
2038
2047
  }
2039
- MonkeyEcxPopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPopoverDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.Overlay }, { token: i1$4.OverlayPositionBuilder }, { token: POPOVER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
2048
+ MonkeyEcxPopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPopoverDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i1$4.Overlay }, { token: i1$4.OverlayPositionBuilder }, { token: i1$3.Router }, { token: POPOVER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
2040
2049
  MonkeyEcxPopoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: MonkeyEcxPopoverDirective, selector: "[monkeyecxPopover]", inputs: { popover: ["monkeyecxPopover", "popover"], closed: ["monkeyecxPopoverClosed", "closed"], target: ["monkeyecxPopoverTarget", "target"], minwidth: ["monkeyecxPopoverMinwidth", "minwidth"], backdrop: ["monkeyecxPopoverBackdrop", "backdrop"], watch: ["monkeyecxPopoverWatch", "watch"], dir: ["monkeyecxPopoverDir", "dir"], contextmenu: ["monkeyecxPopoverContextmenu", "contextmenu"], height: ["monkeyecxPopoverHeight", "height"] }, ngImport: i0 });
2041
2050
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxPopoverDirective, decorators: [{
2042
2051
  type: Directive,
2043
2052
  args: [{
2044
2053
  selector: '[monkeyecxPopover]'
2045
2054
  }]
2046
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.Overlay }, { type: i1$4.OverlayPositionBuilder }, { type: undefined, decorators: [{
2055
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i1$4.Overlay }, { type: i1$4.OverlayPositionBuilder }, { type: i1$3.Router }, { type: undefined, decorators: [{
2047
2056
  type: Inject,
2048
2057
  args: [POPOVER_OPTIONS]
2049
2058
  }, {
@@ -2731,36 +2740,54 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
2731
2740
  this.translateService.setDefaultLang('pt-BR');
2732
2741
  this.translateService.use('pt-BR');
2733
2742
  }
2734
- apply(params, environment, change = false) {
2743
+ async apply(params, environment, change = false) {
2735
2744
  const { monkeyecxService, monkeyecxCookieStorageService, monkeyecxErrorConfigService } = this;
2736
2745
  let { i18n } = params;
2737
- const externali18n = params?.externali18n?.[`${i18n?.lang || 'pt-BR'}`];
2746
+ const currentExternali18n = params?.externali18n?.[`${i18n?.lang || 'pt-BR'}`];
2738
2747
  const cookie = monkeyecxCookieStorageService.getCookie('monkey-app-locale');
2739
2748
  if (cookie && !change) {
2740
2749
  i18n = JSON.parse(atob(cookie));
2741
2750
  }
2742
2751
  else {
2743
2752
  monkeyecxCookieStorageService.setCookie('monkey-app-locale', btoa(JSON.stringify(i18n)), environment);
2744
- if (!cookie)
2745
- change = true;
2746
2753
  }
2747
- monkeyecxService?.get(`${environment.localAssets}/i18n/${i18n?.lang}.json`)?.subscribe((config) => {
2748
- const { lang } = config;
2749
- let { data } = config;
2750
- if (externali18n) {
2754
+ try {
2755
+ const externali18nPaths = params?.i18n?.paths || [];
2756
+ const services = externali18nPaths?.map((url) => {
2757
+ return monkeyecxService?.get(`${url}/${i18n?.lang}.json`).pipe(take(1)).toPromise();
2758
+ });
2759
+ if (!services?.length)
2760
+ return;
2761
+ const externali18nData = await Promise.all(services);
2762
+ externali18nData?.forEach((config) => {
2763
+ const { lang } = config;
2764
+ const { data } = config;
2765
+ this.translateService.setTranslation('pt-BR', data, true);
2766
+ this.translateService.setTranslation(lang, data, true);
2767
+ });
2768
+ }
2769
+ catch (err) {
2770
+ // not to do
2771
+ }
2772
+ try {
2773
+ const currenti18n = await monkeyecxService?.get(`${environment.localAssets}/i18n/${i18n?.lang}.json`).pipe(take(1)).toPromise();
2774
+ const { lang } = currenti18n;
2775
+ let { data } = currenti18n;
2776
+ if (currentExternali18n) {
2751
2777
  data = {
2752
2778
  ...data,
2753
- EXTERNAL: externali18n
2779
+ EXTERNAL: currentExternali18n
2754
2780
  };
2755
2781
  }
2756
2782
  this.translateService.setTranslation('pt-BR', data, true);
2757
2783
  this.translateService.setTranslation(lang, data, true);
2758
2784
  this.translateService.use(lang);
2759
- }, (err) => {
2785
+ }
2786
+ catch (err) {
2760
2787
  console.error(`i18n ${i18n?.lang} not found!`);
2761
2788
  monkeyecxErrorConfigService.apply('i18n');
2762
2789
  throwError(err);
2763
- });
2790
+ }
2764
2791
  }
2765
2792
  }
2766
2793
  MonkeyEcxi18nConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxi18nConfigService, deps: [{ token: MonkeyEcxService }, { token: i1$1.TranslateService }, { token: MonkeyEcxCookieStorageService }, { token: MonkeyEcxErrorConfigService }], target: i0.ɵɵFactoryTarget.Injectable });