@ngflux/ngflux 1.0.6 → 2.1.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,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, signal, computed, Injectable, inject, effect, Injector, viewChild, ViewContainerRef, HostListener, Component, input, ElementRef, HostBinding, makeEnvironmentProviders, output, model, untracked } from '@angular/core';
3
- import { AsyncSubject } from 'rxjs';
2
+ import { InjectionToken, inject, ElementRef, input, computed, HostBinding, Component, ChangeDetectionStrategy, Injector, viewChild, ViewContainerRef, ApplicationRef, signal, createComponent, effect, Injectable, output, model, untracked, HostListener, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
3
+ import { Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
4
+ import { filter, AsyncSubject } from 'rxjs';
4
5
  import { NgClass } from '@angular/common';
5
6
  import * as i1 from '@angular/forms';
6
7
  import { FormsModule } from '@angular/forms';
@@ -9,63 +10,107 @@ const NGF_CONFIG = new InjectionToken('ngf-config');
9
10
 
10
11
  const NGF_DIALOG_DATA = new InjectionToken('ngf-dialog-data');
11
12
 
12
- class NgFluxLoadingInternal {
13
- entries = signal([], ...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
14
- count = computed(() => this.entries().length, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
15
- isLoading = computed(() => this.count() > 0, ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
16
- entry = computed(() => {
17
- const entries = this.entries();
18
- return entries.at(entries.length - 1);
19
- }, ...(ngDevMode ? [{ debugName: "entry" }] : /* istanbul ignore next */ []));
20
- start = (text = '') => this.entries.update(v => {
21
- const entries = Array.from(v);
22
- entries.push({ text });
23
- return entries;
24
- });
25
- stop = () => this.entries.update(v => {
26
- const entries = Array.from(v);
27
- entries.pop();
28
- return entries;
29
- });
30
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingInternal, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
31
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingInternal, providedIn: 'root' });
13
+ class NgFluxButton {
14
+ ref = inject(ElementRef);
15
+ icon = input(/* @ts-ignore */
16
+ ...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
17
+ theme = input(/* @ts-ignore */
18
+ ...(ngDevMode ? [undefined, { debugName: "theme" }] : /* istanbul ignore next */ []));
19
+ type = input(/* @ts-ignore */
20
+ ...(ngDevMode ? [undefined, { debugName: "type" }] : /* istanbul ignore next */ []));
21
+ size = input(/* @ts-ignore */
22
+ ...(ngDevMode ? [undefined, { debugName: "size" }] : /* istanbul ignore next */ []));
23
+ direction = input(/* @ts-ignore */
24
+ ...(ngDevMode ? [undefined, { debugName: "direction" }] : /* istanbul ignore next */ []));
25
+ block = input(false, /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "block" }] : /* istanbul ignore next */ []));
27
+ disabled = input(false, /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
29
+ btnClassNames = computed(() => {
30
+ const names = [];
31
+ const direction = this.direction() ?? 'normal';
32
+ if (direction === 'reversed')
33
+ names.push(direction);
34
+ return names;
35
+ }, /* @ts-ignore */
36
+ ...(ngDevMode ? [{ debugName: "btnClassNames" }] : /* istanbul ignore next */ []));
37
+ classNames = computed(() => [this.theme() ?? 'default', this.size() ?? 'md'].join(' '), /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "classNames" }] : /* istanbul ignore next */ []));
39
+ get bindClass() { return this.classNames(); }
40
+ get isBlock() { return this.block(); }
41
+ get isDisabled() { return this.disabled(); }
42
+ get tabIndex() { return 1; }
43
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
44
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: NgFluxButton, isStandalone: true, selector: "ngf-button", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, block: { classPropertyName: "block", publicName: "block", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.bindClass", "class.block": "this.isBlock", "class.disabled": "this.isDisabled", "tabIndex": "this.tabIndex" } }, ngImport: i0, template: "<button [type]=\"type()\" [disabled]=\"disabled()\">\n <div class=\"wrapper\" [ngClass]=\"btnClassNames()\">\n @if (icon(); as ico) {\n <div class=\"icon\">\n <i [ngClass]=\"ico\"></i>\n </div>\n }\n\n <div class=\"content\">\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</button>\n", styles: [":host{display:inline-block;border:1px solid rgba(0,0,0,.2);border-radius:3px;cursor:pointer;font-size:1rem;overflow:clip}:host.block{display:block}:host.disabled{opacity:.5!important;-webkit-user-select:none!important;user-select:none!important;cursor:not-allowed}:host.xs{font-size:.6rem}:host.sm{font-size:.8rem}:host.md{font-size:1rem}:host.lg{font-size:1.25rem}:host.xl{font-size:1.5rem}:host.default{background-color:var(--ngf-default)!important;color:var(--ngf-default-fg)!important}:host.primary{background-color:var(--ngf-primary)!important;color:var(--ngf-primary-fg)!important}:host.secondary{background-color:var(--ngf-secondary)!important;color:var(--ngf-secondary-fg)!important}:host.error{background-color:var(--ngf-error)!important;color:var(--ngf-error-fg)!important}:host.danger{background-color:var(--ngf-danger)!important;color:var(--ngf-danger-fg)!important}:host.success{background-color:var(--ngf-success)!important;color:var(--ngf-success-fg)!important}:host.warning{background-color:var(--ngf-warning)!important;color:var(--ngf-warning-fg)!important}:host.info{background-color:var(--ngf-info)!important;color:var(--ngf-info-fg)!important}:host.light{background-color:var(--ngf-light)!important;color:var(--ngf-light-fg)!important}:host.dark{background-color:var(--ngf-dark)!important;color:var(--ngf-dark-fg)!important}:host>button{display:block;padding:0!important;background-color:transparent;border:none!important;width:100%!important;cursor:inherit!important;color:inherit!important;font-weight:500;font-size:1em}:host>button:focus{outline:none!important}:host .wrapper{display:flex;flex-direction:var(--flex-direction)!important;--flex-direction: row;--icon-border-left: none;--icon-border-right: 1px solid rgba(0, 0, 0, .2)}:host .wrapper.reversed{--flex-direction: row-reverse;--icon-border-left: 1px solid rgba(0, 0, 0, .2);--icon-border-right: none}:host .wrapper>.icon{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:1.05em;border-left:var(--icon-border-left)!important;border-right:var(--icon-border-right)!important;padding:0 .5em}:host .wrapper>.content{display:block;flex-grow:1;padding:.5em 1em;white-space:nowrap!important;text-align:center!important;text-overflow:ellipsis;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
32
45
  }
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingInternal, decorators: [{
34
- type: Injectable,
35
- args: [{ providedIn: 'root' }]
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxButton, decorators: [{
47
+ type: Component,
48
+ args: [{ selector: 'ngf-button', imports: [NgClass], template: "<button [type]=\"type()\" [disabled]=\"disabled()\">\n <div class=\"wrapper\" [ngClass]=\"btnClassNames()\">\n @if (icon(); as ico) {\n <div class=\"icon\">\n <i [ngClass]=\"ico\"></i>\n </div>\n }\n\n <div class=\"content\">\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</button>\n", styles: [":host{display:inline-block;border:1px solid rgba(0,0,0,.2);border-radius:3px;cursor:pointer;font-size:1rem;overflow:clip}:host.block{display:block}:host.disabled{opacity:.5!important;-webkit-user-select:none!important;user-select:none!important;cursor:not-allowed}:host.xs{font-size:.6rem}:host.sm{font-size:.8rem}:host.md{font-size:1rem}:host.lg{font-size:1.25rem}:host.xl{font-size:1.5rem}:host.default{background-color:var(--ngf-default)!important;color:var(--ngf-default-fg)!important}:host.primary{background-color:var(--ngf-primary)!important;color:var(--ngf-primary-fg)!important}:host.secondary{background-color:var(--ngf-secondary)!important;color:var(--ngf-secondary-fg)!important}:host.error{background-color:var(--ngf-error)!important;color:var(--ngf-error-fg)!important}:host.danger{background-color:var(--ngf-danger)!important;color:var(--ngf-danger-fg)!important}:host.success{background-color:var(--ngf-success)!important;color:var(--ngf-success-fg)!important}:host.warning{background-color:var(--ngf-warning)!important;color:var(--ngf-warning-fg)!important}:host.info{background-color:var(--ngf-info)!important;color:var(--ngf-info-fg)!important}:host.light{background-color:var(--ngf-light)!important;color:var(--ngf-light-fg)!important}:host.dark{background-color:var(--ngf-dark)!important;color:var(--ngf-dark-fg)!important}:host>button{display:block;padding:0!important;background-color:transparent;border:none!important;width:100%!important;cursor:inherit!important;color:inherit!important;font-weight:500;font-size:1em}:host>button:focus{outline:none!important}:host .wrapper{display:flex;flex-direction:var(--flex-direction)!important;--flex-direction: row;--icon-border-left: none;--icon-border-right: 1px solid rgba(0, 0, 0, .2)}:host .wrapper.reversed{--flex-direction: row-reverse;--icon-border-left: 1px solid rgba(0, 0, 0, .2);--icon-border-right: none}:host .wrapper>.icon{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:1.05em;border-left:var(--icon-border-left)!important;border-right:var(--icon-border-right)!important;padding:0 .5em}:host .wrapper>.content{display:block;flex-grow:1;padding:.5em 1em;white-space:nowrap!important;text-align:center!important;text-overflow:ellipsis;overflow:hidden}\n"] }]
49
+ }], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], block: [{ type: i0.Input, args: [{ isSignal: true, alias: "block", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], bindClass: [{
50
+ type: HostBinding,
51
+ args: ['class']
52
+ }], isBlock: [{
53
+ type: HostBinding,
54
+ args: ['class.block']
55
+ }], isDisabled: [{
56
+ type: HostBinding,
57
+ args: ['class.disabled']
58
+ }], tabIndex: [{
59
+ type: HostBinding,
60
+ args: ['tabIndex']
61
+ }] } });
62
+
63
+ class NgFluxDialogBodyComponent {
64
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
65
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.0", type: NgFluxDialogBodyComponent, isStandalone: true, selector: "ngf-dialog-body", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:block;padding:20px}\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
66
+ }
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogBodyComponent, decorators: [{
68
+ type: Component,
69
+ args: [{ selector: 'ngf-dialog-body', changeDetection: ChangeDetectionStrategy.Eager, imports: [], template: "<ng-content></ng-content>\n", styles: [":host{display:block;padding:20px}\n"] }]
36
70
  }] });
37
71
 
38
- class NgFluxLoading {
39
- internal = inject(NgFluxLoadingInternal);
40
- data = computed(() => this.internal.entry(), ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
41
- isLoading = computed(() => this.internal.isLoading(), ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
42
- start(text = '') {
43
- this.internal.start(text);
44
- }
45
- stop() {
46
- this.internal.stop();
47
- }
48
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
49
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoading, providedIn: 'root' });
72
+ class NgFluxDialogFooterComponent {
73
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
74
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.0", type: NgFluxDialogFooterComponent, isStandalone: true, selector: "ngf-dialog-footer", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:flex;flex-direction:row;align-items:center;justify-content:end;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-top:var(--ngf-dialog-border)!important;padding:7px 15px;bottom:0;gap:10px}\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
50
75
  }
51
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoading, decorators: [{
52
- type: Injectable,
53
- args: [{ providedIn: 'root' }]
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogFooterComponent, decorators: [{
77
+ type: Component,
78
+ args: [{ selector: 'ngf-dialog-footer', changeDetection: ChangeDetectionStrategy.Eager, imports: [], template: "<ng-content></ng-content>\n", styles: [":host{display:flex;flex-direction:row;align-items:center;justify-content:end;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-top:var(--ngf-dialog-border)!important;padding:7px 15px;bottom:0;gap:10px}\n"] }]
54
79
  }] });
55
80
 
81
+ class NgFluxDialogRootComponent {
82
+ injector = inject(Injector);
83
+ viewContainer = viewChild.required('container', { read: ViewContainerRef });
84
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
85
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.0", type: NgFluxDialogRootComponent, isStandalone: true, selector: "ngf-dialog-root", viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<ng-template #container></ng-template>\n", styles: [":host{display:block;width:0px;height:0px;visibility:hidden}\n"] });
86
+ }
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogRootComponent, decorators: [{
88
+ type: Component,
89
+ args: [{ selector: 'ngf-dialog-root', imports: [], template: "<ng-template #container></ng-template>\n", styles: [":host{display:block;width:0px;height:0px;visibility:hidden}\n"] }]
90
+ }], propDecorators: { viewContainer: [{ type: i0.ViewChild, args: ['container', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
91
+
56
92
  class NgFluxDialogInternal {
57
- list = signal([], ...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
58
- count = computed(() => this.list().length, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
59
- isOpen = computed(() => this.count() > 0, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
93
+ appRef = inject(ApplicationRef);
94
+ list = signal([], /* @ts-ignore */
95
+ ...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
96
+ count = computed(() => this.list().length, /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
98
+ isOpen = computed(() => this.count() > 0, /* @ts-ignore */
99
+ ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
60
100
  active = computed(() => {
61
101
  const entries = this.cloneList();
62
102
  if (!entries.length)
63
103
  return null;
64
104
  const lastIndex = entries.length - 1;
65
105
  return entries[lastIndex];
66
- }, ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
67
- root = signal(null, ...(ngDevMode ? [{ debugName: "root" }] : /* istanbul ignore next */ []));
106
+ }, /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
108
+ rootRef;
68
109
  constructor() {
110
+ const { appRef } = this;
111
+ this.rootRef = createComponent(NgFluxDialogRootComponent, {
112
+ environmentInjector: appRef.injector,
113
+ });
69
114
  const body = document.querySelector('body');
70
115
  effect(() => {
71
116
  const isOpen = this.isOpen();
@@ -82,6 +127,13 @@ class NgFluxDialogInternal {
82
127
  }
83
128
  });
84
129
  }
130
+ initialize() {
131
+ const { appRef, rootRef } = this;
132
+ appRef.attachView(rootRef.hostView);
133
+ const elem = rootRef.location.nativeElement;
134
+ document.body.appendChild(elem);
135
+ }
136
+ // ==========================
85
137
  cloneList = () => Array.from(this.list());
86
138
  indexOf = (item) => {
87
139
  const entries = this.list();
@@ -116,10 +168,10 @@ class NgFluxDialogInternal {
116
168
  clear = () => {
117
169
  this.list.set([]);
118
170
  };
119
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogInternal, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
120
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogInternal, providedIn: 'root' });
171
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogInternal, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
172
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogInternal, providedIn: 'root' });
121
173
  }
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogInternal, decorators: [{
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogInternal, decorators: [{
123
175
  type: Injectable,
124
176
  args: [{ providedIn: 'root' }]
125
177
  }], ctorParameters: () => [] });
@@ -129,6 +181,234 @@ const NGF_DIALOG_CONFIG = new InjectionToken('ngf-dialog-config');
129
181
  const NGF_DIALOG_INSTANCE = new InjectionToken('ngf-dialog-instance');
130
182
  const NGF_DIALOG_CLOSE_FN = new InjectionToken('ngf-dialog-close-fn');
131
183
 
184
+ class NgFluxDialogHeaderComponent {
185
+ config = inject(NGF_DIALOG_CONFIG);
186
+ dialogRef = inject(NgFluxDialogRef);
187
+ icon = input(/* @ts-ignore */
188
+ ...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
190
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: NgFluxDialogHeaderComponent, isStandalone: true, selector: "ngf-dialog-header", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (icon(); as ico) {\n <div class=\"left\">\n <i [ngClass]=\"ico\"></i>\n </div>\n}\n\n<div class=\"middle\">\n <ng-content></ng-content>\n</div>\n\n@if (config.closeBtn) {\n <div class=\"right\" title=\"Close\" (click)=\"dialogRef.close()\">\n <i class=\"ngf-icon close\"></i>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:row;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-bottom:var(--ngf-dialog-border)!important;min-height:50px;top:0}:host>.left{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:10px}:host>.middle{display:flex;flex-direction:column;justify-content:center;align-items:start;overflow:hidden;text-overflow:ellipsis;padding:10px 20px;flex:1 0 0;width:0px}:host>.right{display:flex;flex-direction:row;justify-content:center;align-items:center;cursor:pointer;padding:10px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
191
+ }
192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogHeaderComponent, decorators: [{
193
+ type: Component,
194
+ args: [{ selector: 'ngf-dialog-header', changeDetection: ChangeDetectionStrategy.Eager, imports: [NgClass], template: "@if (icon(); as ico) {\n <div class=\"left\">\n <i [ngClass]=\"ico\"></i>\n </div>\n}\n\n<div class=\"middle\">\n <ng-content></ng-content>\n</div>\n\n@if (config.closeBtn) {\n <div class=\"right\" title=\"Close\" (click)=\"dialogRef.close()\">\n <i class=\"ngf-icon close\"></i>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:row;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-bottom:var(--ngf-dialog-border)!important;min-height:50px;top:0}:host>.left{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:10px}:host>.middle{display:flex;flex-direction:column;justify-content:center;align-items:start;overflow:hidden;text-overflow:ellipsis;padding:10px 20px;flex:1 0 0;width:0px}:host>.right{display:flex;flex-direction:row;justify-content:center;align-items:center;cursor:pointer;padding:10px}\n"] }]
195
+ }], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });
196
+
197
+ class NgFluxLoadingComponent {
198
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
199
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.0", type: NgFluxLoadingComponent, isStandalone: true, selector: "ngf-loading", ngImport: i0, template: "<svg viewBox=\"25 25 50 50\">\n <circle r=\"20\" cy=\"50\" cx=\"50\"></circle>\n</svg>\n", styles: [":host{display:block}:host svg{width:3.25em;transform-origin:center;animation:rotate4 2s linear infinite}:host circle{fill:none;stroke:var(--ngf-loading-foreground)!important;stroke-width:5;stroke-dasharray:1,200;stroke-dashoffset:0;stroke-linecap:round;animation:dash4 1.5s ease-in-out infinite}@keyframes rotate4{to{transform:rotate(360deg)}}@keyframes dash4{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,200;stroke-dashoffset:-35px}to{stroke-dashoffset:-125px}}\n"] });
200
+ }
201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingComponent, decorators: [{
202
+ type: Component,
203
+ args: [{ selector: 'ngf-loading', imports: [], template: "<svg viewBox=\"25 25 50 50\">\n <circle r=\"20\" cy=\"50\" cx=\"50\"></circle>\n</svg>\n", styles: [":host{display:block}:host svg{width:3.25em;transform-origin:center;animation:rotate4 2s linear infinite}:host circle{fill:none;stroke:var(--ngf-loading-foreground)!important;stroke-width:5;stroke-dasharray:1,200;stroke-dashoffset:0;stroke-linecap:round;animation:dash4 1.5s ease-in-out infinite}@keyframes rotate4{to{transform:rotate(360deg)}}@keyframes dash4{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,200;stroke-dashoffset:-35px}to{stroke-dashoffset:-125px}}\n"] }]
204
+ }] });
205
+
206
+ class NgFluxLoadingRootComponent {
207
+ config = inject(NGF_CONFIG);
208
+ injector = inject(Injector);
209
+ entries = signal([], /* @ts-ignore */
210
+ ...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
211
+ count = computed(() => this.entries().length, /* @ts-ignore */
212
+ ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
213
+ isLoading = computed(() => this.count() > 0, /* @ts-ignore */
214
+ ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
215
+ get showLoading() { return this.isLoading(); }
216
+ viewContainer = viewChild.required('container', { read: ViewContainerRef });
217
+ componentRef;
218
+ constructor() {
219
+ const { config, injector } = this;
220
+ effect(() => {
221
+ const viewContainer = this.viewContainer();
222
+ const component = config.loading?.component ?? NgFluxLoadingComponent;
223
+ const newInjector = Injector.create({
224
+ parent: injector,
225
+ providers: [],
226
+ });
227
+ this.componentRef = viewContainer.createComponent(component, {
228
+ injector: newInjector,
229
+ });
230
+ });
231
+ }
232
+ entry = computed(() => {
233
+ const entries = this.entries();
234
+ return entries.at(entries.length - 1);
235
+ }, /* @ts-ignore */
236
+ ...(ngDevMode ? [{ debugName: "entry" }] : /* istanbul ignore next */ []));
237
+ start = (text = '') => this.entries.update(v => {
238
+ const entries = Array.from(v);
239
+ entries.push({ text });
240
+ return entries;
241
+ });
242
+ stop = () => this.entries.update(v => {
243
+ const entries = Array.from(v);
244
+ entries.pop();
245
+ return entries;
246
+ });
247
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
248
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.0", type: NgFluxLoadingRootComponent, isStandalone: true, selector: "ngf-loading-root", host: { properties: { "class.show": "this.showLoading" } }, viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div class=\"wrapper\">\n <ng-template #container></ng-template>\n</div>\n", styles: [":host{display:none;position:fixed;z-index:var(--ngf-loading-z-index)!important;inset:0}:host.show{display:block}:host>.wrapper{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:var(--ngf-loading-background)!important;height:100%!important;width:100%!important}\n"] });
249
+ }
250
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingRootComponent, decorators: [{
251
+ type: Component,
252
+ args: [{ selector: 'ngf-loading-root', imports: [], template: "<div class=\"wrapper\">\n <ng-template #container></ng-template>\n</div>\n", styles: [":host{display:none;position:fixed;z-index:var(--ngf-loading-z-index)!important;inset:0}:host.show{display:block}:host>.wrapper{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:var(--ngf-loading-background)!important;height:100%!important;width:100%!important}\n"] }]
253
+ }], ctorParameters: () => [], propDecorators: { showLoading: [{
254
+ type: HostBinding,
255
+ args: ['class.show']
256
+ }], viewContainer: [{ type: i0.ViewChild, args: ['container', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
257
+
258
+ class NgFluxPaginationInfo {
259
+ data = input.required(/* @ts-ignore */
260
+ ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
261
+ callback = output();
262
+ limit = model.required(/* @ts-ignore */
263
+ ...(ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []));
264
+ limitOptions = input.required(/* @ts-ignore */
265
+ ...(ngDevMode ? [{ debugName: "limitOptions" }] : /* istanbul ignore next */ []));
266
+ info = computed(() => {
267
+ const data = this.data();
268
+ const from = data.from.toLocaleString();
269
+ const to = data.to.toLocaleString();
270
+ const total = data.total.toLocaleString();
271
+ return `${from} - ${to} of ${total}`;
272
+ }, /* @ts-ignore */
273
+ ...(ngDevMode ? [{ debugName: "info" }] : /* istanbul ignore next */ []));
274
+ disablePrev = computed(() => {
275
+ const data = this.data();
276
+ return data.currentPage <= 1;
277
+ }, /* @ts-ignore */
278
+ ...(ngDevMode ? [{ debugName: "disablePrev" }] : /* istanbul ignore next */ []));
279
+ disableNext = computed(() => {
280
+ const data = this.data();
281
+ return data.currentPage >= data.lastPage;
282
+ }, /* @ts-ignore */
283
+ ...(ngDevMode ? [{ debugName: "disableNext" }] : /* istanbul ignore next */ []));
284
+ prev() {
285
+ const data = this.data();
286
+ this.callback.emit({
287
+ page: data.currentPage - 1,
288
+ limit: data.perPage,
289
+ });
290
+ }
291
+ next() {
292
+ const data = this.data();
293
+ this.callback.emit({
294
+ page: data.currentPage + 1,
295
+ limit: data.perPage,
296
+ });
297
+ }
298
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxPaginationInfo, deps: [], target: i0.ɵɵFactoryTarget.Component });
299
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: NgFluxPaginationInfo, isStandalone: true, selector: "ngf-pagination-info", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: true, transformFunction: null }, limitOptions: { classPropertyName: "limitOptions", publicName: "limitOptions", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { callback: "callback", limit: "limitChange" }, ngImport: i0, template: "<div class=\"wrapper\">\n <div class=\"block limit\">\n <div>Per page</div>\n <select name=\"\" id=\"\" [(ngModel)]=\"limit\">\n @for (entry of limitOptions(); track $index) {\n <option [value]=\"entry\">{{ entry }}</option>\n }\n </select>\n </div>\n\n <div class=\"block info\">\n <div>{{ info() }}</div>\n </div>\n\n <div class=\"block nav\">\n <button (click)=\"prev()\" [disabled]=\"disablePrev()\">\n <i class=\"ngf-icon chevron-left\"></i>\n </button>\n\n <button (click)=\"next()\" [disabled]=\"disableNext()\">\n <i class=\"ngf-icon chevron-right\"></i>\n </button>\n </div>\n</div>\n", styles: [":host{display:block;container:pagination/inline-size}:host .wrapper{display:flex;flex-direction:column;font-family:Poppins,sans-serif;align-items:end;text-align:center;font-size:.8rem;gap:5px}@container pagination (min-width: 400px){:host .wrapper{flex-direction:row;justify-content:end;align-items:center;gap:15px}}:host .wrapper .block{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:5px}:host .wrapper .limit>select{display:block;padding:2px 5px;font-size:inherit;outline:none!important;width:50px}:host .wrapper .nav>button{display:block;background-color:transparent;box-shadow:none!important;outline:none!important;cursor:pointer;border:none;padding:0}:host .wrapper .nav>button:disabled{cursor:default;color:#aaa}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
300
+ }
301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxPaginationInfo, decorators: [{
302
+ type: Component,
303
+ args: [{ selector: 'ngf-pagination-info', changeDetection: ChangeDetectionStrategy.Eager, imports: [FormsModule], template: "<div class=\"wrapper\">\n <div class=\"block limit\">\n <div>Per page</div>\n <select name=\"\" id=\"\" [(ngModel)]=\"limit\">\n @for (entry of limitOptions(); track $index) {\n <option [value]=\"entry\">{{ entry }}</option>\n }\n </select>\n </div>\n\n <div class=\"block info\">\n <div>{{ info() }}</div>\n </div>\n\n <div class=\"block nav\">\n <button (click)=\"prev()\" [disabled]=\"disablePrev()\">\n <i class=\"ngf-icon chevron-left\"></i>\n </button>\n\n <button (click)=\"next()\" [disabled]=\"disableNext()\">\n <i class=\"ngf-icon chevron-right\"></i>\n </button>\n </div>\n</div>\n", styles: [":host{display:block;container:pagination/inline-size}:host .wrapper{display:flex;flex-direction:column;font-family:Poppins,sans-serif;align-items:end;text-align:center;font-size:.8rem;gap:5px}@container pagination (min-width: 400px){:host .wrapper{flex-direction:row;justify-content:end;align-items:center;gap:15px}}:host .wrapper .block{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:5px}:host .wrapper .limit>select{display:block;padding:2px 5px;font-size:inherit;outline:none!important;width:50px}:host .wrapper .nav>button{display:block;background-color:transparent;box-shadow:none!important;outline:none!important;cursor:pointer;border:none;padding:0}:host .wrapper .nav>button:disabled{cursor:default;color:#aaa}\n"] }]
304
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], callback: [{ type: i0.Output, args: ["callback"] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: true }] }, { type: i0.Output, args: ["limitChange"] }], limitOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "limitOptions", required: true }] }] } });
305
+
306
+ class NgFluxPagination {
307
+ config = inject(NGF_CONFIG);
308
+ data = input.required(/* @ts-ignore */
309
+ ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
310
+ preload = input(this.config.pagination?.preload ?? false, /* @ts-ignore */
311
+ ...(ngDevMode ? [{ debugName: "preload" }] : /* istanbul ignore next */ []));
312
+ transform = input(/* @ts-ignore */
313
+ ...(ngDevMode ? [undefined, { debugName: "transform" }] : /* istanbul ignore next */ []));
314
+ limit = model(this.config.pagination?.limit ?? 10, /* @ts-ignore */
315
+ ...(ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []));
316
+ limitOptions = input(this.config.pagination?.limitOptions ?? [5, 10, 20, 30, 40, 50], /* @ts-ignore */
317
+ ...(ngDevMode ? [{ debugName: "limitOptions" }] : /* istanbul ignore next */ []));
318
+ callback = output();
319
+ value = computed(() => {
320
+ const { config } = this;
321
+ const data = this.data();
322
+ const transform = this.transform() ?? config.pagination?.transform;
323
+ if (!transform)
324
+ return data;
325
+ return {
326
+ currentPage: transform.getCurrentPage(data),
327
+ lastPage: transform.getLastPage(data),
328
+ perPage: transform.getPerPage(data),
329
+ from: transform.getFrom(data),
330
+ to: transform.getTo(data),
331
+ total: transform.getTotal(data),
332
+ data: transform.getData(data),
333
+ };
334
+ }, /* @ts-ignore */
335
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
336
+ constructor() {
337
+ let init = false;
338
+ effect(() => {
339
+ const limit = Number(this.limit());
340
+ const preload = untracked(this.preload);
341
+ const { currentPage: page } = untracked(this.value);
342
+ if (preload || init) {
343
+ this.callback.emit({ limit, page });
344
+ }
345
+ init = true;
346
+ });
347
+ }
348
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxPagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
349
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: NgFluxPagination, isStandalone: true, selector: "ngf-pagination", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, preload: { classPropertyName: "preload", publicName: "preload", isSignal: true, isRequired: false, transformFunction: null }, transform: { classPropertyName: "transform", publicName: "transform", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, limitOptions: { classPropertyName: "limitOptions", publicName: "limitOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { limit: "limitChange", callback: "callback" }, ngImport: i0, template: "<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitOptions]=\"limitOptions()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n\n<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitOptions]=\"limitOptions()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n", styles: [":host{display:block}:host>.content{margin:20px 0}\n"], dependencies: [{ kind: "component", type: NgFluxPaginationInfo, selector: "ngf-pagination-info", inputs: ["data", "limit", "limitOptions"], outputs: ["callback", "limitChange"] }], changeDetection: i0.ChangeDetectionStrategy.Eager });
350
+ }
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxPagination, decorators: [{
352
+ type: Component,
353
+ args: [{ selector: 'ngf-pagination', changeDetection: ChangeDetectionStrategy.Eager, imports: [NgFluxPaginationInfo], template: "<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitOptions]=\"limitOptions()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n\n<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitOptions]=\"limitOptions()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n", styles: [":host{display:block}:host>.content{margin:20px 0}\n"] }]
354
+ }], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], preload: [{ type: i0.Input, args: [{ isSignal: true, alias: "preload", required: false }] }], transform: [{ type: i0.Input, args: [{ isSignal: true, alias: "transform", required: false }] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: false }] }, { type: i0.Output, args: ["limitChange"] }], limitOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "limitOptions", required: false }] }], callback: [{ type: i0.Output, args: ["callback"] }] } });
355
+
356
+ class NgFluxLoadingInternal {
357
+ config = inject(NGF_CONFIG);
358
+ appRef = inject(ApplicationRef);
359
+ router = inject(Router, { optional: true });
360
+ rootRef;
361
+ constructor() {
362
+ const { appRef } = this;
363
+ this.rootRef = createComponent(NgFluxLoadingRootComponent, {
364
+ environmentInjector: appRef.injector,
365
+ });
366
+ }
367
+ initialize() {
368
+ const { appRef, rootRef } = this;
369
+ appRef.attachView(rootRef.hostView);
370
+ const elem = rootRef.location.nativeElement;
371
+ document.body.appendChild(elem);
372
+ }
373
+ showOnRouteNavigation() {
374
+ const { config, router } = this;
375
+ if (router && config.loading?.showOnRouteNavigation) {
376
+ const root = this.rootRef.instance;
377
+ const navStart = filter(nav => nav instanceof NavigationStart);
378
+ router.events.pipe(navStart).subscribe(nav => root.start());
379
+ const navEnd = filter(nav => nav instanceof NavigationEnd);
380
+ router.events.pipe(navEnd).subscribe(nav => root.stop());
381
+ const navCancel = filter(nav => nav instanceof NavigationCancel);
382
+ router.events.pipe(navCancel).subscribe(nav => root.stop());
383
+ const navError = filter(nav => nav instanceof NavigationError);
384
+ router.events.pipe(navError).subscribe(nav => root.stop());
385
+ }
386
+ }
387
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingInternal, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
388
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingInternal, providedIn: 'root' });
389
+ }
390
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoadingInternal, decorators: [{
391
+ type: Injectable,
392
+ args: [{ providedIn: 'root' }]
393
+ }], ctorParameters: () => [] });
394
+
395
+ class NgFluxLoading {
396
+ internal = inject(NgFluxLoadingInternal);
397
+ root = this.internal.rootRef.instance;
398
+ data = computed(() => this.root.entry(), /* @ts-ignore */
399
+ ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
400
+ isLoading = computed(() => this.root.isLoading(), /* @ts-ignore */
401
+ ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
402
+ start = (text = '') => this.root.start(text);
403
+ stop = () => this.root.stop();
404
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
405
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoading, providedIn: 'root' });
406
+ }
407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxLoading, decorators: [{
408
+ type: Injectable,
409
+ args: [{ providedIn: 'root' }]
410
+ }] });
411
+
132
412
  class NgFluxDialogComponent {
133
413
  injector = inject(Injector);
134
414
  instance = inject(NgFluxDialogInstance);
@@ -144,9 +424,7 @@ class NgFluxDialogComponent {
144
424
  const viewContainer = this.viewContainer();
145
425
  const newInjector = Injector.create({
146
426
  parent: injector,
147
- providers: [
148
- { provide: NGF_DIALOG_DATA, useValue: config?.data ?? null },
149
- ]
427
+ providers: [{ provide: NGF_DIALOG_DATA, useValue: config?.data ?? null }],
150
428
  });
151
429
  this.componentRef = viewContainer.createComponent(content, {
152
430
  injector: newInjector,
@@ -176,7 +454,8 @@ class NgFluxDialogComponent {
176
454
  onAnimationComplete = (e) => {
177
455
  switch (e.animationName) {
178
456
  case 'ngfDialogOpen':
179
- { }
457
+ {
458
+ }
180
459
  break;
181
460
  case 'ngfDialogClose':
182
461
  {
@@ -194,12 +473,12 @@ class NgFluxDialogComponent {
194
473
  const ref = this.componentRef.location;
195
474
  ref.nativeElement.classList.add('close');
196
475
  }
197
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
198
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.14", type: NgFluxDialogComponent, isStandalone: true, selector: "ngf-dialog", host: { listeners: { "click": "onBackdropClick($event)" } }, viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div class=\"wrapper\">\n <div class=\"content\">\n <ng-template #container></ng-template>\n </div>\n</div>\n", styles: [":host{display:block;position:fixed;background-color:var(--ngf-dialog-backdrop-color)!important;visibility:visible!important;z-index:var(--ngf-dialog-z-index)!important;inset:0}:host>.wrapper{display:block;width:100%!important;height:100%!important;overflow:hidden auto}:host>.wrapper>.content{display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:100%;min-height:100%}\n"] });
476
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
477
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.0", type: NgFluxDialogComponent, isStandalone: true, selector: "ngf-dialog", host: { listeners: { "click": "onBackdropClick($event)" } }, viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div class=\"wrapper\">\n <div class=\"content\">\n <ng-template #container></ng-template>\n </div>\n</div>\n", styles: [":host{display:block;position:fixed;background-color:var(--ngf-dialog-backdrop-color)!important;visibility:visible!important;z-index:var(--ngf-dialog-z-index)!important;inset:0}:host>.wrapper{display:block;width:100%!important;height:100%!important;overflow:hidden auto}:host>.wrapper>.content{display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:100%;min-height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.Eager });
199
478
  }
200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogComponent, decorators: [{
479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialogComponent, decorators: [{
201
480
  type: Component,
202
- args: [{ selector: 'ngf-dialog', imports: [], template: "<div class=\"wrapper\">\n <div class=\"content\">\n <ng-template #container></ng-template>\n </div>\n</div>\n", styles: [":host{display:block;position:fixed;background-color:var(--ngf-dialog-backdrop-color)!important;visibility:visible!important;z-index:var(--ngf-dialog-z-index)!important;inset:0}:host>.wrapper{display:block;width:100%!important;height:100%!important;overflow:hidden auto}:host>.wrapper>.content{display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:100%;min-height:100%}\n"] }]
481
+ args: [{ selector: 'ngf-dialog', changeDetection: ChangeDetectionStrategy.Eager, imports: [], template: "<div class=\"wrapper\">\n <div class=\"content\">\n <ng-template #container></ng-template>\n </div>\n</div>\n", styles: [":host{display:block;position:fixed;background-color:var(--ngf-dialog-backdrop-color)!important;visibility:visible!important;z-index:var(--ngf-dialog-z-index)!important;inset:0}:host>.wrapper{display:block;width:100%!important;height:100%!important;overflow:hidden auto}:host>.wrapper>.content{display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:100%;min-height:100%}\n"] }]
203
482
  }], ctorParameters: () => [], propDecorators: { viewContainer: [{ type: i0.ViewChild, args: ['container', { ...{ read: ViewContainerRef }, isSignal: true }] }], onBackdropClick: [{
204
483
  type: HostListener,
205
484
  args: ['click', ['$event']]
@@ -301,96 +580,21 @@ class NgFluxDialogInstance {
301
580
  }
302
581
  }
303
582
 
304
- class NgFluxDialogHeaderComponent {
305
- config = inject(NGF_DIALOG_CONFIG);
306
- dialogRef = inject(NgFluxDialogRef);
307
- icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
308
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
309
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: NgFluxDialogHeaderComponent, isStandalone: true, selector: "ngf-dialog-header", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (icon(); as ico) {\n <div class=\"left\">\n <i [ngClass]=\"ico\"></i>\n </div>\n}\n\n<div class=\"middle\">\n <ng-content></ng-content>\n</div>\n\n@if (config.closeBtn) {\n <div class=\"right\" title=\"Close\" (click)=\"dialogRef.close()\">\n <i class=\"ngf-icon close\"></i>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:row;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-bottom:var(--ngf-dialog-border)!important;min-height:50px;top:0}:host>.left{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:10px}:host>.middle{display:flex;flex-direction:column;justify-content:center;align-items:start;overflow:hidden;text-overflow:ellipsis;padding:10px 20px;flex:1 0 0;width:0px}:host>.right{display:flex;flex-direction:row;justify-content:center;align-items:center;cursor:pointer;padding:10px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
310
- }
311
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogHeaderComponent, decorators: [{
312
- type: Component,
313
- args: [{ selector: 'ngf-dialog-header', imports: [
314
- NgClass,
315
- ], template: "@if (icon(); as ico) {\n <div class=\"left\">\n <i [ngClass]=\"ico\"></i>\n </div>\n}\n\n<div class=\"middle\">\n <ng-content></ng-content>\n</div>\n\n@if (config.closeBtn) {\n <div class=\"right\" title=\"Close\" (click)=\"dialogRef.close()\">\n <i class=\"ngf-icon close\"></i>\n </div>\n}\n", styles: [":host{display:flex;flex-direction:row;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-bottom:var(--ngf-dialog-border)!important;min-height:50px;top:0}:host>.left{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:10px}:host>.middle{display:flex;flex-direction:column;justify-content:center;align-items:start;overflow:hidden;text-overflow:ellipsis;padding:10px 20px;flex:1 0 0;width:0px}:host>.right{display:flex;flex-direction:row;justify-content:center;align-items:center;cursor:pointer;padding:10px}\n"] }]
316
- }], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }] } });
317
-
318
- class NgFluxDialogBodyComponent {
319
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
320
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: NgFluxDialogBodyComponent, isStandalone: true, selector: "ngf-dialog-body", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:block;padding:20px}\n"] });
321
- }
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogBodyComponent, decorators: [{
323
- type: Component,
324
- args: [{ selector: 'ngf-dialog-body', imports: [], template: "<ng-content></ng-content>\n", styles: [":host{display:block;padding:20px}\n"] }]
325
- }] });
326
-
327
- class NgFluxDialogFooterComponent {
328
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
329
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: NgFluxDialogFooterComponent, isStandalone: true, selector: "ngf-dialog-footer", ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:flex;flex-direction:row;align-items:center;justify-content:end;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-top:var(--ngf-dialog-border)!important;padding:7px 15px;bottom:0;gap:10px}\n"] });
330
- }
331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogFooterComponent, decorators: [{
332
- type: Component,
333
- args: [{ selector: 'ngf-dialog-footer', imports: [], template: "<ng-content></ng-content>\n", styles: [":host{display:flex;flex-direction:row;align-items:center;justify-content:end;position:sticky;background-color:var(--ngf-dialog-background-color)!important;border-top:var(--ngf-dialog-border)!important;padding:7px 15px;bottom:0;gap:10px}\n"] }]
334
- }] });
335
-
336
- class NgFluxButton {
337
- ref = inject(ElementRef);
338
- icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
339
- theme = input(...(ngDevMode ? [undefined, { debugName: "theme" }] : /* istanbul ignore next */ []));
340
- type = input(...(ngDevMode ? [undefined, { debugName: "type" }] : /* istanbul ignore next */ []));
341
- size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : /* istanbul ignore next */ []));
342
- direction = input(...(ngDevMode ? [undefined, { debugName: "direction" }] : /* istanbul ignore next */ []));
343
- block = input(false, ...(ngDevMode ? [{ debugName: "block" }] : /* istanbul ignore next */ []));
344
- disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
345
- btnClassNames = computed(() => {
346
- const names = [];
347
- const direction = this.direction() ?? 'normal';
348
- if (direction === 'reversed')
349
- names.push(direction);
350
- return names;
351
- }, ...(ngDevMode ? [{ debugName: "btnClassNames" }] : /* istanbul ignore next */ []));
352
- classNames = computed(() => [
353
- this.theme() ?? 'default',
354
- this.size() ?? 'md',
355
- ].join(' '), ...(ngDevMode ? [{ debugName: "classNames" }] : /* istanbul ignore next */ []));
356
- get bindClass() { return this.classNames(); }
357
- get isBlock() { return this.block(); }
358
- get isDisabled() { return this.disabled(); }
359
- constructor() {
360
- const { ref: { nativeElement } } = this;
361
- nativeElement.tabIndex = 1;
362
- }
363
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
364
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: NgFluxButton, isStandalone: true, selector: "ngf-button", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, block: { classPropertyName: "block", publicName: "block", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.bindClass", "class.block": "this.isBlock", "class.disabled": "this.isDisabled" } }, ngImport: i0, template: "<button [type]=\"type()\" [disabled]=\"disabled()\">\n <div class=\"wrapper\" [ngClass]=\"btnClassNames()\">\n @if (icon(); as ico) {\n <div class=\"icon\">\n <i [ngClass]=\"ico\"></i>\n </div>\n }\n\n <div class=\"content\">\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</button>\n", styles: [":host{display:inline-block;border:1px solid rgba(0,0,0,.2);border-radius:3px;cursor:pointer;font-size:1rem;overflow:clip}:host.block{display:block}:host.disabled{opacity:.5!important;-webkit-user-select:none!important;user-select:none!important;cursor:not-allowed}:host.xs{font-size:.6rem}:host.sm{font-size:.8rem}:host.md{font-size:1rem}:host.lg{font-size:1.25rem}:host.xl{font-size:1.5rem}:host.default{background-color:var(--ngf-default)!important;color:var(--ngf-default-fg)!important}:host.primary{background-color:var(--ngf-primary)!important;color:var(--ngf-primary-fg)!important}:host.secondary{background-color:var(--ngf-secondary)!important;color:var(--ngf-secondary-fg)!important}:host.error{background-color:var(--ngf-error)!important;color:var(--ngf-error-fg)!important}:host.danger{background-color:var(--ngf-danger)!important;color:var(--ngf-danger-fg)!important}:host.success{background-color:var(--ngf-success)!important;color:var(--ngf-success-fg)!important}:host.warning{background-color:var(--ngf-warning)!important;color:var(--ngf-warning-fg)!important}:host.info{background-color:var(--ngf-info)!important;color:var(--ngf-info-fg)!important}:host.light{background-color:var(--ngf-light)!important;color:var(--ngf-light-fg)!important}:host.dark{background-color:var(--ngf-dark)!important;color:var(--ngf-dark-fg)!important}:host>button{display:block;padding:0!important;background-color:transparent;border:none!important;width:100%!important;cursor:inherit!important;color:inherit!important;font-weight:500;font-size:1em}:host>button:focus{outline:none!important}:host .wrapper{display:flex;flex-direction:var(--flex-direction)!important;--flex-direction: row;--icon-border-left: none;--icon-border-right: 1px solid rgba(0, 0, 0, .2)}:host .wrapper.reversed{--flex-direction: row-reverse;--icon-border-left: 1px solid rgba(0, 0, 0, .2);--icon-border-right: none}:host .wrapper>.icon{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:1.05em;border-left:var(--icon-border-left)!important;border-right:var(--icon-border-right)!important;padding:0 .5em}:host .wrapper>.content{display:block;flex-grow:1;padding:.5em 1em;white-space:nowrap!important;text-align:center!important;text-overflow:ellipsis;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
365
- }
366
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxButton, decorators: [{
367
- type: Component,
368
- args: [{ selector: 'ngf-button', imports: [NgClass], template: "<button [type]=\"type()\" [disabled]=\"disabled()\">\n <div class=\"wrapper\" [ngClass]=\"btnClassNames()\">\n @if (icon(); as ico) {\n <div class=\"icon\">\n <i [ngClass]=\"ico\"></i>\n </div>\n }\n\n <div class=\"content\">\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</button>\n", styles: [":host{display:inline-block;border:1px solid rgba(0,0,0,.2);border-radius:3px;cursor:pointer;font-size:1rem;overflow:clip}:host.block{display:block}:host.disabled{opacity:.5!important;-webkit-user-select:none!important;user-select:none!important;cursor:not-allowed}:host.xs{font-size:.6rem}:host.sm{font-size:.8rem}:host.md{font-size:1rem}:host.lg{font-size:1.25rem}:host.xl{font-size:1.5rem}:host.default{background-color:var(--ngf-default)!important;color:var(--ngf-default-fg)!important}:host.primary{background-color:var(--ngf-primary)!important;color:var(--ngf-primary-fg)!important}:host.secondary{background-color:var(--ngf-secondary)!important;color:var(--ngf-secondary-fg)!important}:host.error{background-color:var(--ngf-error)!important;color:var(--ngf-error-fg)!important}:host.danger{background-color:var(--ngf-danger)!important;color:var(--ngf-danger-fg)!important}:host.success{background-color:var(--ngf-success)!important;color:var(--ngf-success-fg)!important}:host.warning{background-color:var(--ngf-warning)!important;color:var(--ngf-warning-fg)!important}:host.info{background-color:var(--ngf-info)!important;color:var(--ngf-info-fg)!important}:host.light{background-color:var(--ngf-light)!important;color:var(--ngf-light-fg)!important}:host.dark{background-color:var(--ngf-dark)!important;color:var(--ngf-dark-fg)!important}:host>button{display:block;padding:0!important;background-color:transparent;border:none!important;width:100%!important;cursor:inherit!important;color:inherit!important;font-weight:500;font-size:1em}:host>button:focus{outline:none!important}:host .wrapper{display:flex;flex-direction:var(--flex-direction)!important;--flex-direction: row;--icon-border-left: none;--icon-border-right: 1px solid rgba(0, 0, 0, .2)}:host .wrapper.reversed{--flex-direction: row-reverse;--icon-border-left: 1px solid rgba(0, 0, 0, .2);--icon-border-right: none}:host .wrapper>.icon{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:1.05em;border-left:var(--icon-border-left)!important;border-right:var(--icon-border-right)!important;padding:0 .5em}:host .wrapper>.content{display:block;flex-grow:1;padding:.5em 1em;white-space:nowrap!important;text-align:center!important;text-overflow:ellipsis;overflow:hidden}\n"] }]
369
- }], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], block: [{ type: i0.Input, args: [{ isSignal: true, alias: "block", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], bindClass: [{
370
- type: HostBinding,
371
- args: ['class']
372
- }], isBlock: [{
373
- type: HostBinding,
374
- args: ['class.block']
375
- }], isDisabled: [{
376
- type: HostBinding,
377
- args: ['class.disabled']
378
- }] } });
379
-
380
583
  class NgFluxAlertDialog {
381
584
  config = inject(NGF_CONFIG);
382
585
  dialogRef = inject(NgFluxDialogRef);
383
586
  options = inject(NGF_DIALOG_DATA);
384
587
  buttons = computed(() => {
385
588
  const config = this.config.dialog?.alert || {};
386
- return this.options.buttons ?? [
589
+ return (this.options.buttons ?? [
387
590
  Object.assign({
388
591
  text: 'Okay',
389
592
  theme: 'primary',
390
593
  onClick: (e, btn, ref) => ref.close(),
391
594
  }, config.okayButton),
392
- ];
393
- }, ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
595
+ ]);
596
+ }, /* @ts-ignore */
597
+ ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
394
598
  onButtonClick(e, btn) {
395
599
  const { dialogRef } = this;
396
600
  if (btn.onClick) {
@@ -400,17 +604,17 @@ class NgFluxAlertDialog {
400
604
  dialogRef.close();
401
605
  }
402
606
  }
403
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxAlertDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
404
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: NgFluxAlertDialog, isStandalone: true, selector: "ngf-dialog-box-alert", ngImport: i0, template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n @switch (btn) {\n @case ('flex') {<div ngf-flex-x></div>}\n\n @default {\n <ngf-button [theme]=\"btn.theme\" [size]=\"btn.size\" [direction]=\"btn.direction\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n }\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}\n"], dependencies: [{ kind: "component", type: NgFluxButton, selector: "ngf-button", inputs: ["icon", "theme", "type", "size", "direction", "block", "disabled"] }, { kind: "component", type: NgFluxDialogHeaderComponent, selector: "ngf-dialog-header", inputs: ["icon"] }, { kind: "component", type: NgFluxDialogBodyComponent, selector: "ngf-dialog-body" }, { kind: "component", type: NgFluxDialogFooterComponent, selector: "ngf-dialog-footer" }] });
607
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxAlertDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
608
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: NgFluxAlertDialog, isStandalone: true, selector: "ngf-dialog-box-alert", ngImport: i0, template: "@if (options.title) {\n <ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n </ngf-dialog-header>\n}\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n @switch (btn) {\n @case ('flex') {<div ngf-flex-x></div>}\n\n @default {\n <ngf-button [theme]=\"btn.theme\" [size]=\"btn.size\" [direction]=\"btn.direction\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n }\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}:host .success{color:var(--ngf-success)}:host .error{color:var(--ngf-error)}\n"], dependencies: [{ kind: "component", type: NgFluxButton, selector: "ngf-button", inputs: ["icon", "theme", "type", "size", "direction", "block", "disabled"] }, { kind: "component", type: NgFluxDialogHeaderComponent, selector: "ngf-dialog-header", inputs: ["icon"] }, { kind: "component", type: NgFluxDialogBodyComponent, selector: "ngf-dialog-body" }, { kind: "component", type: NgFluxDialogFooterComponent, selector: "ngf-dialog-footer" }] });
405
609
  }
406
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxAlertDialog, decorators: [{
610
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxAlertDialog, decorators: [{
407
611
  type: Component,
408
612
  args: [{ selector: 'ngf-dialog-box-alert', imports: [
409
613
  NgFluxButton,
410
614
  NgFluxDialogHeaderComponent,
411
615
  NgFluxDialogBodyComponent,
412
616
  NgFluxDialogFooterComponent,
413
- ], template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n @switch (btn) {\n @case ('flex') {<div ngf-flex-x></div>}\n\n @default {\n <ngf-button [theme]=\"btn.theme\" [size]=\"btn.size\" [direction]=\"btn.direction\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n }\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}\n"] }]
617
+ ], template: "@if (options.title) {\n <ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n </ngf-dialog-header>\n}\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n @switch (btn) {\n @case ('flex') {<div ngf-flex-x></div>}\n\n @default {\n <ngf-button [theme]=\"btn.theme\" [size]=\"btn.size\" [direction]=\"btn.direction\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n }\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}:host .success{color:var(--ngf-success)}:host .error{color:var(--ngf-error)}\n"] }]
414
618
  }] });
415
619
 
416
620
  class NgFluxConfirmDialog {
@@ -420,72 +624,80 @@ class NgFluxConfirmDialog {
420
624
  buttons = computed(() => {
421
625
  const config = this.config.dialog?.prompt ?? {};
422
626
  return [
423
- this.options.cancelButton ?? Object.assign({
424
- text: 'Cancel',
425
- theme: 'dark',
426
- onClick: (e, btn, dialogRef) => dialogRef.close(),
427
- }, config.cancelButton),
428
- this.options.okayButton ?? Object.assign({
429
- text: 'Okay',
430
- theme: 'primary',
431
- onClick: (e, btn, dialogRef) => dialogRef.close(true),
432
- }, config.submitButton),
627
+ this.options.cancelButton ??
628
+ Object.assign({
629
+ text: 'Cancel',
630
+ theme: 'dark',
631
+ onClick: (e, btn, dialogRef) => dialogRef.close(),
632
+ }, config.cancelButton),
633
+ this.options.okayButton ??
634
+ Object.assign({
635
+ text: 'Okay',
636
+ theme: 'primary',
637
+ onClick: (e, btn, dialogRef) => dialogRef.close(true),
638
+ }, config.submitButton),
433
639
  ];
434
- }, ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
640
+ }, /* @ts-ignore */
641
+ ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
435
642
  onButtonClick(e, btn) {
436
643
  btn.onClick?.call(null, e, btn, this.dialogRef);
437
644
  }
438
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
439
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: NgFluxConfirmDialog, isStandalone: true, selector: "ngf-dialog-box-confirm", ngImport: i0, template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}\n"], dependencies: [{ kind: "component", type: NgFluxButton, selector: "ngf-button", inputs: ["icon", "theme", "type", "size", "direction", "block", "disabled"] }, { kind: "component", type: NgFluxDialogHeaderComponent, selector: "ngf-dialog-header", inputs: ["icon"] }, { kind: "component", type: NgFluxDialogFooterComponent, selector: "ngf-dialog-footer" }, { kind: "component", type: NgFluxDialogBodyComponent, selector: "ngf-dialog-body" }] });
645
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
646
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: NgFluxConfirmDialog, isStandalone: true, selector: "ngf-dialog-box-confirm", ngImport: i0, template: "@if (options.title) {\n <ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n </ngf-dialog-header>\n}\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}\n"], dependencies: [{ kind: "component", type: NgFluxButton, selector: "ngf-button", inputs: ["icon", "theme", "type", "size", "direction", "block", "disabled"] }, { kind: "component", type: NgFluxDialogHeaderComponent, selector: "ngf-dialog-header", inputs: ["icon"] }, { kind: "component", type: NgFluxDialogFooterComponent, selector: "ngf-dialog-footer" }, { kind: "component", type: NgFluxDialogBodyComponent, selector: "ngf-dialog-body" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
440
647
  }
441
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxConfirmDialog, decorators: [{
648
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxConfirmDialog, decorators: [{
442
649
  type: Component,
443
- args: [{ selector: 'ngf-dialog-box-confirm', imports: [
650
+ args: [{ selector: 'ngf-dialog-box-confirm', changeDetection: ChangeDetectionStrategy.Eager, imports: [
444
651
  NgFluxButton,
445
652
  NgFluxDialogHeaderComponent,
446
653
  NgFluxDialogFooterComponent,
447
654
  NgFluxDialogBodyComponent,
448
- ], template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}\n"] }]
655
+ ], template: "@if (options.title) {\n <ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n </ngf-dialog-header>\n}\n\n<ngf-dialog-body>\n <div [innerHTML]=\"options.content\"></div>\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:500px;background-color:#fff}\n"] }]
449
656
  }] });
450
657
 
451
658
  class NgFluxPromptDialog {
452
659
  config = inject(NGF_CONFIG);
453
660
  dialogRef = inject(NgFluxDialogRef);
454
661
  options = inject(NGF_DIALOG_DATA);
455
- text = signal('', ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
456
- value = computed(() => this.text().trim(), ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
662
+ text = signal(this.options.defaultValue ?? '', /* @ts-ignore */
663
+ ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
664
+ value = computed(() => this.text().trim(), /* @ts-ignore */
665
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
457
666
  buttons = computed(() => {
458
667
  const config = this.config.dialog?.prompt ?? {};
459
668
  const value = this.value();
460
669
  return [
461
- this.options.cancelButton ?? Object.assign({
462
- text: 'Cancel',
463
- theme: 'dark',
464
- onClick: (e, btn, dialogRef) => dialogRef.close(),
465
- }, config.cancelButton),
466
- this.options.submitButton ?? Object.assign({
467
- text: 'Submit',
468
- theme: 'primary',
469
- onClick: (e, btn, dialogRef) => dialogRef.close(value),
470
- disabled: () => !value,
471
- }, config.submitButton),
670
+ this.options.cancelButton ??
671
+ Object.assign({
672
+ text: 'Cancel',
673
+ theme: 'dark',
674
+ onClick: (e, btn, dialogRef) => dialogRef.close(),
675
+ }, config.cancelButton),
676
+ this.options.submitButton ??
677
+ Object.assign({
678
+ text: 'Submit',
679
+ theme: 'primary',
680
+ onClick: (e, btn, dialogRef) => dialogRef.close(value),
681
+ disabled: () => !value,
682
+ }, config.submitButton),
472
683
  ];
473
- }, ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
684
+ }, /* @ts-ignore */
685
+ ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
474
686
  onButtonClick(e, btn) {
475
687
  btn.onClick?.call(null, e, btn, this.dialogRef);
476
688
  }
477
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxPromptDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
478
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: NgFluxPromptDialog, isStandalone: true, selector: "ngf-dialog-box-prompt", ngImport: i0, template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div class=\"content\" [innerHTML]=\"options.content\"></div>\n <input type=\"text\" name=\"text\" [(ngModel)]=\"text\">\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\" [disabled]=\"btn.disabled?.() ?? false\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:350px;background-color:#fff}:host .content{margin:0 0 10px}:host input{display:block;width:100%!important;border:1px solid #DDD;background-color:#fff;padding:10px 15px;font-size:1.2rem}:host input:focus{outline:2px solid #DDD;box-shadow:none!important}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgFluxButton, selector: "ngf-button", inputs: ["icon", "theme", "type", "size", "direction", "block", "disabled"] }, { kind: "component", type: NgFluxDialogHeaderComponent, selector: "ngf-dialog-header", inputs: ["icon"] }, { kind: "component", type: NgFluxDialogFooterComponent, selector: "ngf-dialog-footer" }, { kind: "component", type: NgFluxDialogBodyComponent, selector: "ngf-dialog-body" }] });
689
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxPromptDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
690
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: NgFluxPromptDialog, isStandalone: true, selector: "ngf-dialog-box-prompt", ngImport: i0, template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div class=\"content\" [innerHTML]=\"options.content\"></div>\n <input type=\"text\" name=\"text\" [placeholder]=\"options.placeholder\" [(ngModel)]=\"text\">\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\" [disabled]=\"btn.disabled?.() ?? false\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:350px;background-color:#fff}:host .content{margin:0 0 10px}:host input{display:block;width:100%!important;border:1px solid #DDD;background-color:#fff;padding:10px 15px;font-size:1.2rem}:host input:focus{outline:2px solid #DDD;box-shadow:none!important}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: NgFluxButton, selector: "ngf-button", inputs: ["icon", "theme", "type", "size", "direction", "block", "disabled"] }, { kind: "component", type: NgFluxDialogHeaderComponent, selector: "ngf-dialog-header", inputs: ["icon"] }, { kind: "component", type: NgFluxDialogFooterComponent, selector: "ngf-dialog-footer" }, { kind: "component", type: NgFluxDialogBodyComponent, selector: "ngf-dialog-body" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
479
691
  }
480
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxPromptDialog, decorators: [{
692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxPromptDialog, decorators: [{
481
693
  type: Component,
482
- args: [{ selector: 'ngf-dialog-box-prompt', imports: [
694
+ args: [{ selector: 'ngf-dialog-box-prompt', changeDetection: ChangeDetectionStrategy.Eager, imports: [
483
695
  FormsModule,
484
696
  NgFluxButton,
485
697
  NgFluxDialogHeaderComponent,
486
698
  NgFluxDialogFooterComponent,
487
699
  NgFluxDialogBodyComponent,
488
- ], template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div class=\"content\" [innerHTML]=\"options.content\"></div>\n <input type=\"text\" name=\"text\" [(ngModel)]=\"text\">\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\" [disabled]=\"btn.disabled?.() ?? false\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:350px;background-color:#fff}:host .content{margin:0 0 10px}:host input{display:block;width:100%!important;border:1px solid #DDD;background-color:#fff;padding:10px 15px;font-size:1.2rem}:host input:focus{outline:2px solid #DDD;box-shadow:none!important}\n"] }]
700
+ ], template: "<ngf-dialog-header>\n <h1 ngf-dialog-title>{{ options.title }}</h1>\n</ngf-dialog-header>\n\n<ngf-dialog-body>\n <div class=\"content\" [innerHTML]=\"options.content\"></div>\n <input type=\"text\" name=\"text\" [placeholder]=\"options.placeholder\" [(ngModel)]=\"text\">\n</ngf-dialog-body>\n\n<ngf-dialog-footer>\n @for (btn of buttons(); track $index) {\n <ngf-button [theme]=\"btn.theme\" (click)=\"onButtonClick($event, btn)\" [disabled]=\"btn.disabled?.() ?? false\">\n <span>{{ btn.text }}</span>\n </ngf-button>\n }\n</ngf-dialog-footer>\n", styles: [":host{display:block;width:90%;max-width:350px;background-color:#fff}:host .content{margin:0 0 10px}:host input{display:block;width:100%!important;border:1px solid #DDD;background-color:#fff;padding:10px 15px;font-size:1.2rem}:host input:focus{outline:2px solid #DDD;box-shadow:none!important}\n"] }]
489
701
  }] });
490
702
 
491
703
  class NgFluxDialog {
@@ -497,11 +709,7 @@ class NgFluxDialog {
497
709
  config.closeOnBackBtn ??= true;
498
710
  config.closeOnEsc ??= true;
499
711
  const { internal } = this;
500
- const root = internal.root();
501
- if (!root)
502
- throw new Error('"ngf-dialog-root" component not found. ' +
503
- 'Use "<ngf-root></ngf-root>" in your root component to enable all NgFlux features or ' +
504
- 'add "<ngf-dialog-root></ngf-dialog-root>" to your root component to enable the NgFluxDialog feature.');
712
+ const root = internal.rootRef.instance;
505
713
  const onClosed = (ins) => {
506
714
  internal.remove(ins);
507
715
  };
@@ -510,8 +718,7 @@ class NgFluxDialog {
510
718
  return instance.events;
511
719
  }
512
720
  closeAll = () => this.internal.closeAll();
513
- alert(title, content, buttons) {
514
- const data = { title, content, buttons };
721
+ alert(data) {
515
722
  const dialog = this.open(NgFluxAlertDialog, {
516
723
  closeOnBackBtn: false,
517
724
  backdropClose: false,
@@ -520,13 +727,13 @@ class NgFluxDialog {
520
727
  });
521
728
  return dialog.closed;
522
729
  }
523
- success(title, message, buttons) {
524
- message = `<div class="mbi-success">${message}</div>`;
525
- return this.alert(title, message, buttons);
730
+ success(data) {
731
+ data.content = `<div class="success">${data.content}</div>`;
732
+ return this.alert(data);
526
733
  }
527
- error(title, message, buttons) {
528
- message = `<div class="mbi-error">${message}</div>`;
529
- return this.alert(title, message, buttons);
734
+ error(data) {
735
+ data.content = `<div class="error">${data.content}</div>`;
736
+ return this.alert(data);
530
737
  }
531
738
  confirm(data) {
532
739
  const dialog = this.open(NgFluxConfirmDialog, {
@@ -546,10 +753,10 @@ class NgFluxDialog {
546
753
  });
547
754
  return dialog.closed;
548
755
  }
549
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialog, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
550
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialog, providedIn: 'root' });
756
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialog, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
757
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialog, providedIn: 'root' });
551
758
  }
552
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialog, decorators: [{
759
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: NgFluxDialog, decorators: [{
553
760
  type: Injectable,
554
761
  args: [{ providedIn: 'root' }]
555
762
  }] });
@@ -562,170 +769,18 @@ const provideNgFlux = (config) => {
562
769
  NgFluxDialogInternal,
563
770
  NgFluxLoading,
564
771
  NgFluxLoadingInternal,
772
+ provideAppInitializer(() => {
773
+ const dialog = inject(NgFluxDialogInternal);
774
+ dialog.initialize();
775
+ }),
776
+ provideAppInitializer(() => {
777
+ const loading = inject(NgFluxLoadingInternal);
778
+ loading.initialize();
779
+ loading.showOnRouteNavigation();
780
+ }),
565
781
  ]);
566
782
  };
567
783
 
568
- class NgFluxDialogRootComponent {
569
- internal = inject(NgFluxDialogInternal);
570
- injector = inject(Injector);
571
- viewContainer = viewChild.required('container', { read: ViewContainerRef });
572
- constructor() {
573
- const { internal } = this;
574
- internal.root.set(this);
575
- }
576
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
577
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.14", type: NgFluxDialogRootComponent, isStandalone: true, selector: "ngf-dialog-root", viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<ng-template #container></ng-template>\n", styles: [":host{display:block;width:0px;height:0px;visibility:hidden}\n"] });
578
- }
579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxDialogRootComponent, decorators: [{
580
- type: Component,
581
- args: [{ selector: 'ngf-dialog-root', imports: [], template: "<ng-template #container></ng-template>\n", styles: [":host{display:block;width:0px;height:0px;visibility:hidden}\n"] }]
582
- }], ctorParameters: () => [], propDecorators: { viewContainer: [{ type: i0.ViewChild, args: ['container', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
583
-
584
- class NgFluxLoadingComponent {
585
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
586
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: NgFluxLoadingComponent, isStandalone: true, selector: "ngf-loading", ngImport: i0, template: "<svg viewBox=\"25 25 50 50\">\n <circle r=\"20\" cy=\"50\" cx=\"50\"></circle>\n</svg>\n", styles: [":host{display:block}:host svg{width:3.25em;transform-origin:center;animation:rotate4 2s linear infinite}:host circle{fill:none;stroke:var(--ngf-loading-foreground)!important;stroke-width:5;stroke-dasharray:1,200;stroke-dashoffset:0;stroke-linecap:round;animation:dash4 1.5s ease-in-out infinite}@keyframes rotate4{to{transform:rotate(360deg)}}@keyframes dash4{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,200;stroke-dashoffset:-35px}to{stroke-dashoffset:-125px}}\n"] });
587
- }
588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingComponent, decorators: [{
589
- type: Component,
590
- args: [{ selector: 'ngf-loading', imports: [], template: "<svg viewBox=\"25 25 50 50\">\n <circle r=\"20\" cy=\"50\" cx=\"50\"></circle>\n</svg>\n", styles: [":host{display:block}:host svg{width:3.25em;transform-origin:center;animation:rotate4 2s linear infinite}:host circle{fill:none;stroke:var(--ngf-loading-foreground)!important;stroke-width:5;stroke-dasharray:1,200;stroke-dashoffset:0;stroke-linecap:round;animation:dash4 1.5s ease-in-out infinite}@keyframes rotate4{to{transform:rotate(360deg)}}@keyframes dash4{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,200;stroke-dashoffset:-35px}to{stroke-dashoffset:-125px}}\n"] }]
591
- }] });
592
-
593
- class NgFluxLoadingRootComponent {
594
- config = inject(NGF_CONFIG);
595
- internal = inject(NgFluxLoadingInternal);
596
- injector = inject(Injector);
597
- get isLoading() { return this.internal.isLoading(); }
598
- viewContainer = viewChild.required('container', { read: ViewContainerRef });
599
- componentRef;
600
- constructor() {
601
- const { config, injector } = this;
602
- effect(() => {
603
- const viewContainer = this.viewContainer();
604
- const component = config.loading?.component ?? NgFluxLoadingComponent;
605
- const newInjector = Injector.create({
606
- parent: injector,
607
- providers: [],
608
- });
609
- this.componentRef = viewContainer.createComponent(component, {
610
- injector: newInjector,
611
- });
612
- });
613
- }
614
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
615
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.14", type: NgFluxLoadingRootComponent, isStandalone: true, selector: "ngf-loading-root", host: { properties: { "class.show": "this.isLoading" } }, viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div class=\"wrapper\">\n <ng-template #container></ng-template>\n</div>\n", styles: [":host{display:none;position:fixed;z-index:var(--ngf-loading-z-index)!important;inset:0}:host.show{display:block}:host>.wrapper{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:var(--ngf-loading-background)!important;height:100%!important;width:100%!important}\n"] });
616
- }
617
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxLoadingRootComponent, decorators: [{
618
- type: Component,
619
- args: [{ selector: 'ngf-loading-root', imports: [], template: "<div class=\"wrapper\">\n <ng-template #container></ng-template>\n</div>\n", styles: [":host{display:none;position:fixed;z-index:var(--ngf-loading-z-index)!important;inset:0}:host.show{display:block}:host>.wrapper{display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:var(--ngf-loading-background)!important;height:100%!important;width:100%!important}\n"] }]
620
- }], ctorParameters: () => [], propDecorators: { isLoading: [{
621
- type: HostBinding,
622
- args: ['class.show']
623
- }], viewContainer: [{ type: i0.ViewChild, args: ['container', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
624
-
625
- class NgFluxRootComponent {
626
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
627
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: NgFluxRootComponent, isStandalone: true, selector: "ngf-root", ngImport: i0, template: "<ng-content></ng-content>\n\n<ngf-dialog-root></ngf-dialog-root>\n<ngf-loading-root></ngf-loading-root>\n", styles: [""], dependencies: [{ kind: "component", type: NgFluxDialogRootComponent, selector: "ngf-dialog-root" }, { kind: "component", type: NgFluxLoadingRootComponent, selector: "ngf-loading-root" }] });
628
- }
629
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxRootComponent, decorators: [{
630
- type: Component,
631
- args: [{ selector: 'ngf-root', imports: [
632
- NgFluxDialogRootComponent,
633
- NgFluxLoadingRootComponent,
634
- ], template: "<ng-content></ng-content>\n\n<ngf-dialog-root></ngf-dialog-root>\n<ngf-loading-root></ngf-loading-root>\n" }]
635
- }] });
636
-
637
- class NgFluxPaginationInfo {
638
- data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
639
- callback = output();
640
- limit = model.required(...(ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []));
641
- limitEntries = input.required(...(ngDevMode ? [{ debugName: "limitEntries" }] : /* istanbul ignore next */ []));
642
- info = computed(() => {
643
- const data = this.data();
644
- const from = data.from.toLocaleString();
645
- const to = data.to.toLocaleString();
646
- const total = data.total.toLocaleString();
647
- return `${from} - ${to} of ${total}`;
648
- }, ...(ngDevMode ? [{ debugName: "info" }] : /* istanbul ignore next */ []));
649
- disablePrev = computed(() => {
650
- const data = this.data();
651
- return data.currentPage <= 1;
652
- }, ...(ngDevMode ? [{ debugName: "disablePrev" }] : /* istanbul ignore next */ []));
653
- disableNext = computed(() => {
654
- const data = this.data();
655
- return data.currentPage >= data.lastPage;
656
- }, ...(ngDevMode ? [{ debugName: "disableNext" }] : /* istanbul ignore next */ []));
657
- prev() {
658
- const data = this.data();
659
- this.callback.emit({
660
- page: data.currentPage - 1,
661
- limit: data.perPage,
662
- });
663
- }
664
- next() {
665
- const data = this.data();
666
- this.callback.emit({
667
- page: data.currentPage + 1,
668
- limit: data.perPage,
669
- });
670
- }
671
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxPaginationInfo, deps: [], target: i0.ɵɵFactoryTarget.Component });
672
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: NgFluxPaginationInfo, isStandalone: true, selector: "ngf-pagination-info", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: true, transformFunction: null }, limitEntries: { classPropertyName: "limitEntries", publicName: "limitEntries", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { callback: "callback", limit: "limitChange" }, ngImport: i0, template: "<div class=\"wrapper\">\n <div class=\"block limit\">\n <div>Per page</div>\n <select name=\"\" id=\"\" [(ngModel)]=\"limit\">\n @for (entry of limitEntries(); track $index) {\n <option [value]=\"entry\">{{ entry }}</option>\n }\n </select>\n </div>\n\n <div class=\"block info\">\n <div>{{ info() }}</div>\n </div>\n\n <div class=\"block nav\">\n <button (click)=\"prev()\" [disabled]=\"disablePrev()\">\n <i class=\"ngf-icon chevron-left\"></i>\n </button>\n\n <button (click)=\"next()\" [disabled]=\"disableNext()\">\n <i class=\"ngf-icon chevron-right\"></i>\n </button>\n </div>\n</div>\n", styles: [":host{display:block;container:pagination/inline-size}:host .wrapper{display:flex;flex-direction:column;font-family:Poppins,sans-serif;align-items:end;text-align:center;font-size:.8rem;gap:5px}@container pagination (min-width: 400px){:host .wrapper{flex-direction:row;justify-content:end;align-items:center;gap:15px}}:host .wrapper .block{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:5px}:host .wrapper .limit>select{display:block;padding:2px 5px;font-size:inherit;outline:none!important;width:50px}:host .wrapper .nav>button{display:block;background-color:transparent;box-shadow:none!important;outline:none!important;cursor:pointer;border:none;padding:0}:host .wrapper .nav>button:disabled{cursor:default;color:#aaa}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
673
- }
674
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxPaginationInfo, decorators: [{
675
- type: Component,
676
- args: [{ selector: 'ngf-pagination-info', imports: [
677
- FormsModule,
678
- ], template: "<div class=\"wrapper\">\n <div class=\"block limit\">\n <div>Per page</div>\n <select name=\"\" id=\"\" [(ngModel)]=\"limit\">\n @for (entry of limitEntries(); track $index) {\n <option [value]=\"entry\">{{ entry }}</option>\n }\n </select>\n </div>\n\n <div class=\"block info\">\n <div>{{ info() }}</div>\n </div>\n\n <div class=\"block nav\">\n <button (click)=\"prev()\" [disabled]=\"disablePrev()\">\n <i class=\"ngf-icon chevron-left\"></i>\n </button>\n\n <button (click)=\"next()\" [disabled]=\"disableNext()\">\n <i class=\"ngf-icon chevron-right\"></i>\n </button>\n </div>\n</div>\n", styles: [":host{display:block;container:pagination/inline-size}:host .wrapper{display:flex;flex-direction:column;font-family:Poppins,sans-serif;align-items:end;text-align:center;font-size:.8rem;gap:5px}@container pagination (min-width: 400px){:host .wrapper{flex-direction:row;justify-content:end;align-items:center;gap:15px}}:host .wrapper .block{display:flex;flex-direction:row;justify-content:center;align-items:center;gap:5px}:host .wrapper .limit>select{display:block;padding:2px 5px;font-size:inherit;outline:none!important;width:50px}:host .wrapper .nav>button{display:block;background-color:transparent;box-shadow:none!important;outline:none!important;cursor:pointer;border:none;padding:0}:host .wrapper .nav>button:disabled{cursor:default;color:#aaa}\n"] }]
679
- }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], callback: [{ type: i0.Output, args: ["callback"] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: true }] }, { type: i0.Output, args: ["limitChange"] }], limitEntries: [{ type: i0.Input, args: [{ isSignal: true, alias: "limitEntries", required: true }] }] } });
680
-
681
- class NgFluxPagination {
682
- config = inject(NGF_CONFIG);
683
- data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
684
- preload = input(this.config.pagination?.preload ?? false, ...(ngDevMode ? [{ debugName: "preload" }] : /* istanbul ignore next */ []));
685
- transform = input(...(ngDevMode ? [undefined, { debugName: "transform" }] : /* istanbul ignore next */ []));
686
- limit = model(this.config.pagination?.limit ?? 10, ...(ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []));
687
- limitEntries = input(this.config.pagination?.limitEntries ?? [5, 10, 20, 30, 40, 50], ...(ngDevMode ? [{ debugName: "limitEntries" }] : /* istanbul ignore next */ []));
688
- callback = output();
689
- value = computed(() => {
690
- const { config } = this;
691
- const data = this.data();
692
- const transform = this.transform() ?? config.pagination?.transform;
693
- if (!transform)
694
- return data;
695
- return {
696
- currentPage: transform.getCurrentPage(data),
697
- lastPage: transform.getLastPage(data),
698
- perPage: transform.getPerPage(data),
699
- from: transform.getFrom(data),
700
- to: transform.getTo(data),
701
- total: transform.getTotal(data),
702
- data: transform.getData(data),
703
- };
704
- }, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
705
- constructor() {
706
- let init = false;
707
- effect(() => {
708
- const limit = Number(this.limit());
709
- const preload = untracked(this.preload);
710
- const { currentPage: page } = untracked(this.value);
711
- if (preload || init) {
712
- this.callback.emit({ limit, page });
713
- }
714
- init = true;
715
- });
716
- }
717
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxPagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
718
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.14", type: NgFluxPagination, isStandalone: true, selector: "ngf-pagination", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, preload: { classPropertyName: "preload", publicName: "preload", isSignal: true, isRequired: false, transformFunction: null }, transform: { classPropertyName: "transform", publicName: "transform", isSignal: true, isRequired: false, transformFunction: null }, limit: { classPropertyName: "limit", publicName: "limit", isSignal: true, isRequired: false, transformFunction: null }, limitEntries: { classPropertyName: "limitEntries", publicName: "limitEntries", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { limit: "limitChange", callback: "callback" }, ngImport: i0, template: "<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitEntries]=\"limitEntries()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n\n<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitEntries]=\"limitEntries()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n", styles: [":host{display:block}:host>.content{margin:20px 0}\n"], dependencies: [{ kind: "component", type: NgFluxPaginationInfo, selector: "ngf-pagination-info", inputs: ["data", "limit", "limitEntries"], outputs: ["callback", "limitChange"] }] });
719
- }
720
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgFluxPagination, decorators: [{
721
- type: Component,
722
- args: [{ selector: 'ngf-pagination', imports: [
723
- NgFluxPaginationInfo,
724
- ], template: "<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitEntries]=\"limitEntries()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n\n<div class=\"content\">\n <ng-content></ng-content>\n</div>\n\n<ngf-pagination-info\n [data]=\"value()\"\n [(limit)]=\"limit\"\n [limitEntries]=\"limitEntries()\"\n (callback)=\"callback.emit($event)\"\n></ngf-pagination-info>\n", styles: [":host{display:block}:host>.content{margin:20px 0}\n"] }]
725
- }], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], preload: [{ type: i0.Input, args: [{ isSignal: true, alias: "preload", required: false }] }], transform: [{ type: i0.Input, args: [{ isSignal: true, alias: "transform", required: false }] }], limit: [{ type: i0.Input, args: [{ isSignal: true, alias: "limit", required: false }] }, { type: i0.Output, args: ["limitChange"] }], limitEntries: [{ type: i0.Input, args: [{ isSignal: true, alias: "limitEntries", required: false }] }], callback: [{ type: i0.Output, args: ["callback"] }] } });
726
-
727
- // export * from './pagination/info/info.component';
728
-
729
784
  /*
730
785
  * Public API Surface of ngflux
731
786
  */
@@ -734,5 +789,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
734
789
  * Generated bundle index. Do not edit.
735
790
  */
736
791
 
737
- export { NGF_CONFIG, NGF_DIALOG_DATA, NgFluxButton, NgFluxDialog, NgFluxDialogBodyComponent, NgFluxDialogFooterComponent, NgFluxDialogHeaderComponent, NgFluxDialogInstance, NgFluxDialogRef, NgFluxDialogRootComponent, NgFluxLoading, NgFluxLoadingRootComponent, NgFluxPagination, NgFluxRootComponent, provideNgFlux };
792
+ export { NGF_CONFIG, NGF_DIALOG_DATA, NgFluxButton, NgFluxDialog, NgFluxDialogBodyComponent, NgFluxDialogFooterComponent, NgFluxDialogHeaderComponent, NgFluxDialogInstance, NgFluxDialogRef, NgFluxDialogRootComponent, NgFluxLoading, NgFluxLoadingRootComponent, NgFluxPagination, provideNgFlux };
738
793
  //# sourceMappingURL=ngflux-ngflux.mjs.map