@acorex/platform 21.0.0-next.43 → 21.0.0-next.45

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 (29) hide show
  1. package/fesm2022/acorex-platform-auth.mjs +4 -0
  2. package/fesm2022/acorex-platform-auth.mjs.map +1 -1
  3. package/fesm2022/{acorex-platform-common-common-settings.provider-lWz_f-Ia.mjs → acorex-platform-common-common-settings.provider-CsOyxClO.mjs} +17 -3
  4. package/fesm2022/acorex-platform-common-common-settings.provider-CsOyxClO.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-common.mjs +204 -164
  6. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-core.mjs +5 -4
  8. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-entity.mjs +754 -49
  10. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-layout-views.mjs +5 -3
  12. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-widget-core.mjs +72 -6
  14. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-layout-widgets.mjs +109 -131
  16. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-themes-default.mjs +71 -5
  18. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  19. package/fesm2022/acorex-platform-workflow.mjs +85 -4
  20. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  21. package/package.json +1 -1
  22. package/types/acorex-platform-common.d.ts +65 -48
  23. package/types/acorex-platform-core.d.ts +1 -1
  24. package/types/acorex-platform-layout-entity.d.ts +203 -8
  25. package/types/acorex-platform-layout-widget-core.d.ts +15 -0
  26. package/types/acorex-platform-layout-widgets.d.ts +15 -19
  27. package/types/acorex-platform-themes-default.d.ts +6 -0
  28. package/types/acorex-platform-workflow.d.ts +68 -2
  29. package/fesm2022/acorex-platform-common-common-settings.provider-lWz_f-Ia.mjs.map +0 -1
@@ -357,65 +357,78 @@ class AXPEntityMiddleware {
357
357
  this.providedModifiers = inject(AXP_ENTITY_MODIFIER, { optional: true }) || [];
358
358
  this.providedActionPlugins = inject(AXP_ENTITY_ACTION_PLUGIN, { optional: true }) || [];
359
359
  this.injector = inject(Injector);
360
- for (const { entityName, modifier } of this.providedModifiers) {
361
- this.register(entityName, modifier);
360
+ for (const { entityName, modifier, order } of this.providedModifiers) {
361
+ this.register(entityName, modifier, order);
362
362
  }
363
363
  }
364
364
  //#endregion
365
365
  //#region ---- Registration Methods ----
366
- register(entityName, modifier) {
366
+ register(entityName, modifier, order) {
367
+ const resolvedOrder = order ?? 0;
367
368
  if (entityName instanceof RegExp) {
368
- this.patternModifiers.push({ pattern: this.normalizeRegExp(entityName), modifier });
369
+ this.patternModifiers.push({ pattern: this.normalizeRegExp(entityName), modifier, order: resolvedOrder });
369
370
  return;
370
371
  }
371
372
  if (entityName.includes('*')) {
372
373
  const pattern = this.wildcardToRegExp(entityName);
373
- this.patternModifiers.push({ pattern, modifier });
374
+ this.patternModifiers.push({ pattern, modifier, order: resolvedOrder });
374
375
  return;
375
376
  }
376
- this.exactModifiers.set(entityName, modifier);
377
+ this.exactModifiers.set(entityName, { modifier, order: resolvedOrder });
377
378
  }
378
379
  //#endregion
379
380
  //#region ---- Processing ----
380
381
  async process(entity) {
381
- // First, expand action plugins if entity.plugins exists
382
382
  const context = createModifierContext(entity);
383
- const plugins = entity.plugins;
384
- if (plugins && plugins.length) {
385
- const sorted = [...this.providedActionPlugins].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
386
- for (const p of plugins) {
387
- const contrib = sorted.find((x) => x.name === p.name);
388
- if (contrib) {
389
- try {
390
- await runInInjectionContext(this.injector, () => contrib.apply(context, p.options));
391
- }
392
- catch (err) {
393
- console.error('[AXPEntityMiddleware] action plugin failed:', p.name, err);
394
- }
395
- }
396
- }
397
- }
398
- // Then apply entity-specific modifiers
399
- // Collect all matching modifiers
400
- const modifiers = [];
401
- // Exact match first
383
+ const steps = [];
402
384
  const exact = this.exactModifiers.get(entity.name);
403
385
  if (exact) {
404
- modifiers.push(exact);
386
+ steps.push(this.createModifierStep(exact, context));
405
387
  }
406
- // Then all pattern matches
407
- for (const { pattern, modifier } of this.patternModifiers) {
408
- if (pattern.test(entity.name)) {
409
- modifiers.push(modifier);
388
+ for (const entry of this.patternModifiers) {
389
+ if (entry.pattern.test(entity.name)) {
390
+ steps.push(this.createModifierStep(entry, context));
410
391
  }
411
392
  }
412
- // Apply all matching modifiers in order
413
- for (const modifier of modifiers) {
414
- runInInjectionContext(this.injector, () => modifier(context));
393
+ const entityPlugins = entity.plugins ?? [];
394
+ for (const pluginRef of entityPlugins) {
395
+ const contrib = this.providedActionPlugins.find((x) => x.name === pluginRef.name);
396
+ if (contrib) {
397
+ steps.push(this.createPluginStep(contrib, pluginRef.name, context));
398
+ }
399
+ }
400
+ const sorted = steps.sort((a, b) => a.order - b.order);
401
+ for (const step of sorted) {
402
+ try {
403
+ await runInInjectionContext(this.injector, step.run);
404
+ }
405
+ catch (err) {
406
+ console.error('[AXPEntityMiddleware] entity processing step failed:', err);
407
+ }
415
408
  }
416
409
  return context.toEntity();
417
410
  }
418
411
  //#endregion
412
+ //#region ---- Step Factories ----
413
+ createModifierStep(entry, context) {
414
+ return {
415
+ order: entry.order,
416
+ run: () => entry.modifier(context),
417
+ };
418
+ }
419
+ createPluginStep(contrib, pluginName, context) {
420
+ return {
421
+ order: contrib.order ?? 0,
422
+ run: async () => {
423
+ const pluginRef = context.plugins.find(pluginName).get();
424
+ if (!pluginRef) {
425
+ return;
426
+ }
427
+ await contrib.apply(context, pluginRef.options);
428
+ },
429
+ };
430
+ }
431
+ //#endregion
419
432
  //#region ---- Helpers ----
420
433
  wildcardToRegExp(pattern) {
421
434
  const escaped = pattern.replace(/[.+?^${}()|\[\]\\]/g, '\\$&');
@@ -3215,6 +3228,24 @@ class AXPEntityDataProviderImpl {
3215
3228
  insertOne(entity) {
3216
3229
  return this.storageService.insertOne(this.entityName, entity);
3217
3230
  }
3231
+ count(request) {
3232
+ return this.storageService.count(this.entityName, request);
3233
+ }
3234
+ queryAll(request, options) {
3235
+ return this.storageService.queryAll(this.entityName, request, options);
3236
+ }
3237
+ getMany(ids) {
3238
+ return this.storageService.getMany(this.entityName, ids);
3239
+ }
3240
+ exists(id) {
3241
+ return this.storageService.exists(this.entityName, id);
3242
+ }
3243
+ upsertOne(entity, options) {
3244
+ return this.storageService.upsertOne(this.entityName, entity, options);
3245
+ }
3246
+ aggregate(request, options) {
3247
+ return this.storageService.aggregate(this.entityName, request, options);
3248
+ }
3218
3249
  }
3219
3250
  class AXMEntityCrudService {
3220
3251
  }
@@ -3316,6 +3347,24 @@ class AXMEntityCrudServiceImpl {
3316
3347
  get storageService() {
3317
3348
  return this._storageService;
3318
3349
  }
3350
+ async count(request) {
3351
+ return this._entityDataProvider.count(request);
3352
+ }
3353
+ async queryAll(request, options) {
3354
+ return this._entityDataProvider.queryAll(request, options);
3355
+ }
3356
+ async getMany(ids) {
3357
+ return this._entityDataProvider.getMany(ids);
3358
+ }
3359
+ async exists(id) {
3360
+ return this._entityDataProvider.exists(id);
3361
+ }
3362
+ async upsertOne(entity, options) {
3363
+ return this._entityDataProvider.upsertOne(entity, options);
3364
+ }
3365
+ async aggregate(request, options) {
3366
+ return this._entityDataProvider.aggregate(request, options);
3367
+ }
3319
3368
  async custom(request) { }
3320
3369
  }
3321
3370
 
@@ -3943,6 +3992,11 @@ class AXPEntityDetailListViewModel {
3943
3992
  this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
3944
3993
  this.expressionEvaluator = this.injector.get(AXPExpressionEvaluatorService);
3945
3994
  this.queryExecutor = this.injector.get(AXPQueryExecutor);
3995
+ this.settingsService = this.injector.get(AXPSettingsService);
3996
+ this.destroyed = new Subject();
3997
+ this.showRowIndexColumnEnabled = signal(false, ...(ngDevMode ? [{ debugName: "showRowIndexColumnEnabled" }] : /* istanbul ignore next */ []));
3998
+ /** Whether the row index column is shown (user setting). */
3999
+ this.showIndexColumn = computed(() => this.showRowIndexColumnEnabled(), ...(ngDevMode ? [{ debugName: "showIndexColumn" }] : /* istanbul ignore next */ []));
3946
4000
  this.dataSource = new AXDataSource({
3947
4001
  byKey: async (key) => {
3948
4002
  const execute = this.detailEntity()?.queries?.byKey?.execute;
@@ -4082,8 +4136,28 @@ class AXPEntityDetailListViewModel {
4082
4136
  };
4083
4137
  return await this.expressionEvaluator.evaluate(actionData, scope);
4084
4138
  };
4139
+ void this.syncShowRowIndexColumnSetting();
4140
+ this.settingsService.onLoaded.pipe(takeUntil(this.destroyed)).subscribe(() => {
4141
+ void this.syncShowRowIndexColumnSetting();
4142
+ });
4143
+ this.settingsService.onChanged.pipe(takeUntil(this.destroyed)).subscribe(() => {
4144
+ void this.syncShowRowIndexColumnSetting();
4145
+ });
4085
4146
  this.initialize();
4086
4147
  }
4148
+ async syncShowRowIndexColumnSetting() {
4149
+ try {
4150
+ const value = await this.settingsService.get(AXPCommonSettings.ShowRowIndexColumn);
4151
+ this.showRowIndexColumnEnabled.set(value ?? false);
4152
+ }
4153
+ catch {
4154
+ this.showRowIndexColumnEnabled.set(false);
4155
+ }
4156
+ }
4157
+ destroy() {
4158
+ this.destroyed.next();
4159
+ this.destroyed.complete();
4160
+ }
4087
4161
  async initialize() {
4088
4162
  const entityResolver = this.injector.get(AXPEntityDefinitionRegistryService);
4089
4163
  const [moduleName, entityName] = this.detailEntityConfig.entity.split('.');
@@ -4223,6 +4297,73 @@ const AXPEntityEventsKeys = {
4223
4297
  REFRESH_DATA: 'entity:refresh-data',
4224
4298
  };
4225
4299
 
4300
+ /**
4301
+ * Resolves a stable row id from entity list row data.
4302
+ */
4303
+ function getEntityListRowId(data, key = 'id') {
4304
+ const value = data[key];
4305
+ if (value != null && value !== '') {
4306
+ return String(value);
4307
+ }
4308
+ return '';
4309
+ }
4310
+ /**
4311
+ * Finds row data in a hierarchical grid tree (root rows and nested children).
4312
+ */
4313
+ function findEntityListRowDataInTree(items, id, key) {
4314
+ for (const item of items) {
4315
+ if (item && typeof item === 'object' && String(item[key]) === id) {
4316
+ return item;
4317
+ }
4318
+ const rec = item;
4319
+ const metaChildren = rec?.['__meta__']?.['children'];
4320
+ const directChildren = rec?.['children'];
4321
+ const childArr = Array.isArray(metaChildren)
4322
+ ? metaChildren
4323
+ : Array.isArray(directChildren)
4324
+ ? directChildren
4325
+ : null;
4326
+ if (childArr?.length) {
4327
+ const found = findEntityListRowDataInTree(childArr, id, key);
4328
+ if (found) {
4329
+ return found;
4330
+ }
4331
+ }
4332
+ }
4333
+ return null;
4334
+ }
4335
+ /**
4336
+ * Restores expanded rows after data load (parents before children).
4337
+ */
4338
+ async function restoreEntityListExpandedRows(options) {
4339
+ const pending = [...new Set(options.expandedRowIds.filter(Boolean))];
4340
+ if (!pending.length) {
4341
+ return;
4342
+ }
4343
+ let safety = 0;
4344
+ const maxPasses = Math.max(pending.length * 3, 10);
4345
+ while (pending.length > 0 && safety++ < maxPasses) {
4346
+ const rows = options.getDisplayedRows();
4347
+ let progressed = false;
4348
+ for (let i = pending.length - 1; i >= 0; i--) {
4349
+ const id = pending[i];
4350
+ const item = findEntityListRowDataInTree(rows, id, options.rowKey);
4351
+ if (!item) {
4352
+ continue;
4353
+ }
4354
+ const meta = item['__meta__'];
4355
+ if (meta?.['expanded'] !== true) {
4356
+ await options.expandRow({ data: item });
4357
+ }
4358
+ pending.splice(i, 1);
4359
+ progressed = true;
4360
+ }
4361
+ if (!progressed) {
4362
+ break;
4363
+ }
4364
+ }
4365
+ }
4366
+
4226
4367
  /**
4227
4368
  * Entity Event Dispatcher - A wrapper for entity-specific events
4228
4369
  * Handles pattern-based dispatching for entity operations with wildcard support
@@ -4587,6 +4728,10 @@ class AXPEntityMasterListViewModel {
4587
4728
  this.lastAppliedSortKey = null;
4588
4729
  this.lastAppliedFilterKey = null;
4589
4730
  this.hasQueryParamsFilters = false; // Flag to prevent overriding queryParams filters
4731
+ /** Persisted expanded row ids for hierarchical lists (per view). */
4732
+ this.expandedRowIds = signal([], ...(ngDevMode ? [{ debugName: "expandedRowIds" }] : /* istanbul ignore next */ []));
4733
+ /** When true, row expand/collapse is not written to user settings (restore in progress). */
4734
+ this.skipExpandedRowPersistence = false;
4590
4735
  this.events$ = new Subject();
4591
4736
  //****************** Views ******************//
4592
4737
  this.views = computed(() => {
@@ -4596,6 +4741,18 @@ class AXPEntityMasterListViewModel {
4596
4741
  });
4597
4742
  }, ...(ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []));
4598
4743
  this.view = signal(this.views()[0], ...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
4744
+ this.showRowIndexColumnEnabled = signal(false, ...(ngDevMode ? [{ debugName: "showRowIndexColumnEnabled" }] : /* istanbul ignore next */ []));
4745
+ /**
4746
+ * Row index column: if the list view defines `indexCol` (true/false), that overrides the user setting;
4747
+ * if `indexCol` is omitted, visibility follows {@link AXPCommonSettings.ShowRowIndexColumn}.
4748
+ */
4749
+ this.showIndexColumn = computed(() => {
4750
+ const indexCol = this.view().indexCol;
4751
+ if (indexCol !== undefined) {
4752
+ return indexCol;
4753
+ }
4754
+ return this.showRowIndexColumnEnabled();
4755
+ }, ...(ngDevMode ? [{ debugName: "showIndexColumn" }] : /* istanbul ignore next */ []));
4599
4756
  this.dataSource = new AXDataSource({
4600
4757
  byKey: async (key) => {
4601
4758
  const execute = this.entityDef.queries?.byKey?.execute;
@@ -4766,6 +4923,23 @@ class AXPEntityMasterListViewModel {
4766
4923
  }
4767
4924
  });
4768
4925
  this.sortedFields.set(this.sortableFields());
4926
+ void this.syncShowRowIndexColumnSetting();
4927
+ this.settings.onLoaded.pipe(takeUntil(this.destroyed)).subscribe(() => {
4928
+ void this.syncShowRowIndexColumnSetting();
4929
+ });
4930
+ this.settings.onChanged.pipe(takeUntil(this.destroyed)).subscribe(() => {
4931
+ void this.syncShowRowIndexColumnSetting();
4932
+ });
4933
+ }
4934
+ async syncShowRowIndexColumnSetting() {
4935
+ try {
4936
+ const value = await this.settings.get(AXPCommonSettings.ShowRowIndexColumn);
4937
+ this.showRowIndexColumnEnabled.set(value ?? false);
4938
+ }
4939
+ catch {
4940
+ console.log('catch');
4941
+ this.showRowIndexColumnEnabled.set(false);
4942
+ }
4769
4943
  }
4770
4944
  async applySettings() {
4771
4945
  this.saveSettings('view');
@@ -4803,7 +4977,49 @@ class AXPEntityMasterListViewModel {
4803
4977
  if (Array.isArray(filters) && !this.hasQueryParamsFilters) {
4804
4978
  this.filterQueries.set(filters);
4805
4979
  }
4980
+ const expandedRowIds = listViewSetting.list?.views?.[this.view().name]?.expandedRowIds;
4981
+ if (Array.isArray(expandedRowIds)) {
4982
+ this.expandedRowIds.set(expandedRowIds.map((id) => String(id)).filter(Boolean));
4983
+ }
4984
+ else {
4985
+ this.expandedRowIds.set([]);
4986
+ }
4987
+ }
4988
+ }
4989
+ getExpandedRowIds() {
4990
+ return this.expandedRowIds();
4991
+ }
4992
+ /**
4993
+ * Updates persisted expanded row ids when the user expands or collapses a tree row.
4994
+ */
4995
+ updateExpandedRowId(rowId, expanded) {
4996
+ if (!rowId || !this.parentKey()) {
4997
+ return;
4998
+ }
4999
+ const next = new Set(this.expandedRowIds());
5000
+ if (expanded) {
5001
+ next.add(rowId);
5002
+ }
5003
+ else {
5004
+ next.delete(rowId);
4806
5005
  }
5006
+ const ids = Array.from(next);
5007
+ this.expandedRowIds.set(ids);
5008
+ this.saveSettings('expandedRows', ids);
5009
+ }
5010
+ handleRowExpandChange(rowData) {
5011
+ if (this.skipExpandedRowPersistence || !this.parentKey()) {
5012
+ return;
5013
+ }
5014
+ const key = this.dataSource.config?.key ?? 'id';
5015
+ const rowId = getEntityListRowId(rowData, key);
5016
+ if (!rowId) {
5017
+ return;
5018
+ }
5019
+ // onItemExpanded fires before the grid toggles __meta__.expanded on expandedItem.
5020
+ const meta = rowData['__meta__'];
5021
+ const wasExpanded = meta?.['expanded'] === true;
5022
+ this.updateExpandedRowId(rowId, !wasExpanded);
4807
5023
  }
4808
5024
  async saveSettings(changesType, data) {
4809
5025
  const updateSettings = (updateFn) => {
@@ -4900,6 +5116,21 @@ class AXPEntityMasterListViewModel {
4900
5116
  },
4901
5117
  }));
4902
5118
  break;
5119
+ case 'expandedRows':
5120
+ updateSettings((prev) => ({
5121
+ ...prev,
5122
+ list: {
5123
+ ...prev?.list,
5124
+ views: {
5125
+ ...prev?.list?.views,
5126
+ [this.view().name]: {
5127
+ ...prev?.list?.views?.[this.view().name],
5128
+ expandedRowIds: data,
5129
+ },
5130
+ },
5131
+ },
5132
+ }));
5133
+ break;
4903
5134
  default:
4904
5135
  break;
4905
5136
  }
@@ -6343,6 +6574,225 @@ const AXPEntityPreloadFiltersViewModelResolver = async (route, state) => {
6343
6574
  };
6344
6575
  //#endregion
6345
6576
 
6577
+ //#region ---- Path / numeric helpers ----
6578
+ function getPath(obj, path) {
6579
+ if (obj == null || path.length === 0) {
6580
+ return undefined;
6581
+ }
6582
+ const parts = path.split('.');
6583
+ let cur = obj;
6584
+ for (const p of parts) {
6585
+ if (cur == null || typeof cur !== 'object') {
6586
+ return undefined;
6587
+ }
6588
+ cur = cur[p];
6589
+ }
6590
+ return cur;
6591
+ }
6592
+ function toNumber(value) {
6593
+ if (typeof value === 'number' && Number.isFinite(value)) {
6594
+ return value;
6595
+ }
6596
+ if (typeof value === 'string' && value.trim().length > 0) {
6597
+ const n = Number(value);
6598
+ return Number.isFinite(n) ? n : null;
6599
+ }
6600
+ return null;
6601
+ }
6602
+ function defaultAlias(measure, index) {
6603
+ if (measure.alias?.trim()) {
6604
+ return measure.alias.trim();
6605
+ }
6606
+ if (measure.reducer === 'count') {
6607
+ return index === 0 ? 'count' : `count_${index}`;
6608
+ }
6609
+ const field = measure.field ?? 'value';
6610
+ const safeField = field.replace(/\./g, '_');
6611
+ return `${measure.reducer}_${safeField}`;
6612
+ }
6613
+ /**
6614
+ * Pure aggregation over already-filtered plain rows (e.g. outputs of {@link filterSortEntityRows}).
6615
+ */
6616
+ function computeEntityAggregates(rows, request) {
6617
+ const groupBy = request.groupBy ?? [];
6618
+ const measures = request.measures ?? [];
6619
+ if (measures.length === 0) {
6620
+ return [];
6621
+ }
6622
+ const groups = new Map();
6623
+ const stableGroupKey = (row) => {
6624
+ const parts = groupBy.map((path) => getPath(row, path));
6625
+ return JSON.stringify(parts);
6626
+ };
6627
+ for (const row of rows) {
6628
+ const k = stableGroupKey(row);
6629
+ let bucket = groups.get(k);
6630
+ if (!bucket) {
6631
+ bucket = {
6632
+ keyParts: groupBy.map((path) => getPath(row, path)),
6633
+ rows: [],
6634
+ };
6635
+ groups.set(k, bucket);
6636
+ }
6637
+ bucket.rows.push(row);
6638
+ }
6639
+ const result = [];
6640
+ for (const bucket of groups.values()) {
6641
+ const out = {};
6642
+ groupBy.forEach((field, i) => {
6643
+ out[field] = bucket.keyParts[i];
6644
+ });
6645
+ measures.forEach((measure, index) => {
6646
+ const alias = defaultAlias(measure, index);
6647
+ const gRows = bucket.rows;
6648
+ if (measure.reducer === 'count') {
6649
+ out[alias] = gRows.length;
6650
+ return;
6651
+ }
6652
+ const fieldPath = measure.field;
6653
+ if (!fieldPath) {
6654
+ out[alias] = null;
6655
+ return;
6656
+ }
6657
+ const nums = gRows.map((r) => toNumber(getPath(r, fieldPath))).filter((n) => n !== null);
6658
+ switch (measure.reducer) {
6659
+ case 'sum':
6660
+ out[alias] = nums.reduce((a, b) => a + b, 0);
6661
+ break;
6662
+ case 'min':
6663
+ out[alias] = nums.length ? Math.min(...nums) : null;
6664
+ break;
6665
+ case 'max':
6666
+ out[alias] = nums.length ? Math.max(...nums) : null;
6667
+ break;
6668
+ case 'avg':
6669
+ out[alias] = nums.length ? nums.reduce((a, b) => a + b, 0) / nums.length : null;
6670
+ break;
6671
+ default:
6672
+ out[alias] = null;
6673
+ }
6674
+ });
6675
+ result.push(out);
6676
+ }
6677
+ return result;
6678
+ }
6679
+ //#endregion
6680
+
6681
+ //#endregion
6682
+ //#region ---- Pure helpers ----
6683
+ /**
6684
+ * Fields where `contains` means hierarchical category membership (expand to descendants).
6685
+ * Excludes e.g. `roleIds`, which uses array membership only and must use normal filter logic.
6686
+ */
6687
+ function isCategoryContainsFieldName(field) {
6688
+ if (field === 'categoryIds') {
6689
+ return true;
6690
+ }
6691
+ if (typeof field === 'string' && field.endsWith('Ids') && field !== 'roleIds') {
6692
+ return true;
6693
+ }
6694
+ return false;
6695
+ }
6696
+ /**
6697
+ * Check if the entity is a category entity (ends with 'Category').
6698
+ */
6699
+ function isCategoryEntity(entityName) {
6700
+ return entityName.endsWith('Category');
6701
+ }
6702
+ /**
6703
+ * Check if the filter is a category filter (contains operator on categoryIds field).
6704
+ * Handles both simple filters and compound filters.
6705
+ */
6706
+ function isCategoryFilter(filter) {
6707
+ if (filter?.operator?.type === 'contains' && isCategoryContainsFieldName(filter.field)) {
6708
+ return true;
6709
+ }
6710
+ if (filter?.logic && filter?.filters && Array.isArray(filter.filters)) {
6711
+ return filter.filters.some((nestedFilter) => nestedFilter?.operator?.type === 'contains' && isCategoryContainsFieldName(nestedFilter.field));
6712
+ }
6713
+ return false;
6714
+ }
6715
+ //#endregion
6716
+ //#region ---- Query execution ----
6717
+ /**
6718
+ * Apply recursive category filtering: entities that belong to the category or any of its children.
6719
+ */
6720
+ async function applyRecursiveCategoryFilter(result, filter, entityName, getAllChildCategoryIds) {
6721
+ let categoryFilter = filter;
6722
+ let otherFilters = [];
6723
+ if (filter?.logic && filter?.filters && Array.isArray(filter.filters)) {
6724
+ const categoryFilterIndex = filter.filters.findIndex((f) => f?.operator?.type === 'contains' && isCategoryContainsFieldName(f.field));
6725
+ if (categoryFilterIndex !== -1) {
6726
+ categoryFilter = filter.filters[categoryFilterIndex];
6727
+ otherFilters = filter.filters.filter((_, index) => index !== categoryFilterIndex);
6728
+ }
6729
+ }
6730
+ if (!categoryFilter) {
6731
+ return applyFilterArray(result, [filter]);
6732
+ }
6733
+ const categoryId = categoryFilter.value;
6734
+ const categoryField = categoryFilter.field;
6735
+ const allCategoryIds = await getAllChildCategoryIds(categoryId, entityName);
6736
+ let filteredResult = result.filter((item) => {
6737
+ const categoryIds = item[categoryField];
6738
+ if (!categoryIds)
6739
+ return false;
6740
+ const itemCategoryIds = Array.isArray(categoryIds) ? categoryIds : [categoryIds];
6741
+ return itemCategoryIds.some((itemCategoryId) => allCategoryIds.includes(itemCategoryId));
6742
+ });
6743
+ if (otherFilters.length > 0) {
6744
+ filteredResult = applyFilterArray(filteredResult, otherFilters);
6745
+ }
6746
+ return filteredResult;
6747
+ }
6748
+ /**
6749
+ * Calculate childrenCount for each category entity when missing.
6750
+ */
6751
+ async function calculateChildrenCounts(items, entityName, getDirectChildCount) {
6752
+ return Promise.all(items.map(async (item) => {
6753
+ if (typeof item.childrenCount === 'number') {
6754
+ return { ...item };
6755
+ }
6756
+ const childrenCount = await getDirectChildCount(item.id, entityName);
6757
+ return { ...item, childrenCount };
6758
+ }));
6759
+ }
6760
+ /**
6761
+ * Loads raw rows for an entity and applies the same sorting and filtering as {@link runEntityQuery},
6762
+ * without pagination.
6763
+ */
6764
+ async function filterSortEntityRows(entityName, request, adapters) {
6765
+ let result = await adapters.getRawAll(entityName);
6766
+ if (request.sort && request.sort.length) {
6767
+ result = applySortArray(result, request.sort);
6768
+ }
6769
+ if (request.filter && isCategoryFilter(request.filter)) {
6770
+ result = await applyRecursiveCategoryFilter(result, request.filter, entityName, adapters.getAllChildCategoryIds);
6771
+ }
6772
+ else {
6773
+ result = applyFilterArray(result, request.filter ? [request.filter] : []);
6774
+ }
6775
+ if (isCategoryEntity(entityName)) {
6776
+ result = await calculateChildrenCounts(result, entityName, adapters.getDirectChildCount);
6777
+ }
6778
+ return result;
6779
+ }
6780
+ /**
6781
+ * Shared entity query logic: sort, filter (including recursive category filter), childrenCount, pagination.
6782
+ */
6783
+ async function runEntityQuery(entityName, request, adapters) {
6784
+ const rows = await filterSortEntityRows(entityName, request, adapters);
6785
+ const skip = request.skip ?? 0;
6786
+ const take = request.take ?? 0;
6787
+ return {
6788
+ total: rows.length,
6789
+ items: rows.slice(skip, skip + take),
6790
+ };
6791
+ }
6792
+ //#endregion
6793
+
6794
+ //#endregion
6795
+
6346
6796
  //#region ---- Imports ----
6347
6797
  //#endregion
6348
6798
  //#region ---- Constants ----
@@ -10581,6 +11031,7 @@ class AXPEntityListTableService {
10581
11031
  this.workflow = inject(AXPWorkflowService);
10582
11032
  this.commandService = inject(AXPCommandService);
10583
11033
  this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
11034
+ this.settings = inject(AXPSettingsService);
10584
11035
  this.evaluateExpressions = async (options, data) => {
10585
11036
  if (!options) {
10586
11037
  return {};
@@ -10601,6 +11052,20 @@ class AXPEntityListTableService {
10601
11052
  * Convert Entity to List Widget Options
10602
11053
  */
10603
11054
  async convertEntityToListOptions(entity, options, allActions) {
11055
+ const viewIndexCol = entity.interfaces?.master?.list?.views?.[0]?.indexCol;
11056
+ let showIndex = false;
11057
+ if (viewIndexCol !== undefined) {
11058
+ showIndex = viewIndexCol;
11059
+ }
11060
+ else {
11061
+ try {
11062
+ const fromSetting = await this.settings.get(AXPCommonSettings.ShowRowIndexColumn);
11063
+ showIndex = fromSetting ?? false;
11064
+ }
11065
+ catch {
11066
+ showIndex = false;
11067
+ }
11068
+ }
10604
11069
  const listOptions = {
10605
11070
  // 📊 Data Source
10606
11071
  dataSource: this.createDataSource(entity),
@@ -10610,7 +11075,7 @@ class AXPEntityListTableService {
10610
11075
  primaryCommands: this.createRowCommands(allActions, 'primary'),
10611
11076
  secondaryCommands: this.createRowCommands(allActions, 'secondary'),
10612
11077
  // ⚙️ Table Features
10613
- showIndex: entity.interfaces?.master?.list?.views?.[0]?.indexCol ?? false,
11078
+ showIndex,
10614
11079
  allowSelection: this.hasSelectedScopeActions(entity),
10615
11080
  paging: true,
10616
11081
  showHeader: true,
@@ -10627,7 +11092,6 @@ class AXPEntityListTableService {
10627
11092
  // 🎪 Events
10628
11093
  ...this.createDefaultEvents(entity, allActions, options?.excludeProperties),
10629
11094
  };
10630
- console.log('listOptions', listOptions);
10631
11095
  return listOptions;
10632
11096
  }
10633
11097
  //#endregion
@@ -11015,6 +11479,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11015
11479
  this.commandService = inject(AXPCommandService);
11016
11480
  this.eventService = inject(AXPBroadcastEventService);
11017
11481
  this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
11482
+ this.route = inject(ActivatedRoute);
11018
11483
  this.isMounted = signal(false, ...(ngDevMode ? [{ debugName: "isMounted" }] : /* istanbul ignore next */ []));
11019
11484
  this.entity = signal(null, ...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
11020
11485
  this.listNode = signal(null, ...(ngDevMode ? [{ debugName: "listNode" }] : /* istanbul ignore next */ []));
@@ -11188,13 +11653,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11188
11653
  // console.log(this.listWidget()?.instance.output('selectedRows'));
11189
11654
  // }
11190
11655
  async execute(commandName, _data) {
11191
- const action = this.allActions().find((c) => {
11192
- return (c.name == commandName &&
11193
- ((this.selectedItems().length
11194
- ? c.scope == AXPEntityCommandScope.Selected
11195
- : c.scope == AXPEntityCommandScope.Individual) ||
11196
- c.scope == AXPEntityCommandScope.TypeLevel));
11197
- });
11656
+ const action = this.findToolbarAction(commandName);
11198
11657
  const command = commandName.split('&')[0];
11199
11658
  const commandData = action?.scope == AXPEntityCommandScope.Selected
11200
11659
  ? this.selectedItems()
@@ -11260,6 +11719,29 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11260
11719
  });
11261
11720
  }
11262
11721
  }
11722
+ /**
11723
+ * Resolves toolbar commands including nested dropdown (`items`) actions.
11724
+ */
11725
+ findToolbarAction(commandName) {
11726
+ const scopeMatches = (c) => (this.selectedItems().length
11727
+ ? c.scope === AXPEntityCommandScope.Selected
11728
+ : c.scope === AXPEntityCommandScope.Individual) || c.scope === AXPEntityCommandScope.TypeLevel;
11729
+ const visit = (nodes) => {
11730
+ for (const node of nodes) {
11731
+ if (node.name === commandName && scopeMatches(node)) {
11732
+ return node;
11733
+ }
11734
+ if (node.items?.length) {
11735
+ const nested = visit(node.items);
11736
+ if (nested) {
11737
+ return nested;
11738
+ }
11739
+ }
11740
+ }
11741
+ return undefined;
11742
+ };
11743
+ return visit(this.allActions());
11744
+ }
11263
11745
  async evaluateToolbarExpressions(opts, expressionData) {
11264
11746
  if (!opts) {
11265
11747
  return {};
@@ -11272,6 +11754,92 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11272
11754
  };
11273
11755
  return (await this.expressionEvaluator.evaluate(opts, scope));
11274
11756
  }
11757
+ /**
11758
+ * Parses the `filters` query param (same shape as standalone entity list routes).
11759
+ */
11760
+ parseFiltersFromRoute() {
11761
+ const filtersJson = this.route.snapshot.queryParamMap.get('filters');
11762
+ if (!filtersJson) {
11763
+ return [];
11764
+ }
11765
+ try {
11766
+ const parsed = JSON.parse(filtersJson);
11767
+ const rows = [];
11768
+ if (Array.isArray(parsed)) {
11769
+ for (const item of parsed) {
11770
+ if (item && typeof item === 'object' && typeof item.field === 'string') {
11771
+ rows.push(item);
11772
+ }
11773
+ }
11774
+ }
11775
+ else if (parsed !== null && typeof parsed === 'object') {
11776
+ for (const [field, value] of Object.entries(parsed)) {
11777
+ rows.push({ field, value, operator: { type: 'equal' } });
11778
+ }
11779
+ }
11780
+ return rows
11781
+ .filter((row) => row.field && row.value !== undefined && row.value !== null && row.value !== '')
11782
+ .map((row) => ({
11783
+ field: row.field,
11784
+ operator: row.operator && typeof row.operator === 'object' && 'type' in row.operator
11785
+ ? row.operator
11786
+ : { type: 'equal' },
11787
+ value: row.value,
11788
+ hidden: true,
11789
+ }));
11790
+ }
11791
+ catch {
11792
+ return [];
11793
+ }
11794
+ }
11795
+ /**
11796
+ * Route `filters` apply only when the active details `page` matches this list's entity
11797
+ * (e.g. WorkOrder filters must not affect FailureRegister on the same asset layout).
11798
+ */
11799
+ shouldApplyRouteFilters() {
11800
+ const pageId = this.route.snapshot.queryParamMap.get('page');
11801
+ if (!pageId) {
11802
+ return false;
11803
+ }
11804
+ const entitySource = this.entitySource();
11805
+ if (!entitySource) {
11806
+ return false;
11807
+ }
11808
+ const [, entityName] = entitySource.split('.');
11809
+ return !!entityName && pageId === entityName;
11810
+ }
11811
+ /**
11812
+ * Merges route filters into related-entity toolbar filters (route wins per field).
11813
+ */
11814
+ mergeToolbarFilters(baseFilters, routeFilters) {
11815
+ const byField = new Map(baseFilters.map((filter) => [filter.field, filter]));
11816
+ for (const filter of routeFilters) {
11817
+ byField.set(filter.field, filter);
11818
+ }
11819
+ return [...byField.values()];
11820
+ }
11821
+ getMergedToolbarFilters() {
11822
+ const base = (this.getValue()?.toolbar?.filters ?? []);
11823
+ if (!this.shouldApplyRouteFilters()) {
11824
+ return base;
11825
+ }
11826
+ const routeFilters = this.parseFiltersFromRoute();
11827
+ return routeFilters.length ? this.mergeToolbarFilters(base, routeFilters) : base;
11828
+ }
11829
+ /**
11830
+ * Applies merged route + parent-scope filters to the widget value and data source.
11831
+ */
11832
+ applyMergedRouteFiltersToList() {
11833
+ const merged = this.getMergedToolbarFilters();
11834
+ const current = this.getValue();
11835
+ if (!isEqual$1(current?.toolbar?.filters, merged)) {
11836
+ this.setValue({
11837
+ ...current,
11838
+ toolbar: { ...(current?.toolbar ?? {}), filters: merged },
11839
+ });
11840
+ }
11841
+ this.pushToolbarFiltersToDataSource();
11842
+ }
11275
11843
  /**
11276
11844
  * Re-evaluates related-entity list filters from the live dialog form context (e.g. after create saves the main row id).
11277
11845
  */
@@ -11461,23 +12029,27 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11461
12029
  mode: 'view',
11462
12030
  defaultValue: this.getValue()?.table,
11463
12031
  });
12032
+ const mergedToolbarFilters = this.getMergedToolbarFilters();
11464
12033
  this.toolbarNode.set({
11465
12034
  type: AXPWidgetsCatalog.listToolbar,
11466
12035
  path: `toolbar`,
11467
12036
  options: toolbarOptions,
11468
12037
  mode: 'view',
11469
12038
  defaultValue: {
11470
- filters: this.getValue()?.toolbar?.filters,
12039
+ filters: mergedToolbarFilters,
11471
12040
  sorts: this.getValue()?.toolbar?.sorts,
11472
12041
  columns: this.getValue()?.toolbar?.columns,
11473
12042
  },
11474
12043
  });
11475
12044
  queueMicrotask(() => {
11476
- void this.pushToolbarFiltersToDataSource();
12045
+ this.applyMergedRouteFiltersToList();
11477
12046
  });
11478
12047
  }, 100);
11479
12048
  }
11480
12049
  async ngAfterViewInit() {
12050
+ this.route.queryParamMap.pipe(takeUntil(this.destroyed)).subscribe(() => {
12051
+ this.applyMergedRouteFiltersToList();
12052
+ });
11481
12053
  this.workflow.events$
11482
12054
  .pipe(ofType(AXPRefreshEvent))
11483
12055
  .pipe(takeUntil(this.destroyed))
@@ -13269,6 +13841,14 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
13269
13841
  }
13270
13842
  });
13271
13843
  }
13844
+ outputs() {
13845
+ return [
13846
+ {
13847
+ name: 'selectedItems',
13848
+ value: this.selectedItems(),
13849
+ },
13850
+ ];
13851
+ }
13272
13852
  singleOrMultiple(values) {
13273
13853
  return this.multiple() ? values : values[0];
13274
13854
  }
@@ -17438,9 +18018,16 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
17438
18018
  return result;
17439
18019
  };
17440
18020
  const flatActions = flattenActions(mergedActions);
17441
- const action = flatActions.find((a) => {
17442
- return a.name === command.name || a.name === commandName || a.name.split('&')[0] === commandName;
17443
- });
18021
+ /**
18022
+ * Toolbar keys are `commandKey&action.name`. Several dropdown items can share the same `commandKey`
18023
+ * (e.g. multiple `WorkflowManagement.WorkflowDefinition:Execute` lifecycle templates). Matching only by
18024
+ * prefix makes `.find` return the first sibling — wrong template (e.g. offboarding runs onboarding).
18025
+ */
18026
+ const action = command.name.includes('&')
18027
+ ? flatActions.find((a) => a.name === command.name)
18028
+ : flatActions.find((a) => {
18029
+ return a.name === command.name || a.name === commandName || a.name.split('&')[0] === commandName;
18030
+ });
17444
18031
  if (!action) {
17445
18032
  console.warn(`Action ${commandName} not found in entity definition`);
17446
18033
  return {
@@ -19396,6 +19983,9 @@ function getDedupKey(op, entityName, init) {
19396
19983
  if (op === 'getOne' && init?.id !== undefined) {
19397
19984
  return `getOne:${entityName}:${String(init.id)}`;
19398
19985
  }
19986
+ if (op === 'exists' && init?.id !== undefined) {
19987
+ return `exists:${entityName}:${String(init.id)}`;
19988
+ }
19399
19989
  if (op === 'getAll') {
19400
19990
  return `getAll:${entityName}`;
19401
19991
  }
@@ -19403,6 +19993,20 @@ function getDedupKey(op, entityName, init) {
19403
19993
  const r = init.request;
19404
19994
  return `query:${entityName}:${r.skip ?? 0}:${r.take ?? 0}:${JSON.stringify(r.filter ?? null)}:${JSON.stringify(r.sort ?? null)}:${JSON.stringify(r.params ?? null)}`;
19405
19995
  }
19996
+ if (op === 'count' && init?.request) {
19997
+ const r = init.request;
19998
+ return `count:${entityName}:${JSON.stringify(r.filter ?? null)}:${JSON.stringify(r.sort ?? null)}`;
19999
+ }
20000
+ if (op === 'queryAll' && init?.request) {
20001
+ const r = init.request;
20002
+ return `queryAll:${entityName}:${JSON.stringify(r.filter ?? null)}:${JSON.stringify(r.sort ?? null)}:${JSON.stringify(init.queryAllOptions ?? null)}`;
20003
+ }
20004
+ if (op === 'getMany' && init?.ids) {
20005
+ return `getMany:${entityName}:${init.ids.map(String).join(',')}`;
20006
+ }
20007
+ if (op === 'aggregate' && init?.aggregateRequest) {
20008
+ return `aggregate:${entityName}:${JSON.stringify(init.aggregateRequest)}:${JSON.stringify(init.aggregateOptions ?? null)}`;
20009
+ }
19406
20010
  return '';
19407
20011
  }
19408
20012
  class AXPMiddlewareEntityStorageService extends AXPEntityStorageService {
@@ -19462,6 +20066,13 @@ class AXPMiddlewareEntityStorageService extends AXPEntityStorageService {
19462
20066
  insertOne: (name, e) => this.backend.insertOne(name, e),
19463
20067
  query: (name, request) => this.backend.query(name, request),
19464
20068
  updateOne: (name, id, data) => this.backend.updateOne(name, id, data),
20069
+ deleteOne: (name, id) => this.backend.deleteOne(name, id),
20070
+ count: (name, request) => this.backend.count(name, request),
20071
+ queryAll: (name, request, options) => this.backend.queryAll(name, request, options),
20072
+ getMany: (name, ids) => this.backend.getMany(name, ids),
20073
+ exists: (name, id) => this.backend.exists(name, id),
20074
+ upsertOne: (name, entity, options) => this.backend.upsertOne(name, entity, options),
20075
+ aggregate: (name, request, options) => this.backend.aggregate(name, request, options),
19465
20076
  },
19466
20077
  ...init,
19467
20078
  };
@@ -19533,6 +20144,100 @@ class AXPMiddlewareEntityStorageService extends AXPEntityStorageService {
19533
20144
  const ctx = this.createCtx('query', entityName, { request });
19534
20145
  return this.run(ctx, () => this.backend.query(ctx.entityName, request));
19535
20146
  }
20147
+ async count(entityName, request) {
20148
+ const filterSortRequest = { ...request, skip: 0, take: 0 };
20149
+ const key = getDedupKey('count', entityName, { request: filterSortRequest });
20150
+ if (key) {
20151
+ const existing = this.inFlight.get(key);
20152
+ if (existing) {
20153
+ return existing;
20154
+ }
20155
+ const promise = this.runWithDedup(key, () => {
20156
+ const ctx = this.createCtx('count', entityName, { request: filterSortRequest });
20157
+ return this.run(ctx, () => this.backend.count(ctx.entityName, request));
20158
+ });
20159
+ this.inFlight.set(key, promise);
20160
+ return promise;
20161
+ }
20162
+ const ctx = this.createCtx('count', entityName, { request: filterSortRequest });
20163
+ return this.run(ctx, () => this.backend.count(ctx.entityName, request));
20164
+ }
20165
+ async queryAll(entityName, request, options) {
20166
+ const filterSortRequest = { ...request, skip: 0, take: 0 };
20167
+ const key = getDedupKey('queryAll', entityName, { request: filterSortRequest, queryAllOptions: options });
20168
+ if (key) {
20169
+ const existing = this.inFlight.get(key);
20170
+ if (existing) {
20171
+ return existing;
20172
+ }
20173
+ const promise = this.runWithDedup(key, () => {
20174
+ const ctx = this.createCtx('queryAll', entityName, { request: filterSortRequest });
20175
+ return this.run(ctx, () => this.backend.queryAll(ctx.entityName, request, options));
20176
+ });
20177
+ this.inFlight.set(key, promise);
20178
+ return promise;
20179
+ }
20180
+ const ctx = this.createCtx('queryAll', entityName, { request: filterSortRequest });
20181
+ return this.run(ctx, () => this.backend.queryAll(ctx.entityName, request, options));
20182
+ }
20183
+ async getMany(entityName, ids) {
20184
+ const key = getDedupKey('getMany', entityName, { ids: ids });
20185
+ if (key) {
20186
+ const existing = this.inFlight.get(key);
20187
+ if (existing) {
20188
+ return existing;
20189
+ }
20190
+ const promise = this.runWithDedup(key, () => {
20191
+ const ctx = this.createCtx('getMany', entityName);
20192
+ return this.run(ctx, () => this.backend.getMany(ctx.entityName, ids));
20193
+ });
20194
+ this.inFlight.set(key, promise);
20195
+ return promise;
20196
+ }
20197
+ const ctx = this.createCtx('getMany', entityName);
20198
+ return this.run(ctx, () => this.backend.getMany(ctx.entityName, ids));
20199
+ }
20200
+ async exists(entityName, id) {
20201
+ const key = getDedupKey('exists', entityName, { id });
20202
+ if (key) {
20203
+ const existing = this.inFlight.get(key);
20204
+ if (existing) {
20205
+ return existing;
20206
+ }
20207
+ const promise = this.runWithDedup(key, () => {
20208
+ const ctx = this.createCtx('exists', entityName, { id });
20209
+ return this.run(ctx, () => this.backend.exists(ctx.entityName, id));
20210
+ });
20211
+ this.inFlight.set(key, promise);
20212
+ return promise;
20213
+ }
20214
+ const ctx = this.createCtx('exists', entityName, { id });
20215
+ return this.run(ctx, () => this.backend.exists(ctx.entityName, id));
20216
+ }
20217
+ async upsertOne(entityName, entity, options) {
20218
+ const ctx = this.createCtx('upsertOne', entityName, { data: entity });
20219
+ ctx.locals.set('upsertOptions', options);
20220
+ return this.run(ctx, () => this.backend.upsertOne(ctx.entityName, entity, options));
20221
+ }
20222
+ async aggregate(entityName, request, options) {
20223
+ const key = getDedupKey('aggregate', entityName, { aggregateRequest: request, aggregateOptions: options });
20224
+ if (key) {
20225
+ const existing = this.inFlight.get(key);
20226
+ if (existing) {
20227
+ return existing;
20228
+ }
20229
+ const promise = this.runWithDedup(key, () => {
20230
+ const ctx = this.createCtx('aggregate', entityName);
20231
+ ctx.locals.set('aggregateRequest', request);
20232
+ ctx.locals.set('aggregateOptions', options);
20233
+ return this.run(ctx, () => this.backend.aggregate(ctx.entityName, request, options));
20234
+ });
20235
+ this.inFlight.set(key, promise);
20236
+ return promise;
20237
+ }
20238
+ const ctx = this.createCtx('aggregate', entityName);
20239
+ return this.run(ctx, () => this.backend.aggregate(ctx.entityName, request, options));
20240
+ }
19536
20241
  async runWithDedup(key, fn) {
19537
20242
  try {
19538
20243
  return await fn();
@@ -20493,5 +21198,5 @@ var getEntityDetails_query = /*#__PURE__*/Object.freeze({
20493
21198
  * Generated bundle index. Do not edit.
20494
21199
  */
20495
21200
 
20496
- export { AXMEntityCrudService, AXMEntityCrudServiceImpl, AXPCategoryTreeService, AXPCreateEntityCommand, AXPCreateEntityWorkflow, AXPDataSeederService, AXPDeleteEntityWorkflow, AXPEntitiesListDataSourceDefinition, AXPEntityApplyUpdatesAction, AXPEntityCategoryTreeSelectorComponent, AXPEntityCategoryWidget, AXPEntityCategoryWidgetColumnComponent, AXPEntityCategoryWidgetEditComponent, AXPEntityCategoryWidgetViewComponent, AXPEntityCommandTriggerViewModel, AXPEntityCreateEvent, AXPEntityCreatePopupAction, AXPEntityCreateSubmittedAction, AXPEntityCreateViewElementViewModel, AXPEntityCreateViewModelFactory, AXPEntityCreateViewSectionViewModel, AXPEntityDataProvider, AXPEntityDataProviderImpl, AXPEntityDataSelectorService, AXPEntityDefinitionProviderWidget, AXPEntityDefinitionProviderWidgetEditComponent, AXPEntityDefinitionRegistryService, AXPEntityDeletedEvent, AXPEntityDetailListViewModel, AXPEntityDetailPopoverComponent, AXPEntityDetailPopoverService, AXPEntityDetailViewModelFactory, AXPEntityDetailViewModelResolver, AXPEntityEventDispatcherService, AXPEntityEventsKeys, AXPEntityFormBuilderService, AXPEntityListTableService, AXPEntityListToolbarService, AXPEntityListViewColumnViewModel, AXPEntityListViewModelFactory, AXPEntityListViewModelResolver, AXPEntityListWidget, AXPEntityListWidgetViewComponent, AXPEntityMasterCreateViewModel, AXPEntityMasterListViewModel, AXPEntityMasterListViewQueryViewModel, AXPEntityMasterSingleElementViewModel, AXPEntityMasterSingleViewGroupViewModel, AXPEntityMasterSingleViewModel, AXPEntityMasterUpdateElementViewModel, AXPEntityMasterUpdateViewModel, AXPEntityMasterUpdateViewModelFactory, AXPEntityMiddleware, AXPEntityModifyConfirmedAction, AXPEntityModifyEvent, AXPEntityModifySectionPopupAction, AXPEntityModule, AXPEntityPerformDeleteAction, AXPEntityPreloadFiltersContainerComponent, AXPEntityPreloadFiltersViewModel, AXPEntityPreloadFiltersViewModelResolver, AXPEntityResolver, AXPEntityService, AXPEntityStorageService, AXPEntityUpdateViewSectionViewModel, AXPGetEntityDetailsQuery, AXPLayoutOrderingConfigService, AXPLookupWidget, AXPLookupWidgetColumnComponent, AXPLookupWidgetEditComponent, AXPLookupWidgetViewComponent, AXPMiddlewareAbortError, AXPMiddlewareEntityStorageService, AXPModifyEntitySectionWorkflow, AXPMultiSourceDefinitionProviderContext, AXPMultiSourceDefinitionProviderService, AXPMultiSourceFederatedSearchService, AXPMultiSourceSelectorComponent, AXPMultiSourceSelectorService, AXPMultiSourceSelectorWidget, AXPMultiSourceSelectorWidgetColumnComponent, AXPMultiSourceSelectorWidgetEditComponent, AXPMultiSourceSelectorWidgetViewComponent, AXPMultiSourceType, AXPOpenEntityDetailsCommand, AXPQuickEntityModifyPopupAction, AXPQuickModifyEntityWorkflow, AXPRelatedColumnEnrichmentService, AXPRelatedColumnMetadataResolver, AXPSelectorStructureWidget, AXPSelectorStructureWidgetColumnComponent, AXPSelectorStructureWidgetEditComponent, AXPSelectorStructureWidgetViewComponent, AXPShowDetailViewAction, AXPShowDetailsViewWorkflow, AXPShowListViewAction, AXPShowListViewWorkflow, AXPTruncatedBreadcrumbComponent, AXPUpdateEntityCommand, AXPViewEntityDetailsCommand, AXP_CATEGORY_TREE_ROOT_TITLE_I18N_KEY, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_ACTION_PLUGIN, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER, AXP_ENTITY_MODIFIER, AXP_ENTITY_STORAGE_BACKEND, AXP_ENTITY_STORAGE_MIDDLEWARE, AXP_MULTI_SOURCE_DEFINITION_PROVIDER, DEFAULT_COLUMN_ORDER, DEFAULT_PAIR_SPAN_RULES, DEFAULT_PROPERTY_ORDER, DEFAULT_SECTION_ORDER, EntityBuilder, EntityDataAccessor, actionExists, axpCreateEntityAiToolInputDefaults, axpCreateEntityCommandDefinition, cloneLayoutArrays, collectEntityQuickSearchFieldPaths, collectNestedCreateHiddenProperties, collectNestedFieldPathsFromEntityColumns, collectQuickSearchPathsFromSingleEntityDefinition, columnOrderingMiddleware, columnOrderingMiddlewareProvider, columnWidthMiddleware, columnWidthMiddlewareProvider, createColumnOrderingMiddlewareProvider, createLayoutOrderingMiddlewareProvider, createModifierContext, defaultMultiLanguageMiddleware, defaultMultiLanguageMiddlewareProvider, detectEntityChanges, ensureLayoutPropertyView, ensureLayoutSection, ensureListActions, entityDetailsCreateActions, entityDetailsCreateActionsDeferredParent, entityDetailsCrudActions, entityDetailsEditAction, entityDetailsNewEditAction, entityDetailsReferenceCondition, entityDetailsReferenceCreateActions, entityDetailsSimpleCondition, entityMasterBulkDeleteAction, entityMasterCreateAction, entityMasterCrudActions, entityMasterDeleteAction, entityMasterEditAction, entityMasterRecordActions, entityMasterViewAction, entityOverrideDetailsViewAction, eventDispatchMiddleware, getMasterInterfacePropertySortKey, isAXPMiddlewareAbortError, layoutOrderingMiddlewareFactory, layoutOrderingMiddlewareProvider, mergeForeignKeyFieldIntoCreateActions, provideEntity, resolveEntityPluginDetailPageOrder, searchResultDescriptionMiddleware, searchResultDescriptionMiddlewareProvider };
21201
+ export { AXMEntityCrudService, AXMEntityCrudServiceImpl, AXPCategoryTreeService, AXPCreateEntityCommand, AXPCreateEntityWorkflow, AXPDataSeederService, AXPDeleteEntityWorkflow, AXPEntitiesListDataSourceDefinition, AXPEntityApplyUpdatesAction, AXPEntityCategoryTreeSelectorComponent, AXPEntityCategoryWidget, AXPEntityCategoryWidgetColumnComponent, AXPEntityCategoryWidgetEditComponent, AXPEntityCategoryWidgetViewComponent, AXPEntityCommandTriggerViewModel, AXPEntityCreateEvent, AXPEntityCreatePopupAction, AXPEntityCreateSubmittedAction, AXPEntityCreateViewElementViewModel, AXPEntityCreateViewModelFactory, AXPEntityCreateViewSectionViewModel, AXPEntityDataProvider, AXPEntityDataProviderImpl, AXPEntityDataSelectorService, AXPEntityDefinitionProviderWidget, AXPEntityDefinitionProviderWidgetEditComponent, AXPEntityDefinitionRegistryService, AXPEntityDeletedEvent, AXPEntityDetailListViewModel, AXPEntityDetailPopoverComponent, AXPEntityDetailPopoverService, AXPEntityDetailViewModelFactory, AXPEntityDetailViewModelResolver, AXPEntityEventDispatcherService, AXPEntityEventsKeys, AXPEntityFormBuilderService, AXPEntityListTableService, AXPEntityListToolbarService, AXPEntityListViewColumnViewModel, AXPEntityListViewModelFactory, AXPEntityListViewModelResolver, AXPEntityListWidget, AXPEntityListWidgetViewComponent, AXPEntityMasterCreateViewModel, AXPEntityMasterListViewModel, AXPEntityMasterListViewQueryViewModel, AXPEntityMasterSingleElementViewModel, AXPEntityMasterSingleViewGroupViewModel, AXPEntityMasterSingleViewModel, AXPEntityMasterUpdateElementViewModel, AXPEntityMasterUpdateViewModel, AXPEntityMasterUpdateViewModelFactory, AXPEntityMiddleware, AXPEntityModifyConfirmedAction, AXPEntityModifyEvent, AXPEntityModifySectionPopupAction, AXPEntityModule, AXPEntityPerformDeleteAction, AXPEntityPreloadFiltersContainerComponent, AXPEntityPreloadFiltersViewModel, AXPEntityPreloadFiltersViewModelResolver, AXPEntityResolver, AXPEntityService, AXPEntityStorageService, AXPEntityUpdateViewSectionViewModel, AXPGetEntityDetailsQuery, AXPLayoutOrderingConfigService, AXPLookupWidget, AXPLookupWidgetColumnComponent, AXPLookupWidgetEditComponent, AXPLookupWidgetViewComponent, AXPMiddlewareAbortError, AXPMiddlewareEntityStorageService, AXPModifyEntitySectionWorkflow, AXPMultiSourceDefinitionProviderContext, AXPMultiSourceDefinitionProviderService, AXPMultiSourceFederatedSearchService, AXPMultiSourceSelectorComponent, AXPMultiSourceSelectorService, AXPMultiSourceSelectorWidget, AXPMultiSourceSelectorWidgetColumnComponent, AXPMultiSourceSelectorWidgetEditComponent, AXPMultiSourceSelectorWidgetViewComponent, AXPMultiSourceType, AXPOpenEntityDetailsCommand, AXPQuickEntityModifyPopupAction, AXPQuickModifyEntityWorkflow, AXPRelatedColumnEnrichmentService, AXPRelatedColumnMetadataResolver, AXPSelectorStructureWidget, AXPSelectorStructureWidgetColumnComponent, AXPSelectorStructureWidgetEditComponent, AXPSelectorStructureWidgetViewComponent, AXPShowDetailViewAction, AXPShowDetailsViewWorkflow, AXPShowListViewAction, AXPShowListViewWorkflow, AXPTruncatedBreadcrumbComponent, AXPUpdateEntityCommand, AXPViewEntityDetailsCommand, AXP_CATEGORY_TREE_ROOT_TITLE_I18N_KEY, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_ACTION_PLUGIN, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER, AXP_ENTITY_MODIFIER, AXP_ENTITY_STORAGE_BACKEND, AXP_ENTITY_STORAGE_MIDDLEWARE, AXP_MULTI_SOURCE_DEFINITION_PROVIDER, DEFAULT_COLUMN_ORDER, DEFAULT_PAIR_SPAN_RULES, DEFAULT_PROPERTY_ORDER, DEFAULT_SECTION_ORDER, EntityBuilder, EntityDataAccessor, actionExists, axpCreateEntityAiToolInputDefaults, axpCreateEntityCommandDefinition, cloneLayoutArrays, collectEntityQuickSearchFieldPaths, collectNestedCreateHiddenProperties, collectNestedFieldPathsFromEntityColumns, collectQuickSearchPathsFromSingleEntityDefinition, columnOrderingMiddleware, columnOrderingMiddlewareProvider, columnWidthMiddleware, columnWidthMiddlewareProvider, computeEntityAggregates, createColumnOrderingMiddlewareProvider, createLayoutOrderingMiddlewareProvider, createModifierContext, defaultMultiLanguageMiddleware, defaultMultiLanguageMiddlewareProvider, detectEntityChanges, ensureLayoutPropertyView, ensureLayoutSection, ensureListActions, entityDetailsCreateActions, entityDetailsCreateActionsDeferredParent, entityDetailsCrudActions, entityDetailsEditAction, entityDetailsNewEditAction, entityDetailsReferenceCondition, entityDetailsReferenceCreateActions, entityDetailsSimpleCondition, entityMasterBulkDeleteAction, entityMasterCreateAction, entityMasterCrudActions, entityMasterDeleteAction, entityMasterEditAction, entityMasterRecordActions, entityMasterViewAction, entityOverrideDetailsViewAction, eventDispatchMiddleware, filterSortEntityRows, findEntityListRowDataInTree, getEntityListRowId, getMasterInterfacePropertySortKey, isAXPMiddlewareAbortError, isCategoryEntity, isCategoryFilter, layoutOrderingMiddlewareFactory, layoutOrderingMiddlewareProvider, mergeForeignKeyFieldIntoCreateActions, provideEntity, resolveEntityPluginDetailPageOrder, restoreEntityListExpandedRows, runEntityQuery, searchResultDescriptionMiddleware, searchResultDescriptionMiddlewareProvider };
20497
21202
  //# sourceMappingURL=acorex-platform-layout-entity.mjs.map