ngx-kit 3.1.0 → 4.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.
@@ -1,43 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EnvironmentProviders, Injector, OnInit, AfterViewInit, ElementRef, ComponentRef, ApplicationRef, EnvironmentInjector } from '@angular/core';
2
+ import { EnvironmentProviders, Injector, EventEmitter, OnInit, AfterViewInit, ElementRef, ComponentRef, ApplicationRef, EnvironmentInjector, InjectionToken } from '@angular/core';
3
+ import * as ngx_kit_message from 'ngx-kit/message';
3
4
  import * as rxjs from 'rxjs';
4
5
  import { SafeHtml, DomSanitizer } from '@angular/platform-browser';
5
6
 
6
- declare class MessageOptions implements IMessageOptions {
7
- private config?;
8
- constructor(config?: IMessageOptions | undefined);
9
- /**
10
- * add popover manual to set alert dialog container to top layer
11
- * - usefull when using alert modal in angular material dialog
12
- *
13
- */
14
- useOverlay?: boolean;
15
- title?: string;
16
- text?: string;
17
- html?: string | HTMLElement;
18
- backdrop?: boolean;
19
- icon?: MessageIcon;
20
- width?: number | string;
21
- allowOutsideClick?: boolean;
22
- allowEscapeKey?: boolean;
23
- allowEnterKey?: boolean;
24
- showConfirmButton?: boolean;
25
- showDenyButton?: boolean;
26
- showCancelButton?: boolean;
27
- confirmButtonText: string;
28
- denyButtonText?: string;
29
- cancelButtonText?: string;
30
- confirmButtonColor?: string;
31
- denyButtonColor?: string;
32
- cancelButtonColor?: string;
33
- confirmButtonAriaLabel?: string;
34
- denyButtonAriaLabel?: string;
35
- cancelButtonAriaLabel?: string;
36
- reverseButtons?: boolean;
37
- showCloseButton?: boolean;
38
- containerClass?: string;
39
- }
40
-
41
7
  type MessageIcon = 'None' | 'success' | 'error' | 'warning' | 'info' | 'question' | 'loading';
42
8
 
43
9
  interface IMessageOptions {
@@ -195,6 +161,26 @@ interface IMessageOptions {
195
161
 
196
162
  declare function provideMessage(options?: IMessageOptions): EnvironmentProviders;
197
163
 
164
+ /**
165
+ * Static facade so call sites can use: MSG.warn('msg', opts)
166
+ * Module will set the service instance in its constructor.
167
+ */
168
+ declare class MSG {
169
+ static injector: Injector;
170
+ static show<T = any>(options?: IMessageOptions): ngx_kit_message.MessageOutput<T>;
171
+ static fire(options?: IMessageOptions): ngx_kit_message.MessageOutput<any>;
172
+ static info(title: string, text?: string, options?: IMessageOptions): ngx_kit_message.MessageOutput<any>;
173
+ static success(title: string, text?: string, options?: IMessageOptions): ngx_kit_message.MessageOutput<any>;
174
+ static warning(title: string, text?: string, options?: IMessageOptions): ngx_kit_message.MessageOutput<any>;
175
+ static error(title: string, text?: string, options?: IMessageOptions): ngx_kit_message.MessageOutput<any>;
176
+ static loading(title: string, text?: string, options?: IMessageOptions): ngx_kit_message.MessageOutput<any>;
177
+ }
178
+
179
+ type MessageOutput<T = any> = {
180
+ id: number;
181
+ close: () => void;
182
+ afterClose: EventEmitter<MessageResult>;
183
+ };
198
184
  interface MessageResult<T = any> {
199
185
  readonly isConfirmed: boolean;
200
186
  readonly isDenied: boolean;
@@ -213,29 +199,15 @@ declare enum DismissReason {
213
199
  backdrop = 1,
214
200
  close = 2,
215
201
  /**
216
- * @description ❌⚠️NOT Implemented!⚠️❌
217
- */
202
+ * @description ❌⚠️NOT Implemented!⚠️❌
203
+ */
218
204
  esc = 3,
219
205
  /**
220
- * @description ❌⚠️NOT Implemented!⚠️❌
221
- */
206
+ * @description ❌⚠️NOT Implemented!⚠️❌
207
+ */
222
208
  timer = 4
223
209
  }
224
210
 
225
- /**
226
- * Static facade so call sites can use: MSG.warn('msg', opts)
227
- * Module will set the service instance in its constructor.
228
- */
229
- declare class MSG {
230
- static injector: Injector;
231
- static show(options?: IMessageOptions): Promise<MessageResult<any>>;
232
- static fire(options?: IMessageOptions): Promise<MessageResult<any>>;
233
- static info(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
234
- static success(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
235
- static warning(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
236
- static error(title: string, text?: string, options?: IMessageOptions): Promise<MessageResult<any>>;
237
- }
238
-
239
211
  declare class NgxMessageComponent implements OnInit, AfterViewInit {
240
212
  icon?: SafeHtml;
241
213
  showIcon: i0.WritableSignal<boolean>;
@@ -272,7 +244,7 @@ declare class NgxMessageService {
272
244
  alerts: ComponentRef<NgxMessageComponent>[];
273
245
  insertedId: number;
274
246
  constructor(appRef: ApplicationRef, injector: Injector, envInjector: EnvironmentInjector, _doc: Document);
275
- show(c?: IMessageOptions): Promise<MessageResult<any>>;
247
+ show<T = any>(c?: IMessageOptions): MessageOutput<T>;
276
248
  private removeDialogComponentFromBody;
277
249
  private appendDialogComponentToBody;
278
250
  closeAll(): void;
@@ -280,5 +252,44 @@ declare class NgxMessageService {
280
252
  static ɵprov: i0.ɵɵInjectableDeclaration<NgxMessageService>;
281
253
  }
282
254
 
283
- export { DismissReason, MSG, MessageOptions, NgxMessageService, provideMessage };
284
- export type { IMessageOptions, MessageResult };
255
+ declare class MessageOptions implements IMessageOptions {
256
+ private config?;
257
+ constructor(config?: IMessageOptions | undefined);
258
+ /**
259
+ * add popover manual to set alert dialog container to top layer
260
+ * - usefull when using alert modal in angular material dialog
261
+ *
262
+ */
263
+ useOverlay?: boolean;
264
+ title?: string;
265
+ text?: string;
266
+ html?: string | HTMLElement;
267
+ backdrop?: boolean;
268
+ icon?: MessageIcon;
269
+ width?: number | string;
270
+ allowOutsideClick?: boolean;
271
+ allowEscapeKey?: boolean;
272
+ allowEnterKey?: boolean;
273
+ showConfirmButton?: boolean;
274
+ showDenyButton?: boolean;
275
+ showCancelButton?: boolean;
276
+ confirmButtonText: string;
277
+ denyButtonText?: string;
278
+ cancelButtonText?: string;
279
+ confirmButtonColor?: string;
280
+ denyButtonColor?: string;
281
+ cancelButtonColor?: string;
282
+ confirmButtonAriaLabel?: string;
283
+ denyButtonAriaLabel?: string;
284
+ cancelButtonAriaLabel?: string;
285
+ reverseButtons?: boolean;
286
+ showCloseButton?: boolean;
287
+ containerClass?: string;
288
+ }
289
+
290
+ declare const NGX_MESSAGE_CONFIGS: InjectionToken<IMessageOptions>;
291
+ declare const NGX_MESSAGE_API: InjectionToken<NgxMessageService>;
292
+ declare const NGX_MESSAGE_DEFAULT_OPTIONS: MessageOptions;
293
+
294
+ export { DismissReason, MSG, MessageOptions, NGX_MESSAGE_API, NGX_MESSAGE_CONFIGS, NGX_MESSAGE_DEFAULT_OPTIONS, NgxMessageService, provideMessage };
295
+ export type { IMessageOptions, MessageOutput, MessageResult };
@@ -165,6 +165,8 @@ declare class SliderComponent implements OnInit, ControlValueAccessor, Validator
165
165
  static ɵcmp: i0.ɵɵComponentDeclaration<SliderComponent, "slider", never, { "step": { "alias": "step"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "background": { "alias": "background"; "required": false; }; "isBgTransparent": { "alias": "isBgTransparent"; "required": false; }; }, { "change": "change"; }, never, ["*"], true, never>;
166
166
  }
167
167
 
168
+ declare function mergeConfig<T>(base: T, override?: Partial<T>): T;
169
+
168
170
  declare function getOffsetPosition(evt: MouseEvent | TouchEvent, parent: HTMLElement): {
169
171
  x: number;
170
172
  y: number;
@@ -274,5 +276,5 @@ interface OverlayInstance {
274
276
  cleanup: () => void;
275
277
  }
276
278
 
277
- export { BrowserService, DIALOG_OVERLAY_CLASSNAME, FOCUSABLE_SELECTOR, IsRtl, OverlayRef, OverlayService, RangeSliderComponent, SaturationComponent, SliderComponent, ValueModel, WINDOW, getOffsetPosition, makeConfetti, randomStrnig };
279
+ export { BrowserService, DIALOG_OVERLAY_CLASSNAME, FOCUSABLE_SELECTOR, IsRtl, OverlayRef, OverlayService, RangeSliderComponent, SaturationComponent, SliderComponent, ValueModel, WINDOW, getOffsetPosition, makeConfetti, mergeConfig, randomStrnig };
278
280
  export type { Alignment, BaseOverlayOptions, IPosition, IValue, OverlayInstance, OverlayOptions, Placement, Point, TemplateOptions };