@evotor-dev/ui-kit 8.7.1 → 8.8.1
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.
- package/esm2022/lib/components/evo-modal/classes/EvoConfiguredComponentModalDrawingStrategy.mjs +8 -0
- package/esm2022/lib/components/evo-modal/classes/EvoConfiguredModalDrawingStrategy.mjs +14 -0
- package/esm2022/lib/components/evo-modal/classes/EvoConfiguredTemplateModalDrawingStrategy.mjs +11 -0
- package/esm2022/lib/components/evo-modal/classes/EvoDynamicModalDrawingStrategy.mjs +9 -0
- package/esm2022/lib/components/evo-modal/classes/EvoModalDrawingStrategy.mjs +3 -0
- package/esm2022/lib/components/evo-modal/enums.mjs +8 -0
- package/esm2022/lib/components/evo-modal/evo-modal-buttons/evo-modal-buttons.component.mjs +17 -0
- package/esm2022/lib/components/evo-modal/evo-modal-portal.mjs +29 -0
- package/esm2022/lib/components/evo-modal/evo-modal.component.mjs +128 -103
- package/esm2022/lib/components/evo-modal/evo-modal.provider.mjs +18 -0
- package/esm2022/lib/components/evo-modal/evo-modal.service.mjs +47 -12
- package/esm2022/lib/components/evo-modal/interfaces.mjs +2 -0
- package/esm2022/lib/components/evo-modal/public-api.mjs +7 -1
- package/esm2022/lib/components/evo-modal/tokens.mjs +12 -0
- package/esm2022/lib/components/evo-modal/utils.mjs +21 -0
- package/fesm2022/evotor-dev-ui-kit.mjs +420 -237
- package/fesm2022/evotor-dev-ui-kit.mjs.map +1 -1
- package/lib/components/evo-modal/classes/EvoConfiguredComponentModalDrawingStrategy.d.ts +6 -0
- package/lib/components/evo-modal/classes/EvoConfiguredModalDrawingStrategy.d.ts +6 -0
- package/lib/components/evo-modal/classes/EvoConfiguredTemplateModalDrawingStrategy.d.ts +6 -0
- package/lib/components/evo-modal/classes/EvoDynamicModalDrawingStrategy.d.ts +6 -0
- package/lib/components/evo-modal/classes/EvoModalDrawingStrategy.d.ts +5 -0
- package/lib/components/evo-modal/enums.d.ts +6 -0
- package/lib/components/evo-modal/evo-modal-buttons/evo-modal-buttons.component.d.ts +6 -0
- package/lib/components/evo-modal/evo-modal-portal.d.ts +16 -0
- package/lib/components/evo-modal/evo-modal.component.d.ts +48 -32
- package/lib/components/evo-modal/evo-modal.provider.d.ts +3 -0
- package/lib/components/evo-modal/evo-modal.service.d.ts +13 -12
- package/lib/components/evo-modal/interfaces.d.ts +47 -0
- package/lib/components/evo-modal/public-api.d.ts +6 -0
- package/lib/components/evo-modal/tokens.d.ts +7 -0
- package/lib/components/evo-modal/utils.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, PLATFORM_ID, ɵstringify as _stringify, Directive, Input, EventEmitter, Output, HostListener, Optional, ViewContainerRef, TemplateRef, Inject, NgModule, CUSTOM_ELEMENTS_SCHEMA, inject, SecurityContext, Component, ChangeDetectionStrategy, HostBinding, Pipe, output, forwardRef, ViewChild, ViewEncapsulation, ContentChild, ElementRef,
|
|
2
|
+
import { InjectionToken, Injectable, PLATFORM_ID, ɵstringify as _stringify, Directive, Input, EventEmitter, Output, HostListener, Optional, ViewContainerRef, TemplateRef, Inject, NgModule, CUSTOM_ELEMENTS_SCHEMA, inject, SecurityContext, Component, ChangeDetectionStrategy, HostBinding, Pipe, output, forwardRef, ViewChild, ViewEncapsulation, ContentChild, ElementRef, ComponentRef, input, model, viewChild, signal, computed, DestroyRef, EnvironmentInjector, createComponent, Injector, makeEnvironmentProviders, booleanAttribute, ChangeDetectorRef, NgZone, ApplicationRef, ComponentFactoryResolver, Host, ContentChildren, ViewChildren } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { isPlatformBrowser, CommonModule, AsyncPipe, NgClass, NgTemplateOutlet, NgIf, NgStyle, Location, NgFor } from '@angular/common';
|
|
5
5
|
import * as i1$2 from '@angular/forms';
|
|
@@ -8,7 +8,7 @@ import { NgxPageScrollModule } from 'ngx-page-scroll';
|
|
|
8
8
|
import * as i3 from '@angular/router';
|
|
9
9
|
import { RouterModule, NavigationEnd, RouterLink, RouterLinkActive } from '@angular/router';
|
|
10
10
|
import * as i1$3 from 'rxjs';
|
|
11
|
-
import { BehaviorSubject, Subject, Observable, shareReplay, fromEvent, merge, concat, of, asyncScheduler, scheduled } from 'rxjs';
|
|
11
|
+
import { BehaviorSubject, Subject, Observable, shareReplay, fromEvent, merge, concat, of, finalize, filter as filter$1, asyncScheduler, scheduled } from 'rxjs';
|
|
12
12
|
import { takeUntil, map, debounceTime, tap, delay, distinctUntilChanged, switchMap, filter, takeWhile, observeOn, take, mergeMap, throttleTime } from 'rxjs/operators';
|
|
13
13
|
import { style, animate, trigger, state, transition } from '@angular/animations';
|
|
14
14
|
import * as i1$1 from '@angular/platform-browser';
|
|
@@ -21,9 +21,8 @@ import { isNull, cloneDeep, isEqual, merge as merge$1, isUndefined } from 'lodas
|
|
|
21
21
|
import * as IMask from 'imask';
|
|
22
22
|
import flatpickr from 'flatpickr';
|
|
23
23
|
import { IMaskDirective } from 'angular-imask';
|
|
24
|
-
import {
|
|
24
|
+
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
25
25
|
import { createPopper } from '@popperjs/core';
|
|
26
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
27
26
|
import { __decorate } from 'tslib';
|
|
28
27
|
import autobind from 'autobind-decorator';
|
|
29
28
|
import bytes from 'bytes';
|
|
@@ -3363,31 +3362,255 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
|
|
|
3363
3362
|
}]
|
|
3364
3363
|
}] });
|
|
3365
3364
|
|
|
3365
|
+
const EVO_MODAL_CONFIG = new InjectionToken('EVO_MODAL_CONFIG');
|
|
3366
|
+
// Root ID
|
|
3367
|
+
const EVO_MODAL_DEFAULT_ROOT_ID = 'EVO_MODAL_ROOT_ID';
|
|
3368
|
+
const EVO_MODAL_ROOT_ID = new InjectionToken('EvoModal default root ID');
|
|
3369
|
+
// Config
|
|
3370
|
+
const EVO_MODAL_DEFAULT_CONFIG = {
|
|
3371
|
+
host: 'body',
|
|
3372
|
+
};
|
|
3373
|
+
// Modal Data
|
|
3374
|
+
const EVO_MODAL_DATA = new InjectionToken('EVO_MODAL_DATA');
|
|
3375
|
+
|
|
3376
|
+
class EvoPortalOutlet {
|
|
3377
|
+
constructor(injector, viewContainerRef) {
|
|
3378
|
+
this.injector = injector;
|
|
3379
|
+
this.viewContainerRef = viewContainerRef;
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
// eslint-disable-next-line:max-line-length
|
|
3384
|
+
class EvoAbstractPortal {
|
|
3385
|
+
}
|
|
3386
|
+
class EvoPortalService {
|
|
3387
|
+
constructor(appRef, injector, cfr) {
|
|
3388
|
+
this.appRef = appRef;
|
|
3389
|
+
this.injector = injector;
|
|
3390
|
+
this.cfr = cfr;
|
|
3391
|
+
}
|
|
3392
|
+
// eslint-disable-next-line
|
|
3393
|
+
attachComponent(portal, host, injector) {
|
|
3394
|
+
if (host instanceof EvoPortalOutlet) {
|
|
3395
|
+
return this.attachToHost(portal, host, injector);
|
|
3396
|
+
}
|
|
3397
|
+
else {
|
|
3398
|
+
return this.attachToDomElement(portal, host, injector);
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
// eslint-disable-next-line
|
|
3402
|
+
attachToDomElement(portal, elementOrSelector, injector) {
|
|
3403
|
+
let element;
|
|
3404
|
+
if (this.isElementSelector(elementOrSelector)) {
|
|
3405
|
+
element = document.querySelector(elementOrSelector);
|
|
3406
|
+
if (!element) {
|
|
3407
|
+
this.errNotFoundBySelector(elementOrSelector);
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
3410
|
+
else if (this.isHTMLElement(elementOrSelector)) {
|
|
3411
|
+
element = elementOrSelector;
|
|
3412
|
+
}
|
|
3413
|
+
// TODO: rewrite without deprecated ComponentFactoryResolver
|
|
3414
|
+
const factory = this.cfr.resolveComponentFactory(portal);
|
|
3415
|
+
const compRef = factory.create(injector || this.injector);
|
|
3416
|
+
this.appRef.attachView(compRef.hostView);
|
|
3417
|
+
element.appendChild(this.getRootNode(compRef));
|
|
3418
|
+
return compRef;
|
|
3419
|
+
}
|
|
3420
|
+
// eslint-disable-next-line
|
|
3421
|
+
attachToHost(portal, portalHost, injector) {
|
|
3422
|
+
const factory = this.cfr.resolveComponentFactory(portal);
|
|
3423
|
+
return portalHost.viewContainerRef.createComponent(factory, portalHost.viewContainerRef.length, injector || portalHost.injector);
|
|
3424
|
+
}
|
|
3425
|
+
// eslint-disable-next-line
|
|
3426
|
+
attachTemplate(template, host, context) {
|
|
3427
|
+
if (host instanceof EvoPortalOutlet) {
|
|
3428
|
+
return host.viewContainerRef.createEmbeddedView(template, context, host.viewContainerRef.length);
|
|
3429
|
+
}
|
|
3430
|
+
else if (this.isHTMLElement(host)) {
|
|
3431
|
+
return this.attachTemplateToElement(template, host, context);
|
|
3432
|
+
}
|
|
3433
|
+
else {
|
|
3434
|
+
const hostEl = document.querySelector(host);
|
|
3435
|
+
if (!hostEl) {
|
|
3436
|
+
this.errNotFoundBySelector(host);
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3439
|
+
return this.attachTemplateToElement(template, hostEl, context);
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
// eslint-disable-next-line
|
|
3443
|
+
detach(portal) {
|
|
3444
|
+
portal.destroy();
|
|
3445
|
+
}
|
|
3446
|
+
attachTemplateToElement(template, element, context) {
|
|
3447
|
+
const viewRef = template.createEmbeddedView(context);
|
|
3448
|
+
this.appRef.attachView(viewRef);
|
|
3449
|
+
element.appendChild(viewRef.rootNodes[0]);
|
|
3450
|
+
return viewRef;
|
|
3451
|
+
}
|
|
3452
|
+
// eslint-disable-next-line
|
|
3453
|
+
getRootNode(ref) {
|
|
3454
|
+
if (ref instanceof ComponentRef) {
|
|
3455
|
+
// eslint-disable-next-line
|
|
3456
|
+
return ref.hostView.rootNodes[0];
|
|
3457
|
+
}
|
|
3458
|
+
else {
|
|
3459
|
+
return ref.rootNodes[0];
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
// eslint-disable-next-line
|
|
3463
|
+
isElementSelector(selector) {
|
|
3464
|
+
return selector && typeof selector === 'string' && !!selector.trim().length;
|
|
3465
|
+
}
|
|
3466
|
+
// eslint-disable-next-line
|
|
3467
|
+
isHTMLElement(element) {
|
|
3468
|
+
return element && (element instanceof Element || element instanceof HTMLDocument);
|
|
3469
|
+
}
|
|
3470
|
+
errNotFoundBySelector(selector) {
|
|
3471
|
+
throw new Error(`Element with selector '${selector}' not found`);
|
|
3472
|
+
}
|
|
3473
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalService, deps: [{ token: i0.ApplicationRef }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3474
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalService }); }
|
|
3475
|
+
}
|
|
3476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalService, decorators: [{
|
|
3477
|
+
type: Injectable
|
|
3478
|
+
}], ctorParameters: () => [{ type: i0.ApplicationRef }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }] });
|
|
3479
|
+
|
|
3480
|
+
class EvoPortalOutletDirective extends EvoPortalOutlet {
|
|
3481
|
+
constructor(injector, viewContainerRef) {
|
|
3482
|
+
super(injector, viewContainerRef);
|
|
3483
|
+
this.injector = injector;
|
|
3484
|
+
this.viewContainerRef = viewContainerRef;
|
|
3485
|
+
}
|
|
3486
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalOutletDirective, deps: [{ token: i0.Injector }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3487
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.10", type: EvoPortalOutletDirective, isStandalone: true, selector: "[evoPortalOutlet]", usesInheritance: true, ngImport: i0 }); }
|
|
3488
|
+
}
|
|
3489
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalOutletDirective, decorators: [{
|
|
3490
|
+
type: Directive,
|
|
3491
|
+
args: [{
|
|
3492
|
+
selector: '[evoPortalOutlet]',
|
|
3493
|
+
standalone: true,
|
|
3494
|
+
}]
|
|
3495
|
+
}], ctorParameters: () => [{ type: i0.Injector }, { type: i0.ViewContainerRef }] });
|
|
3496
|
+
|
|
3497
|
+
class EvoPortalModule {
|
|
3498
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3499
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, imports: [EvoPortalOutletDirective], exports: [EvoPortalOutletDirective] }); }
|
|
3500
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, providers: [EvoPortalService] }); }
|
|
3501
|
+
}
|
|
3502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, decorators: [{
|
|
3503
|
+
type: NgModule,
|
|
3504
|
+
args: [{
|
|
3505
|
+
imports: [EvoPortalOutletDirective],
|
|
3506
|
+
providers: [EvoPortalService],
|
|
3507
|
+
exports: [EvoPortalOutletDirective],
|
|
3508
|
+
}]
|
|
3509
|
+
}] });
|
|
3510
|
+
|
|
3511
|
+
class EvoModalPortal extends EvoPortalService {
|
|
3512
|
+
constructor(appRef, injector, cfr) {
|
|
3513
|
+
super(appRef, injector, cfr);
|
|
3514
|
+
this.appRef = appRef;
|
|
3515
|
+
this.injector = injector;
|
|
3516
|
+
this.cfr = cfr;
|
|
3517
|
+
}
|
|
3518
|
+
attach(host) {
|
|
3519
|
+
this.attachedPortal = this.attachComponent(EvoModalComponent, host, this.injector);
|
|
3520
|
+
this.attachedPortal.changeDetectorRef.detectChanges();
|
|
3521
|
+
}
|
|
3522
|
+
detach() {
|
|
3523
|
+
super.detach(this.attachedPortal);
|
|
3524
|
+
this.attachedPortal = null;
|
|
3525
|
+
}
|
|
3526
|
+
hasAttachedPortal() {
|
|
3527
|
+
return !!this.attachedPortal;
|
|
3528
|
+
}
|
|
3529
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalPortal, deps: [{ token: i0.ApplicationRef }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3530
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalPortal }); }
|
|
3531
|
+
}
|
|
3532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalPortal, decorators: [{
|
|
3533
|
+
type: Injectable
|
|
3534
|
+
}], ctorParameters: () => [{ type: i0.ApplicationRef }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }] });
|
|
3535
|
+
|
|
3536
|
+
function isDynamicModalParams(params) {
|
|
3537
|
+
return params && !isConfiguredModalParams(params) && params?.hasOwnProperty('component');
|
|
3538
|
+
}
|
|
3539
|
+
function isConfiguredModalParams(params) {
|
|
3540
|
+
return params &&
|
|
3541
|
+
(params.hasOwnProperty('titleText') ||
|
|
3542
|
+
params.hasOwnProperty('acceptText') ||
|
|
3543
|
+
params.hasOwnProperty('declineText') ||
|
|
3544
|
+
params.hasOwnProperty('acceptButtonColor') ||
|
|
3545
|
+
params.hasOwnProperty('acceptButtonTheme') ||
|
|
3546
|
+
params.hasOwnProperty('declineButtonColor') ||
|
|
3547
|
+
params.hasOwnProperty('declineButtonTheme') ||
|
|
3548
|
+
params.hasOwnProperty('asyncAccept'));
|
|
3549
|
+
}
|
|
3550
|
+
function isConfiguredTemplateModalParams(params) {
|
|
3551
|
+
return params && isConfiguredModalParams(params) && params.hasOwnProperty('template');
|
|
3552
|
+
}
|
|
3553
|
+
function isConfiguredComponentModalParams(params) {
|
|
3554
|
+
return params && isConfiguredModalParams(params) && params.hasOwnProperty('component');
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3366
3557
|
class EvoModalService {
|
|
3367
3558
|
constructor() {
|
|
3559
|
+
this.portal = inject(EvoModalPortal);
|
|
3560
|
+
this.config = inject(EVO_MODAL_CONFIG);
|
|
3561
|
+
this.evoModalRootId = inject(EVO_MODAL_ROOT_ID);
|
|
3368
3562
|
this.modalEvents$ = new Subject();
|
|
3369
|
-
this.registeredModals =
|
|
3563
|
+
this.registeredModals = new Map();
|
|
3370
3564
|
}
|
|
3371
3565
|
register(id) {
|
|
3372
|
-
this.registeredModals
|
|
3566
|
+
this.registeredModals.set(id, { id, isOpen: false });
|
|
3373
3567
|
}
|
|
3374
3568
|
unregister(id) {
|
|
3375
|
-
|
|
3569
|
+
this.registeredModals.delete(id);
|
|
3376
3570
|
}
|
|
3377
|
-
open(
|
|
3378
|
-
|
|
3571
|
+
open(idOrParams, params) {
|
|
3572
|
+
if (typeof idOrParams === 'string') {
|
|
3573
|
+
this.modalEvents$.next({ id: idOrParams, isOpen: true, params });
|
|
3574
|
+
}
|
|
3575
|
+
else if (isDynamicModalParams(idOrParams)) {
|
|
3576
|
+
this.openDynamicModal(idOrParams);
|
|
3577
|
+
}
|
|
3578
|
+
else if (isConfiguredModalParams(idOrParams)) {
|
|
3579
|
+
this.openConfiguredModal(idOrParams);
|
|
3580
|
+
}
|
|
3379
3581
|
}
|
|
3380
|
-
close(id, agreement, params) {
|
|
3582
|
+
close(id = this.evoModalRootId, agreement = false, params) {
|
|
3381
3583
|
this.modalEvents$.next({ id, isOpen: false, agreement, params });
|
|
3382
3584
|
}
|
|
3383
3585
|
getEventsSubscription(id) {
|
|
3384
|
-
return this.modalEvents$.pipe(filter((
|
|
3586
|
+
return this.modalEvents$.pipe(filter(({ id: currentId }) => currentId === id), distinctUntilChanged((a, b) => isEqual(a, b)));
|
|
3587
|
+
}
|
|
3588
|
+
openDynamicModal(params) {
|
|
3589
|
+
this.attachPortal();
|
|
3590
|
+
this.modalEvents$.next({ id: this.evoModalRootId, isOpen: true, params });
|
|
3591
|
+
}
|
|
3592
|
+
openConfiguredModal(idOrParams) {
|
|
3593
|
+
this.attachPortal();
|
|
3594
|
+
this.modalEvents$.next({ id: this.evoModalRootId, isOpen: true, params: idOrParams });
|
|
3595
|
+
}
|
|
3596
|
+
cleanupDefaultHost() {
|
|
3597
|
+
if (!this.portal.hasAttachedPortal()) {
|
|
3598
|
+
return;
|
|
3599
|
+
}
|
|
3600
|
+
this.portal.detach();
|
|
3601
|
+
}
|
|
3602
|
+
attachPortal() {
|
|
3603
|
+
if (this.portal.hasAttachedPortal()) {
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
this.portal.attach(this.config.host);
|
|
3385
3607
|
}
|
|
3386
3608
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3387
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalService }); }
|
|
3609
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalService, providedIn: 'root' }); }
|
|
3388
3610
|
}
|
|
3389
3611
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalService, decorators: [{
|
|
3390
|
-
type: Injectable
|
|
3612
|
+
type: Injectable,
|
|
3613
|
+
args: [{ providedIn: 'root' }]
|
|
3391
3614
|
}] });
|
|
3392
3615
|
|
|
3393
3616
|
var EvoModalCloseTargets;
|
|
@@ -3397,117 +3620,198 @@ var EvoModalCloseTargets;
|
|
|
3397
3620
|
EvoModalCloseTargets["DEFAULT"] = "default";
|
|
3398
3621
|
EvoModalCloseTargets["ESC"] = "escape";
|
|
3399
3622
|
})(EvoModalCloseTargets || (EvoModalCloseTargets = {}));
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3623
|
+
|
|
3624
|
+
class EvoModalDrawingStrategy {
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3627
|
+
class EvoDynamicModalDrawingStrategy extends EvoModalDrawingStrategy {
|
|
3628
|
+
draw(params) {
|
|
3629
|
+
this.isDynamicContent.set(true);
|
|
3630
|
+
this.clearView();
|
|
3631
|
+
this.insertComponent(params);
|
|
3403
3632
|
}
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
class EvoConfiguredModalDrawingStrategy extends EvoModalDrawingStrategy {
|
|
3636
|
+
draw(params) {
|
|
3637
|
+
this.titleText.set(params.titleText);
|
|
3638
|
+
this.acceptText.set(params.acceptText);
|
|
3639
|
+
this.declineText.set(params.declineText);
|
|
3640
|
+
this.acceptButtonColor.update((color) => params.acceptButtonColor || color);
|
|
3641
|
+
this.acceptButtonTheme.update((theme) => params.acceptButtonTheme || theme);
|
|
3642
|
+
this.declineButtonColor.update((color) => params.declineButtonColor || color);
|
|
3643
|
+
this.declineButtonTheme.update((theme) => params.declineButtonTheme || theme);
|
|
3644
|
+
this.asyncAccept.set(params.asyncAccept);
|
|
3412
3645
|
}
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
this.
|
|
3419
|
-
|
|
3420
|
-
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
class EvoConfiguredComponentModalDrawingStrategy extends EvoConfiguredModalDrawingStrategy {
|
|
3649
|
+
draw(params) {
|
|
3650
|
+
super.draw(params);
|
|
3651
|
+
this.insertComponent(params, 'content');
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
class EvoConfiguredTemplateModalDrawingStrategy extends EvoConfiguredModalDrawingStrategy {
|
|
3656
|
+
draw(params) {
|
|
3657
|
+
super.draw(params);
|
|
3658
|
+
this.modalContent.set({
|
|
3659
|
+
template: params.template,
|
|
3660
|
+
context: params.data,
|
|
3661
|
+
});
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
class EvoModalButtonsComponent {
|
|
3666
|
+
constructor() {
|
|
3667
|
+
this.single = input(false);
|
|
3668
|
+
}
|
|
3669
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3670
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.10", type: EvoModalButtonsComponent, isStandalone: true, selector: "evo-modal-buttons, [evo-modal-buttons]", inputs: { single: { classPropertyName: "single", publicName: "single", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.evo-modal-buttons_single-btn": "single()" }, classAttribute: "evo-modal-buttons" }, ngImport: i0, template: '<ng-content select="[evoButton]"/>', isInline: true, styles: [".evo-modal-buttons{display:flex;flex-shrink:0;flex-direction:column-reverse;justify-content:center;align-items:center;width:100%;margin-top:32px;gap:16px}@media (min-width: 768px){.evo-modal-buttons{display:grid;width:auto;grid-template-columns:repeat(2,minmax(140px,1fr));gap:32px;margin:32px auto 0}.evo-modal-buttons_single-btn{grid-template-columns:minmax(140px,1fr)}}.evo-modal-buttons button{display:block;width:100%}@media (min-width: 768px){.evo-modal-buttons button{width:auto}}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
3671
|
+
}
|
|
3672
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalButtonsComponent, decorators: [{
|
|
3673
|
+
type: Component,
|
|
3674
|
+
args: [{ selector: 'evo-modal-buttons, [evo-modal-buttons]', standalone: true, imports: [], template: '<ng-content select="[evoButton]"/>', host: {
|
|
3675
|
+
class: 'evo-modal-buttons',
|
|
3676
|
+
'[class.evo-modal-buttons_single-btn]': 'single()',
|
|
3677
|
+
}, encapsulation: ViewEncapsulation.None, styles: [".evo-modal-buttons{display:flex;flex-shrink:0;flex-direction:column-reverse;justify-content:center;align-items:center;width:100%;margin-top:32px;gap:16px}@media (min-width: 768px){.evo-modal-buttons{display:grid;width:auto;grid-template-columns:repeat(2,minmax(140px,1fr));gap:32px;margin:32px auto 0}.evo-modal-buttons_single-btn{grid-template-columns:minmax(140px,1fr)}}.evo-modal-buttons button{display:block;width:100%}@media (min-width: 768px){.evo-modal-buttons button{width:auto}}\n"] }]
|
|
3678
|
+
}] });
|
|
3679
|
+
|
|
3680
|
+
class EvoModalComponent {
|
|
3681
|
+
constructor() {
|
|
3682
|
+
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
3683
|
+
this.evoModalRootId = inject(EVO_MODAL_ROOT_ID);
|
|
3684
|
+
this.acceptText = model('');
|
|
3685
|
+
this.acceptButtonColor = model(`success`);
|
|
3686
|
+
this.acceptButtonTheme = model(`rounded-solid`);
|
|
3687
|
+
this.asyncAccept = model(null);
|
|
3688
|
+
this.declineText = model('');
|
|
3689
|
+
this.declineButtonColor = model('secondary');
|
|
3690
|
+
this.declineButtonTheme = model('rounded-outline');
|
|
3691
|
+
this.id = model(this.evoModalRootId);
|
|
3692
|
+
this.titleText = model('');
|
|
3693
|
+
this.contentContainer = viewChild('contentContainer', { read: ViewContainerRef });
|
|
3694
|
+
this.contentContainer$ = toObservable(this.contentContainer);
|
|
3695
|
+
this.drawingStrategy = signal(null);
|
|
3696
|
+
this.isDynamicContent = signal(false);
|
|
3697
|
+
this.isLoading = signal(false);
|
|
3698
|
+
this.isVisible = computed(() => this.modalState()?.isOpen || false);
|
|
3699
|
+
this.modalContainer = viewChild('modalContainer', { read: ViewContainerRef });
|
|
3700
|
+
this.modalContainer$ = toObservable(this.modalContainer);
|
|
3701
|
+
this.modalContent = signal(null);
|
|
3702
|
+
this.modalElement = viewChild('modal', { read: ElementRef });
|
|
3703
|
+
this.modalState = signal(null);
|
|
3704
|
+
this.showButtons = computed(() => this.acceptText() || this.declineText());
|
|
3421
3705
|
this.closeTargets = EvoModalCloseTargets;
|
|
3422
|
-
this.
|
|
3706
|
+
this.destroyRef = inject(DestroyRef);
|
|
3707
|
+
this.environmentInjector = inject(EnvironmentInjector);
|
|
3708
|
+
this.evoModalService = inject(EvoModalService);
|
|
3423
3709
|
}
|
|
3424
3710
|
ngOnInit() {
|
|
3711
|
+
this.evoModalService.register(this.id());
|
|
3425
3712
|
this.subscribeModalEvents();
|
|
3426
3713
|
}
|
|
3427
3714
|
ngOnDestroy() {
|
|
3428
|
-
this.
|
|
3715
|
+
this.evoModalService.unregister(this.id());
|
|
3429
3716
|
}
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
!this.elRef.nativeElement.querySelector('.evo-modal').contains($event.target) &&
|
|
3435
|
-
this.modalState.isOpen) {
|
|
3436
|
-
this.handleOnClose(false, this.closeTargets.BACKGROUND);
|
|
3717
|
+
onAcceptClick() {
|
|
3718
|
+
const asyncAcceptAction = this.asyncAccept()?.();
|
|
3719
|
+
if (!asyncAcceptAction) {
|
|
3720
|
+
return this.close(true, EvoModalCloseTargets.BUTTON);
|
|
3437
3721
|
}
|
|
3722
|
+
this.isLoading.set(true);
|
|
3723
|
+
asyncAcceptAction.pipe(finalize(() => this.isLoading.set(false)), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.close(true, EvoModalCloseTargets.BUTTON));
|
|
3438
3724
|
}
|
|
3439
|
-
|
|
3440
|
-
this.
|
|
3441
|
-
|
|
3442
|
-
return;
|
|
3725
|
+
onBackgroundClick(event) {
|
|
3726
|
+
if (this.canCloseByBackground(event)) {
|
|
3727
|
+
this.close(false, EvoModalCloseTargets.BACKGROUND);
|
|
3443
3728
|
}
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
};
|
|
3449
|
-
setAsyncStates(true);
|
|
3450
|
-
return this.asyncAccept().subscribe(() => {
|
|
3451
|
-
setAsyncStates(false);
|
|
3452
|
-
this.modalService.close(this.id, agreement, {
|
|
3453
|
-
closeTarget: this.closeTarget,
|
|
3454
|
-
});
|
|
3455
|
-
}, () => {
|
|
3456
|
-
setAsyncStates(false);
|
|
3457
|
-
});
|
|
3729
|
+
}
|
|
3730
|
+
onDeclineClick() {
|
|
3731
|
+
if (this.isLoading()) {
|
|
3732
|
+
return;
|
|
3458
3733
|
}
|
|
3459
|
-
this.
|
|
3460
|
-
closeTarget: this.closeTarget,
|
|
3461
|
-
});
|
|
3734
|
+
this.close(false, EvoModalCloseTargets.BUTTON);
|
|
3462
3735
|
}
|
|
3463
|
-
|
|
3464
|
-
this.
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3736
|
+
clearView() {
|
|
3737
|
+
this.modalContainer()?.clear();
|
|
3738
|
+
}
|
|
3739
|
+
insertComponent({ data, injector, component }, target = 'modal') {
|
|
3740
|
+
const dynamicComponentRef = createComponent(component, {
|
|
3741
|
+
environmentInjector: this.environmentInjector,
|
|
3742
|
+
elementInjector: Injector.create({
|
|
3743
|
+
providers: [
|
|
3744
|
+
{
|
|
3745
|
+
provide: EVO_MODAL_DATA,
|
|
3746
|
+
useValue: data,
|
|
3747
|
+
},
|
|
3748
|
+
],
|
|
3749
|
+
parent: injector,
|
|
3750
|
+
}),
|
|
3473
3751
|
});
|
|
3752
|
+
this.getInsertionContainer(target).pipe(filter$1((container) => !!container), takeUntilDestroyed(this.destroyRef)).subscribe((container) => {
|
|
3753
|
+
container.insert(dynamicComponentRef.hostView);
|
|
3754
|
+
dynamicComponentRef.changeDetectorRef.markForCheck();
|
|
3755
|
+
});
|
|
3756
|
+
}
|
|
3757
|
+
canCloseByBackground(event) {
|
|
3758
|
+
return (this.declineText() || this.isDynamicContent()) &&
|
|
3759
|
+
!this.isLoading() &&
|
|
3760
|
+
this.modalState().isOpen &&
|
|
3761
|
+
event?.target &&
|
|
3762
|
+
!this.modalElement().nativeElement.contains(event.target);
|
|
3763
|
+
}
|
|
3764
|
+
close(agreement, closeTarget) {
|
|
3765
|
+
this.evoModalService.close(this.id(), agreement, { closeTarget });
|
|
3766
|
+
this.clearView();
|
|
3767
|
+
if (this.id() !== this.evoModalRootId) {
|
|
3768
|
+
return;
|
|
3769
|
+
}
|
|
3770
|
+
this.evoModalService.unregister(this.evoModalRootId);
|
|
3771
|
+
this.evoModalService.cleanupDefaultHost();
|
|
3772
|
+
}
|
|
3773
|
+
getInsertionContainer(target) {
|
|
3774
|
+
return target === 'modal' ? this.modalContainer$ : this.contentContainer$;
|
|
3474
3775
|
}
|
|
3475
3776
|
initKeyboardListener() {
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3777
|
+
fromEvent(document.body, 'keydown').pipe(takeWhile(() => this.modalState().isOpen), filter$1((event) => (this.declineText() || this.isDynamicContent()) && event.key === 'Escape'), takeUntilDestroyed(this.destroyRef)).subscribe(() => this.close(false, this.closeTargets.ESC));
|
|
3778
|
+
}
|
|
3779
|
+
setDrawingStrategy(params) {
|
|
3780
|
+
switch (true) {
|
|
3781
|
+
case isDynamicModalParams(params):
|
|
3782
|
+
return this.drawingStrategy.set(new EvoDynamicModalDrawingStrategy());
|
|
3783
|
+
case isConfiguredComponentModalParams(params):
|
|
3784
|
+
return this.drawingStrategy.set(new EvoConfiguredComponentModalDrawingStrategy());
|
|
3785
|
+
case isConfiguredTemplateModalParams(params):
|
|
3786
|
+
return this.drawingStrategy.set(new EvoConfiguredTemplateModalDrawingStrategy());
|
|
3787
|
+
default:
|
|
3788
|
+
return;
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
subscribeModalEvents() {
|
|
3792
|
+
this.evoModalService.getEventsSubscription(this.id()).pipe(takeUntilDestroyed(this.destroyRef)).subscribe((modalState) => {
|
|
3793
|
+
this.modalState.set(modalState);
|
|
3794
|
+
if (!modalState.isOpen) {
|
|
3795
|
+
return;
|
|
3483
3796
|
}
|
|
3797
|
+
this.initKeyboardListener();
|
|
3798
|
+
this.setDrawingStrategy(modalState.params);
|
|
3799
|
+
this.drawingStrategy()?.draw.call(this, modalState.params);
|
|
3484
3800
|
});
|
|
3485
3801
|
}
|
|
3486
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalComponent, deps: [
|
|
3487
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.10", type: EvoModalComponent, isStandalone: true, selector: "evo-modal", inputs: {
|
|
3802
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3803
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.10", type: EvoModalComponent, isStandalone: true, selector: "evo-modal", inputs: { acceptText: { classPropertyName: "acceptText", publicName: "acceptText", isSignal: true, isRequired: false, transformFunction: null }, acceptButtonColor: { classPropertyName: "acceptButtonColor", publicName: "acceptButtonColor", isSignal: true, isRequired: false, transformFunction: null }, acceptButtonTheme: { classPropertyName: "acceptButtonTheme", publicName: "acceptButtonTheme", isSignal: true, isRequired: false, transformFunction: null }, asyncAccept: { classPropertyName: "asyncAccept", publicName: "asyncAccept", isSignal: true, isRequired: false, transformFunction: null }, declineText: { classPropertyName: "declineText", publicName: "declineText", isSignal: true, isRequired: false, transformFunction: null }, declineButtonColor: { classPropertyName: "declineButtonColor", publicName: "declineButtonColor", isSignal: true, isRequired: false, transformFunction: null }, declineButtonTheme: { classPropertyName: "declineButtonTheme", publicName: "declineButtonTheme", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, titleText: { classPropertyName: "titleText", publicName: "titleText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { acceptText: "acceptTextChange", acceptButtonColor: "acceptButtonColorChange", acceptButtonTheme: "acceptButtonThemeChange", asyncAccept: "asyncAcceptChange", declineText: "declineTextChange", declineButtonColor: "declineButtonColorChange", declineButtonTheme: "declineButtonThemeChange", id: "idChange", titleText: "titleTextChange" }, viewQueries: [{ propertyName: "contentContainer", first: true, predicate: ["contentContainer"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "modalContainer", first: true, predicate: ["modalContainer"], descendants: true, read: ViewContainerRef, isSignal: true }, { propertyName: "modalElement", first: true, predicate: ["modal"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@if (isVisible()) {\n <div class=\"evo-modal__background\" (click)=\"onBackgroundClick($event)\"></div>\n\n <div class=\"evo-modal__wrapper\" (click)=\"onBackgroundClick($event)\">\n <div class=\"evo-modal\" #modal>\n @if (isDynamicContent()) {\n <ng-template #modalContainer/>\n } @else {\n <div class=\"evo-modal__icon\">\n <ng-content select=\"evo-icon\"/>\n </div>\n\n @if (titleText()) {\n <h2 class=\"evo-modal__title\">{{ titleText() }}</h2>\n }\n\n <div class=\"evo-modal__content\">\n <ng-content/>\n\n <ng-container *ngTemplateOutlet=\"modalContent()?.template; context: {data: modalContent()?.context}\"/>\n\n <ng-template #contentContainer/>\n </div>\n\n @if (showButtons()) {\n <evo-modal-buttons [single]=\"!declineText() || !acceptText()\">\n @if (declineText()) {\n <button\n class=\"evo-modal__button_decline\"\n evoButton\n [color]=\"declineButtonColor()\"\n [theme]=\"declineButtonTheme()\"\n [disabled]=\"isLoading()\"\n (click)=\"onDeclineClick()\"\n >{{ declineText() }}</button>\n }\n\n @if (acceptText()) {\n <button\n class=\"evo-modal__button_accept\"\n evoButton\n [color]=\"acceptButtonColor()\"\n [theme]=\"acceptButtonTheme()\"\n [loading]=\"isLoading()\"\n (click)=\"onAcceptClick()\"\n >{{ acceptText() }}</button>\n }\n </evo-modal-buttons>\n }\n }\n </div>\n </div>\n}\n", styles: ["@keyframes appearance{0%{opacity:0}to{opacity:1}}.evo-modal{display:flex;flex-direction:column;justify-content:flex-start;align-items:center;width:100%;max-width:752px;height:auto;max-height:100%;padding:16px;overflow:hidden;text-align:center;background-color:#fff;border-radius:16px;box-shadow:0 0 12px 2px #0000004d;animation:appearance .25s linear}@media (min-width: 768px){.evo-modal{width:752px;height:auto;padding:32px}}.evo-modal__title{margin-top:0;margin-bottom:0;font-weight:700;font-size:16px;line-height:24px}@media (min-width: 768px){.evo-modal__title{width:674px;font-size:24px;line-height:32px}}.evo-modal__icon{margin-bottom:8px}.evo-modal__icon ::ng-deep evo-icon{display:block;width:64px;height:64px}@media (min-width: 768px){.evo-modal__icon{margin-bottom:32px}}.evo-modal__icon:empty{display:none}.evo-modal__content{width:100%;margin-top:32px;overflow:auto;font-size:14px;line-height:22px}.evo-modal__content:empty{display:none;margin-top:0}.evo-modal__content ::ng-deep *:last-child{margin-bottom:0}.evo-modal__background{position:fixed;inset:0;z-index:1010;display:flex;justify-content:center;width:100%;height:100%;background:#00000080}.evo-modal__wrapper{position:fixed;inset:0;z-index:1011;display:flex;justify-content:center;align-items:center;width:100%;padding:16px}@media (min-width: 768px){.evo-modal__wrapper{width:auto}}\n"], dependencies: [{ kind: "component", type: EvoButtonComponent, selector: "button[evoButton], a[evoButton]", inputs: ["size", "color", "theme", "disabled", "loading"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: EvoModalButtonsComponent, selector: "evo-modal-buttons, [evo-modal-buttons]", inputs: ["single"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3488
3804
|
}
|
|
3489
3805
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalComponent, decorators: [{
|
|
3490
3806
|
type: Component,
|
|
3491
|
-
args: [{ selector: 'evo-modal', standalone: true, imports: [
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
type: Input
|
|
3500
|
-
}], acceptButtonTheme: [{
|
|
3501
|
-
type: Input
|
|
3502
|
-
}], declineText: [{
|
|
3503
|
-
type: Input
|
|
3504
|
-
}], declineButtonColor: [{
|
|
3505
|
-
type: Input
|
|
3506
|
-
}], declineButtonTheme: [{
|
|
3507
|
-
type: Input
|
|
3508
|
-
}], asyncAccept: [{
|
|
3509
|
-
type: Input
|
|
3510
|
-
}] } });
|
|
3807
|
+
args: [{ selector: 'evo-modal', standalone: true, imports: [
|
|
3808
|
+
EvoButtonComponent,
|
|
3809
|
+
EvoUiClassDirective,
|
|
3810
|
+
NgIf,
|
|
3811
|
+
NgTemplateOutlet,
|
|
3812
|
+
EvoModalButtonsComponent,
|
|
3813
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (isVisible()) {\n <div class=\"evo-modal__background\" (click)=\"onBackgroundClick($event)\"></div>\n\n <div class=\"evo-modal__wrapper\" (click)=\"onBackgroundClick($event)\">\n <div class=\"evo-modal\" #modal>\n @if (isDynamicContent()) {\n <ng-template #modalContainer/>\n } @else {\n <div class=\"evo-modal__icon\">\n <ng-content select=\"evo-icon\"/>\n </div>\n\n @if (titleText()) {\n <h2 class=\"evo-modal__title\">{{ titleText() }}</h2>\n }\n\n <div class=\"evo-modal__content\">\n <ng-content/>\n\n <ng-container *ngTemplateOutlet=\"modalContent()?.template; context: {data: modalContent()?.context}\"/>\n\n <ng-template #contentContainer/>\n </div>\n\n @if (showButtons()) {\n <evo-modal-buttons [single]=\"!declineText() || !acceptText()\">\n @if (declineText()) {\n <button\n class=\"evo-modal__button_decline\"\n evoButton\n [color]=\"declineButtonColor()\"\n [theme]=\"declineButtonTheme()\"\n [disabled]=\"isLoading()\"\n (click)=\"onDeclineClick()\"\n >{{ declineText() }}</button>\n }\n\n @if (acceptText()) {\n <button\n class=\"evo-modal__button_accept\"\n evoButton\n [color]=\"acceptButtonColor()\"\n [theme]=\"acceptButtonTheme()\"\n [loading]=\"isLoading()\"\n (click)=\"onAcceptClick()\"\n >{{ acceptText() }}</button>\n }\n </evo-modal-buttons>\n }\n }\n </div>\n </div>\n}\n", styles: ["@keyframes appearance{0%{opacity:0}to{opacity:1}}.evo-modal{display:flex;flex-direction:column;justify-content:flex-start;align-items:center;width:100%;max-width:752px;height:auto;max-height:100%;padding:16px;overflow:hidden;text-align:center;background-color:#fff;border-radius:16px;box-shadow:0 0 12px 2px #0000004d;animation:appearance .25s linear}@media (min-width: 768px){.evo-modal{width:752px;height:auto;padding:32px}}.evo-modal__title{margin-top:0;margin-bottom:0;font-weight:700;font-size:16px;line-height:24px}@media (min-width: 768px){.evo-modal__title{width:674px;font-size:24px;line-height:32px}}.evo-modal__icon{margin-bottom:8px}.evo-modal__icon ::ng-deep evo-icon{display:block;width:64px;height:64px}@media (min-width: 768px){.evo-modal__icon{margin-bottom:32px}}.evo-modal__icon:empty{display:none}.evo-modal__content{width:100%;margin-top:32px;overflow:auto;font-size:14px;line-height:22px}.evo-modal__content:empty{display:none;margin-top:0}.evo-modal__content ::ng-deep *:last-child{margin-bottom:0}.evo-modal__background{position:fixed;inset:0;z-index:1010;display:flex;justify-content:center;width:100%;height:100%;background:#00000080}.evo-modal__wrapper{position:fixed;inset:0;z-index:1011;display:flex;justify-content:center;align-items:center;width:100%;padding:16px}@media (min-width: 768px){.evo-modal__wrapper{width:auto}}\n"] }]
|
|
3814
|
+
}] });
|
|
3511
3815
|
|
|
3512
3816
|
class EvoModalModule {
|
|
3513
3817
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -3523,6 +3827,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
|
|
|
3523
3827
|
}]
|
|
3524
3828
|
}] });
|
|
3525
3829
|
|
|
3830
|
+
function provideModal(config = {}) {
|
|
3831
|
+
return makeEnvironmentProviders([
|
|
3832
|
+
EvoModalPortal,
|
|
3833
|
+
{
|
|
3834
|
+
provide: EVO_MODAL_ROOT_ID,
|
|
3835
|
+
useValue: EVO_MODAL_DEFAULT_ROOT_ID,
|
|
3836
|
+
},
|
|
3837
|
+
{
|
|
3838
|
+
provide: EVO_MODAL_CONFIG,
|
|
3839
|
+
useValue: merge$1(EVO_MODAL_DEFAULT_CONFIG, config),
|
|
3840
|
+
},
|
|
3841
|
+
]);
|
|
3842
|
+
}
|
|
3843
|
+
|
|
3526
3844
|
class EvoNoteComponent {
|
|
3527
3845
|
constructor() {
|
|
3528
3846
|
this.closable = input(false, { transform: booleanAttribute });
|
|
@@ -3871,141 +4189,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
|
|
|
3871
4189
|
}]
|
|
3872
4190
|
}] });
|
|
3873
4191
|
|
|
3874
|
-
class EvoPortalOutlet {
|
|
3875
|
-
constructor(injector, viewContainerRef) {
|
|
3876
|
-
this.injector = injector;
|
|
3877
|
-
this.viewContainerRef = viewContainerRef;
|
|
3878
|
-
}
|
|
3879
|
-
}
|
|
3880
|
-
|
|
3881
|
-
// eslint-disable-next-line:max-line-length
|
|
3882
|
-
class EvoAbstractPortal {
|
|
3883
|
-
}
|
|
3884
|
-
class EvoPortalService {
|
|
3885
|
-
constructor(appRef, injector, cfr) {
|
|
3886
|
-
this.appRef = appRef;
|
|
3887
|
-
this.injector = injector;
|
|
3888
|
-
this.cfr = cfr;
|
|
3889
|
-
}
|
|
3890
|
-
// eslint-disable-next-line
|
|
3891
|
-
attachComponent(portal, host, injector) {
|
|
3892
|
-
if (host instanceof EvoPortalOutlet) {
|
|
3893
|
-
return this.attachToHost(portal, host, injector);
|
|
3894
|
-
}
|
|
3895
|
-
else {
|
|
3896
|
-
return this.attachToDomElement(portal, host, injector);
|
|
3897
|
-
}
|
|
3898
|
-
}
|
|
3899
|
-
// eslint-disable-next-line
|
|
3900
|
-
attachToDomElement(portal, elementOrSelector, injector) {
|
|
3901
|
-
let element;
|
|
3902
|
-
if (this.isElementSelector(elementOrSelector)) {
|
|
3903
|
-
element = document.querySelector(elementOrSelector);
|
|
3904
|
-
if (!element) {
|
|
3905
|
-
this.errNotFoundBySelector(elementOrSelector);
|
|
3906
|
-
}
|
|
3907
|
-
}
|
|
3908
|
-
else if (this.isHTMLElement(elementOrSelector)) {
|
|
3909
|
-
element = elementOrSelector;
|
|
3910
|
-
}
|
|
3911
|
-
// TODO: rewrite without deprecated ComponentFactoryResolver
|
|
3912
|
-
const factory = this.cfr.resolveComponentFactory(portal);
|
|
3913
|
-
const compRef = factory.create(injector || this.injector);
|
|
3914
|
-
this.appRef.attachView(compRef.hostView);
|
|
3915
|
-
element.appendChild(this.getRootNode(compRef));
|
|
3916
|
-
return compRef;
|
|
3917
|
-
}
|
|
3918
|
-
// eslint-disable-next-line
|
|
3919
|
-
attachToHost(portal, portalHost, injector) {
|
|
3920
|
-
const factory = this.cfr.resolveComponentFactory(portal);
|
|
3921
|
-
return portalHost.viewContainerRef.createComponent(factory, portalHost.viewContainerRef.length, injector || portalHost.injector);
|
|
3922
|
-
}
|
|
3923
|
-
// eslint-disable-next-line
|
|
3924
|
-
attachTemplate(template, host, context) {
|
|
3925
|
-
if (host instanceof EvoPortalOutlet) {
|
|
3926
|
-
return host.viewContainerRef.createEmbeddedView(template, context, host.viewContainerRef.length);
|
|
3927
|
-
}
|
|
3928
|
-
else if (this.isHTMLElement(host)) {
|
|
3929
|
-
return this.attachTemplateToElement(template, host, context);
|
|
3930
|
-
}
|
|
3931
|
-
else {
|
|
3932
|
-
const hostEl = document.querySelector(host);
|
|
3933
|
-
if (!hostEl) {
|
|
3934
|
-
this.errNotFoundBySelector(host);
|
|
3935
|
-
return;
|
|
3936
|
-
}
|
|
3937
|
-
return this.attachTemplateToElement(template, hostEl, context);
|
|
3938
|
-
}
|
|
3939
|
-
}
|
|
3940
|
-
// eslint-disable-next-line
|
|
3941
|
-
detach(portal) {
|
|
3942
|
-
portal.destroy();
|
|
3943
|
-
}
|
|
3944
|
-
attachTemplateToElement(template, element, context) {
|
|
3945
|
-
const viewRef = template.createEmbeddedView(context);
|
|
3946
|
-
this.appRef.attachView(viewRef);
|
|
3947
|
-
element.appendChild(viewRef.rootNodes[0]);
|
|
3948
|
-
return viewRef;
|
|
3949
|
-
}
|
|
3950
|
-
// eslint-disable-next-line
|
|
3951
|
-
getRootNode(ref) {
|
|
3952
|
-
if (ref instanceof ComponentRef) {
|
|
3953
|
-
// eslint-disable-next-line
|
|
3954
|
-
return ref.hostView.rootNodes[0];
|
|
3955
|
-
}
|
|
3956
|
-
else {
|
|
3957
|
-
return ref.rootNodes[0];
|
|
3958
|
-
}
|
|
3959
|
-
}
|
|
3960
|
-
// eslint-disable-next-line
|
|
3961
|
-
isElementSelector(selector) {
|
|
3962
|
-
return selector && typeof selector === 'string' && !!selector.trim().length;
|
|
3963
|
-
}
|
|
3964
|
-
// eslint-disable-next-line
|
|
3965
|
-
isHTMLElement(element) {
|
|
3966
|
-
return element && (element instanceof Element || element instanceof HTMLDocument);
|
|
3967
|
-
}
|
|
3968
|
-
errNotFoundBySelector(selector) {
|
|
3969
|
-
throw new Error(`Element with selector '${selector}' not found`);
|
|
3970
|
-
}
|
|
3971
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalService, deps: [{ token: i0.ApplicationRef }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3972
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalService }); }
|
|
3973
|
-
}
|
|
3974
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalService, decorators: [{
|
|
3975
|
-
type: Injectable
|
|
3976
|
-
}], ctorParameters: () => [{ type: i0.ApplicationRef }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }] });
|
|
3977
|
-
|
|
3978
|
-
class EvoPortalOutletDirective extends EvoPortalOutlet {
|
|
3979
|
-
constructor(injector, viewContainerRef) {
|
|
3980
|
-
super(injector, viewContainerRef);
|
|
3981
|
-
this.injector = injector;
|
|
3982
|
-
this.viewContainerRef = viewContainerRef;
|
|
3983
|
-
}
|
|
3984
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalOutletDirective, deps: [{ token: i0.Injector }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3985
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.10", type: EvoPortalOutletDirective, isStandalone: true, selector: "[evoPortalOutlet]", usesInheritance: true, ngImport: i0 }); }
|
|
3986
|
-
}
|
|
3987
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalOutletDirective, decorators: [{
|
|
3988
|
-
type: Directive,
|
|
3989
|
-
args: [{
|
|
3990
|
-
selector: '[evoPortalOutlet]',
|
|
3991
|
-
standalone: true,
|
|
3992
|
-
}]
|
|
3993
|
-
}], ctorParameters: () => [{ type: i0.Injector }, { type: i0.ViewContainerRef }] });
|
|
3994
|
-
|
|
3995
|
-
class EvoPortalModule {
|
|
3996
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3997
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, imports: [EvoPortalOutletDirective], exports: [EvoPortalOutletDirective] }); }
|
|
3998
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, providers: [EvoPortalService] }); }
|
|
3999
|
-
}
|
|
4000
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: EvoPortalModule, decorators: [{
|
|
4001
|
-
type: NgModule,
|
|
4002
|
-
args: [{
|
|
4003
|
-
imports: [EvoPortalOutletDirective],
|
|
4004
|
-
providers: [EvoPortalService],
|
|
4005
|
-
exports: [EvoPortalOutletDirective],
|
|
4006
|
-
}]
|
|
4007
|
-
}] });
|
|
4008
|
-
|
|
4009
4192
|
class EvoRadioComponent extends EvoBaseControl {
|
|
4010
4193
|
constructor() {
|
|
4011
4194
|
super(...arguments);
|
|
@@ -6161,5 +6344,5 @@ class Serializable {
|
|
|
6161
6344
|
* Generated bundle index. Do not edit.
|
|
6162
6345
|
*/
|
|
6163
6346
|
|
|
6164
|
-
export { CSS_BREAKPOINTS, DESKTOP_SMALL_VIEW, DaDataEntityTypes, DaDataParty, DadataBankStatus, DadataBankType, DadataCompanyBranchType, DadataCompanyStatus, DadataCompanyType, DadataFounderShareType, DadataManagerType, DeclinationPipe, DeprecateMethod, DeprecateVariable, DesktopSmallViewProvider, EVO_ASSETS_PATH, EVO_DROPDOWN_POSITION_DESCRIPTION, EVO_ICON_RESOLVER, EVO_LOCAL_ASSETS_PATH, EVO_SIDEBAR_CONFIG, EVO_SIDEBAR_DATA, EVO_SIDEBAR_ROOT_ID, EvoAbstractPortal, EvoAccordionComponent, EvoAccordionContentComponent, EvoAccordionModule, EvoAccordionPanelComponent, EvoAccordionTitleComponent, EvoAutocompleteComponent, EvoAutocompleteDefaultOptionComponent, EvoAutocompleteFooterComponent, EvoAutocompleteHeaderComponent, EvoAutocompleteModule, EvoBadgeComponent, EvoBadgeModule, EvoBaseControl, EvoButtonComponent, EvoButtonModule, EvoCheckboxComponent, EvoCheckboxModule, EvoChipComponent, EvoChipModule, EvoChipTheme, EvoChipType, EvoCircularLoaderComponent, EvoClickOutsideDirective, EvoCollection, EvoCollectionFabric, EvoControlErrorComponent, EvoControlErrorModule, EvoControlLabelComponent, EvoControlLabelModule, EvoControlStateManager, EvoControlStates, EvoCounterComponent, EvoCounterModule, EvoCounterSize, EvoDatepickerComponent, EvoDatepickerModule, EvoDropdownComponent, EvoDropdownModule, EvoDropdownOriginDirective, EvoExpandedService, EvoIconButtonComponent, EvoIconButtonModule, EvoIconComponent, EvoIconNumberComponent, EvoIconNumberModule, EvoIconService, EvoInputComponent, EvoInputContenteditableComponent, EvoInputContenteditableModule, EvoInputIconDirective, EvoInputModule, EvoInputSizes, EvoInputTheme, EvoIsExpandedDirective, EvoLetContext, EvoLetDirective, EvoLoaderModule, EvoModalCloseTargets, EvoModalComponent, EvoModalModule, EvoModalService, EvoNavbarComponent, EvoNavbarItemComponent, EvoNavbarModule, EvoNavigationButtonComponent, EvoNavigationButtonModule, EvoNoteComponent, EvoNoteModule, EvoPaginatorComponent, EvoPaginatorModule, EvoPipesModule, EvoPopoverComponent, EvoPopoverModule, EvoPortalModule, EvoPortalOutlet, EvoPortalOutletDirective, EvoPortalService, EvoRadioComponent, EvoRadioModule, EvoRadioshapeComponent, EvoRadioshapeModule, EvoSidebarCloseTargets, EvoSidebarComponent, EvoSidebarContentComponent, EvoSidebarFooterComponent, EvoSidebarHeaderComponent, EvoSidebarService, EvoSidebarSizes, EvoSidebarStates, EvoStepperComponent, EvoStepperItemComponent, EvoStepperModule, EvoTabComponent, EvoTabContentComponent, EvoTabStateCollection, EvoTableColumnComponent, EvoTableComponent, EvoTableModule, EvoTableRowClickEvent, EvoTabsComponent, EvoTabsModule, EvoTabsService, EvoTabsSize, EvoTabsSizeService, EvoTextareaComponent, EvoTextareaModule, EvoToastComponent, EvoToastModule, EvoToastService, EvoToastTypes, EvoToggleComponent, EvoToggleModule, EvoUiClassDirective, EvoUiKitModule, EvoUploadComponent, EvoUploadModule, FormHelper, MOBILE_VIEW, MobileViewProvider, SafeHtmlPipe, Serializable, TABLET_VIEW, TabletViewProvider, VIEW_BREAKPOINTS_PROVIDERS, WINDOW_PROVIDERS, enterZone, evoAssetsPathProvider, evoCreateToken, evoCreateTokenFromFactory, evoIconResolverProvider, evoLocalAssetsPathProvider, evoSidebarAnimationDuration, evoSidebarDefaultConfig, evoSidebarRootId, expandAnimation, portalProvider, provideSidebar, sidebarAnimation, skipInitialRenderAnimation, switchQueryToList };
|
|
6347
|
+
export { CSS_BREAKPOINTS, DESKTOP_SMALL_VIEW, DaDataEntityTypes, DaDataParty, DadataBankStatus, DadataBankType, DadataCompanyBranchType, DadataCompanyStatus, DadataCompanyType, DadataFounderShareType, DadataManagerType, DeclinationPipe, DeprecateMethod, DeprecateVariable, DesktopSmallViewProvider, EVO_ASSETS_PATH, EVO_DROPDOWN_POSITION_DESCRIPTION, EVO_ICON_RESOLVER, EVO_LOCAL_ASSETS_PATH, EVO_MODAL_CONFIG, EVO_MODAL_DATA, EVO_MODAL_DEFAULT_CONFIG, EVO_MODAL_DEFAULT_ROOT_ID, EVO_MODAL_ROOT_ID, EVO_SIDEBAR_CONFIG, EVO_SIDEBAR_DATA, EVO_SIDEBAR_ROOT_ID, EvoAbstractPortal, EvoAccordionComponent, EvoAccordionContentComponent, EvoAccordionModule, EvoAccordionPanelComponent, EvoAccordionTitleComponent, EvoAutocompleteComponent, EvoAutocompleteDefaultOptionComponent, EvoAutocompleteFooterComponent, EvoAutocompleteHeaderComponent, EvoAutocompleteModule, EvoBadgeComponent, EvoBadgeModule, EvoBaseControl, EvoButtonComponent, EvoButtonModule, EvoCheckboxComponent, EvoCheckboxModule, EvoChipComponent, EvoChipModule, EvoChipTheme, EvoChipType, EvoCircularLoaderComponent, EvoClickOutsideDirective, EvoCollection, EvoCollectionFabric, EvoControlErrorComponent, EvoControlErrorModule, EvoControlLabelComponent, EvoControlLabelModule, EvoControlStateManager, EvoControlStates, EvoCounterComponent, EvoCounterModule, EvoCounterSize, EvoDatepickerComponent, EvoDatepickerModule, EvoDropdownComponent, EvoDropdownModule, EvoDropdownOriginDirective, EvoExpandedService, EvoIconButtonComponent, EvoIconButtonModule, EvoIconComponent, EvoIconNumberComponent, EvoIconNumberModule, EvoIconService, EvoInputComponent, EvoInputContenteditableComponent, EvoInputContenteditableModule, EvoInputIconDirective, EvoInputModule, EvoInputSizes, EvoInputTheme, EvoIsExpandedDirective, EvoLetContext, EvoLetDirective, EvoLoaderModule, EvoModalButtonsComponent, EvoModalCloseTargets, EvoModalComponent, EvoModalModule, EvoModalService, EvoNavbarComponent, EvoNavbarItemComponent, EvoNavbarModule, EvoNavigationButtonComponent, EvoNavigationButtonModule, EvoNoteComponent, EvoNoteModule, EvoPaginatorComponent, EvoPaginatorModule, EvoPipesModule, EvoPopoverComponent, EvoPopoverModule, EvoPortalModule, EvoPortalOutlet, EvoPortalOutletDirective, EvoPortalService, EvoRadioComponent, EvoRadioModule, EvoRadioshapeComponent, EvoRadioshapeModule, EvoSidebarCloseTargets, EvoSidebarComponent, EvoSidebarContentComponent, EvoSidebarFooterComponent, EvoSidebarHeaderComponent, EvoSidebarService, EvoSidebarSizes, EvoSidebarStates, EvoStepperComponent, EvoStepperItemComponent, EvoStepperModule, EvoTabComponent, EvoTabContentComponent, EvoTabStateCollection, EvoTableColumnComponent, EvoTableComponent, EvoTableModule, EvoTableRowClickEvent, EvoTabsComponent, EvoTabsModule, EvoTabsService, EvoTabsSize, EvoTabsSizeService, EvoTextareaComponent, EvoTextareaModule, EvoToastComponent, EvoToastModule, EvoToastService, EvoToastTypes, EvoToggleComponent, EvoToggleModule, EvoUiClassDirective, EvoUiKitModule, EvoUploadComponent, EvoUploadModule, FormHelper, MOBILE_VIEW, MobileViewProvider, SafeHtmlPipe, Serializable, TABLET_VIEW, TabletViewProvider, VIEW_BREAKPOINTS_PROVIDERS, WINDOW_PROVIDERS, enterZone, evoAssetsPathProvider, evoCreateToken, evoCreateTokenFromFactory, evoIconResolverProvider, evoLocalAssetsPathProvider, evoSidebarAnimationDuration, evoSidebarDefaultConfig, evoSidebarRootId, expandAnimation, isConfiguredComponentModalParams, isConfiguredModalParams, isConfiguredTemplateModalParams, isDynamicModalParams, portalProvider, provideModal, provideSidebar, sidebarAnimation, skipInitialRenderAnimation, switchQueryToList };
|
|
6165
6348
|
//# sourceMappingURL=evotor-dev-ui-kit.mjs.map
|