@evotor-dev/ui-kit 8.7.0 → 8.8.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.
Files changed (35) hide show
  1. package/esm2022/lib/components/evo-autocomplete/components/evo-autocomplete/evo-autocomplete.component.mjs +3 -3
  2. package/esm2022/lib/components/evo-autocomplete/components/evo-autocomplete-default-option/evo-autocomplete-default-option.component.mjs +2 -2
  3. package/esm2022/lib/components/evo-modal/classes/EvoConfiguredComponentModalDrawingStrategy.mjs +8 -0
  4. package/esm2022/lib/components/evo-modal/classes/EvoConfiguredModalDrawingStrategy.mjs +14 -0
  5. package/esm2022/lib/components/evo-modal/classes/EvoConfiguredTemplateModalDrawingStrategy.mjs +11 -0
  6. package/esm2022/lib/components/evo-modal/classes/EvoDynamicModalDrawingStrategy.mjs +9 -0
  7. package/esm2022/lib/components/evo-modal/classes/EvoModalDrawingStrategy.mjs +3 -0
  8. package/esm2022/lib/components/evo-modal/enums.mjs +8 -0
  9. package/esm2022/lib/components/evo-modal/evo-modal-buttons/evo-modal-buttons.component.mjs +17 -0
  10. package/esm2022/lib/components/evo-modal/evo-modal-portal.mjs +29 -0
  11. package/esm2022/lib/components/evo-modal/evo-modal.component.mjs +128 -103
  12. package/esm2022/lib/components/evo-modal/evo-modal.provider.mjs +18 -0
  13. package/esm2022/lib/components/evo-modal/evo-modal.service.mjs +47 -12
  14. package/esm2022/lib/components/evo-modal/interfaces.mjs +2 -0
  15. package/esm2022/lib/components/evo-modal/public-api.mjs +7 -1
  16. package/esm2022/lib/components/evo-modal/tokens.mjs +12 -0
  17. package/esm2022/lib/components/evo-modal/utils.mjs +21 -0
  18. package/fesm2022/evotor-dev-ui-kit.mjs +424 -241
  19. package/fesm2022/evotor-dev-ui-kit.mjs.map +1 -1
  20. package/lib/components/evo-modal/classes/EvoConfiguredComponentModalDrawingStrategy.d.ts +6 -0
  21. package/lib/components/evo-modal/classes/EvoConfiguredModalDrawingStrategy.d.ts +6 -0
  22. package/lib/components/evo-modal/classes/EvoConfiguredTemplateModalDrawingStrategy.d.ts +6 -0
  23. package/lib/components/evo-modal/classes/EvoDynamicModalDrawingStrategy.d.ts +6 -0
  24. package/lib/components/evo-modal/classes/EvoModalDrawingStrategy.d.ts +5 -0
  25. package/lib/components/evo-modal/enums.d.ts +6 -0
  26. package/lib/components/evo-modal/evo-modal-buttons/evo-modal-buttons.component.d.ts +6 -0
  27. package/lib/components/evo-modal/evo-modal-portal.d.ts +16 -0
  28. package/lib/components/evo-modal/evo-modal.component.d.ts +48 -32
  29. package/lib/components/evo-modal/evo-modal.provider.d.ts +3 -0
  30. package/lib/components/evo-modal/evo-modal.service.d.ts +13 -12
  31. package/lib/components/evo-modal/interfaces.d.ts +47 -0
  32. package/lib/components/evo-modal/public-api.d.ts +6 -0
  33. package/lib/components/evo-modal/tokens.d.ts +7 -0
  34. package/lib/components/evo-modal/utils.d.ts +5 -0
  35. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ import { EvoConfiguredModalDrawingStrategy } from './EvoConfiguredModalDrawingStrategy';
2
+ import { EvoConfiguredComponentModalParams } from '../interfaces';
3
+ import { EvoModalComponent } from '../evo-modal.component';
4
+ export declare class EvoConfiguredComponentModalDrawingStrategy extends EvoConfiguredModalDrawingStrategy {
5
+ draw(this: EvoModalComponent, params: EvoConfiguredComponentModalParams<unknown>): void;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { EvoModalDrawingStrategy } from './EvoModalDrawingStrategy';
2
+ import { EvoConfiguredModalParams } from '../interfaces';
3
+ import { EvoModalComponent } from '../evo-modal.component';
4
+ export declare abstract class EvoConfiguredModalDrawingStrategy extends EvoModalDrawingStrategy {
5
+ draw(this: EvoModalComponent, params: EvoConfiguredModalParams): void;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { EvoConfiguredModalDrawingStrategy } from './EvoConfiguredModalDrawingStrategy';
2
+ import { EvoConfiguredTemplateModalParams } from '../interfaces';
3
+ import { EvoModalComponent } from '../evo-modal.component';
4
+ export declare class EvoConfiguredTemplateModalDrawingStrategy extends EvoConfiguredModalDrawingStrategy {
5
+ draw(this: EvoModalComponent, params: EvoConfiguredTemplateModalParams<unknown>): void;
6
+ }
@@ -0,0 +1,6 @@
1
+ import { EvoModalDrawingStrategy } from './EvoModalDrawingStrategy';
2
+ import { EvoDynamicModalParams } from '../interfaces';
3
+ import { EvoModalComponent } from '../evo-modal.component';
4
+ export declare class EvoDynamicModalDrawingStrategy extends EvoModalDrawingStrategy {
5
+ draw(this: EvoModalComponent, params: EvoDynamicModalParams): void;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { EvoModalCombinedParams } from '../interfaces';
2
+ import { EvoModalComponent } from '../evo-modal.component';
3
+ export declare abstract class EvoModalDrawingStrategy {
4
+ abstract draw(this: EvoModalComponent, params: EvoModalCombinedParams): void;
5
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum EvoModalCloseTargets {
2
+ BACKGROUND = "background",
3
+ BUTTON = "button",
4
+ DEFAULT = "default",
5
+ ESC = "escape"
6
+ }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class EvoModalButtonsComponent {
3
+ single: import("@angular/core").InputSignal<boolean>;
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<EvoModalButtonsComponent, never>;
5
+ static ɵcmp: i0.ɵɵComponentDeclaration<EvoModalButtonsComponent, "evo-modal-buttons, [evo-modal-buttons]", never, { "single": { "alias": "single"; "required": false; "isSignal": true; }; }, {}, never, ["[evoButton]"], true, never>;
6
+ }
@@ -0,0 +1,16 @@
1
+ import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injector } from '@angular/core';
2
+ import { EvoAbstractPortal, EvoPortalService } from '../evo-portal';
3
+ import { EvoModalComponent } from './evo-modal.component';
4
+ import * as i0 from "@angular/core";
5
+ export declare class EvoModalPortal extends EvoPortalService implements EvoAbstractPortal {
6
+ appRef: ApplicationRef;
7
+ injector: Injector;
8
+ cfr: ComponentFactoryResolver;
9
+ attachedPortal: ComponentRef<EvoModalComponent>;
10
+ constructor(appRef: ApplicationRef, injector: Injector, cfr: ComponentFactoryResolver);
11
+ attach(host: string): void;
12
+ detach(): void;
13
+ hasAttachedPortal(): boolean;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<EvoModalPortal, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<EvoModalPortal>;
16
+ }
@@ -1,41 +1,57 @@
1
- import { ElementRef, OnDestroy, OnInit } from '@angular/core';
2
- import { EvoModalService, EvoModalState } from './evo-modal.service';
3
- import { Observable, Subscription } from 'rxjs';
1
+ import { ElementRef, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
2
+ import { Observable } from 'rxjs';
4
3
  import { EvoButtonColor, EvoButtonTheme } from '../evo-button';
4
+ import { EvoDynamicModalParams, EvoModalState } from './interfaces';
5
+ import { EvoModalCloseTargets } from './enums';
6
+ import { EvoModalDrawingStrategy } from './classes/EvoModalDrawingStrategy';
5
7
  import * as i0 from "@angular/core";
6
- export declare enum EvoModalCloseTargets {
7
- BACKGROUND = "background",
8
- BUTTON = "button",
9
- DEFAULT = "default",
10
- ESC = "escape"
11
- }
8
+ type InsertionContainerType = 'modal' | 'content';
12
9
  export declare class EvoModalComponent implements OnInit, OnDestroy {
13
- private readonly modalService;
14
- private readonly elRef;
15
- get id(): string;
16
- set id(id: string);
17
- titleText: string;
18
- acceptText: string;
19
- acceptButtonColor: EvoButtonColor;
20
- acceptButtonTheme: EvoButtonTheme;
21
- declineText: string;
22
- declineButtonColor: EvoButtonColor;
23
- declineButtonTheme: EvoButtonTheme;
24
- asyncAccept: () => Observable<any>;
25
- modalState: EvoModalState;
26
- isAcceptLoading: boolean;
27
- isDeclineDisabled: boolean;
28
- isVisible: boolean;
10
+ private readonly evoModalRootId;
11
+ acceptText: import("@angular/core").ModelSignal<string>;
12
+ acceptButtonColor: import("@angular/core").ModelSignal<EvoButtonColor>;
13
+ acceptButtonTheme: import("@angular/core").ModelSignal<EvoButtonTheme>;
14
+ asyncAccept: import("@angular/core").ModelSignal<() => Observable<unknown> | null>;
15
+ declineText: import("@angular/core").ModelSignal<string>;
16
+ declineButtonColor: import("@angular/core").ModelSignal<EvoButtonColor>;
17
+ declineButtonTheme: import("@angular/core").ModelSignal<EvoButtonTheme>;
18
+ id: import("@angular/core").ModelSignal<string>;
19
+ titleText: import("@angular/core").ModelSignal<string>;
20
+ readonly contentContainer: import("@angular/core").Signal<ViewContainerRef>;
21
+ readonly contentContainer$: Observable<ViewContainerRef>;
22
+ readonly drawingStrategy: import("@angular/core").WritableSignal<EvoModalDrawingStrategy>;
23
+ readonly isDynamicContent: import("@angular/core").WritableSignal<boolean>;
24
+ readonly isLoading: import("@angular/core").WritableSignal<boolean>;
25
+ readonly isVisible: import("@angular/core").Signal<boolean>;
26
+ readonly modalContainer: import("@angular/core").Signal<ViewContainerRef>;
27
+ readonly modalContainer$: Observable<ViewContainerRef>;
28
+ readonly modalContent: import("@angular/core").WritableSignal<{
29
+ template: TemplateRef<{
30
+ data: unknown;
31
+ }>;
32
+ context: unknown;
33
+ }>;
34
+ readonly modalElement: import("@angular/core").Signal<ElementRef<any>>;
35
+ readonly modalState: import("@angular/core").WritableSignal<EvoModalState>;
36
+ readonly showButtons: import("@angular/core").Signal<string>;
29
37
  readonly closeTargets: typeof EvoModalCloseTargets;
30
- private _id;
31
- private closeTarget;
32
- constructor(modalService: EvoModalService, elRef: ElementRef);
38
+ private readonly destroyRef;
39
+ private readonly environmentInjector;
40
+ private readonly evoModalService;
33
41
  ngOnInit(): void;
34
42
  ngOnDestroy(): void;
35
- onBackgroundClick($event: any): void;
36
- handleOnClose(agreement: boolean, closeTarget: EvoModalCloseTargets): Subscription;
37
- private subscribeModalEvents;
43
+ onAcceptClick(): void;
44
+ onBackgroundClick(event: Event): void;
45
+ onDeclineClick(): void;
46
+ protected clearView(): void;
47
+ protected insertComponent({ data, injector, component }: Pick<EvoDynamicModalParams, 'data' | 'component' | 'injector'>, target?: InsertionContainerType): void;
48
+ private canCloseByBackground;
49
+ private close;
50
+ private getInsertionContainer;
38
51
  private initKeyboardListener;
52
+ private setDrawingStrategy;
53
+ private subscribeModalEvents;
39
54
  static ɵfac: i0.ɵɵFactoryDeclaration<EvoModalComponent, never>;
40
- static ɵcmp: i0.ɵɵComponentDeclaration<EvoModalComponent, "evo-modal", never, { "id": { "alias": "id"; "required": false; }; "titleText": { "alias": "titleText"; "required": false; }; "acceptText": { "alias": "acceptText"; "required": false; }; "acceptButtonColor": { "alias": "acceptButtonColor"; "required": false; }; "acceptButtonTheme": { "alias": "acceptButtonTheme"; "required": false; }; "declineText": { "alias": "declineText"; "required": false; }; "declineButtonColor": { "alias": "declineButtonColor"; "required": false; }; "declineButtonTheme": { "alias": "declineButtonTheme"; "required": false; }; "asyncAccept": { "alias": "asyncAccept"; "required": false; }; }, {}, never, ["evo-icon", "*"], true, never>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<EvoModalComponent, "evo-modal", never, { "acceptText": { "alias": "acceptText"; "required": false; "isSignal": true; }; "acceptButtonColor": { "alias": "acceptButtonColor"; "required": false; "isSignal": true; }; "acceptButtonTheme": { "alias": "acceptButtonTheme"; "required": false; "isSignal": true; }; "asyncAccept": { "alias": "asyncAccept"; "required": false; "isSignal": true; }; "declineText": { "alias": "declineText"; "required": false; "isSignal": true; }; "declineButtonColor": { "alias": "declineButtonColor"; "required": false; "isSignal": true; }; "declineButtonTheme": { "alias": "declineButtonTheme"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "titleText": { "alias": "titleText"; "required": false; "isSignal": true; }; }, { "acceptText": "acceptTextChange"; "acceptButtonColor": "acceptButtonColorChange"; "acceptButtonTheme": "acceptButtonThemeChange"; "asyncAccept": "asyncAcceptChange"; "declineText": "declineTextChange"; "declineButtonColor": "declineButtonColorChange"; "declineButtonTheme": "declineButtonThemeChange"; "id": "idChange"; "titleText": "titleTextChange"; }, never, ["evo-icon", "*"], true, never>;
41
56
  }
57
+ export {};
@@ -0,0 +1,3 @@
1
+ import { EnvironmentProviders } from "@angular/core";
2
+ import { EvoModalConfig } from './interfaces';
3
+ export declare function provideModal(config?: EvoModalConfig): EnvironmentProviders;
@@ -1,22 +1,23 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { EvoConfiguredModalParams, EvoDynamicModalParams, EvoModalParams, EvoModalState } from './interfaces';
2
3
  import * as i0 from "@angular/core";
3
- export interface EvoModalState {
4
- id: string;
5
- isOpen: boolean;
6
- agreement?: boolean;
7
- params?: EvoModalParams;
8
- }
9
- export interface EvoModalParams {
10
- [property: string]: any;
11
- }
12
4
  export declare class EvoModalService {
5
+ private readonly portal;
6
+ private readonly config;
7
+ private readonly evoModalRootId;
13
8
  private readonly modalEvents$;
14
- private registeredModals;
9
+ private readonly registeredModals;
15
10
  register(id: string): void;
16
11
  unregister(id: string): void;
17
- open(id: string, params?: EvoModalParams): void;
18
- close(id: string, agreement: boolean, params?: EvoModalParams): void;
12
+ open<T>(params: EvoConfiguredModalParams<T>): any;
13
+ open(params: EvoDynamicModalParams): any;
14
+ open(id: string, params?: EvoModalParams): any;
15
+ close(id?: string, agreement?: boolean, params?: EvoModalParams): void;
19
16
  getEventsSubscription(id: string): Observable<EvoModalState>;
17
+ openDynamicModal(params: EvoDynamicModalParams): void;
18
+ openConfiguredModal(idOrParams: EvoConfiguredModalParams): void;
19
+ cleanupDefaultHost(): void;
20
+ private attachPortal;
20
21
  static ɵfac: i0.ɵɵFactoryDeclaration<EvoModalService, never>;
21
22
  static ɵprov: i0.ɵɵInjectableDeclaration<EvoModalService>;
22
23
  }
@@ -0,0 +1,47 @@
1
+ import { Injector, TemplateRef, Type } from '@angular/core';
2
+ import { EvoButtonColor, EvoButtonTheme } from '../evo-button/types';
3
+ import { Observable } from 'rxjs';
4
+ export interface EvoModalConfig {
5
+ host?: string;
6
+ }
7
+ export interface EvoModalState {
8
+ id: string;
9
+ isOpen: boolean;
10
+ agreement?: boolean;
11
+ params?: EvoModalCombinedParams;
12
+ }
13
+ export interface EvoDynamicModalParams {
14
+ component: Type<unknown>;
15
+ data?: unknown;
16
+ injector?: Injector;
17
+ }
18
+ interface EvoConfiguredBaseModalParams {
19
+ acceptButtonColor?: EvoButtonColor;
20
+ acceptButtonTheme?: EvoButtonTheme;
21
+ acceptText?: string;
22
+ asyncAccept?: () => Observable<unknown>;
23
+ declineButtonColor?: EvoButtonColor;
24
+ declineButtonTheme?: EvoButtonTheme;
25
+ declineText?: string;
26
+ titleText?: string;
27
+ }
28
+ export interface EvoConfiguredTemplateModalParams<T> extends EvoConfiguredBaseModalParams {
29
+ template: TemplateRef<{
30
+ data: T;
31
+ }>;
32
+ component?: never;
33
+ data?: T;
34
+ injector?: never;
35
+ }
36
+ export interface EvoConfiguredComponentModalParams<T> extends EvoConfiguredBaseModalParams {
37
+ component: Type<unknown>;
38
+ data?: T;
39
+ injector?: Injector;
40
+ template?: never;
41
+ }
42
+ export type EvoConfiguredModalParams<T = unknown> = EvoConfiguredTemplateModalParams<T> | EvoConfiguredComponentModalParams<T>;
43
+ export interface EvoModalParams {
44
+ [property: string]: unknown;
45
+ }
46
+ export type EvoModalCombinedParams = EvoModalParams | EvoDynamicModalParams | EvoConfiguredModalParams;
47
+ export {};
@@ -1,3 +1,9 @@
1
1
  export * from './evo-modal.module';
2
2
  export * from './evo-modal.component';
3
3
  export * from './evo-modal.service';
4
+ export * from "./enums";
5
+ export * from "./interfaces";
6
+ export * from "./evo-modal.provider";
7
+ export * from "./tokens";
8
+ export * from "./utils";
9
+ export * from './evo-modal-buttons/evo-modal-buttons.component';
@@ -0,0 +1,7 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { EvoModalConfig } from "./interfaces";
3
+ export declare const EVO_MODAL_CONFIG: InjectionToken<EvoModalConfig>;
4
+ export declare const EVO_MODAL_DEFAULT_ROOT_ID = "EVO_MODAL_ROOT_ID";
5
+ export declare const EVO_MODAL_ROOT_ID: InjectionToken<string>;
6
+ export declare const EVO_MODAL_DEFAULT_CONFIG: EvoModalConfig;
7
+ export declare const EVO_MODAL_DATA: InjectionToken<unknown>;
@@ -0,0 +1,5 @@
1
+ import { EvoConfiguredComponentModalParams, EvoConfiguredModalParams, EvoConfiguredTemplateModalParams, EvoDynamicModalParams, EvoModalCombinedParams } from './interfaces';
2
+ export declare function isDynamicModalParams(params?: EvoModalCombinedParams): params is EvoDynamicModalParams;
3
+ export declare function isConfiguredModalParams(params?: EvoModalCombinedParams): params is EvoConfiguredModalParams;
4
+ export declare function isConfiguredTemplateModalParams(params?: EvoModalCombinedParams): params is EvoConfiguredTemplateModalParams<unknown>;
5
+ export declare function isConfiguredComponentModalParams(params?: EvoModalCombinedParams): params is EvoConfiguredComponentModalParams<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evotor-dev/ui-kit",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "homepage": "https://evotor.github.io/Evo-UI-Kit",
5
5
  "repository": {
6
6
  "type": "git",