@acorex/platform 20.8.19 → 20.8.21
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/common/index.d.ts +71 -5
- package/fesm2022/acorex-platform-common.mjs +248 -59
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +55 -19
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default-error-404.component-CgVwJxdC.mjs +42 -0
- package/fesm2022/acorex-platform-themes-default-error-404.component-CgVwJxdC.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +14 -4
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/layout/entity/index.d.ts +3 -3
- package/package.json +8 -8
- package/fesm2022/acorex-platform-themes-default-error-404.component-DVF9soT5.mjs +0 -25
- package/fesm2022/acorex-platform-themes-default-error-404.component-DVF9soT5.mjs.map +0 -1
|
@@ -2,14 +2,14 @@ import { AXToastService } from '@acorex/components/toast';
|
|
|
2
2
|
import * as i6 from '@acorex/core/translation';
|
|
3
3
|
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
4
4
|
import * as i4$1 from '@acorex/platform/common';
|
|
5
|
-
import { AXPSettingsService, AXPCommonSettings, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPRefreshEvent, AXPReloadEvent, AXPEntityQueryType, AXPCleanNestedFilters, AXPWorkflowNavigateAction, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER } from '@acorex/platform/common';
|
|
5
|
+
import { AXPNotFoundError, AXPSettingsService, AXPCommonSettings, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPRefreshEvent, AXPReloadEvent, axpRedirectToNotFound, axpIsEntityRecordNotFound, AXPEntityQueryType, AXPCleanNestedFilters, AXPWorkflowNavigateAction, AXP_NOT_FOUND_ROUTE, AXP_PROTECTED_ROUTE_GUARDS, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER } from '@acorex/platform/common';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
7
|
import { InjectionToken, inject, Injector, runInInjectionContext, Injectable, input, viewChild, signal, ElementRef, ChangeDetectionStrategy, Component, ApplicationRef, EnvironmentInjector, createComponent, computed, ChangeDetectorRef, effect, Input, afterNextRender, untracked, ViewEncapsulation, viewChildren, linkedSignal, HostBinding, output, NgModule } from '@angular/core';
|
|
8
8
|
import { Subject, takeUntil } from 'rxjs';
|
|
9
9
|
import { AXPLayoutBuilderService } from '@acorex/platform/layout/builder';
|
|
10
10
|
import { AXPDeviceService, AXPBroadcastEventService, applyFilterArray, applySortArray, resolveActionLook, AXPExpressionEvaluatorService, AXPDistributedEventListenerService, AXPPlatformScope, AXPColumnWidthService, AXHighlightService, extractValue, setSmart, getChangedPaths, defaultColumnWidthProvider, AXP_COLUMN_WIDTH_PROVIDER, AXP_DATASOURCE_DEFINITION_PROVIDER, AXPSystemActionType } from '@acorex/platform/core';
|
|
11
11
|
import { merge, castArray, cloneDeep, get, set, orderBy, isNil, isEmpty, isEqual } from 'lodash-es';
|
|
12
|
-
import { AXPSessionService
|
|
12
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
13
13
|
import { Router, ActivatedRoute, RouterModule, ROUTES } from '@angular/router';
|
|
14
14
|
import * as i3 from '@acorex/components/button';
|
|
15
15
|
import { AXButtonModule } from '@acorex/components/button';
|
|
@@ -604,7 +604,7 @@ class AXPEntityDefinitionRegistryService {
|
|
|
604
604
|
throw error; // Rethrow to allow error handling by caller
|
|
605
605
|
}
|
|
606
606
|
if (!config) {
|
|
607
|
-
throw new
|
|
607
|
+
throw new AXPNotFoundError(`Invalid entity name: ${key}`);
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
return config;
|
|
@@ -4778,20 +4778,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
4778
4778
|
type: Injectable,
|
|
4779
4779
|
args: [{ providedIn: 'root' }]
|
|
4780
4780
|
}] });
|
|
4781
|
-
const AXPEntityListViewModelResolver = async (route, state, service = inject(AXPEntityListViewModelFactory)) => {
|
|
4781
|
+
const AXPEntityListViewModelResolver = async (route, state, service = inject(AXPEntityListViewModelFactory), router = inject(Router)) => {
|
|
4782
4782
|
const moduleName = route.parent?.paramMap.get('module');
|
|
4783
4783
|
const entityName = route.paramMap.get('entity');
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4784
|
+
try {
|
|
4785
|
+
const vm = await service.create(moduleName, entityName);
|
|
4786
|
+
// Check if filters are provided in query params
|
|
4787
|
+
const filtersParam = route.queryParamMap.get('filters');
|
|
4788
|
+
if (filtersParam) {
|
|
4789
|
+
const applied = vm.applyFiltersFromQueryParams(filtersParam);
|
|
4790
|
+
if (applied) {
|
|
4791
|
+
// Trigger filter and sort application
|
|
4792
|
+
await vm.applyFilterAndSort();
|
|
4793
|
+
}
|
|
4794
|
+
}
|
|
4795
|
+
return vm;
|
|
4796
|
+
}
|
|
4797
|
+
catch (error) {
|
|
4798
|
+
if (error instanceof AXPNotFoundError) {
|
|
4799
|
+
return axpRedirectToNotFound(router);
|
|
4792
4800
|
}
|
|
4801
|
+
throw error;
|
|
4793
4802
|
}
|
|
4794
|
-
return vm;
|
|
4795
4803
|
};
|
|
4796
4804
|
|
|
4797
4805
|
const AXPEntityDeletedEvent = createWorkFlowEvent('[Entity] Deleted');
|
|
@@ -5583,10 +5591,19 @@ class AXPEntityPreloadFiltersViewModel {
|
|
|
5583
5591
|
const AXPEntityPreloadFiltersViewModelResolver = async (route, state) => {
|
|
5584
5592
|
const injector = inject(Injector);
|
|
5585
5593
|
const entityRegistry = inject(AXPEntityDefinitionRegistryService);
|
|
5594
|
+
const router = inject(Router);
|
|
5586
5595
|
const moduleName = route.parent?.paramMap.get('module');
|
|
5587
5596
|
const entityName = route.paramMap.get('entity');
|
|
5588
|
-
|
|
5589
|
-
|
|
5597
|
+
try {
|
|
5598
|
+
const entity = await entityRegistry.resolve(moduleName, entityName);
|
|
5599
|
+
return new AXPEntityPreloadFiltersViewModel(injector, entity);
|
|
5600
|
+
}
|
|
5601
|
+
catch (error) {
|
|
5602
|
+
if (error instanceof AXPNotFoundError) {
|
|
5603
|
+
return axpRedirectToNotFound(router);
|
|
5604
|
+
}
|
|
5605
|
+
throw error;
|
|
5606
|
+
}
|
|
5590
5607
|
};
|
|
5591
5608
|
//#endregion
|
|
5592
5609
|
|
|
@@ -7161,9 +7178,12 @@ class AXPLayoutAdapterFactory {
|
|
|
7161
7178
|
async createDetailsViewAdapter(entityResolver, moduleName, entityName, id, dependencies) {
|
|
7162
7179
|
const entity = await entityResolver.resolve(moduleName, entityName);
|
|
7163
7180
|
if (!entity) {
|
|
7164
|
-
throw new
|
|
7181
|
+
throw new AXPNotFoundError(`Entity ${moduleName}.${entityName} not found`);
|
|
7165
7182
|
}
|
|
7166
7183
|
const rootContext = await this.loadRootContext(entity, id);
|
|
7184
|
+
if (axpIsEntityRecordNotFound(rootContext)) {
|
|
7185
|
+
throw new AXPNotFoundError(`Entity record ${moduleName}.${entityName}#${id} not found`);
|
|
7186
|
+
}
|
|
7167
7187
|
// Evaluate hidden expressions for related entities once, reuse across building and composing
|
|
7168
7188
|
const evaluatedRelatedEntities = await this.evaluateRelatedEntitiesHidden(entity?.relatedEntities ?? [], rootContext, dependencies);
|
|
7169
7189
|
// Build main and related pages using evaluated related entities
|
|
@@ -7334,7 +7354,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
7334
7354
|
}]
|
|
7335
7355
|
}], ctorParameters: () => [{ type: AXPRelatedEntityConverterFactory }, { type: AXPMainEntityContentBuilder }, { type: AXPLayoutAdapterBuilder }, { type: i4$1.AXPFilterOperatorMiddlewareService }] });
|
|
7336
7356
|
|
|
7337
|
-
const AXPLayoutDetailsViewRouteResolver = async (route, state, entityResolver = inject(AXPEntityDefinitionRegistryService), expressionEvaluator = inject(AXPExpressionEvaluatorService), session = inject(AXPSessionService), formatService = inject(AXFormatService), workflowService = inject(AXPWorkflowService), commandService = inject(AXPCommandService), layoutAdapterFactory = inject(AXPLayoutAdapterFactory)) => {
|
|
7357
|
+
const AXPLayoutDetailsViewRouteResolver = async (route, state, entityResolver = inject(AXPEntityDefinitionRegistryService), expressionEvaluator = inject(AXPExpressionEvaluatorService), session = inject(AXPSessionService), formatService = inject(AXFormatService), workflowService = inject(AXPWorkflowService), commandService = inject(AXPCommandService), layoutAdapterFactory = inject(AXPLayoutAdapterFactory), router = inject(Router)) => {
|
|
7338
7358
|
const moduleName = route.parent?.paramMap.get('module');
|
|
7339
7359
|
const entityName = route.paramMap.get('entity');
|
|
7340
7360
|
const id = route.paramMap.get('id');
|
|
@@ -7346,7 +7366,15 @@ const AXPLayoutDetailsViewRouteResolver = async (route, state, entityResolver =
|
|
|
7346
7366
|
workflowService,
|
|
7347
7367
|
commandService,
|
|
7348
7368
|
};
|
|
7349
|
-
|
|
7369
|
+
try {
|
|
7370
|
+
return await layoutAdapterFactory.createDetailsViewAdapter(entityResolver, moduleName, entityName, id, dependencies);
|
|
7371
|
+
}
|
|
7372
|
+
catch (error) {
|
|
7373
|
+
if (error instanceof AXPNotFoundError) {
|
|
7374
|
+
return axpRedirectToNotFound(router);
|
|
7375
|
+
}
|
|
7376
|
+
throw error;
|
|
7377
|
+
}
|
|
7350
7378
|
};
|
|
7351
7379
|
|
|
7352
7380
|
class AXPEntityPreloadFilterGuard {
|
|
@@ -16215,7 +16243,7 @@ function routesFacory() {
|
|
|
16215
16243
|
loadComponent: () => {
|
|
16216
16244
|
return config.viewers.root();
|
|
16217
16245
|
},
|
|
16218
|
-
canActivate: [
|
|
16246
|
+
canActivate: [...AXP_PROTECTED_ROUTE_GUARDS],
|
|
16219
16247
|
children: [
|
|
16220
16248
|
{
|
|
16221
16249
|
path: ':module',
|
|
@@ -16271,8 +16299,16 @@ function routesFacory() {
|
|
|
16271
16299
|
redirectTo: ':entity/list',
|
|
16272
16300
|
pathMatch: 'full',
|
|
16273
16301
|
},
|
|
16302
|
+
{
|
|
16303
|
+
path: '**',
|
|
16304
|
+
redirectTo: AXP_NOT_FOUND_ROUTE,
|
|
16305
|
+
},
|
|
16274
16306
|
],
|
|
16275
16307
|
},
|
|
16308
|
+
{
|
|
16309
|
+
path: '**',
|
|
16310
|
+
redirectTo: AXP_NOT_FOUND_ROUTE,
|
|
16311
|
+
},
|
|
16276
16312
|
],
|
|
16277
16313
|
},
|
|
16278
16314
|
];
|