monkey-front-core 0.0.427 → 0.0.429

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, NgModule, Pipe, ViewEncapsulation, Injectable, EventEmitter, Directive, Output, HostBinding, HostListener, forwardRef, Self, InjectionToken, Inject, Optional, SkipSelf, NgZone, ErrorHandler } from '@angular/core';
2
+ import { Component, Input, NgModule, Pipe, ViewEncapsulation, Injectable, EventEmitter, Directive, Output, HostBinding, HostListener, forwardRef, Self, InjectionToken, Inject, Optional, inject, SkipSelf, NgZone, ErrorHandler } from '@angular/core';
3
3
  import * as i1 from 'monkey-style-guide';
4
4
  import { MonkeyButtonModule, MonkeyModalModule, MonkeyIconModule, MonkeyInputModule, MonkeyRadioButtonModule, MonkeyOptionModule, MonkeyUtils, MonkeyStyleGuideModule, MonkeyStyleGuideModalService, MonkeyStyleGuideSettingsService, MonkeyStyleGuideSnackbarService } from 'monkey-style-guide';
5
5
  import * as i2 from '@angular/common';
@@ -14,13 +14,13 @@ import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS, HttpClientModule } fr
14
14
  import * as i2$1 from '@angular/platform-browser';
15
15
  import * as i1$3 from 'ngx-cookie-service';
16
16
  import * as i2$2 from '@angular/router';
17
- import { NavigationStart, NavigationEnd, NavigationError, NavigationCancel } from '@angular/router';
17
+ import { NavigationStart, NavigationEnd, NavigationError, NavigationCancel, Router } from '@angular/router';
18
18
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
19
19
  import { TemplatePortal } from '@angular/cdk/portal';
20
20
  import * as i1$4 from '@angular/cdk/overlay';
21
21
  import { OverlayModule } from '@angular/cdk/overlay';
22
22
  import * as i2$3 from '@ngrx/store';
23
- import { createAction, props, INIT, createReducer, on, createFeatureSelector, createSelector, StoreModule } from '@ngrx/store';
23
+ import { createAction, props, INIT, createReducer, on, createFeatureSelector, createSelector, Store, StoreModule } from '@ngrx/store';
24
24
  import { createEntityAdapter } from '@ngrx/entity';
25
25
  import { __decorate } from 'tslib';
26
26
  import { datadogRum } from '@datadog/browser-rum';
@@ -2761,6 +2761,7 @@ class MonkeyEcxCommonsService {
2761
2761
  this.__data$ = null;
2762
2762
  this.__pagination$ = null;
2763
2763
  this.__control$ = null;
2764
+ this.__page$ = null;
2764
2765
  this.__savedState = null;
2765
2766
  this.__error = null;
2766
2767
  this.__handledError = null;
@@ -3098,6 +3099,122 @@ __decorate([
3098
3099
  })
3099
3100
  ], MonkeyEcxCommonsService.prototype, "getGenericData", null);
3100
3101
 
3102
+ class MonkeyEcxCommonsResolveService extends MonkeyEcxCommonsService {
3103
+ constructor(monkeyecxService, tokenStorage, config) {
3104
+ super(monkeyecxService, tokenStorage);
3105
+ this.route = null;
3106
+ this.currentRoute = null;
3107
+ this.paginationService = inject(MonkeyEcxPaginationService);
3108
+ this.translateService = inject(TranslateService);
3109
+ this.router = inject(Router);
3110
+ this.store = inject(Store);
3111
+ this.monkeyDiscovery = inject(MonkeyEcxDiscoveryParamsService);
3112
+ const { actions, actionsPagination, selectors } = config;
3113
+ this.action = actions;
3114
+ this.actionPagination = actionsPagination;
3115
+ this.selector = selectors;
3116
+ }
3117
+ ;
3118
+ async getData() {
3119
+ try {
3120
+ const { store, route, action, selector, tokenStorage } = this;
3121
+ const { companyId, companyType } = await tokenStorage?.getToken();
3122
+ const identifier = `${companyId}-${companyType}`;
3123
+ if (!route)
3124
+ return;
3125
+ const url = MonkeyEcxUtils.replaceVariables(route, { companyId });
3126
+ store.dispatch(action.load({ url, identifier }));
3127
+ this.__data$ = store.select(selector.selectByIdentifier({ identifier }));
3128
+ this.__control$ = store.select(selector.selectControl());
3129
+ if (selector?.selectLinks) {
3130
+ this.__pagination$ = store.select(selector.selectLinks({ identifier }));
3131
+ }
3132
+ if (selector?.selectPage) {
3133
+ this.__page$ = store.select(selector.selectPage({ identifier }));
3134
+ }
3135
+ }
3136
+ catch (e) {
3137
+ throw new Error(`MECX Core - Method getData -> ${e}`);
3138
+ }
3139
+ }
3140
+ async loadPage() {
3141
+ try {
3142
+ const { store, tokenStorage, actionPagination } = this;
3143
+ const { companyId, companyType } = await tokenStorage?.getToken();
3144
+ store.dispatch(actionPagination.load({
3145
+ identifier: `${companyId}-${companyType}`,
3146
+ pagination: {
3147
+ action: 'next'
3148
+ }
3149
+ }));
3150
+ }
3151
+ catch (e) {
3152
+ throw new Error(`MECX Core - Method loadPage -> ${e}`);
3153
+ }
3154
+ }
3155
+ /**
3156
+ * @description Inicializar a class genérica
3157
+ * @param (args: MonkeyEcxInitialResolverConfig)
3158
+ * => route é obrigátorio pois ele quem inicializa a store.
3159
+ * A searchClass só se faz necessaria quando for usar filtros
3160
+ */
3161
+ init(args) {
3162
+ try {
3163
+ const { searchClass, route } = args;
3164
+ this.route = route;
3165
+ if (searchClass) {
3166
+ // eslint-disable-next-line new-cap
3167
+ const searchInstance = new searchClass(this.__search);
3168
+ this.route = `${route}${searchInstance.buildParams()}`;
3169
+ this.__onSearchChanged$.next(searchInstance);
3170
+ }
3171
+ this.getData();
3172
+ }
3173
+ catch (e) {
3174
+ throw new Error(`${e?.message}`);
3175
+ }
3176
+ }
3177
+ resolve(route, state, otherArgs) {
3178
+ this.__search = route?.queryParams;
3179
+ const [currentRoute] = state?.url.split('?') || [null];
3180
+ this.currentRoute = currentRoute;
3181
+ super.resolve(route, state, otherArgs);
3182
+ }
3183
+ /**
3184
+ * @description Atualizar os filtros da tela
3185
+ * @param (search: T, route?: string)
3186
+ * => route é opcional, passar ele apenas se a rota for diferente do padrão
3187
+ */
3188
+ setSearch(search, route) {
3189
+ try {
3190
+ const { currentRoute, router } = this;
3191
+ this.setSearchByUrl(router, route || `${currentRoute}`, search);
3192
+ }
3193
+ catch (e) {
3194
+ throw new Error(`MECX Core - Method setSearch -> ${e}`);
3195
+ }
3196
+ }
3197
+ /**
3198
+ * @description Navegação para details.
3199
+ * Por padrão sera redirecionado para '${currentRoute}/details'
3200
+ * @param (detailsData: T, route?: string)
3201
+ * => route é opcional, passar ele apenas se a rota for diferente do padrão
3202
+ */
3203
+ navigateToDetails(detailsData, route) {
3204
+ try {
3205
+ const { router, currentRoute } = this;
3206
+ router.navigate([route || `${currentRoute}/details`], {
3207
+ state: {
3208
+ detailsData
3209
+ }
3210
+ });
3211
+ }
3212
+ catch (e) {
3213
+ throw new Error(`MECX Core - Method navigateToDetails -> ${e}`);
3214
+ }
3215
+ }
3216
+ }
3217
+
3101
3218
  let window$1;
3102
3219
  const text = {
3103
3220
  i18n: {
@@ -6036,5 +6153,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
6036
6153
  * Generated bundle index. Do not edit.
6037
6154
  */
6038
6155
 
6039
- 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, differentFromZero, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
6156
+ export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsResolveService, 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, differentFromZero, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
6040
6157
  //# sourceMappingURL=monkey-front-core.mjs.map