monkey-front-core 0.0.412 → 0.0.414
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 +10 -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.414.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.412.tgz +0 -0
|
@@ -2680,6 +2680,13 @@ class MonkeyEcxModel {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
2682
|
|
|
2683
|
+
class MonkeyEcxLinksModel extends MonkeyEcxModel {
|
|
2684
|
+
constructor(data) {
|
|
2685
|
+
super();
|
|
2686
|
+
this._links = data?._links;
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2683
2690
|
class MonkeyEcxRequestPagedHandling {
|
|
2684
2691
|
constructor(url, pagedParams, links, samePage = false) {
|
|
2685
2692
|
this.samePage = false;
|
|
@@ -5287,6 +5294,191 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
5287
5294
|
}]
|
|
5288
5295
|
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxLoggedHandlingService }]; }, propDecorators: { doCall: [], doGenericCall: [] } });
|
|
5289
5296
|
|
|
5297
|
+
/**
|
|
5298
|
+
* Classe genérica que recebe duas interfaces como tipos genéricos.
|
|
5299
|
+
*
|
|
5300
|
+
* @typeparam T deve ser a mesma interface utilizada na Entity da Store
|
|
5301
|
+
* @typeparam K faz referência ao tipo de configuração.
|
|
5302
|
+
*
|
|
5303
|
+
* @description interfaces de configuração:
|
|
5304
|
+
* ```
|
|
5305
|
+
* MonkeyEcxCollectionStore e MonkeyEcxEntityStore
|
|
5306
|
+
* ```
|
|
5307
|
+
*/
|
|
5308
|
+
class MonkeyEcxCommonsStoreService extends MonkeyEcxCommonsService {
|
|
5309
|
+
constructor(monkeyecxService, tokenStorage, store, config) {
|
|
5310
|
+
super(monkeyecxService, tokenStorage);
|
|
5311
|
+
this.store = store;
|
|
5312
|
+
const { actions, selectors } = config;
|
|
5313
|
+
this.action = actions;
|
|
5314
|
+
this.selector = selectors;
|
|
5315
|
+
}
|
|
5316
|
+
handleResponseData(resp, identifier, updatePagination = true) {
|
|
5317
|
+
try {
|
|
5318
|
+
let data;
|
|
5319
|
+
if (resp?._embedded) {
|
|
5320
|
+
const { _embedded, _links, page } = resp;
|
|
5321
|
+
const key = Object.keys(_embedded)[0];
|
|
5322
|
+
data = _embedded[key];
|
|
5323
|
+
if (updatePagination) {
|
|
5324
|
+
this.updateLinks?.(_links, identifier);
|
|
5325
|
+
}
|
|
5326
|
+
this.updatePage?.(page, identifier);
|
|
5327
|
+
}
|
|
5328
|
+
else
|
|
5329
|
+
data = resp;
|
|
5330
|
+
this.update?.(data, identifier);
|
|
5331
|
+
}
|
|
5332
|
+
catch (e) {
|
|
5333
|
+
throw new Error(`MECX Core - Method handleResponseData -> ${e}`);
|
|
5334
|
+
}
|
|
5335
|
+
}
|
|
5336
|
+
async paginationHasDifference(url, identifier) {
|
|
5337
|
+
try {
|
|
5338
|
+
const { action, store, selector } = this;
|
|
5339
|
+
const { hasDifference, hasField } = (await store
|
|
5340
|
+
.select(selector.paginationHasDifference({ identifier, url }))
|
|
5341
|
+
.pipe(take(1))
|
|
5342
|
+
.toPromise());
|
|
5343
|
+
if (hasDifference && hasField) {
|
|
5344
|
+
store.dispatch(action.clear({ identifier }));
|
|
5345
|
+
}
|
|
5346
|
+
return { hasDifference };
|
|
5347
|
+
}
|
|
5348
|
+
catch (e) {
|
|
5349
|
+
throw new Error(`MECX Core - Method paginationHasDifference -> ${e}`);
|
|
5350
|
+
}
|
|
5351
|
+
}
|
|
5352
|
+
updateControl(ctrl) {
|
|
5353
|
+
try {
|
|
5354
|
+
this.store.dispatch(this.action.updateControl({
|
|
5355
|
+
ctrl
|
|
5356
|
+
}));
|
|
5357
|
+
}
|
|
5358
|
+
catch (e) {
|
|
5359
|
+
throw new Error(`MECX Core - Method updateControl -> ${e}`);
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5362
|
+
mappingData(args, identifier) {
|
|
5363
|
+
try {
|
|
5364
|
+
const handle = (item) => {
|
|
5365
|
+
let id = '';
|
|
5366
|
+
const { href } = new MonkeyEcxLinksModel(item)?.getAction('self') || {
|
|
5367
|
+
href: ''
|
|
5368
|
+
};
|
|
5369
|
+
if (href) {
|
|
5370
|
+
id = href.split('/').pop() || '';
|
|
5371
|
+
}
|
|
5372
|
+
return {
|
|
5373
|
+
...item,
|
|
5374
|
+
identifier,
|
|
5375
|
+
id
|
|
5376
|
+
};
|
|
5377
|
+
};
|
|
5378
|
+
if (args instanceof Array) {
|
|
5379
|
+
return args.map((item) => {
|
|
5380
|
+
return handle(item);
|
|
5381
|
+
});
|
|
5382
|
+
}
|
|
5383
|
+
return handle(args);
|
|
5384
|
+
}
|
|
5385
|
+
catch (e) {
|
|
5386
|
+
throw new Error(`MECX Core - Method mappingData -> ${e}`);
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
update(args, identifier) {
|
|
5390
|
+
try {
|
|
5391
|
+
let typeAction = 'updateOne';
|
|
5392
|
+
if (args instanceof Array) {
|
|
5393
|
+
typeAction = 'updateAll';
|
|
5394
|
+
}
|
|
5395
|
+
this.store.dispatch(this.action[typeAction]({
|
|
5396
|
+
data: this.mappingData(args, identifier)
|
|
5397
|
+
}));
|
|
5398
|
+
}
|
|
5399
|
+
catch (e) {
|
|
5400
|
+
throw new Error(`MECX Core - Method update -> ${e}`);
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
updatePage(args, identifier) {
|
|
5404
|
+
try {
|
|
5405
|
+
this.store.dispatch(this.action.updatePage({
|
|
5406
|
+
data: {
|
|
5407
|
+
[identifier]: args
|
|
5408
|
+
}
|
|
5409
|
+
}));
|
|
5410
|
+
}
|
|
5411
|
+
catch (e) {
|
|
5412
|
+
throw new Error(`MECX Core - Method updatePage -> ${e}`);
|
|
5413
|
+
}
|
|
5414
|
+
}
|
|
5415
|
+
updateLinks(args, identifier) {
|
|
5416
|
+
try {
|
|
5417
|
+
this.store.dispatch(this.action.updateLinks({
|
|
5418
|
+
data: {
|
|
5419
|
+
[identifier]: args
|
|
5420
|
+
}
|
|
5421
|
+
}));
|
|
5422
|
+
}
|
|
5423
|
+
catch (e) {
|
|
5424
|
+
throw new Error(`MECX Core - Method updateLinks -> ${e}`);
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5427
|
+
async loadData(url, identifier, updatePagination = true) {
|
|
5428
|
+
this.updateControl({ isLoading: true });
|
|
5429
|
+
try {
|
|
5430
|
+
const data = await this.monkeyecxService?.get(url).toPromise();
|
|
5431
|
+
this.handleResponseData(data, identifier, updatePagination);
|
|
5432
|
+
}
|
|
5433
|
+
catch (e) {
|
|
5434
|
+
throw new Error(`${e?.message}`);
|
|
5435
|
+
}
|
|
5436
|
+
this.updateControl({ isLoading: false });
|
|
5437
|
+
}
|
|
5438
|
+
async loadPageData(pagination, identifier) {
|
|
5439
|
+
const { store, selector } = this;
|
|
5440
|
+
const data = await store
|
|
5441
|
+
.select(selector.selectPagination({ identifier }))
|
|
5442
|
+
.pipe(take(1))
|
|
5443
|
+
.toPromise();
|
|
5444
|
+
const { action } = pagination;
|
|
5445
|
+
const { href } = new MonkeyEcxLinksModel({ _links: data }).getAction(action) || {
|
|
5446
|
+
href: ''
|
|
5447
|
+
};
|
|
5448
|
+
if (href) {
|
|
5449
|
+
this.loadData(href, identifier);
|
|
5450
|
+
}
|
|
5451
|
+
}
|
|
5452
|
+
/**
|
|
5453
|
+
* @description Neste método precisamos incluir a lógica para conferir se precisa limpar a
|
|
5454
|
+
* entidade ou não
|
|
5455
|
+
* E depois precisa invocar o método loadData
|
|
5456
|
+
* @param (url, identifier) ou de acordo com a action criada
|
|
5457
|
+
* @example
|
|
5458
|
+
* ```
|
|
5459
|
+
* const hasDifference = .....
|
|
5460
|
+
* if(hasDifference) {
|
|
5461
|
+
* store.dispatch(clear)
|
|
5462
|
+
* }
|
|
5463
|
+
*
|
|
5464
|
+
* this.loadData(...)
|
|
5465
|
+
* ```
|
|
5466
|
+
*/
|
|
5467
|
+
load(args) {
|
|
5468
|
+
throw new Error('MECX Core - Method load not implemented.');
|
|
5469
|
+
}
|
|
5470
|
+
loadPage(args) {
|
|
5471
|
+
throw new Error('MECX Core - Method loadPage not implemented.');
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
__decorate([
|
|
5475
|
+
MonkeyEcxCoreService({
|
|
5476
|
+
requestInProgress: {
|
|
5477
|
+
showProgress: true
|
|
5478
|
+
}
|
|
5479
|
+
})
|
|
5480
|
+
], MonkeyEcxCommonsStoreService.prototype, "loadData", null);
|
|
5481
|
+
|
|
5290
5482
|
class MonkeyEcxFeatureByProgramDirective {
|
|
5291
5483
|
constructor(cdr, elementRef, monkeyConfigService) {
|
|
5292
5484
|
this.cdr = cdr;
|
|
@@ -5826,5 +6018,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
5826
6018
|
* Generated bundle index. Do not edit.
|
|
5827
6019
|
*/
|
|
5828
6020
|
|
|
5829
|
-
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDisplaySupportPhone, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
|
|
6021
|
+
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxCommonsStoreService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDisplaySupportPhone, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLinksModel, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
|
|
5830
6022
|
//# sourceMappingURL=monkey-front-core.mjs.map
|