@ngflux/ngflux 1.0.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.
@@ -0,0 +1,254 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { InjectionToken, Signal, ViewContainerRef, Injector } from '@angular/core';
3
+ import * as _ngflux_ngflux from '@ngflux/ngflux';
4
+ import * as rxjs from 'rxjs';
5
+ import { Observable } from 'rxjs';
6
+
7
+ type ButtonDirection = 'normal' | 'reversed';
8
+ type ButtonTheme = 'default' | 'primary' | 'secondary' | 'error' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
9
+ type ButtonType = 'submit' | 'button' | 'reset' | 'menu';
10
+ type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
11
+ type ButtonOptions = {
12
+ icon?: string;
13
+ text: string;
14
+ theme?: ButtonTheme;
15
+ direction?: ButtonDirection;
16
+ size?: ButtonSize;
17
+ };
18
+
19
+ interface NgFluxComponent<T = any> {
20
+ new (...args: any[]): T;
21
+ }
22
+
23
+ type Pagination<T = any> = {
24
+ currentPage: number;
25
+ from: number;
26
+ lastPage: number;
27
+ perPage: number;
28
+ to: number;
29
+ total: number;
30
+ data: T[];
31
+ };
32
+ type PaginationTransformer<T = any> = {
33
+ getCurrentPage: (data: any) => number;
34
+ getFrom: (data: any) => number;
35
+ getLastPage: (data: any) => number;
36
+ getPerPage: (data: any) => number;
37
+ getTo: (data: any) => number;
38
+ getTotal: (data: any) => number;
39
+ getData: (data: any) => T[];
40
+ };
41
+ type PaginationInfo = {
42
+ limit: number;
43
+ page: number;
44
+ };
45
+
46
+ type LoadingOptions = {
47
+ component?: NgFluxComponent;
48
+ };
49
+ type DialogAlertOptions = {
50
+ okayButton?: ButtonOptions;
51
+ };
52
+ type DialogConfirmOptions = {
53
+ okayButton?: ButtonOptions;
54
+ cancelButton?: ButtonOptions;
55
+ };
56
+ type DialogPromptOptions = {
57
+ submitButton?: ButtonOptions;
58
+ cancelButton?: ButtonOptions;
59
+ };
60
+ type DialogOptions = {
61
+ alert?: DialogAlertOptions;
62
+ confirm?: DialogConfirmOptions;
63
+ prompt?: DialogPromptOptions;
64
+ };
65
+ type PaginationOptions = {
66
+ preload?: boolean;
67
+ transform?: PaginationTransformer;
68
+ limitEntries?: number[];
69
+ limit?: number;
70
+ };
71
+ type NgFluxConfig = {
72
+ loading?: LoadingOptions;
73
+ dialog?: DialogOptions;
74
+ pagination?: PaginationOptions;
75
+ };
76
+ declare const NGF_CONFIG: InjectionToken<NgFluxConfig>;
77
+
78
+ type OnClosed<T = any> = (cmd: NgFluxDialogCommand<T>) => void;
79
+ declare class NgFluxDialogRef<T = any> {
80
+ private readonly onClosed;
81
+ constructor(onClosed: OnClosed<T>);
82
+ readonly close: (value?: T) => void;
83
+ }
84
+
85
+ type NgFluxDialogRoot = {
86
+ viewContainer: Signal<ViewContainerRef>;
87
+ injector: Injector;
88
+ };
89
+ type NgFluxDialogConfig = {
90
+ closeOnEsc?: boolean;
91
+ closeOnBackBtn?: boolean;
92
+ backdropClose?: boolean;
93
+ closeBtn?: boolean;
94
+ data?: any;
95
+ };
96
+ type NgFluxDialogCommand<T = any> = {
97
+ name: string;
98
+ value?: T;
99
+ };
100
+ declare const NGF_DIALOG_DATA: InjectionToken<any>;
101
+ type NgFluxDialogEvents<T = any> = {
102
+ readonly closing: Observable<T | null>;
103
+ readonly closed: Observable<T | null>;
104
+ };
105
+ type NgFluxDialogButtonObj<T = any> = ButtonOptions & {
106
+ onClick?: (e: MouseEvent, btn: NgFluxDialogButton<T>, dialogRef: NgFluxDialogRef<T>) => void;
107
+ disabled?: () => boolean;
108
+ };
109
+ type NgFluxDialogButton<T = any> = 'flex' | NgFluxDialogButtonObj<T>;
110
+ type NgFluxDialogAlertOptions = {
111
+ title: string;
112
+ content: string;
113
+ buttons?: NgFluxDialogButton<boolean>[];
114
+ };
115
+ type NgFluxDialogConfirmOptions = {
116
+ title: string;
117
+ content: string;
118
+ okayButton?: NgFluxDialogButtonObj;
119
+ cancelButton?: NgFluxDialogButtonObj;
120
+ };
121
+ type NgFluxDialogPromptOptions = {
122
+ title: string;
123
+ content: string;
124
+ submitButton?: NgFluxDialogButtonObj;
125
+ cancelButton?: NgFluxDialogButtonObj;
126
+ };
127
+
128
+ type NgFluxLoadingEntry = {
129
+ text: string;
130
+ };
131
+
132
+ declare const provideNgFlux: (config?: NgFluxConfig) => _angular_core.EnvironmentProviders;
133
+
134
+ declare class NgFluxRootComponent {
135
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxRootComponent, never>;
136
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxRootComponent, "ngf-root", never, {}, {}, never, ["*"], true, never>;
137
+ }
138
+
139
+ declare class NgFluxButton {
140
+ private readonly ref;
141
+ readonly icon: _angular_core.InputSignal<string | undefined>;
142
+ readonly theme: _angular_core.InputSignal<ButtonTheme | undefined>;
143
+ readonly type: _angular_core.InputSignal<ButtonType | undefined>;
144
+ readonly size: _angular_core.InputSignal<ButtonSize | undefined>;
145
+ readonly direction: _angular_core.InputSignal<ButtonDirection | undefined>;
146
+ readonly block: _angular_core.InputSignal<boolean>;
147
+ readonly disabled: _angular_core.InputSignal<boolean>;
148
+ readonly btnClassNames: _angular_core.Signal<string[]>;
149
+ readonly classNames: _angular_core.Signal<string>;
150
+ get bindClass(): string;
151
+ get isBlock(): boolean;
152
+ get isDisabled(): boolean;
153
+ constructor();
154
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxButton, never>;
155
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxButton, "ngf-button", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "block": { "alias": "block"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
156
+ }
157
+
158
+ declare class NgFluxDialogBodyComponent {
159
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialogBodyComponent, never>;
160
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogBodyComponent, "ngf-dialog-body", never, {}, {}, never, ["*"], true, never>;
161
+ }
162
+
163
+ declare class NgFluxDialogFooterComponent {
164
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialogFooterComponent, never>;
165
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogFooterComponent, "ngf-dialog-footer", never, {}, {}, never, ["*"], true, never>;
166
+ }
167
+
168
+ declare class NgFluxLoading {
169
+ private readonly internal;
170
+ readonly data: _angular_core.Signal<_ngflux_ngflux.NgFluxLoadingEntry | undefined>;
171
+ readonly isLoading: _angular_core.Signal<boolean>;
172
+ start(text?: string): void;
173
+ stop(): void;
174
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxLoading, never>;
175
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgFluxLoading>;
176
+ }
177
+
178
+ declare class NgFluxDialog {
179
+ private readonly internal;
180
+ open<T = any>(component: NgFluxComponent<any>, config?: NgFluxDialogConfig): NgFluxDialogEvents<T>;
181
+ readonly closeAll: () => void;
182
+ alert(title: string, content: string, buttons?: NgFluxDialogButton[]): rxjs.Observable<boolean | null>;
183
+ success(title: string, message: string, buttons?: NgFluxDialogButton[]): rxjs.Observable<boolean | null>;
184
+ error(title: string, message: string, buttons?: NgFluxDialogButton[]): rxjs.Observable<boolean | null>;
185
+ confirm(data: NgFluxDialogConfirmOptions): rxjs.Observable<any>;
186
+ prompt(data: NgFluxDialogPromptOptions): rxjs.Observable<any>;
187
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialog, never>;
188
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgFluxDialog>;
189
+ }
190
+
191
+ type OnClosedFn<T = any> = (ins: NgFluxDialogInstance<T>) => void;
192
+ declare class NgFluxDialogInstance<T = any> {
193
+ private readonly viewContainer;
194
+ private readonly component;
195
+ private readonly injector;
196
+ private readonly onClosed;
197
+ readonly config: NgFluxDialogConfig;
198
+ private readonly xDialogComponentRef;
199
+ private readonly xClosing;
200
+ private readonly xAfterClosed;
201
+ readonly events: NgFluxDialogEvents<T>;
202
+ constructor(viewContainer: ViewContainerRef, component: NgFluxComponent<any>, injector: Injector, onClosed: OnClosedFn<T>, config: NgFluxDialogConfig);
203
+ private readonly onCommand;
204
+ private readonly afterClosedFn;
205
+ focus(): void;
206
+ close(data?: T): void;
207
+ send(cmd: NgFluxDialogCommand<T>): void;
208
+ }
209
+
210
+ declare class NgFluxDialogHeaderComponent {
211
+ readonly config: _ngflux_ngflux.NgFluxDialogConfig;
212
+ readonly dialogRef: NgFluxDialogRef<unknown>;
213
+ readonly icon: _angular_core.InputSignal<string | undefined>;
214
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialogHeaderComponent, never>;
215
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogHeaderComponent, "ngf-dialog-header", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
216
+ }
217
+
218
+ declare class NgFluxDialogRootComponent {
219
+ private readonly internal;
220
+ readonly injector: Injector;
221
+ readonly viewContainer: _angular_core.Signal<ViewContainerRef>;
222
+ constructor();
223
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialogRootComponent, never>;
224
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogRootComponent, "ngf-dialog-root", never, {}, {}, never, never, true, never>;
225
+ }
226
+
227
+ declare class NgFluxLoadingRootComponent {
228
+ private readonly config;
229
+ private readonly internal;
230
+ private readonly injector;
231
+ get isLoading(): boolean;
232
+ readonly viewContainer: _angular_core.Signal<ViewContainerRef>;
233
+ private componentRef;
234
+ constructor();
235
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxLoadingRootComponent, never>;
236
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxLoadingRootComponent, "ngf-loading-root", never, {}, {}, never, never, true, never>;
237
+ }
238
+
239
+ declare class NgFluxPagination {
240
+ private readonly config;
241
+ readonly data: _angular_core.InputSignal<any>;
242
+ readonly preload: _angular_core.InputSignal<boolean>;
243
+ readonly transform: _angular_core.InputSignal<PaginationTransformer | undefined>;
244
+ readonly limit: _angular_core.ModelSignal<number>;
245
+ readonly limitEntries: _angular_core.InputSignal<number[]>;
246
+ readonly callback: _angular_core.OutputEmitterRef<PaginationInfo>;
247
+ protected readonly value: _angular_core.Signal<Pagination>;
248
+ constructor();
249
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxPagination, never>;
250
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxPagination, "ngf-pagination", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "preload": { "alias": "preload"; "required": false; "isSignal": true; }; "transform": { "alias": "transform"; "required": false; "isSignal": true; }; "limit": { "alias": "limit"; "required": false; "isSignal": true; }; "limitEntries": { "alias": "limitEntries"; "required": false; "isSignal": true; }; }, { "limit": "limitChange"; "callback": "callback"; }, never, ["*"], true, never>;
251
+ }
252
+
253
+ export { NGF_CONFIG, NGF_DIALOG_DATA, NgFluxButton, NgFluxDialog, NgFluxDialogBodyComponent, NgFluxDialogFooterComponent, NgFluxDialogHeaderComponent, NgFluxDialogInstance, NgFluxDialogRef, NgFluxDialogRootComponent, NgFluxLoading, NgFluxLoadingRootComponent, NgFluxPagination, NgFluxRootComponent, provideNgFlux };
254
+ export type { ButtonDirection, ButtonOptions, ButtonSize, ButtonTheme, ButtonType, NgFluxComponent, NgFluxConfig, NgFluxDialogAlertOptions, NgFluxDialogButton, NgFluxDialogButtonObj, NgFluxDialogCommand, NgFluxDialogConfig, NgFluxDialogConfirmOptions, NgFluxDialogEvents, NgFluxDialogPromptOptions, NgFluxDialogRoot, NgFluxLoadingEntry, Pagination, PaginationInfo, PaginationTransformer };