monkey-front-core 0.0.469 → 0.0.471
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/esm2020/lib/core/services/commons/index.mjs +2 -1
- package/esm2020/lib/core/services/commons/monkeyecx-commons-resolve-base.service.mjs +109 -0
- package/esm2020/lib/core/services/store/index.mjs +2 -1
- package/esm2020/lib/core/services/store/monkeyecx-store-base.service.mjs +169 -0
- package/esm2020/lib/core/services/store/monkeyecx-store.selector.mjs +9 -3
- package/fesm2015/monkey-front-core.mjs +283 -3
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +275 -3
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/services/commons/index.d.ts +1 -0
- package/lib/core/services/commons/monkeyecx-commons-resolve-base.service.d.ts +46 -0
- package/lib/core/services/store/index.d.ts +1 -0
- package/lib/core/services/store/monkeyecx-store-base.service.d.ts +47 -0
- package/lib/core/services/store/monkeyecx-store.selector.d.ts +4 -4
- package/monkey-front-core-0.0.471.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.469.tgz +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
|
|
2
|
+
import { Action, Store } from '@ngrx/store';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { MonkeyEcxCommonsService } from '.';
|
|
5
|
+
import { MonkeyEcxDiscoveryParamsService, MonkeyEcxPaginationService, MonkeyEcxTokenStorageService } from '../..';
|
|
6
|
+
import { MonkeyEcxCommonsConfig, MonkeyEcxInitialResolverConfig } from '../../interfaces';
|
|
7
|
+
import { MonkeyEcxService } from '../monkeyecx-service.service';
|
|
8
|
+
export declare abstract class MonkeyEcxCommonsResolveBaseService extends MonkeyEcxCommonsService {
|
|
9
|
+
private action;
|
|
10
|
+
protected route: string | null;
|
|
11
|
+
protected currentRoute: string | null;
|
|
12
|
+
protected paginationService: MonkeyEcxPaginationService;
|
|
13
|
+
protected translateService: TranslateService;
|
|
14
|
+
protected router: Router;
|
|
15
|
+
protected store: Store<any>;
|
|
16
|
+
protected monkeyDiscovery: MonkeyEcxDiscoveryParamsService;
|
|
17
|
+
constructor(monkeyecxService: MonkeyEcxService, tokenStorage: MonkeyEcxTokenStorageService, config: {
|
|
18
|
+
actions: {
|
|
19
|
+
load: Action;
|
|
20
|
+
loadPagination?: Action;
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
protected getData(): Promise<void>;
|
|
24
|
+
protected loadPage(actionType: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* @description Inicializar a class genérica
|
|
27
|
+
* @param (args: MonkeyEcxInitialResolverConfig)
|
|
28
|
+
* => route é obrigátorio pois ele quem inicializa a store.
|
|
29
|
+
* A searchClass só se faz necessaria quando for usar filtros
|
|
30
|
+
*/
|
|
31
|
+
protected init(args: MonkeyEcxInitialResolverConfig): void;
|
|
32
|
+
resolve(route: ActivatedRouteSnapshot | null, state: RouterStateSnapshot | null, otherArgs?: MonkeyEcxCommonsConfig): void;
|
|
33
|
+
/**
|
|
34
|
+
* @description Atualizar os filtros da tela
|
|
35
|
+
* @param (search: T, route?: string)
|
|
36
|
+
* => route é opcional, passar ele apenas se a rota for diferente do padrão
|
|
37
|
+
*/
|
|
38
|
+
setSearch<T>(search: T, route?: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* @description Navegação para details.
|
|
41
|
+
* Por padrão sera redirecionado para '${currentRoute}/details'
|
|
42
|
+
* @param (detailsData: T, route?: string)
|
|
43
|
+
* => route é opcional, passar ele apenas se a rota for diferente do padrão
|
|
44
|
+
*/
|
|
45
|
+
navigateToDetails<T>(detailsData: T, route?: string): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Store } from '@ngrx/store';
|
|
2
|
+
import { MonkeyEcxConfigStore, MonkeyEcxControlStore, MonkeyEcxLinks, MonkeyEcxPage, MonkeyEcxPagination } from '../../interfaces';
|
|
3
|
+
import { MonkeyEcxCommonsService } from '../commons';
|
|
4
|
+
import { MonkeyEcxService } from '../monkeyecx-service.service';
|
|
5
|
+
import { MonkeyEcxTokenStorageService } from '../storage';
|
|
6
|
+
/**
|
|
7
|
+
* Classe genérica que recebe duas interfaces como tipos genéricos.
|
|
8
|
+
*
|
|
9
|
+
* @typeparam T deve ser a mesma interface utilizada na Entity da Store
|
|
10
|
+
* @typeparam K faz referência ao tipo de configuração.
|
|
11
|
+
*
|
|
12
|
+
* @description interfaces de configuração:
|
|
13
|
+
* ```
|
|
14
|
+
* MonkeyEcxCollectionStore e MonkeyEcxEntityStore
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare abstract class MonkeyEcxCommonsStoreBaseService<T, K extends MonkeyEcxConfigStore> extends MonkeyEcxCommonsService {
|
|
18
|
+
protected store: Store;
|
|
19
|
+
private action;
|
|
20
|
+
private selector;
|
|
21
|
+
constructor(monkeyecxService: MonkeyEcxService, tokenStorage: MonkeyEcxTokenStorageService, store: Store, config: K);
|
|
22
|
+
private handleResponseData;
|
|
23
|
+
protected updateControl(data: MonkeyEcxControlStore): void;
|
|
24
|
+
protected mappingData(args: T | T[]): T | T[];
|
|
25
|
+
protected update?(args: T | T[]): void;
|
|
26
|
+
protected updatePage?(data: MonkeyEcxPage): void;
|
|
27
|
+
protected updateLinks?(data: MonkeyEcxLinks): void;
|
|
28
|
+
protected loadData(url: string, updateLinks?: boolean): Promise<void>;
|
|
29
|
+
protected loadPageData(pagination: MonkeyEcxPagination): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Neste método precisamos incluir a lógica para conferir se precisa limpar a
|
|
32
|
+
* entidade ou não
|
|
33
|
+
* E depois precisa invocar o método loadData
|
|
34
|
+
* @param (url) ou de acordo com a action criada
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* const hasDifference = .....
|
|
38
|
+
* if(hasDifference) {
|
|
39
|
+
* store.dispatch(clear)
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* this.loadData(...)
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
load?(args: any): void;
|
|
46
|
+
loadPage?(args: any): void;
|
|
47
|
+
}
|
|
@@ -10,18 +10,18 @@ export declare abstract class MonkeyEcxCommonsSelectors {
|
|
|
10
10
|
selectState: import("@ngrx/store").MemoizedSelector<object, unknown, import("@ngrx/store").DefaultProjectorFn<unknown>>;
|
|
11
11
|
selectAll: any;
|
|
12
12
|
selectControl: () => import("@ngrx/store").MemoizedSelector<object, any, import("@ngrx/store").DefaultProjectorFn<any>>;
|
|
13
|
-
selectLinks: (props
|
|
13
|
+
selectLinks: (props?: {
|
|
14
14
|
identifier: string;
|
|
15
|
-
}) => import("@ngrx/store").MemoizedSelector<object, any, import("@ngrx/store").DefaultProjectorFn<any>>;
|
|
15
|
+
} | undefined) => import("@ngrx/store").MemoizedSelector<object, any, import("@ngrx/store").DefaultProjectorFn<any>>;
|
|
16
16
|
selectByIdentifier: (props: {
|
|
17
17
|
identifier: string;
|
|
18
18
|
}) => import("@ngrx/store").MemoizedSelector<unknown, T[], import("@ngrx/store").DefaultProjectorFn<T[]>>;
|
|
19
19
|
selectOneByIdentifier: (props: {
|
|
20
20
|
identifier: string;
|
|
21
21
|
}) => import("@ngrx/store").MemoizedSelector<unknown, T | null, import("@ngrx/store").DefaultProjectorFn<T | null>>;
|
|
22
|
-
selectPage: (props
|
|
22
|
+
selectPage: (props?: {
|
|
23
23
|
identifier: string;
|
|
24
|
-
}) => import("@ngrx/store").MemoizedSelector<object, any, import("@ngrx/store").DefaultProjectorFn<any>>;
|
|
24
|
+
} | undefined) => import("@ngrx/store").MemoizedSelector<object, any, import("@ngrx/store").DefaultProjectorFn<any>>;
|
|
25
25
|
linksHasDifference: (props: {
|
|
26
26
|
identifier: string;
|
|
27
27
|
url: string;
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|