monkey-front-core 0.0.469 → 0.0.470

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.
@@ -3143,6 +3143,108 @@ __decorate([
3143
3143
  })
3144
3144
  ], MonkeyEcxCommonsService.prototype, "getGenericData", null);
3145
3145
 
3146
+ class MonkeyEcxCommonsResolveBaseService extends MonkeyEcxCommonsService {
3147
+ constructor(monkeyecxService, tokenStorage, config) {
3148
+ super(monkeyecxService, tokenStorage);
3149
+ this.route = null;
3150
+ this.currentRoute = null;
3151
+ this.paginationService = inject(MonkeyEcxPaginationService);
3152
+ this.translateService = inject(TranslateService);
3153
+ this.router = inject(Router);
3154
+ this.store = inject(Store);
3155
+ this.monkeyDiscovery = inject(MonkeyEcxDiscoveryParamsService);
3156
+ const { actions } = config;
3157
+ this.action = actions;
3158
+ }
3159
+ async getData() {
3160
+ try {
3161
+ const { store, route, action, tokenStorage } = this;
3162
+ const { companyId, governmentId } = await tokenStorage?.getToken();
3163
+ if (!route)
3164
+ return;
3165
+ const url = MonkeyEcxUtils.replaceVariables(route, { companyId, governmentId });
3166
+ store.dispatch(action.load({ url }));
3167
+ }
3168
+ catch (e) {
3169
+ throw new Error(`MECX Core - Method getData -> ${e}`);
3170
+ }
3171
+ }
3172
+ async loadPage(actionType) {
3173
+ try {
3174
+ const { store, action } = this;
3175
+ store.dispatch(action.loadPagination({
3176
+ pagination: {
3177
+ action: actionType
3178
+ }
3179
+ }));
3180
+ }
3181
+ catch (e) {
3182
+ throw new Error(`MECX Core - Method loadPage -> ${e}`);
3183
+ }
3184
+ }
3185
+ /**
3186
+ * @description Inicializar a class genérica
3187
+ * @param (args: MonkeyEcxInitialResolverConfig)
3188
+ * => route é obrigátorio pois ele quem inicializa a store.
3189
+ * A searchClass só se faz necessaria quando for usar filtros
3190
+ */
3191
+ init(args) {
3192
+ try {
3193
+ const { searchClass, route } = args;
3194
+ this.route = route;
3195
+ if (searchClass) {
3196
+ // eslint-disable-next-line new-cap
3197
+ const searchInstance = new searchClass(this.__search);
3198
+ this.route = `${route}${searchInstance.buildParams()}`;
3199
+ this.__onSearchChanged$.next(searchInstance);
3200
+ }
3201
+ this.getData();
3202
+ }
3203
+ catch (e) {
3204
+ throw new Error(`${e?.message}`);
3205
+ }
3206
+ }
3207
+ resolve(route, state, otherArgs) {
3208
+ this.__search = route?.queryParams;
3209
+ const [currentRoute] = state?.url.split('?') || [null];
3210
+ this.currentRoute = currentRoute;
3211
+ super.resolve(route, state, otherArgs);
3212
+ }
3213
+ /**
3214
+ * @description Atualizar os filtros da tela
3215
+ * @param (search: T, route?: string)
3216
+ * => route é opcional, passar ele apenas se a rota for diferente do padrão
3217
+ */
3218
+ setSearch(search, route) {
3219
+ try {
3220
+ const { currentRoute, router } = this;
3221
+ this.setSearchByUrl(router, route || `${currentRoute}`, search);
3222
+ }
3223
+ catch (e) {
3224
+ throw new Error(`MECX Core - Method setSearch -> ${e}`);
3225
+ }
3226
+ }
3227
+ /**
3228
+ * @description Navegação para details.
3229
+ * Por padrão sera redirecionado para '${currentRoute}/details'
3230
+ * @param (detailsData: T, route?: string)
3231
+ * => route é opcional, passar ele apenas se a rota for diferente do padrão
3232
+ */
3233
+ navigateToDetails(detailsData, route) {
3234
+ try {
3235
+ const { router, currentRoute } = this;
3236
+ router.navigate([route || `${currentRoute}/details`], {
3237
+ state: {
3238
+ detailsData
3239
+ }
3240
+ });
3241
+ }
3242
+ catch (e) {
3243
+ throw new Error(`MECX Core - Method navigateToDetails -> ${e}`);
3244
+ }
3245
+ }
3246
+ }
3247
+
3146
3248
  class MonkeyEcxCommonsResolveService extends MonkeyEcxCommonsService {
3147
3249
  constructor(monkeyecxService, tokenStorage, config) {
3148
3250
  super(monkeyecxService, tokenStorage);
@@ -6360,5 +6462,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
6360
6462
  * Generated bundle index. Do not edit.
6361
6463
  */
6362
6464
 
6363
- export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsActions, MonkeyEcxCommonsResolveService, MonkeyEcxCommonsSelectors, 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, documentValidatorByType, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
6465
+ export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsActions, MonkeyEcxCommonsResolveBaseService, MonkeyEcxCommonsResolveService, MonkeyEcxCommonsSelectors, 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, documentValidatorByType, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
6364
6466
  //# sourceMappingURL=monkey-front-core.mjs.map