monkey-front-core 0.0.412 → 0.0.413
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/interfaces/index.mjs +4 -1
- package/esm2020/lib/core/interfaces/monkeyecx-interface.mjs +2 -0
- package/esm2020/lib/core/interfaces/monkeyecx-pagination.mjs +2 -0
- package/esm2020/lib/core/interfaces/monkeyecx-store.mjs +2 -0
- package/esm2020/lib/core/model/index.mjs +2 -1
- package/esm2020/lib/core/model/monkeyecx-links.model.mjs +8 -0
- package/esm2020/lib/core/services/index.mjs +5 -4
- package/esm2020/lib/core/services/store/index.mjs +2 -0
- package/esm2020/lib/core/services/store/monkeyecx-store.service.mjs +190 -0
- package/fesm2015/monkey-front-core.mjs +199 -1
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +193 -1
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/interfaces/index.d.ts +3 -0
- package/lib/core/interfaces/monkeyecx-interface.d.ts +9 -0
- package/lib/core/interfaces/monkeyecx-pagination.d.ts +25 -0
- package/lib/core/interfaces/monkeyecx-store.d.ts +31 -0
- package/lib/core/model/index.d.ts +1 -0
- package/lib/core/model/monkeyecx-links.model.d.ts +4 -0
- package/lib/core/services/index.d.ts +4 -3
- package/lib/core/services/store/index.d.ts +1 -0
- package/lib/core/services/store/monkeyecx-store.service.d.ts +51 -0
- package/monkey-front-core-0.0.413.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.412.tgz +0 -0
|
@@ -9,8 +9,10 @@ export * from './monkeyecx-filter';
|
|
|
9
9
|
export * from './monkeyecx-handled-error-response';
|
|
10
10
|
export * from './monkeyecx-header-credentials';
|
|
11
11
|
export * from './monkeyecx-intercom-options';
|
|
12
|
+
export * from './monkeyecx-interface';
|
|
12
13
|
export * from './monkeyecx-me-credentials';
|
|
13
14
|
export * from './monkeyecx-navigation';
|
|
15
|
+
export * from './monkeyecx-pagination';
|
|
14
16
|
export * from './monkeyecx-program';
|
|
15
17
|
export * from './monkeyecx-releases';
|
|
16
18
|
export * from './monkeyecx-request-in-progress';
|
|
@@ -21,6 +23,7 @@ export * from './monkeyecx-saved-state';
|
|
|
21
23
|
export * from './monkeyecx-scroll-options';
|
|
22
24
|
export * from './monkeyecx-service-credentials';
|
|
23
25
|
export * from './monkeyecx-storage';
|
|
26
|
+
export * from './monkeyecx-store';
|
|
24
27
|
export * from './monkeyecx-support-options';
|
|
25
28
|
export * from './monkeyecx-token-credentials';
|
|
26
29
|
export * from './monkeyecx-translate-options';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Link } from '../model';
|
|
2
|
+
export interface MonkeyEcxPagination {
|
|
3
|
+
action: 'next';
|
|
4
|
+
}
|
|
5
|
+
interface MonkeyEcxTypedLink extends Link {
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MonkeyEcxPaginationData {
|
|
9
|
+
[key: string]: MonkeyEcxTypedLink;
|
|
10
|
+
}
|
|
11
|
+
export interface MonkeyEcxPaginationSortField {
|
|
12
|
+
type?: string;
|
|
13
|
+
format?: string;
|
|
14
|
+
direction: 'desc' | 'asc';
|
|
15
|
+
}
|
|
16
|
+
export interface MonkeyEcxPaginationSortData {
|
|
17
|
+
[key: string]: MonkeyEcxPaginationSortField;
|
|
18
|
+
}
|
|
19
|
+
export interface MonkeyEcxPage {
|
|
20
|
+
size: number;
|
|
21
|
+
totalElements: number;
|
|
22
|
+
totalPages: number;
|
|
23
|
+
number: number;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Action } from '@ngrx/store';
|
|
2
|
+
import { Link } from '../model';
|
|
3
|
+
export interface MonkeyEcxConfigStore {
|
|
4
|
+
actions?: {};
|
|
5
|
+
selectors?: {};
|
|
6
|
+
}
|
|
7
|
+
export interface MonkeyEcxCollectionStore extends MonkeyEcxConfigStore {
|
|
8
|
+
actions: {
|
|
9
|
+
updateControl: Action;
|
|
10
|
+
updateLinks: Action;
|
|
11
|
+
updatePage: Action;
|
|
12
|
+
updateAll: Action;
|
|
13
|
+
clear: Action;
|
|
14
|
+
};
|
|
15
|
+
selectors: {
|
|
16
|
+
paginationHasDifference: Function;
|
|
17
|
+
selectPagination: Function;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface MonkeyEcxEntityStore extends MonkeyEcxConfigStore {
|
|
21
|
+
actions: {
|
|
22
|
+
updateControl: Action;
|
|
23
|
+
updateOne: Action;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface MonkeyEcxControlStore {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
export interface MonkeyEcxLinks {
|
|
30
|
+
[key: string]: Link;
|
|
31
|
+
}
|
|
@@ -3,6 +3,7 @@ export * from './auth';
|
|
|
3
3
|
export * from './commons/monkeyecx-commons.service';
|
|
4
4
|
export * from './config/monkeyecx-config.module';
|
|
5
5
|
export * from './config/monkeyecx-config.service';
|
|
6
|
+
export * from './config/monkeyecx-currency-config.service';
|
|
6
7
|
export * from './config/monkeyecx-error-config.service';
|
|
7
8
|
export * from './config/monkeyecx-feature-toggle.service';
|
|
8
9
|
export * from './config/monkeyecx-i18n-config.service';
|
|
@@ -10,15 +11,15 @@ export * from './config/monkeyecx-logs-config.service';
|
|
|
10
11
|
export * from './config/monkeyecx-maintenance-config.service';
|
|
11
12
|
export * from './config/monkeyecx-security-console-config.service';
|
|
12
13
|
export * from './config/monkeyecx-service-worker-config.service';
|
|
13
|
-
export * from './config/monkeyecx-currency-config.service';
|
|
14
14
|
export * from './error';
|
|
15
15
|
export * from './logged';
|
|
16
|
-
export * from './pagination';
|
|
17
|
-
export * from './monkeyecx-service.service';
|
|
18
16
|
export * from './monkeyecx-handling.service';
|
|
17
|
+
export * from './monkeyecx-service.service';
|
|
18
|
+
export * from './pagination';
|
|
19
19
|
export * from './request-download';
|
|
20
20
|
export * from './request-paged';
|
|
21
21
|
export * from './request-queue';
|
|
22
22
|
export * from './routes';
|
|
23
23
|
export * from './schedules';
|
|
24
24
|
export * from './storage';
|
|
25
|
+
export * from './store';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './monkeyecx-store.service';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Store } from '@ngrx/store';
|
|
2
|
+
import { MonkeyEcxConfigStore, MonkeyEcxControlStore, MonkeyEcxLinks } from '../..';
|
|
3
|
+
import { MonkeyEcxPage, MonkeyEcxPagination } from '../../interfaces';
|
|
4
|
+
import { MonkeyEcxCommonsService } from '../commons';
|
|
5
|
+
import { MonkeyEcxService } from '../monkeyecx-service.service';
|
|
6
|
+
import { MonkeyEcxTokenStorageService } from '../storage';
|
|
7
|
+
/**
|
|
8
|
+
* Classe genérica que recebe duas interfaces como tipos genéricos.
|
|
9
|
+
*
|
|
10
|
+
* @typeparam T deve ser a mesma interface utilizada na Entity da Store
|
|
11
|
+
* @typeparam K faz referência ao tipo de configuração.
|
|
12
|
+
*
|
|
13
|
+
* @description interfaces de configuração:
|
|
14
|
+
* ```
|
|
15
|
+
* MonkeyEcxCollectionStore e MonkeyEcxEntityStore
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class MonkeyEcxCommonsStoreService<T, K extends MonkeyEcxConfigStore> extends MonkeyEcxCommonsService {
|
|
19
|
+
store: Store;
|
|
20
|
+
private action;
|
|
21
|
+
private selector;
|
|
22
|
+
constructor(monkeyecxService: MonkeyEcxService, tokenStorage: MonkeyEcxTokenStorageService, store: Store, config: K);
|
|
23
|
+
private handleResponseData;
|
|
24
|
+
protected paginationHasDifference(url: string, identifier: string): Promise<{
|
|
25
|
+
hasDifference: any;
|
|
26
|
+
}>;
|
|
27
|
+
protected updateControl(ctrl: MonkeyEcxControlStore): void;
|
|
28
|
+
protected mappingData(args: T | T[], identifier: string): T | T[];
|
|
29
|
+
protected update?(args: T | T[], identifier: string): void;
|
|
30
|
+
protected updatePage?(args: MonkeyEcxPage, identifier: string): void;
|
|
31
|
+
protected updateLinks?(args: MonkeyEcxLinks, identifier: string): void;
|
|
32
|
+
protected loadData(url: string, identifier: string, updatePagination?: boolean): Promise<void>;
|
|
33
|
+
protected loadPageData(pagination: MonkeyEcxPagination, identifier: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Neste método precisamos incluir a lógica para conferir se precisa limpar a
|
|
36
|
+
* entidade ou não
|
|
37
|
+
* E depois precisa invocar o método loadData
|
|
38
|
+
* @param (url, identifier) ou de acordo com a action criada
|
|
39
|
+
* @example
|
|
40
|
+
* ```
|
|
41
|
+
* const hasDifference = .....
|
|
42
|
+
* if(hasDifference) {
|
|
43
|
+
* store.dispatch(clear)
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* this.loadData(...)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
load?(args: any): void;
|
|
50
|
+
loadPage?(args: any): void;
|
|
51
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|