@smartsoft001-mobilems/angular 2.12.0 → 2.14.0

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.
@@ -1,18 +1,20 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, inject, PLATFORM_ID, signal, effect, computed, Component, Directive, contentChild, HostListener, Inject, ElementRef, input, APP_INITIALIZER, NgModule } from '@angular/core';
3
+ import { Injectable, inject, PLATFORM_ID, signal, effect, computed, input, output, HostListener, Component, ApplicationRef, EnvironmentInjector, createComponent, Directive, contentChild, Inject, ElementRef, APP_INITIALIZER, NgModule } from '@angular/core';
4
4
  import { Meta, Title, DomSanitizer } from '@angular/platform-browser';
5
5
  import { StyleService as StyleService$1, ReduxAction, AppBaseComponent, PageBaseComponent, BaseComponent } from '@smartsoft001/angular';
6
6
  import { HttpClient } from '@angular/common/http';
7
7
  import * as moment from 'moment';
8
- import { lastValueFrom, combineLatest, firstValueFrom, of, throwError } from 'rxjs';
8
+ import { lastValueFrom, combineLatest, firstValueFrom, Subject, of, throwError } from 'rxjs';
9
9
  import { map, filter, catchError } from 'rxjs/operators';
10
- import { isPlatformBrowser, DOCUMENT } from '@angular/common';
10
+ import * as i1 from '@angular/common';
11
+ import { isPlatformBrowser, CommonModule, DOCUMENT } from '@angular/common';
11
12
  import { Router, ActivatedRoute, NavigationEnd, RouterOutlet, RouterModule } from '@angular/router';
12
13
  import { TranslateService } from '@ngx-translate/core';
13
14
  import { CrudService, CrudFacade } from '@smartsoft001/crud-shell-angular';
14
15
  import * as _ from 'lodash';
15
16
  import { Debounce } from 'lodash-decorators';
17
+ import { ConfigPageType } from '@smartsoft001-mobilems/models';
16
18
 
17
19
  function setTranslationsAndLang(service) {
18
20
  const map = {
@@ -554,6 +556,164 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
554
556
  }]
555
557
  }], ctorParameters: () => [] });
556
558
 
559
+ /**
560
+ * Container component for modal overlay and content.
561
+ * Handles backdrop clicks and ESC key press.
562
+ */
563
+ class ModalContainerComponent {
564
+ constructor() {
565
+ /**
566
+ * Template to render inside the modal content area.
567
+ */
568
+ this.contentTemplate = input.required(...(ngDevMode ? [{ debugName: "contentTemplate" }] : []));
569
+ /**
570
+ * Emits when backdrop is clicked or ESC key is pressed.
571
+ */
572
+ this.backdropClick = output();
573
+ }
574
+ /**
575
+ * Listens for ESC key press on document level.
576
+ */
577
+ onEscapeKey() {
578
+ this.backdropClick.emit();
579
+ }
580
+ /**
581
+ * Handles backdrop click event.
582
+ * @param _event Mouse click event
583
+ */
584
+ onBackdropClick(_event) {
585
+ this.backdropClick.emit();
586
+ }
587
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ModalContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
588
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.0", type: ModalContainerComponent, isStandalone: true, selector: "smart-mobilems-modal-container", inputs: { contentTemplate: { classPropertyName: "contentTemplate", publicName: "contentTemplate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { backdropClick: "backdropClick" }, host: { listeners: { "document:keydown.escape": "onEscapeKey()" } }, ngImport: i0, template: `
589
+ <div
590
+ class="smart-fixed smart-inset-0 smart-bg-black smart-bg-opacity-50 smart-flex smart-items-center smart-justify-center smart-z-50"
591
+ (click)="onBackdropClick($event)"
592
+ >
593
+ <div
594
+ class="smart-bg-white smart-rounded-lg smart-shadow-xl smart-max-w-2xl smart-w-full smart-m-4 smart-max-h-[90vh] smart-overflow-auto"
595
+ (click)="$event.stopPropagation()"
596
+ >
597
+ <div class="smart-p-6">
598
+ <ng-container *ngTemplateOutlet="contentTemplate()"></ng-container>
599
+ </div>
600
+ </div>
601
+ </div>
602
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
603
+ }
604
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ModalContainerComponent, decorators: [{
605
+ type: Component,
606
+ args: [{
607
+ selector: 'smart-mobilems-modal-container',
608
+ standalone: true,
609
+ imports: [CommonModule],
610
+ template: `
611
+ <div
612
+ class="smart-fixed smart-inset-0 smart-bg-black smart-bg-opacity-50 smart-flex smart-items-center smart-justify-center smart-z-50"
613
+ (click)="onBackdropClick($event)"
614
+ >
615
+ <div
616
+ class="smart-bg-white smart-rounded-lg smart-shadow-xl smart-max-w-2xl smart-w-full smart-m-4 smart-max-h-[90vh] smart-overflow-auto"
617
+ (click)="$event.stopPropagation()"
618
+ >
619
+ <div class="smart-p-6">
620
+ <ng-container *ngTemplateOutlet="contentTemplate()"></ng-container>
621
+ </div>
622
+ </div>
623
+ </div>
624
+ `,
625
+ }]
626
+ }], propDecorators: { onEscapeKey: [{
627
+ type: HostListener,
628
+ args: ['document:keydown.escape']
629
+ }] } });
630
+
631
+ /**
632
+ * Reference to an opened modal.
633
+ * Provides methods to close the modal and observe its lifecycle.
634
+ */
635
+ class ModalRef {
636
+ constructor(closeCallback) {
637
+ this.closeCallback = closeCallback;
638
+ this._afterClosed = new Subject();
639
+ /**
640
+ * Observable that emits when the modal has been closed.
641
+ * Completes after emission.
642
+ */
643
+ this.afterClosed$ = this._afterClosed.asObservable();
644
+ }
645
+ /**
646
+ * Closes the modal and triggers cleanup.
647
+ * Safe to call multiple times.
648
+ */
649
+ close() {
650
+ this.closeCallback();
651
+ this._afterClosed.next();
652
+ this._afterClosed.complete();
653
+ }
654
+ }
655
+
656
+ /**
657
+ * Service for managing modal dialogs.
658
+ * Provides methods to open, close, and manage modal instances.
659
+ */
660
+ class ModalService {
661
+ constructor() {
662
+ this.appRef = inject(ApplicationRef);
663
+ this.injector = inject(EnvironmentInjector);
664
+ this.document = inject(DOCUMENT);
665
+ this.activeModals = [];
666
+ }
667
+ /**
668
+ * Opens a modal with the provided template.
669
+ * @param template TemplateRef to render inside the modal
670
+ * @returns ModalRef instance for controlling the modal
671
+ */
672
+ open(template) {
673
+ const componentRef = createComponent(ModalContainerComponent, {
674
+ environmentInjector: this.injector,
675
+ });
676
+ componentRef.setInput('contentTemplate', template);
677
+ const modalRef = new ModalRef(() => this.closeModal(componentRef));
678
+ componentRef.instance.backdropClick.subscribe(() => {
679
+ modalRef.close();
680
+ });
681
+ this.appRef.attachView(componentRef.hostView);
682
+ const domElem = componentRef.hostView.rootNodes[0];
683
+ this.document.body.appendChild(domElem);
684
+ componentRef.changeDetectorRef.detectChanges();
685
+ this.activeModals.push(componentRef);
686
+ return modalRef;
687
+ }
688
+ /**
689
+ * Closes a specific modal instance.
690
+ * @param componentRef Component reference to close
691
+ */
692
+ closeModal(componentRef) {
693
+ const index = this.activeModals.indexOf(componentRef);
694
+ if (index > -1) {
695
+ this.activeModals.splice(index, 1);
696
+ }
697
+ this.appRef.detachView(componentRef.hostView);
698
+ componentRef.destroy();
699
+ }
700
+ /**
701
+ * Closes all currently open modals.
702
+ */
703
+ closeAll() {
704
+ const modals = [...this.activeModals];
705
+ modals.forEach((componentRef) => this.closeModal(componentRef));
706
+ }
707
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
708
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ModalService, providedIn: 'root' }); }
709
+ }
710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ModalService, decorators: [{
711
+ type: Injectable,
712
+ args: [{
713
+ providedIn: 'root',
714
+ }]
715
+ }] });
716
+
557
717
  class SeoService {
558
718
  constructor() {
559
719
  this.title = inject(Title);
@@ -891,6 +1051,7 @@ const SERVICES = [
891
1051
  MetaService,
892
1052
  SeoService,
893
1053
  StyleService,
1054
+ ModalService,
894
1055
  ];
895
1056
 
896
1057
  class ConfigsFacade {
@@ -1331,6 +1492,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
1331
1492
  args: ['window:scroll', []]
1332
1493
  }] } });
1333
1494
 
1495
+ class FooterComponent {
1496
+ constructor() {
1497
+ this.configsFacade = inject(ConfigsFacade);
1498
+ this.config = computed(() => this.configsFacade.data, ...(ngDevMode ? [{ debugName: "config" }] : []));
1499
+ this.currentYear = computed(() => new Date().getFullYear(), ...(ngDevMode ? [{ debugName: "currentYear" }] : []));
1500
+ this.staticPages = computed(() => {
1501
+ const config = this.config();
1502
+ if (!config?.theme?.footer?.menu)
1503
+ return [];
1504
+ return config.theme.footer.menu.filter((item) => item.type === ConfigPageType.static);
1505
+ }, ...(ngDevMode ? [{ debugName: "staticPages" }] : []));
1506
+ this.hasStaticPages = computed(() => this.staticPages().length > 0, ...(ngDevMode ? [{ debugName: "hasStaticPages" }] : []));
1507
+ this.menuItems = computed(() => {
1508
+ const config = this.config();
1509
+ return config?.theme?.footer?.menu ?? [];
1510
+ }, ...(ngDevMode ? [{ debugName: "menuItems" }] : []));
1511
+ this.hasMenuItems = computed(() => this.menuItems().length > 0, ...(ngDevMode ? [{ debugName: "hasMenuItems" }] : []));
1512
+ }
1513
+ getStaticPageById(id) {
1514
+ return this.staticPages().find((page) => page.page.id === id);
1515
+ }
1516
+ getStaticPageTitle(id) {
1517
+ return this.getStaticPageById(id)?.page.title;
1518
+ }
1519
+ updateConfig(_config) {
1520
+ const current = this.config();
1521
+ if (!current)
1522
+ return;
1523
+ }
1524
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1525
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.0", type: FooterComponent, isStandalone: true, selector: "smart-mobilems-footer", ngImport: i0, template: ``, isInline: true }); }
1526
+ }
1527
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FooterComponent, decorators: [{
1528
+ type: Component,
1529
+ args: [{ selector: 'smart-mobilems-footer', standalone: true, imports: [], template: `` }]
1530
+ }] });
1531
+
1334
1532
  const COMPONENTS = [AppComponent];
1335
1533
 
1336
1534
  /**
@@ -1580,5 +1778,5 @@ const unauthorizedGuard = () => {
1580
1778
  * Generated bundle index. Do not edit.
1581
1779
  */
1582
1780
 
1583
- export { AppComponent, AuthStorageService, COMPONENTS, ConfigsFacade, ConfigsService, ContrastService, CrudBaseService, DIRECTIVES, DictionaryService, FileUrlService, FiltersBaseComponent, FiltersContext, GameType, GlobalService, HoverDirective, ImageBox, ListMode, MetaService, PageComponent, SERVICES, ScrollTopComponent, ScrollableDirective, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, authenticationGuard, environment, setTranslationsAndLang, unauthorizedGuard };
1781
+ export { AppComponent, AuthStorageService, COMPONENTS, ConfigsFacade, ConfigsService, ContrastService, CrudBaseService, DIRECTIVES, DictionaryService, FileUrlService, FiltersBaseComponent, FiltersContext, FooterComponent, GameType, GlobalService, HoverDirective, ImageBox, ListMode, MetaService, ModalContainerComponent, ModalRef, ModalService, PageComponent, SERVICES, ScrollTopComponent, ScrollableDirective, SeoService, SettingsService, SharedConfig, SharedModule, StyleService, TRANSLATE_DATA_PL, TranslationService, WcagService, authenticationGuard, environment, setTranslationsAndLang, unauthorizedGuard };
1584
1782
  //# sourceMappingURL=smartsoft001-mobilems-angular.mjs.map