@webilix/ngx-helper-m3 0.0.12 → 0.0.13

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,25 @@
1
+ import { AfterViewInit } from '@angular/core';
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { NgxHelperToastService } from '../../toast/ngx-helper-toast.service';
4
+ import { INgxHelperHttpDownloadConfig } from '../ngx-helper-http.interface';
5
+ import * as i0 from "@angular/core";
6
+ export declare class DownloadComponent implements AfterViewInit {
7
+ private readonly httpClient;
8
+ private readonly ngxHelperToastService;
9
+ private host;
10
+ private className;
11
+ bottom: string;
12
+ id: string;
13
+ path: string;
14
+ title: string;
15
+ config: Partial<INgxHelperHttpDownloadConfig>;
16
+ onSuccess: (arrayBuffer: ArrayBuffer) => void;
17
+ onError: () => void;
18
+ close: () => void;
19
+ progress: number;
20
+ constructor(httpClient: HttpClient, ngxHelperToastService: NgxHelperToastService);
21
+ ngAfterViewInit(): void;
22
+ download(): void;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<DownloadComponent, never>;
24
+ static ɵcmp: i0.ɵɵComponentDeclaration<DownloadComponent, "ng-component", never, {}, {}, never, never, true, never>;
25
+ }
@@ -1,3 +1,9 @@
1
+ export interface INgxHelperHttpDownloadConfig {
2
+ readonly method: 'GET' | 'POST' | 'PUT' | 'PATCH';
3
+ readonly header: {
4
+ [key: string]: any;
5
+ };
6
+ }
1
7
  export interface INgxHelperHttpUploadConfig {
2
8
  readonly method: 'POST' | 'PUT' | 'PATCH';
3
9
  readonly header: {
@@ -1,16 +1,27 @@
1
1
  import { ApplicationRef, Injector } from '@angular/core';
2
2
  import { HttpStatusCode } from '@angular/common/http';
3
- import { INgxHelperHttpUploadConfig } from './ngx-helper-http.interface';
3
+ import { NgxHelperToastService } from '../toast/ngx-helper-toast.service';
4
+ import { INgxHelperHttpDownloadConfig, INgxHelperHttpUploadConfig } from './ngx-helper-http.interface';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class NgxHelperHttpService {
6
7
  private readonly applicationRef;
7
8
  private readonly injector;
9
+ private readonly ngxHelperToastService;
8
10
  private components;
9
- constructor(applicationRef: ApplicationRef, injector: Injector);
11
+ constructor(applicationRef: ApplicationRef, injector: Injector, ngxHelperToastService: NgxHelperToastService);
10
12
  private getId;
11
13
  private updatePositions;
14
+ private getBuffer;
15
+ download(path: string, title: string): void;
16
+ download(path: string, title: string, config: Partial<INgxHelperHttpDownloadConfig>): void;
12
17
  upload<R, E>(file: File, url: string, onSuccess: (response: R | undefined, status: HttpStatusCode) => void, onError: (error: E | undefined, status: HttpStatusCode) => void): void;
13
18
  upload<R, E>(file: File, url: string, config: Partial<INgxHelperHttpUploadConfig>, onSuccess: (response: R, status: HttpStatusCode) => void, onError: (error: E, status: HttpStatusCode) => void): void;
19
+ printPDF(url: string): void;
20
+ printPDF(url: string, config: Partial<INgxHelperHttpDownloadConfig>): void;
21
+ printPDF(buffer: ArrayBuffer): void;
22
+ printPDF(buffer: ArrayBuffer, config: Partial<INgxHelperHttpDownloadConfig>): void;
23
+ printPDF(blob: Blob): void;
24
+ printPDF(blob: Blob, config: Partial<INgxHelperHttpDownloadConfig>): void;
14
25
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxHelperHttpService, never>;
15
26
  static ɵprov: i0.ɵɵInjectableDeclaration<NgxHelperHttpService>;
16
27
  }
@@ -4,8 +4,8 @@ import { INgxHelperHttpUploadConfig } from '../ngx-helper-http.interface';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class UploadComponent<R, E> implements AfterViewInit {
6
6
  private readonly httpClient;
7
- private className;
8
7
  private host;
8
+ private className;
9
9
  bottom: string;
10
10
  id: string;
11
11
  file: File;
@@ -2,6 +2,11 @@ import { EnvironmentProviders, InjectionToken } from '@angular/core';
2
2
  export interface INgxHelperConfig {
3
3
  readonly mobileWidth: number;
4
4
  readonly pageGroupSidebarWidth: string;
5
+ readonly toastTimeout: number;
6
+ readonly toastXPosition: 'LEFT' | 'CENTER' | 'RIGHT';
7
+ readonly toastAllowDuplicates: boolean;
8
+ readonly toastResetDuplicates: boolean;
9
+ readonly toastProgressAnimation: 'DECREASE' | 'INCREASE';
5
10
  readonly stickyView: {
6
11
  readonly top?: string | {
7
12
  readonly desktopView: string;
@@ -0,0 +1,4 @@
1
+ export interface INgxHelperToastConfig {
2
+ readonly timeout: number;
3
+ readonly showClose: boolean;
4
+ }
@@ -0,0 +1,41 @@
1
+ import { ApplicationRef, Injector } from '@angular/core';
2
+ import { INgxHelperConfig } from '../ngx-helper.config';
3
+ import { INgxHelperToastConfig } from './ngx-helper-toast.interface';
4
+ import * as i0 from "@angular/core";
5
+ interface IToast {
6
+ readonly icon: string;
7
+ readonly textColor: string;
8
+ readonly backgroundColor: string;
9
+ }
10
+ export declare class NgxHelperToastService {
11
+ private readonly applicationRef;
12
+ private readonly injector;
13
+ private readonly config?;
14
+ private components;
15
+ constructor(applicationRef: ApplicationRef, injector: Injector, config?: Partial<INgxHelperConfig> | undefined);
16
+ private getId;
17
+ private updatePositions;
18
+ toast(toast: IToast, message: string | string[]): void;
19
+ toast(toast: IToast, message: string | string[], config: Partial<INgxHelperToastConfig>): void;
20
+ toast(toast: IToast, message: string | string[], onClose: () => void): void;
21
+ toast(toast: IToast, message: string | string[], config: Partial<INgxHelperToastConfig>, onClose: () => void): void;
22
+ info(message: string | string[]): void;
23
+ info(message: string | string[], config: Partial<INgxHelperToastConfig>): void;
24
+ info(message: string | string[], onClose: () => void): void;
25
+ info(message: string | string[], config: Partial<INgxHelperToastConfig>, onClose: () => void): void;
26
+ success(message: string | string[]): void;
27
+ success(message: string | string[], config: Partial<INgxHelperToastConfig>): void;
28
+ success(message: string | string[], onClose: () => void): void;
29
+ success(message: string | string[], config: Partial<INgxHelperToastConfig>, onClose: () => void): void;
30
+ warning(message: string | string[]): void;
31
+ warning(message: string | string[], config: Partial<INgxHelperToastConfig>): void;
32
+ warning(message: string | string[], onClose: () => void): void;
33
+ warning(message: string | string[], config: Partial<INgxHelperToastConfig>, onClose: () => void): void;
34
+ error(message: string | string[]): void;
35
+ error(message: string | string[], config: Partial<INgxHelperToastConfig>): void;
36
+ error(message: string | string[], onClose: () => void): void;
37
+ error(message: string | string[], config: Partial<INgxHelperToastConfig>, onClose: () => void): void;
38
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxHelperToastService, [null, null, { optional: true; }]>;
39
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxHelperToastService>;
40
+ }
41
+ export {};
@@ -0,0 +1,35 @@
1
+ import { AfterViewInit, ElementRef, OnDestroy, OnInit } from '@angular/core';
2
+ import { INgxHelperConfig } from '../../ngx-helper.config';
3
+ import { INgxHelperToastConfig } from '../ngx-helper-toast.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ToastComponent implements OnInit, OnDestroy, AfterViewInit {
6
+ readonly elementRef: ElementRef;
7
+ private onClick;
8
+ private host;
9
+ private className;
10
+ top: string;
11
+ textColor: string;
12
+ borderColor: string;
13
+ backgroundColor: string;
14
+ id: string;
15
+ icon: string;
16
+ messages: string[];
17
+ config: {
18
+ helper?: Partial<INgxHelperConfig>;
19
+ toast: Partial<INgxHelperToastConfig>;
20
+ };
21
+ init: () => void;
22
+ close: () => void;
23
+ timeout: number;
24
+ showClose: boolean;
25
+ animation: 'DECREASE' | 'INCREASE';
26
+ progress: number;
27
+ start: number;
28
+ private interval?;
29
+ constructor(elementRef: ElementRef);
30
+ ngOnInit(): void;
31
+ ngOnDestroy(): void;
32
+ ngAfterViewInit(): void;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToastComponent, never>;
34
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToastComponent, "ng-component", never, {}, {}, never, never, true, never>;
35
+ }
package/ngx-helper-m3.css CHANGED
@@ -109,9 +109,21 @@
109
109
  flex: 1;
110
110
 
111
111
  font-size: 90%;
112
-
113
112
  text-align: left;
114
113
  direction: ltr;
114
+ font-family: Roboto, 'Helvetica Neue', sans-serif;
115
+
116
+ white-space: nowrap;
117
+ overflow: hidden;
118
+ text-overflow: ellipsis;
119
+ }
120
+
121
+ .title {
122
+ flex: 1;
123
+
124
+ font-size: 90%;
125
+ text-align: right;
126
+ direction: rtl;
115
127
 
116
128
  white-space: nowrap;
117
129
  overflow: hidden;
@@ -137,6 +149,93 @@
137
149
  }
138
150
  }
139
151
 
152
+ /* NGX HELPER TOAST */
153
+ .ngx-helper-m3-toast {
154
+ position: fixed;
155
+
156
+ display: block;
157
+ direction: rtl;
158
+ width: calc(100vw - 4rem);
159
+ max-width: 350px;
160
+ transition: top 0.35s ease-out;
161
+ z-index: 5000;
162
+ border-radius: 8px;
163
+ cursor: pointer;
164
+ box-sizing: border-box;
165
+ overflow: hidden;
166
+ border: 1px solid transparent;
167
+
168
+ .content {
169
+ display: flex;
170
+ align-items: flex-start;
171
+ column-gap: 0.5rem;
172
+
173
+ .toast {
174
+ flex: 1;
175
+
176
+ display: flex;
177
+ align-items: center;
178
+ column-gap: 1rem;
179
+
180
+ padding-right: 1rem;
181
+
182
+ ul {
183
+ flex: 1;
184
+ list-style: none;
185
+ margin: 0;
186
+ padding: 1rem 0 1rem 1rem;
187
+
188
+ li {
189
+ margin: 0;
190
+ padding: 0;
191
+ font-weight: 500;
192
+ line-height: 1.45;
193
+ padding-top: 0.25rem;
194
+ }
195
+
196
+ li:first-of-type {
197
+ padding-top: 0;
198
+ }
199
+ }
200
+
201
+ mat-icon.icon {
202
+ font-size: 26px;
203
+ }
204
+ }
205
+
206
+ mat-icon.close {
207
+ padding: 1rem 0 0 1rem;
208
+ }
209
+ }
210
+
211
+ .progress-container {
212
+ width: 100%;
213
+ height: 4px;
214
+ position: relative;
215
+
216
+ .progress-value {
217
+ position: absolute;
218
+ top: 0;
219
+ bottom: 0;
220
+ left: 0;
221
+
222
+ transition: all 0.35s ease-out;
223
+ }
224
+ }
225
+ }
226
+ .ngx-helper-m3-toast.center {
227
+ left: 50%;
228
+ transform: translate(-50%, 0);
229
+ }
230
+
231
+ .ngx-helper-m3-toast.left {
232
+ left: 1rem;
233
+ }
234
+
235
+ .ngx-helper-m3-toast.right {
236
+ right: 1rem;
237
+ }
238
+
140
239
  /* NGX HELPER VALUE LIST */
141
240
  .ngx-helper-m3-box {
142
241
  display: block;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webilix/ngx-helper-m3",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "author": "Ali Amirnezhad",
5
5
  "description": "Helper library for Angular and Material 3",
6
6
  "repository": {
package/public-api.d.ts CHANGED
@@ -31,3 +31,5 @@ export * from './lib/container/container.interface';
31
31
  export * from './lib/container/container.service';
32
32
  export * from './lib/http/ngx-helper-http.interface';
33
33
  export * from './lib/http/ngx-helper-http.service';
34
+ export * from './lib/toast/ngx-helper-toast.interface';
35
+ export * from './lib/toast/ngx-helper-toast.service';