@acorex/platform 20.0.4 → 20.0.6

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.
Files changed (37) hide show
  1. package/common/index.d.ts +102 -2
  2. package/core/index.d.ts +1 -1
  3. package/domain/index.d.ts +1 -65
  4. package/fesm2022/acorex-platform-common.mjs +243 -1
  5. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-domain.mjs +32 -38
  8. package/fesm2022/acorex-platform-domain.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-builder.mjs +2 -0
  10. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-layout-components.mjs +184 -14
  12. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-entity.mjs +117 -35
  14. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-layout-views.mjs +4 -17
  16. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-runtime.mjs +6 -5
  18. package/fesm2022/acorex-platform-runtime.mjs.map +1 -1
  19. package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-cvoKMP84.mjs → acorex-platform-themes-default-entity-master-single-view.component--tn_1mKA.mjs} +6 -7
  20. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component--tn_1mKA.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-themes-default.mjs +6 -6
  22. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  23. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-5kuroU6r.mjs → acorex-platform-widgets-checkbox-widget-designer.component-BuU7nJ6u.mjs} +2 -2
  24. package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-BuU7nJ6u.mjs.map +1 -0
  25. package/fesm2022/{acorex-platform-widgets-page-widget-designer.component-tITe8tiu.mjs → acorex-platform-widgets-page-widget-designer.component-Dwts3at7.mjs} +3 -1
  26. package/fesm2022/acorex-platform-widgets-page-widget-designer.component-Dwts3at7.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-widgets.mjs +79 -67
  28. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  29. package/layout/builder/index.d.ts +4 -3
  30. package/layout/components/index.d.ts +103 -2
  31. package/layout/entity/index.d.ts +9 -0
  32. package/package.json +1 -1
  33. package/runtime/index.d.ts +5 -5
  34. package/widgets/index.d.ts +5 -4
  35. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-cvoKMP84.mjs.map +0 -1
  36. package/fesm2022/acorex-platform-widgets-checkbox-widget-designer.component-5kuroU6r.mjs.map +0 -1
  37. package/fesm2022/acorex-platform-widgets-page-widget-designer.component-tITe8tiu.mjs.map +0 -1
package/common/index.d.ts CHANGED
@@ -1282,6 +1282,106 @@ declare abstract class AXPLockService {
1282
1282
  static ɵprov: i0.ɵɵInjectableDeclaration<AXPLockService>;
1283
1283
  }
1284
1284
 
1285
+ interface AXPReportCategory {
1286
+ id: string;
1287
+ title: string;
1288
+ description?: string;
1289
+ parentId?: string;
1290
+ hasChild?: boolean;
1291
+ hasReport?: boolean;
1292
+ }
1293
+ interface AXPReportDefinition {
1294
+ id: string;
1295
+ title: string;
1296
+ description?: string;
1297
+ categoryIds: string[];
1298
+ parameterGroups: AXPReportParameterGroup[];
1299
+ }
1300
+ interface AXPReportParameterGroup {
1301
+ name: string;
1302
+ title: string;
1303
+ description?: string;
1304
+ parameters: AXPReportParameter[];
1305
+ }
1306
+ interface AXPReportParameter {
1307
+ path: string;
1308
+ title: string;
1309
+ description?: string;
1310
+ widget: AXPWidgetNode;
1311
+ }
1312
+
1313
+ type AXPReportDefinitionProviderToken = AXPReportDefinitionProvider | Promise<AXPReportDefinitionProvider>;
1314
+ declare const AXP_REPORT_DEFINITION_PROVIDER: InjectionToken<AXPReportDefinitionProviderToken[]>;
1315
+ interface AXPReportDefinitionProvider {
1316
+ getList(categoryId: string): Promise<AXPReportDefinition[]>;
1317
+ getById(id: string): Promise<AXPReportDefinition | undefined>;
1318
+ }
1319
+ type AXPReportCategoryProviderToken = AXPReportCategoryProvider | Promise<AXPReportCategoryProvider>;
1320
+ declare const AXP_REPORT_CATEGORY_PROVIDER: InjectionToken<AXPReportCategoryProviderToken[]>;
1321
+ interface AXPReportCategoryProvider {
1322
+ getList(parentId?: string): Promise<AXPReportCategory[]>;
1323
+ getById(id: string): Promise<AXPReportCategory | undefined>;
1324
+ }
1325
+
1326
+ declare class AXPReportDefinitionService {
1327
+ private readonly categoryProviders;
1328
+ private readonly definitionProviders;
1329
+ /** Cache for definitions by categoryId. */
1330
+ private definitionsByCategory;
1331
+ /** Cache for categories by id. */
1332
+ private categoriesById;
1333
+ /** Cache for categories by parentId. */
1334
+ private categoriesByParentId;
1335
+ /**
1336
+ * Returns all categories for a given parentId, loading from providers if not cached.
1337
+ * @param parentId The parent ID to filter by (or undefined for root categories).
1338
+ */
1339
+ getCategories(parentId?: string): Promise<AXPReportCategory[]>;
1340
+ /**
1341
+ * Returns all report definitions for a given categoryId, loading from providers if not cached.
1342
+ * @param categoryId The category ID to filter by.
1343
+ */
1344
+ getReportsByCategoryId(categoryId: string): Promise<AXPReportDefinition[]>;
1345
+ /**
1346
+ * Returns a report definition by its id.
1347
+ * First checks the cache, then queries all providers if not found.
1348
+ * @param id The report id.
1349
+ * @returns The report definition if found, undefined otherwise.
1350
+ */
1351
+ getReportById(id: string): Promise<AXPReportDefinition | undefined>;
1352
+ /**
1353
+ * Returns a category by its id, using cache and providers if needed.
1354
+ * @param categoryId The category id.
1355
+ */
1356
+ getCategoryById(categoryId: string): Promise<AXPReportCategory | undefined>;
1357
+ /**
1358
+ * Returns the full categories path from root to the specified category.
1359
+ * @param categoryId The category ID to get the path for.
1360
+ * @returns Array of categories from root to the specified category.
1361
+ * @throws Error if category not found.
1362
+ */
1363
+ getCategoriesPathById(categoryId: string): Promise<AXPReportCategory[]>;
1364
+ /**
1365
+ * Returns the full categories path for the category that contains the specified report.
1366
+ * @param reportId The report ID to find the category path for.
1367
+ * @returns Array of categories from root to the category containing the report.
1368
+ * @throws Error if report not found.
1369
+ */
1370
+ getCategoriesPathByReportId(reportId: string): Promise<AXPReportCategory[]>;
1371
+ /**
1372
+ * Returns the category ID that contains a specific report.
1373
+ * @param reportId The report ID to search for.
1374
+ * @returns The category ID containing the report, or undefined if not found.
1375
+ */
1376
+ getCategoryIdByReportId(reportId: string): Promise<string | undefined>;
1377
+ /** Clears the definitions by category cache. */
1378
+ clearDefinitionsCache(): void;
1379
+ /** Clears the categories by parentId cache. */
1380
+ clearCategoriesCache(): void;
1381
+ static ɵfac: i0.ɵɵFactoryDeclaration<AXPReportDefinitionService, never>;
1382
+ static ɵprov: i0.ɵɵInjectableDeclaration<AXPReportDefinitionService>;
1383
+ }
1384
+
1285
1385
  declare class AXPClipBoardService {
1286
1386
  private toast;
1287
1387
  copy(title: string, value: string): void;
@@ -1444,5 +1544,5 @@ declare class AXMWorkflowErrorHandler implements AXPErrorHandler {
1444
1544
  static ɵprov: i0.ɵɵInjectableDeclaration<AXMWorkflowErrorHandler>;
1445
1545
  }
1446
1546
 
1447
- export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPHomePageModule, AXPHomePageService, AXPLockService, AXPLogoComponent, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRegionalService, AXPRelationshipCardinality, AXPRelationshipKind, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValueProvider, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPToastAction, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, createAllQueryView, createQueryView, getEntityInfo, provideDynamicHomePage, resolveActionLook };
1448
- export type { AXEntityPropertyWidget, AXPAggregate, AXPAppVersion, AXPAppVersionProvider, AXPApplication, AXPCategoryEntity, AXPCity, AXPCommandActionCallback, AXPCommandActionDisplay, AXPCommandActionLook, AXPCommandActionPriority, AXPCommandActionType, AXPCommonModuleConfigs, AXPCountry, AXPCurrency, AXPDomToImageOptions, AXPEntity, AXPEntityAction, AXPEntityCommand, AXPEntityDetailListView, AXPEntityMasterCreateLayoutView, AXPEntityMasterLayoutView, AXPEntityMasterListView, AXPEntityMasterSingleLayoutView, AXPEntityMasterUpdateLayoutView, AXPEntityProperty, AXPEntityPropertyCreateView, AXPEntityPropertyGroup, AXPEntityPropertyLayoutConfig, AXPEntityPropertyUpdateView, AXPEntityPropertyView, AXPEntityQuery, AXPEntitySectionView, AXPEntityTableColumn, AXPEntityVersionHistory, AXPErrorHandler, AXPFileExtension, AXPFileStorageCreateRequest, AXPFileStorageFindRequest, AXPFileStorageInfo, AXPFileStorageUpdateRequest, AXPFileType, AXPFileTypeInfoProvider, AXPFilterOperator, AXPGeoLocation, AXPGridLayoutOptions, AXPGridLayoutPositions, AXPGroupSearchResult, AXPHomePageDefinition, AXPLanguage, AXPLocaleProfile, AXPLockGetInfoRequest, AXPLockInfo, AXPLockRequest, AXPLockType, AXPMenuFinderResult, AXPMenuInsertion, AXPMenuItem, AXPMenuItemCommand, AXPMenuItemWithParent, AXPMenuProvider, AXPMenuProviderContext, AXPMenuType, AXPModule, AXPPlatformConfigs, AXPProvince, AXPQueryFilter, AXPQuerySort, AXPQueryView, AXPRelatedEntity, AXPRelationship, AXPRootConfigs, AXPSearchAction, AXPSearchDefinition, AXPSearchDefinitionDisplayFormat, AXPSearchDefinitionProvider, AXPSearchDisplayGroupResult, AXPSearchDisplayResult, AXPSearchDisplayResultForSave, AXPSearchParentResult, AXPSearchProvider, AXPSearchResult, AXPSettingChangedEvent, AXPSettingDefinition, AXPSettingDefinitionGroup, AXPSettingDefinitionProvider, AXPSettingDefinitionSection, AXPSettingServiceInterface, AXPSettingValue, AXPSettingValueProvider, AXPTimeZone, AXPUnLockRequest };
1547
+ export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPHomePageModule, AXPHomePageService, AXPLockService, AXPLogoComponent, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRegionalService, AXPRelationshipCardinality, AXPRelationshipKind, AXPReportDefinitionService, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValueProvider, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPToastAction, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_REPORT_CATEGORY_PROVIDER, AXP_REPORT_DEFINITION_PROVIDER, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, createAllQueryView, createQueryView, getEntityInfo, provideDynamicHomePage, resolveActionLook };
1548
+ export type { AXEntityPropertyWidget, AXPAggregate, AXPAppVersion, AXPAppVersionProvider, AXPApplication, AXPCategoryEntity, AXPCity, AXPCommandActionCallback, AXPCommandActionDisplay, AXPCommandActionLook, AXPCommandActionPriority, AXPCommandActionType, AXPCommonModuleConfigs, AXPCountry, AXPCurrency, AXPDomToImageOptions, AXPEntity, AXPEntityAction, AXPEntityCommand, AXPEntityDetailListView, AXPEntityMasterCreateLayoutView, AXPEntityMasterLayoutView, AXPEntityMasterListView, AXPEntityMasterSingleLayoutView, AXPEntityMasterUpdateLayoutView, AXPEntityProperty, AXPEntityPropertyCreateView, AXPEntityPropertyGroup, AXPEntityPropertyLayoutConfig, AXPEntityPropertyUpdateView, AXPEntityPropertyView, AXPEntityQuery, AXPEntitySectionView, AXPEntityTableColumn, AXPEntityVersionHistory, AXPErrorHandler, AXPFileExtension, AXPFileStorageCreateRequest, AXPFileStorageFindRequest, AXPFileStorageInfo, AXPFileStorageUpdateRequest, AXPFileType, AXPFileTypeInfoProvider, AXPFilterOperator, AXPGeoLocation, AXPGridLayoutOptions, AXPGridLayoutPositions, AXPGroupSearchResult, AXPHomePageDefinition, AXPLanguage, AXPLocaleProfile, AXPLockGetInfoRequest, AXPLockInfo, AXPLockRequest, AXPLockType, AXPMenuFinderResult, AXPMenuInsertion, AXPMenuItem, AXPMenuItemCommand, AXPMenuItemWithParent, AXPMenuProvider, AXPMenuProviderContext, AXPMenuType, AXPModule, AXPPlatformConfigs, AXPProvince, AXPQueryFilter, AXPQuerySort, AXPQueryView, AXPRelatedEntity, AXPRelationship, AXPReportCategory, AXPReportCategoryProvider, AXPReportCategoryProviderToken, AXPReportDefinition, AXPReportDefinitionProvider, AXPReportDefinitionProviderToken, AXPReportParameter, AXPReportParameterGroup, AXPRootConfigs, AXPSearchAction, AXPSearchDefinition, AXPSearchDefinitionDisplayFormat, AXPSearchDefinitionProvider, AXPSearchDisplayGroupResult, AXPSearchDisplayResult, AXPSearchDisplayResultForSave, AXPSearchParentResult, AXPSearchProvider, AXPSearchResult, AXPSettingChangedEvent, AXPSettingDefinition, AXPSettingDefinitionGroup, AXPSettingDefinitionProvider, AXPSettingDefinitionSection, AXPSettingServiceInterface, AXPSettingValue, AXPSettingValueProvider, AXPTimeZone, AXPUnLockRequest };
package/core/index.d.ts CHANGED
@@ -1177,7 +1177,7 @@ declare class AXPExpressionEvaluatorService {
1177
1177
  private getMergedScope;
1178
1178
  evaluate(source: any | any[], scope: AXPExpressionEvaluatorScope): Promise<any>;
1179
1179
  private evaluateStringExpression;
1180
- isExpression(expression: unknown): boolean;
1180
+ isExpression(expression: string): boolean;
1181
1181
  static ɵfac: i0.ɵɵFactoryDeclaration<AXPExpressionEvaluatorService, never>;
1182
1182
  static ɵprov: i0.ɵɵInjectableDeclaration<AXPExpressionEvaluatorService>;
1183
1183
  }
package/domain/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, EnvironmentProviders } from '@angular/core';
3
3
  import * as i1 from '@acorex/platform/runtime';
4
- import { AXPOptionsData } from '@acorex/platform/core';
5
4
 
6
5
  declare const AXP_ENTITY_CRUD_SETUP: InjectionToken<void>;
7
6
  declare function provideEntity(entityKeys: string[]): EnvironmentProviders;
@@ -13,67 +12,4 @@ declare class AXPDomainModule {
13
12
  static ɵinj: i0.ɵɵInjectorDeclaration<AXPDomainModule>;
14
13
  }
15
14
 
16
- declare enum AXPRelationshipKind {
17
- Association = 0,
18
- Composition = 1,
19
- Aggregation = 2
20
- }
21
- declare enum AXPRelationshipCardinality {
22
- OneToOne = 0,
23
- OneToMany = 1,
24
- ManyToMany = 2
25
- }
26
- declare enum AXPEntityType {
27
- Entity = 0,
28
- AggregateRoot = 1,
29
- ValueObject = 2
30
- }
31
- interface AXPRelationshipDefinition {
32
- key: string;
33
- source: {
34
- path: string;
35
- field: string;
36
- };
37
- target: {
38
- path: string;
39
- field: string;
40
- };
41
- kind: AXPRelationshipKind;
42
- cardinality: AXPRelationshipCardinality;
43
- }
44
- interface AXPModuleDefinition {
45
- key: string;
46
- title: string;
47
- description: string;
48
- icon: string;
49
- aggregates: AXPAggregateDefinition[];
50
- }
51
- interface AXPAggregateDefinition {
52
- key: string;
53
- title: string;
54
- entities: AXPEntityDefinition[];
55
- }
56
- interface AXPEntityDefinition {
57
- key: string;
58
- title: string;
59
- fields: AXPEntityFieldDefinition[];
60
- type: AXPEntityType;
61
- }
62
- interface AXPEntityFieldDefinition {
63
- key: string;
64
- title: string;
65
- dataType: string;
66
- widget: {
67
- type: string;
68
- options?: AXPOptionsData;
69
- };
70
- }
71
- declare enum AXPEntityCommandScope {
72
- TypeLevel = "typeLevel",
73
- Selected = "selected",
74
- Individual = "individual",
75
- Section = "section"
76
- }
77
-
78
- export { AXPDomainModule, AXPEntityCommandScope, AXPEntityType, AXPRelationshipCardinality, AXPRelationshipKind, AXP_ENTITY_CRUD_SETUP, provideEntity };
79
- export type { AXPAggregateDefinition, AXPEntityDefinition, AXPEntityFieldDefinition, AXPModuleDefinition, AXPRelationshipDefinition };
15
+ export { AXPDomainModule, AXP_ENTITY_CRUD_SETUP, provideEntity };
@@ -2231,6 +2231,248 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
2231
2231
  type: Injectable
2232
2232
  }] });
2233
2233
 
2234
+ const AXP_REPORT_DEFINITION_PROVIDER = new InjectionToken('AXP_REPORT_DEFINITION_PROVIDER', {
2235
+ factory: () => [],
2236
+ });
2237
+ const AXP_REPORT_CATEGORY_PROVIDER = new InjectionToken('AXP_REPORT_CATEGORY_PROVIDER', {
2238
+ factory: () => [],
2239
+ });
2240
+
2241
+ //#region ---- Imports ----
2242
+ //#endregion
2243
+ class AXPReportDefinitionService {
2244
+ constructor() {
2245
+ //#region ---- Providers & Caches ----
2246
+ this.categoryProviders = inject(AXP_REPORT_CATEGORY_PROVIDER, { optional: true }) || [];
2247
+ this.definitionProviders = inject(AXP_REPORT_DEFINITION_PROVIDER, { optional: true }) || [];
2248
+ /** Cache for definitions by categoryId. */
2249
+ this.definitionsByCategory = new Map();
2250
+ /** Cache for categories by id. */
2251
+ this.categoriesById = new Map();
2252
+ /** Cache for categories by parentId. */
2253
+ this.categoriesByParentId = new Map();
2254
+ }
2255
+ //#endregion
2256
+ //#region ---- Public API ----
2257
+ /**
2258
+ * Returns all categories for a given parentId, loading from providers if not cached.
2259
+ * @param parentId The parent ID to filter by (or undefined for root categories).
2260
+ */
2261
+ async getCategories(parentId) {
2262
+ if (this.categoriesByParentId.has(parentId)) {
2263
+ return this.categoriesByParentId.get(parentId);
2264
+ }
2265
+ const resolvedProviders = await Promise.all(this.categoryProviders);
2266
+ const categories = [];
2267
+ for (const provider of resolvedProviders) {
2268
+ if (provider && typeof provider.getList === 'function') {
2269
+ const cats = await provider.getList(parentId);
2270
+ if (Array.isArray(cats)) {
2271
+ categories.push(...cats);
2272
+ }
2273
+ }
2274
+ }
2275
+ this.categoriesByParentId.set(parentId, categories);
2276
+ // Optionally update categoriesById cache for fast lookup by id
2277
+ for (const cat of categories) {
2278
+ this.categoriesById.set(cat.id, cat);
2279
+ }
2280
+ return categories;
2281
+ }
2282
+ /**
2283
+ * Returns all report definitions for a given categoryId, loading from providers if not cached.
2284
+ * @param categoryId The category ID to filter by.
2285
+ */
2286
+ async getReportsByCategoryId(categoryId) {
2287
+ if (this.definitionsByCategory.has(categoryId)) {
2288
+ return this.definitionsByCategory.get(categoryId);
2289
+ }
2290
+ const resolvedProviders = await Promise.all(this.definitionProviders);
2291
+ const definitions = [];
2292
+ for (const provider of resolvedProviders) {
2293
+ if (provider && typeof provider.getList === 'function') {
2294
+ const defs = await provider.getList(categoryId);
2295
+ if (Array.isArray(defs)) {
2296
+ definitions.push(...defs);
2297
+ }
2298
+ }
2299
+ }
2300
+ this.definitionsByCategory.set(categoryId, definitions);
2301
+ return definitions;
2302
+ }
2303
+ /**
2304
+ * Returns a report definition by its id.
2305
+ * First checks the cache, then queries all providers if not found.
2306
+ * @param id The report id.
2307
+ * @returns The report definition if found, undefined otherwise.
2308
+ */
2309
+ async getReportById(id) {
2310
+ // Check cache first
2311
+ for (const reports of this.definitionsByCategory.values()) {
2312
+ const found = reports.find(report => report.id === id);
2313
+ if (found) {
2314
+ return found;
2315
+ }
2316
+ }
2317
+ // Not in cache, query providers
2318
+ const resolvedProviders = await Promise.all(this.definitionProviders);
2319
+ const results = await Promise.all(resolvedProviders
2320
+ .filter(p => p && typeof p.getById === 'function')
2321
+ .map(p => p.getById(id)));
2322
+ return results.find(r => r !== undefined);
2323
+ }
2324
+ /**
2325
+ * Returns a category by its id, using cache and providers if needed.
2326
+ * @param categoryId The category id.
2327
+ */
2328
+ async getCategoryById(categoryId) {
2329
+ // Check if it's already in cache
2330
+ if (this.categoriesById.has(categoryId)) {
2331
+ return this.categoriesById.get(categoryId);
2332
+ }
2333
+ // Search in already loaded categories first
2334
+ for (const [parentId, categories] of this.categoriesByParentId.entries()) {
2335
+ const found = categories.find(cat => cat.id === categoryId);
2336
+ if (found) {
2337
+ this.categoriesById.set(categoryId, found);
2338
+ return found;
2339
+ }
2340
+ }
2341
+ // If not found in loaded categories, we need to search level by level
2342
+ // Start with root categories if not already loaded
2343
+ if (!this.categoriesByParentId.has(undefined)) {
2344
+ await this.getCategories();
2345
+ const found = this.categoriesById.get(categoryId);
2346
+ if (found)
2347
+ return found;
2348
+ }
2349
+ // Search through loaded categories and their children
2350
+ const searchQueue = [undefined];
2351
+ const searched = new Set();
2352
+ while (searchQueue.length > 0) {
2353
+ const parentId = searchQueue.shift();
2354
+ if (searched.has(parentId))
2355
+ continue;
2356
+ searched.add(parentId);
2357
+ const categories = await this.getCategories(parentId);
2358
+ const found = categories.find(cat => cat.id === categoryId);
2359
+ if (found) {
2360
+ return found;
2361
+ }
2362
+ // Add children to search queue
2363
+ for (const category of categories) {
2364
+ if (!searched.has(category.id)) {
2365
+ searchQueue.push(category.id);
2366
+ }
2367
+ }
2368
+ }
2369
+ return undefined;
2370
+ }
2371
+ /**
2372
+ * Returns the full categories path from root to the specified category.
2373
+ * @param categoryId The category ID to get the path for.
2374
+ * @returns Array of categories from root to the specified category.
2375
+ * @throws Error if category not found.
2376
+ */
2377
+ async getCategoriesPathById(categoryId) {
2378
+ const path = [];
2379
+ let currentCategoryId = categoryId;
2380
+ while (currentCategoryId) {
2381
+ // Try to get from cache first
2382
+ let category = this.categoriesById.get(currentCategoryId);
2383
+ // If not in cache, we need to find it by searching parent levels
2384
+ if (!category) {
2385
+ category = await this.getCategoryById(currentCategoryId);
2386
+ if (!category) {
2387
+ throw new Error(`Category with id '${currentCategoryId}' not found`);
2388
+ }
2389
+ }
2390
+ path.unshift(category); // Add to beginning to maintain root->target order
2391
+ currentCategoryId = category.parentId;
2392
+ }
2393
+ return path;
2394
+ }
2395
+ /**
2396
+ * Returns the full categories path for the category that contains the specified report.
2397
+ * @param reportId The report ID to find the category path for.
2398
+ * @returns Array of categories from root to the category containing the report.
2399
+ * @throws Error if report not found.
2400
+ */
2401
+ async getCategoriesPathByReportId(reportId) {
2402
+ // Find which category contains this report
2403
+ const categoryId = await this.getCategoryIdByReportId(reportId);
2404
+ if (!categoryId) {
2405
+ throw new Error(`Report with id '${reportId}' not found in any category`);
2406
+ }
2407
+ return this.getCategoriesPathById(categoryId);
2408
+ }
2409
+ /**
2410
+ * Returns the category ID that contains a specific report.
2411
+ * @param reportId The report ID to search for.
2412
+ * @returns The category ID containing the report, or undefined if not found.
2413
+ */
2414
+ async getCategoryIdByReportId(reportId) {
2415
+ // First check already cached report definitions
2416
+ for (const [categoryId, reports] of this.definitionsByCategory.entries()) {
2417
+ if (reports.some(report => report.id === reportId)) {
2418
+ return categoryId;
2419
+ }
2420
+ }
2421
+ // If not found in cache, search through categories level by level
2422
+ // Start with root categories
2423
+ if (!this.categoriesByParentId.has(undefined)) {
2424
+ await this.getCategories();
2425
+ }
2426
+ const searchQueue = [];
2427
+ const searched = new Set();
2428
+ // Add all known category IDs to search queue
2429
+ for (const category of this.categoriesById.values()) {
2430
+ searchQueue.push(category.id);
2431
+ }
2432
+ // Search level by level
2433
+ const searchQueueParents = [undefined];
2434
+ const searchedParents = new Set();
2435
+ while (searchQueueParents.length > 0) {
2436
+ const parentId = searchQueueParents.shift();
2437
+ if (searchedParents.has(parentId))
2438
+ continue;
2439
+ searchedParents.add(parentId);
2440
+ const categories = await this.getCategories(parentId);
2441
+ // Check reports in each category
2442
+ for (const category of categories) {
2443
+ if (!searched.has(category.id)) {
2444
+ searched.add(category.id);
2445
+ const reports = await this.getReportsByCategoryId(category.id);
2446
+ if (reports.some(report => report.id === reportId)) {
2447
+ return category.id;
2448
+ }
2449
+ // Add category to search queue for children
2450
+ searchQueueParents.push(category.id);
2451
+ }
2452
+ }
2453
+ }
2454
+ return undefined;
2455
+ }
2456
+ //#endregion
2457
+ //#region ---- Cache Management ----
2458
+ /** Clears the definitions by category cache. */
2459
+ clearDefinitionsCache() {
2460
+ this.definitionsByCategory.clear();
2461
+ }
2462
+ /** Clears the categories by parentId cache. */
2463
+ clearCategoriesCache() {
2464
+ this.categoriesByParentId.clear();
2465
+ }
2466
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: AXPReportDefinitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2467
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: AXPReportDefinitionService, providedIn: 'root' }); }
2468
+ }
2469
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: AXPReportDefinitionService, decorators: [{
2470
+ type: Injectable,
2471
+ args: [{
2472
+ providedIn: 'root',
2473
+ }]
2474
+ }] });
2475
+
2234
2476
  class AXPClipBoardService {
2235
2477
  constructor() {
2236
2478
  this.toast = inject(AXToastService);
@@ -2508,5 +2750,5 @@ class AXPRegionalService {
2508
2750
  * Generated bundle index. Do not edit.
2509
2751
  */
2510
2752
 
2511
- export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPHomePageModule, AXPHomePageService, AXPLockService, AXPLogoComponent, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRegionalService, AXPRelationshipCardinality, AXPRelationshipKind, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValueProvider, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPToastAction, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, createAllQueryView, createQueryView, getEntityInfo, provideDynamicHomePage, resolveActionLook };
2753
+ export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPHomePageModule, AXPHomePageService, AXPLockService, AXPLogoComponent, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRegionalService, AXPRelationshipCardinality, AXPRelationshipKind, AXPReportDefinitionService, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValueProvider, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPToastAction, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_REPORT_CATEGORY_PROVIDER, AXP_REPORT_DEFINITION_PROVIDER, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, createAllQueryView, createQueryView, getEntityInfo, provideDynamicHomePage, resolveActionLook };
2512
2754
  //# sourceMappingURL=acorex-platform-common.mjs.map