@stemy/ngx-utils 19.7.20 → 19.7.21
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/stemy-ngx-utils.mjs +243 -193
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +10 -3
- package/ngx-utils/components/upload/upload.component.d.ts +2 -3
- package/ngx-utils/ngx-utils.imports.d.ts +2 -2
- package/ngx-utils/services/base-http.client.d.ts +10 -9
- package/ngx-utils/services/base-http.service.d.ts +8 -4
- package/ngx-utils/services/request-bag.d.ts +15 -0
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
|
@@ -470,7 +470,11 @@ export interface IProgress {
|
|
|
470
470
|
export type ProgressListener = (progress: IProgress) => void;
|
|
471
471
|
export type CacheExpireMode = boolean | "auth" | Date;
|
|
472
472
|
export interface IHttpService {
|
|
473
|
-
language: ILanguageService;
|
|
473
|
+
readonly language: ILanguageService;
|
|
474
|
+
readonly requestHeaders: Readonly<HttpRequestHeaders>;
|
|
475
|
+
readonly requestParams: Readonly<HttpRequestQuery>;
|
|
476
|
+
setHeader(name: string, value?: string | string[]): void;
|
|
477
|
+
setParam(name: string, value?: any): void;
|
|
474
478
|
cached(mode: CacheExpireMode): Observable<any>;
|
|
475
479
|
url(url: string): string;
|
|
476
480
|
makeListParams(page: number, itemsPerPage: number, orderBy?: string, orderDescending?: boolean, filter?: string): HttpRequestQuery;
|
|
@@ -482,8 +486,11 @@ export interface SvgDefinition {
|
|
|
482
486
|
}
|
|
483
487
|
export type SvgSourceModifier = (svg: SVGSVGElement, width: number, height: number) => string;
|
|
484
488
|
export interface IBaseHttpClient extends HttpClient {
|
|
485
|
-
readonly requestHeaders: HttpRequestHeaders
|
|
486
|
-
readonly requestParams: HttpRequestQuery
|
|
489
|
+
readonly requestHeaders: Readonly<HttpRequestHeaders>;
|
|
490
|
+
readonly requestParams: Readonly<HttpRequestQuery>;
|
|
491
|
+
setHeader(name: string, value?: string | string[]): void;
|
|
492
|
+
setParam(name: string, value?: any): void;
|
|
493
|
+
makeHeaders(): HttpHeaders;
|
|
487
494
|
}
|
|
488
495
|
export interface IApiService extends IHttpService {
|
|
489
496
|
client: IBaseHttpClient;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges } from "@angular/core";
|
|
2
2
|
import { ControlValueAccessor } from "@angular/forms";
|
|
3
|
-
import { IApiService, IFileUploadProcess, IFileUploadResult, IToasterService, UploadType } from "../../common-types";
|
|
4
|
-
import { BaseHttpClient } from "../../services/base-http.client";
|
|
3
|
+
import { IApiService, IBaseHttpClient, IFileUploadProcess, IFileUploadResult, IToasterService, UploadType } from "../../common-types";
|
|
5
4
|
import { BtnComponent } from "../btn/btn.component";
|
|
6
5
|
import * as i0 from "@angular/core";
|
|
7
6
|
export declare class UploadComponent implements ControlValueAccessor, OnChanges {
|
|
@@ -31,7 +30,7 @@ export declare class UploadComponent implements ControlValueAccessor, OnChanges
|
|
|
31
30
|
protected rootElem: DocumentOrShadowRoot;
|
|
32
31
|
protected fileImageCache: Map<Blob, string>;
|
|
33
32
|
protected acceptTypes: string[];
|
|
34
|
-
get http():
|
|
33
|
+
get http(): IBaseHttpClient;
|
|
35
34
|
get root(): DocumentOrShadowRoot;
|
|
36
35
|
constructor(cdr: ChangeDetectorRef, element: ElementRef<HTMLElement>, api: IApiService, toaster: IToasterService);
|
|
37
36
|
onDragEnter(ev: DragEvent): void;
|
|
@@ -61,10 +61,10 @@ import { DynamicTableComponent } from "./components/dynamic-table/dynamic-table.
|
|
|
61
61
|
import { PaginationMenuComponent } from "./components/pagination-menu/pagination-menu.component";
|
|
62
62
|
import { UnorderedListComponent } from "./components/unordered-list/unordered-list.component";
|
|
63
63
|
import { UploadComponent } from "./components/upload/upload.component";
|
|
64
|
-
export declare const pipes: (typeof
|
|
64
|
+
export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof SyncAsyncPipe | typeof TranslatePipe)[];
|
|
65
65
|
export declare const directives: (typeof AsyncMethodBase | typeof AsyncMethodTargetDirective | typeof BackgroundDirective | typeof ComponentLoaderDirective | typeof DynamicTableTemplateDirective | typeof GlobalTemplateDirective | typeof IconDirective | typeof NgxTemplateOutletDirective | typeof PaginationDirective | typeof PaginationItemDirective | typeof ResourceIfDirective | typeof StickyDirective | typeof StickyClassDirective | typeof DropdownDirective | typeof DropdownContentDirective | typeof TabsItemDirective | typeof UnorderedListItemDirective | typeof UnorderedListTemplateDirective)[];
|
|
66
66
|
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof PaginationMenuComponent | typeof UnorderedListComponent | typeof UploadComponent)[];
|
|
67
|
-
export declare const providers: (typeof
|
|
67
|
+
export declare const providers: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof SyncAsyncPipe | typeof TranslatePipe | typeof BaseHttpClient | typeof BaseHttpService | typeof AuthGuard | typeof AclService | typeof StaticAuthService | typeof ConfigService | typeof BaseDialogService | typeof ErrorHandlerService | typeof EventsService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof PromiseService | typeof SocketService | typeof StateService | typeof StorageService | typeof BaseToasterService | typeof CacheService | typeof ComponentLoaderService | typeof TranslatedUrlSerializer | typeof UniversalService | typeof DeviceDetectorService | {
|
|
68
68
|
provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
|
|
69
69
|
useClass: typeof DragDropEventPlugin;
|
|
70
70
|
multi: boolean;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { HttpClient, HttpHandler, HttpHeaders
|
|
2
|
-
import {
|
|
1
|
+
import { HttpClient, HttpHandler, HttpHeaders } from "@angular/common/http";
|
|
2
|
+
import { RequestBag } from "./request-bag";
|
|
3
|
+
import { HttpRequestHeaders, HttpRequestQuery, IBaseHttpClient } from "../common-types";
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class BaseHttpClient extends HttpClient {
|
|
5
|
-
requestHeaders: HttpRequestHeaders;
|
|
6
|
-
requestParams: HttpRequestQuery;
|
|
5
|
+
export declare class BaseHttpClient extends HttpClient implements IBaseHttpClient {
|
|
7
6
|
renewTokenFunc: () => void;
|
|
8
|
-
|
|
7
|
+
readonly bag: RequestBag;
|
|
9
8
|
constructor(handler: HttpHandler);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
get requestHeaders(): Readonly<HttpRequestHeaders>;
|
|
10
|
+
get requestParams(): Readonly<HttpRequestQuery>;
|
|
11
|
+
setHeader(name: string, value?: string | string[]): void;
|
|
12
|
+
setParam(name: string, value?: any): void;
|
|
13
|
+
makeHeaders(): HttpHeaders;
|
|
13
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseHttpClient, never>;
|
|
14
15
|
static ɵprov: i0.ɵɵInjectableDeclaration<BaseHttpClient>;
|
|
15
16
|
}
|
|
@@ -7,6 +7,7 @@ import { UniversalService } from "./universal.service";
|
|
|
7
7
|
import { StorageService } from "./storage.service";
|
|
8
8
|
import { Observable } from "rxjs";
|
|
9
9
|
import { CacheService } from "./cache.service";
|
|
10
|
+
import { RequestBag } from "./request-bag";
|
|
10
11
|
import * as i0 from "@angular/core";
|
|
11
12
|
export declare class BaseHttpService implements IHttpService {
|
|
12
13
|
readonly injector: Injector;
|
|
@@ -17,15 +18,18 @@ export declare class BaseHttpService implements IHttpService {
|
|
|
17
18
|
readonly toaster: IToasterService;
|
|
18
19
|
readonly configs: IConfigService;
|
|
19
20
|
readonly request: Request;
|
|
20
|
-
protected static failedRequests: Array<() => void>;
|
|
21
21
|
get name(): string;
|
|
22
|
+
get requestHeaders(): Readonly<HttpRequestHeaders>;
|
|
23
|
+
get requestParams(): Readonly<HttpRequestQuery>;
|
|
22
24
|
protected get withCredentials(): boolean;
|
|
23
|
-
requestHeaders: HttpRequestHeaders;
|
|
24
|
-
requestParams: HttpRequestQuery;
|
|
25
|
-
protected static retryFailedRequests(): void;
|
|
26
25
|
get universal(): UniversalService;
|
|
26
|
+
protected static failedRequests: Array<() => void>;
|
|
27
|
+
protected readonly bag: RequestBag;
|
|
28
|
+
protected static retryFailedRequests(): void;
|
|
27
29
|
constructor(injector: Injector, client: BaseHttpClient, storage: StorageService, caches: CacheService, language: ILanguageService, toaster: IToasterService, configs: IConfigService, request?: Request);
|
|
28
30
|
protected initService(): void;
|
|
31
|
+
setHeader(name: string, value?: string | string[]): void;
|
|
32
|
+
setParam(name: string, value?: any): void;
|
|
29
33
|
cached(mode: CacheExpireMode): Observable<any>;
|
|
30
34
|
url(url: string): string;
|
|
31
35
|
createUrl(url: string, params: HttpRequestQuery): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpHeaders, HttpParams } from "@angular/common/http";
|
|
2
|
+
import { HttpRequestHeaders, HttpRequestQuery } from "../common-types";
|
|
3
|
+
export declare class RequestBag {
|
|
4
|
+
protected source?: RequestBag;
|
|
5
|
+
protected readonly headers: HttpRequestHeaders;
|
|
6
|
+
protected readonly params: HttpRequestQuery;
|
|
7
|
+
get requestHeaders(): Readonly<HttpRequestHeaders>;
|
|
8
|
+
get requestParams(): Readonly<HttpRequestQuery>;
|
|
9
|
+
constructor(source?: RequestBag);
|
|
10
|
+
makeHeaders(headersObj?: HttpRequestHeaders | HttpHeaders, withCredentials?: boolean): HttpHeaders;
|
|
11
|
+
makeParams(paramsObj?: HttpRequestQuery): HttpParams;
|
|
12
|
+
setHeader(name: string, value?: string | string[]): void;
|
|
13
|
+
setParam(name: string, value?: any): void;
|
|
14
|
+
protected convertHeaders(headers: HttpHeaders): HttpRequestHeaders;
|
|
15
|
+
}
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export { CacheService } from "./ngx-utils/services/cache.service";
|
|
|
54
54
|
export { ComponentLoaderService } from "./ngx-utils/services/component-loader.service";
|
|
55
55
|
export { IUrlDictionary, TranslatedUrlSerializer } from "./ngx-utils/services/translated-url.serializer";
|
|
56
56
|
export { PromiseService } from "./ngx-utils/services/promise.service";
|
|
57
|
+
export { RequestBag } from "./ngx-utils/services/request-bag";
|
|
57
58
|
export { SocketService } from "./ngx-utils/services/socket.service";
|
|
58
59
|
export { DragEventListener } from "./ngx-utils/plugins/drag-drop-handler";
|
|
59
60
|
export { DragDropEventPlugin } from "./ngx-utils/plugins/drag-drop-event.plugin";
|