ngx-kit 2.0.2 → 3.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.
- package/fesm2022/ngx-kit-menu.mjs +8 -13
- package/fesm2022/ngx-kit-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +350 -0
- package/fesm2022/ngx-kit-message.mjs.map +1 -0
- package/fesm2022/ngx-kit-notify.mjs +157 -90
- package/fesm2022/ngx-kit-notify.mjs.map +1 -1
- package/fesm2022/ngx-kit-shared.mjs +9 -4
- package/fesm2022/ngx-kit-shared.mjs.map +1 -1
- package/package.json +5 -1
- package/types/ngx-kit-menu.d.ts +1 -1
- package/types/ngx-kit-message.d.ts +276 -0
- package/types/ngx-kit-notify.d.ts +92 -8
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EnvironmentProviders, Injector, ComponentRef, ApplicationRef, EnvironmentInjector } from '@angular/core';
|
|
3
|
+
import * as rxjs from 'rxjs';
|
|
4
|
+
|
|
5
|
+
declare class MessageOptions implements IMessageOptions {
|
|
6
|
+
private config?;
|
|
7
|
+
constructor(config?: IMessageOptions | undefined);
|
|
8
|
+
/**
|
|
9
|
+
* add popover manual to set alert dialog container to top layer
|
|
10
|
+
* - usefull when using alert modal in angular material dialog
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
useOverlay?: boolean;
|
|
14
|
+
title?: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
html?: string | HTMLElement;
|
|
17
|
+
backdrop?: boolean;
|
|
18
|
+
icon?: MessageIcon;
|
|
19
|
+
width?: number | string;
|
|
20
|
+
allowOutsideClick?: boolean;
|
|
21
|
+
allowEscapeKey?: boolean;
|
|
22
|
+
allowEnterKey?: boolean;
|
|
23
|
+
showConfirmButton?: boolean;
|
|
24
|
+
showDenyButton?: boolean;
|
|
25
|
+
showCancelButton?: boolean;
|
|
26
|
+
confirmButtonText: string;
|
|
27
|
+
denyButtonText?: string;
|
|
28
|
+
cancelButtonText?: string;
|
|
29
|
+
confirmButtonColor?: string;
|
|
30
|
+
denyButtonColor?: string;
|
|
31
|
+
cancelButtonColor?: string;
|
|
32
|
+
confirmButtonAriaLabel?: string;
|
|
33
|
+
denyButtonAriaLabel?: string;
|
|
34
|
+
cancelButtonAriaLabel?: string;
|
|
35
|
+
reverseButtons?: boolean;
|
|
36
|
+
showCloseButton?: boolean;
|
|
37
|
+
containerClass?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type MessageIcon = 'None' | 'success' | 'error' | 'warning' | 'info' | 'question';
|
|
41
|
+
|
|
42
|
+
interface IMessageOptions {
|
|
43
|
+
/**
|
|
44
|
+
* add popover manual to set alert dialog container to top layer
|
|
45
|
+
* - usefull when using alert modal in angular material dialog
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
useOverlay?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The title of the popup
|
|
51
|
+
*
|
|
52
|
+
* @default ''
|
|
53
|
+
*/
|
|
54
|
+
title?: string;
|
|
55
|
+
/**
|
|
56
|
+
* A description for the popup.
|
|
57
|
+
*
|
|
58
|
+
* @default ''
|
|
59
|
+
*/
|
|
60
|
+
text?: string;
|
|
61
|
+
/**
|
|
62
|
+
* A HTML description for the popup.
|
|
63
|
+
*
|
|
64
|
+
* [Security] we does NOT sanitize this parameter. It is the developer's responsibility
|
|
65
|
+
* to escape any user input when using the `html` option, so XSS attacks would be prevented.
|
|
66
|
+
*
|
|
67
|
+
* @default ''
|
|
68
|
+
*/
|
|
69
|
+
html?: string | HTMLElement;
|
|
70
|
+
/**
|
|
71
|
+
* Whether or not should show a full screen click-to-dismiss backdrop.
|
|
72
|
+
* Either a boolean value or a css background value (hex, rgb, rgba, url, etc.)
|
|
73
|
+
*
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
backdrop?: boolean;
|
|
77
|
+
icon?: MessageIcon;
|
|
78
|
+
/**
|
|
79
|
+
* Popup width, including paddings (`box-sizing: border-box`).
|
|
80
|
+
*
|
|
81
|
+
* @default undefined
|
|
82
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
83
|
+
*/
|
|
84
|
+
width?: number | string;
|
|
85
|
+
/**
|
|
86
|
+
* If set to `false`, the user can't dismiss the popup by clicking outside it.
|
|
87
|
+
*
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
allowOutsideClick?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* If set to `false`, the user can't dismiss the popup by pressing the Escape key.
|
|
93
|
+
*
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
allowEscapeKey?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* If set to `false`, the user can't confirm the popup by pressing the Enter or Space keys,
|
|
99
|
+
* unless they manually focus the confirm button.
|
|
100
|
+
*
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
allowEnterKey?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* If set to `false`, the "Confirm" button will not be shown.
|
|
106
|
+
*
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
showConfirmButton?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* If set to `true`, the "Deny" button will be shown, which the user can click on to deny the popup.
|
|
112
|
+
*
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
showDenyButton?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* If set to `true`, the "Cancel" button will be shown, which the user can click on to dismiss the popup.
|
|
118
|
+
*
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
showCancelButton?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Use this to change the text on the "Confirm" button.
|
|
124
|
+
*
|
|
125
|
+
* @default 'OK'
|
|
126
|
+
*/
|
|
127
|
+
confirmButtonText?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Use this to change the text on the "Confirm" button.
|
|
130
|
+
*
|
|
131
|
+
* @default 'No'
|
|
132
|
+
*/
|
|
133
|
+
denyButtonText?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Use this to change the text on the "Cancel" button.
|
|
136
|
+
*
|
|
137
|
+
* @default 'Cancel'
|
|
138
|
+
*/
|
|
139
|
+
cancelButtonText?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Use this to change the background color of the "Confirm" button.
|
|
142
|
+
*
|
|
143
|
+
* @default undefined
|
|
144
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
145
|
+
*/
|
|
146
|
+
confirmButtonColor?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Use this to change the background color of the "Deny" button.
|
|
149
|
+
*
|
|
150
|
+
* @default undefined
|
|
151
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
152
|
+
*/
|
|
153
|
+
denyButtonColor?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Use this to change the background color of the "Cancel" button.
|
|
156
|
+
*
|
|
157
|
+
* @default undefined
|
|
158
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
159
|
+
*/
|
|
160
|
+
cancelButtonColor?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Use this to change the `aria-label` for the "Confirm" button.
|
|
163
|
+
*
|
|
164
|
+
* @default ''
|
|
165
|
+
*/
|
|
166
|
+
confirmButtonAriaLabel?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Use this to change the `aria-label` for the "Deny" button.
|
|
169
|
+
*
|
|
170
|
+
* @default ''
|
|
171
|
+
*/
|
|
172
|
+
denyButtonAriaLabel?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Use this to change the `aria-label` for the "Cancel" button.
|
|
175
|
+
*
|
|
176
|
+
* @default ''
|
|
177
|
+
*/
|
|
178
|
+
cancelButtonAriaLabel?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Set to `true` if you want to invert default buttons positions.
|
|
181
|
+
*
|
|
182
|
+
* @default false
|
|
183
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
184
|
+
*/
|
|
185
|
+
reverseButtons?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Set to `true` to show close button.
|
|
188
|
+
*
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
showCloseButton?: boolean;
|
|
192
|
+
containerClass?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare function provideMessage(options?: IMessageOptions): EnvironmentProviders;
|
|
196
|
+
|
|
197
|
+
interface MessageResult<T = any> {
|
|
198
|
+
readonly isConfirmed: boolean;
|
|
199
|
+
readonly isDenied: boolean;
|
|
200
|
+
readonly isDismissed: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
203
|
+
*/
|
|
204
|
+
readonly value?: T;
|
|
205
|
+
readonly dismiss?: DismissReason;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* An enum of possible reasons that can explain an alert dismissal.
|
|
209
|
+
*/
|
|
210
|
+
declare enum DismissReason {
|
|
211
|
+
cancel = 0,
|
|
212
|
+
backdrop = 1,
|
|
213
|
+
close = 2,
|
|
214
|
+
/**
|
|
215
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
216
|
+
*/
|
|
217
|
+
esc = 3,
|
|
218
|
+
/**
|
|
219
|
+
* @description ❌⚠️NOT Implemented!⚠️❌
|
|
220
|
+
*/
|
|
221
|
+
timer = 4
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Static facade so call sites can use: MSG.warn('msg', opts)
|
|
226
|
+
* Module will set the service instance in its constructor.
|
|
227
|
+
*/
|
|
228
|
+
declare class MSG {
|
|
229
|
+
static injector: Injector;
|
|
230
|
+
static show(options?: IMessageOptions): Promise<MessageResult<any>>;
|
|
231
|
+
static fire(options?: IMessageOptions): Promise<MessageResult<any>>;
|
|
232
|
+
static info(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
|
|
233
|
+
static success(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
|
|
234
|
+
static warning(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
|
|
235
|
+
static error(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
declare class NgxMessageComponent {
|
|
239
|
+
options: IMessageOptions;
|
|
240
|
+
index: number;
|
|
241
|
+
private readonly _onClose;
|
|
242
|
+
onClose: rxjs.Observable<{
|
|
243
|
+
index: number;
|
|
244
|
+
result: MessageResult<any>;
|
|
245
|
+
}>;
|
|
246
|
+
onScapeKey(event: Event): void;
|
|
247
|
+
onEnterKey(event: Event): void;
|
|
248
|
+
onConfirm(): void;
|
|
249
|
+
onCancel(): void;
|
|
250
|
+
onDeny(): void;
|
|
251
|
+
close(): void;
|
|
252
|
+
onOutSideClick(): void;
|
|
253
|
+
innerOnClick(ev: Event): void;
|
|
254
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMessageComponent, never>;
|
|
255
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxMessageComponent, "ngx-message", never, {}, {}, never, never, true, never>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
declare class NgxMessageService {
|
|
259
|
+
private appRef;
|
|
260
|
+
private injector;
|
|
261
|
+
private envInjector;
|
|
262
|
+
private _doc;
|
|
263
|
+
currentAdIndex: number;
|
|
264
|
+
alerts: ComponentRef<NgxMessageComponent>[];
|
|
265
|
+
insertedId: number;
|
|
266
|
+
constructor(appRef: ApplicationRef, injector: Injector, envInjector: EnvironmentInjector, _doc: Document);
|
|
267
|
+
show(c?: IMessageOptions): Promise<MessageResult<any>>;
|
|
268
|
+
private removeDialogComponentFromBody;
|
|
269
|
+
private appendDialogComponentToBody;
|
|
270
|
+
closeAll(): void;
|
|
271
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMessageService, never>;
|
|
272
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxMessageService>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export { DismissReason, MSG, MessageOptions, NgxMessageService, provideMessage };
|
|
276
|
+
export type { IMessageOptions, MessageResult };
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { EventEmitter, EnvironmentProviders, Injector, OnInit, OnDestroy, ElementRef, ChangeDetectorRef, InjectionToken } from '@angular/core';
|
|
3
|
+
import { SafeHtml, DomSanitizer } from '@angular/platform-browser';
|
|
4
|
+
|
|
5
|
+
type NgxNotifyType = 'success' | 'error' | 'warning' | 'info';
|
|
6
|
+
type NgxNotifyPositionType = 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
|
|
7
|
+
interface NgxNotifyPayload {
|
|
8
|
+
id: string;
|
|
9
|
+
message: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
type: NgxNotifyType;
|
|
12
|
+
options: NgxNotifyOptions;
|
|
13
|
+
onClose: EventEmitter<INotifyEnd>;
|
|
14
|
+
onFinish: EventEmitter<INotifyEnd>;
|
|
15
|
+
}
|
|
16
|
+
interface INotifyEnd {
|
|
17
|
+
id: string;
|
|
18
|
+
el: HTMLElement;
|
|
19
|
+
}
|
|
2
20
|
|
|
3
21
|
interface NgxNotifyOptions {
|
|
4
22
|
/**
|
|
@@ -10,7 +28,7 @@ interface NgxNotifyOptions {
|
|
|
10
28
|
* Notify position
|
|
11
29
|
* @default top-center
|
|
12
30
|
*/
|
|
13
|
-
position?:
|
|
31
|
+
position?: NgxNotifyPositionType;
|
|
14
32
|
/**
|
|
15
33
|
* How many visible at once
|
|
16
34
|
* queued, prevents overlap
|
|
@@ -32,6 +50,11 @@ interface NgxNotifyOptions {
|
|
|
32
50
|
* @default true
|
|
33
51
|
*/
|
|
34
52
|
dismissible?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* close on tap notify
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
closeOnTap?: boolean;
|
|
35
58
|
/**
|
|
36
59
|
* Additional container class
|
|
37
60
|
*/
|
|
@@ -50,11 +73,72 @@ declare function provideNotify(options?: NgxNotifyOptions): EnvironmentProviders
|
|
|
50
73
|
*/
|
|
51
74
|
declare class Notify {
|
|
52
75
|
static injector: Injector;
|
|
53
|
-
static show(
|
|
54
|
-
static info(message: string, options?: NgxNotifyOptions):
|
|
55
|
-
static success(message: string, options?: NgxNotifyOptions):
|
|
56
|
-
static warning(message: string, options?: NgxNotifyOptions):
|
|
57
|
-
static error(message: string, options?: NgxNotifyOptions):
|
|
76
|
+
static show(type: "info" | "success" | "warning" | "error" | undefined, message: string, description?: string, options?: NgxNotifyOptions): NgxNotifyPayload;
|
|
77
|
+
static info(message: string, description?: string, options?: NgxNotifyOptions): NgxNotifyPayload;
|
|
78
|
+
static success(message: string, description?: string, options?: NgxNotifyOptions): NgxNotifyPayload;
|
|
79
|
+
static warning(message: string, description?: string, options?: NgxNotifyOptions): NgxNotifyPayload;
|
|
80
|
+
static error(message: string, description?: string, options?: NgxNotifyOptions): NgxNotifyPayload;
|
|
58
81
|
}
|
|
59
82
|
|
|
60
|
-
|
|
83
|
+
declare class NgxNotificationComponent implements OnInit, OnDestroy {
|
|
84
|
+
payload: _angular_core.InputSignal<NgxNotifyPayload>;
|
|
85
|
+
containerClass: string;
|
|
86
|
+
bar: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
|
|
87
|
+
onClose: _angular_core.OutputEmitterRef<INotifyEnd>;
|
|
88
|
+
onFinish: _angular_core.OutputEmitterRef<INotifyEnd>;
|
|
89
|
+
private _rafId;
|
|
90
|
+
private _duration;
|
|
91
|
+
private _remaining;
|
|
92
|
+
private _endTs;
|
|
93
|
+
private _paused;
|
|
94
|
+
safeMessage: SafeHtml | string;
|
|
95
|
+
safeDescription: SafeHtml | string;
|
|
96
|
+
showClass: _angular_core.WritableSignal<string>;
|
|
97
|
+
protected doc: Document;
|
|
98
|
+
protected el: ElementRef<any>;
|
|
99
|
+
protected sanitizer: DomSanitizer;
|
|
100
|
+
protected chdr: ChangeDetectorRef;
|
|
101
|
+
constructor();
|
|
102
|
+
ngOnInit(): void;
|
|
103
|
+
ngOnDestroy(): void;
|
|
104
|
+
startTimer(ms: number): void;
|
|
105
|
+
pauseTimer(): void;
|
|
106
|
+
resumeTimer(): void;
|
|
107
|
+
private clearTimer;
|
|
108
|
+
private animateProgress;
|
|
109
|
+
close(ev?: Event): void;
|
|
110
|
+
onMouseEnter(): void;
|
|
111
|
+
onMouseLeave(): void;
|
|
112
|
+
onTap(): void;
|
|
113
|
+
escapeHtml(input?: string): string;
|
|
114
|
+
ngOnDestroyCleanup(): void;
|
|
115
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxNotificationComponent, never>;
|
|
116
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgxNotificationComponent, "ngx-notification", never, { "payload": { "alias": "payload"; "required": true; "isSignal": true; }; "containerClass": { "alias": "containerClass"; "required": false; }; }, { "onClose": "onClose"; "onFinish": "onFinish"; }, never, never, true, never>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class NgxNotifyService {
|
|
120
|
+
private queue;
|
|
121
|
+
private visible;
|
|
122
|
+
private container;
|
|
123
|
+
private envInjector;
|
|
124
|
+
private appRef;
|
|
125
|
+
private doc;
|
|
126
|
+
private win;
|
|
127
|
+
private defaultOptions;
|
|
128
|
+
constructor();
|
|
129
|
+
configureContainer(position: NgxNotifyOptions['position'], containerClass: string): void;
|
|
130
|
+
show(message: string, description?: string, type?: NgxNotifyType, options?: NgxNotifyOptions): NgxNotifyPayload;
|
|
131
|
+
private _createAndShow;
|
|
132
|
+
private removeNode;
|
|
133
|
+
private removeEl;
|
|
134
|
+
private _showNextIfPossible;
|
|
135
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgxNotifyService, never>;
|
|
136
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgxNotifyService>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare const NGX_NOTIFY_CONFIG: InjectionToken<NgxNotifyOptions>;
|
|
140
|
+
declare const NGX_NOTIFY_API: InjectionToken<NgxNotifyService>;
|
|
141
|
+
declare const NGX_NOTIFY_DEFAULTS: Required<NgxNotifyOptions>;
|
|
142
|
+
|
|
143
|
+
export { NGX_NOTIFY_API, NGX_NOTIFY_CONFIG, NGX_NOTIFY_DEFAULTS, NgxNotificationComponent, Notify, provideNotify };
|
|
144
|
+
export type { INotifyEnd, NgxNotifyOptions, NgxNotifyPayload, NgxNotifyPositionType, NgxNotifyType };
|