@acorex/platform 21.0.0-next.44 → 21.0.0-next.46

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 (28) hide show
  1. package/fesm2022/{acorex-platform-common-common-settings.provider-lWz_f-Ia.mjs → acorex-platform-common-common-settings.provider-CsOyxClO.mjs} +17 -3
  2. package/fesm2022/acorex-platform-common-common-settings.provider-CsOyxClO.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-common.mjs +204 -164
  4. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-core.mjs +5 -4
  6. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-components.mjs +2 -2
  8. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-entity.mjs +381 -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 +64 -47
  23. package/types/acorex-platform-layout-entity.d.ts +79 -4
  24. package/types/acorex-platform-layout-widget-core.d.ts +15 -0
  25. package/types/acorex-platform-layout-widgets.d.ts +15 -19
  26. package/types/acorex-platform-themes-default.d.ts +6 -0
  27. package/types/acorex-platform-workflow.d.ts +68 -2
  28. 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, '\\$&');
@@ -3979,6 +3992,11 @@ class AXPEntityDetailListViewModel {
3979
3992
  this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
3980
3993
  this.expressionEvaluator = this.injector.get(AXPExpressionEvaluatorService);
3981
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 */ []));
3982
4000
  this.dataSource = new AXDataSource({
3983
4001
  byKey: async (key) => {
3984
4002
  const execute = this.detailEntity()?.queries?.byKey?.execute;
@@ -4118,8 +4136,28 @@ class AXPEntityDetailListViewModel {
4118
4136
  };
4119
4137
  return await this.expressionEvaluator.evaluate(actionData, scope);
4120
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
+ });
4121
4146
  this.initialize();
4122
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
+ }
4123
4161
  async initialize() {
4124
4162
  const entityResolver = this.injector.get(AXPEntityDefinitionRegistryService);
4125
4163
  const [moduleName, entityName] = this.detailEntityConfig.entity.split('.');
@@ -4259,6 +4297,73 @@ const AXPEntityEventsKeys = {
4259
4297
  REFRESH_DATA: 'entity:refresh-data',
4260
4298
  };
4261
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
+
4262
4367
  /**
4263
4368
  * Entity Event Dispatcher - A wrapper for entity-specific events
4264
4369
  * Handles pattern-based dispatching for entity operations with wildcard support
@@ -4623,6 +4728,10 @@ class AXPEntityMasterListViewModel {
4623
4728
  this.lastAppliedSortKey = null;
4624
4729
  this.lastAppliedFilterKey = null;
4625
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;
4626
4735
  this.events$ = new Subject();
4627
4736
  //****************** Views ******************//
4628
4737
  this.views = computed(() => {
@@ -4632,6 +4741,18 @@ class AXPEntityMasterListViewModel {
4632
4741
  });
4633
4742
  }, ...(ngDevMode ? [{ debugName: "views" }] : /* istanbul ignore next */ []));
4634
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 */ []));
4635
4756
  this.dataSource = new AXDataSource({
4636
4757
  byKey: async (key) => {
4637
4758
  const execute = this.entityDef.queries?.byKey?.execute;
@@ -4802,6 +4923,23 @@ class AXPEntityMasterListViewModel {
4802
4923
  }
4803
4924
  });
4804
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
+ }
4805
4943
  }
4806
4944
  async applySettings() {
4807
4945
  this.saveSettings('view');
@@ -4839,7 +4977,49 @@ class AXPEntityMasterListViewModel {
4839
4977
  if (Array.isArray(filters) && !this.hasQueryParamsFilters) {
4840
4978
  this.filterQueries.set(filters);
4841
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);
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;
4842
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);
4843
5023
  }
4844
5024
  async saveSettings(changesType, data) {
4845
5025
  const updateSettings = (updateFn) => {
@@ -4936,6 +5116,21 @@ class AXPEntityMasterListViewModel {
4936
5116
  },
4937
5117
  }));
4938
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;
4939
5134
  default:
4940
5135
  break;
4941
5136
  }
@@ -10836,6 +11031,7 @@ class AXPEntityListTableService {
10836
11031
  this.workflow = inject(AXPWorkflowService);
10837
11032
  this.commandService = inject(AXPCommandService);
10838
11033
  this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
11034
+ this.settings = inject(AXPSettingsService);
10839
11035
  this.evaluateExpressions = async (options, data) => {
10840
11036
  if (!options) {
10841
11037
  return {};
@@ -10856,6 +11052,20 @@ class AXPEntityListTableService {
10856
11052
  * Convert Entity to List Widget Options
10857
11053
  */
10858
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
+ }
10859
11069
  const listOptions = {
10860
11070
  // 📊 Data Source
10861
11071
  dataSource: this.createDataSource(entity),
@@ -10865,7 +11075,7 @@ class AXPEntityListTableService {
10865
11075
  primaryCommands: this.createRowCommands(allActions, 'primary'),
10866
11076
  secondaryCommands: this.createRowCommands(allActions, 'secondary'),
10867
11077
  // ⚙️ Table Features
10868
- showIndex: entity.interfaces?.master?.list?.views?.[0]?.indexCol ?? false,
11078
+ showIndex,
10869
11079
  allowSelection: this.hasSelectedScopeActions(entity),
10870
11080
  paging: true,
10871
11081
  showHeader: true,
@@ -10882,7 +11092,6 @@ class AXPEntityListTableService {
10882
11092
  // 🎪 Events
10883
11093
  ...this.createDefaultEvents(entity, allActions, options?.excludeProperties),
10884
11094
  };
10885
- console.log('listOptions', listOptions);
10886
11095
  return listOptions;
10887
11096
  }
10888
11097
  //#endregion
@@ -11270,6 +11479,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11270
11479
  this.commandService = inject(AXPCommandService);
11271
11480
  this.eventService = inject(AXPBroadcastEventService);
11272
11481
  this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
11482
+ this.route = inject(ActivatedRoute);
11273
11483
  this.isMounted = signal(false, ...(ngDevMode ? [{ debugName: "isMounted" }] : /* istanbul ignore next */ []));
11274
11484
  this.entity = signal(null, ...(ngDevMode ? [{ debugName: "entity" }] : /* istanbul ignore next */ []));
11275
11485
  this.listNode = signal(null, ...(ngDevMode ? [{ debugName: "listNode" }] : /* istanbul ignore next */ []));
@@ -11443,13 +11653,7 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11443
11653
  // console.log(this.listWidget()?.instance.output('selectedRows'));
11444
11654
  // }
11445
11655
  async execute(commandName, _data) {
11446
- const action = this.allActions().find((c) => {
11447
- return (c.name == commandName &&
11448
- ((this.selectedItems().length
11449
- ? c.scope == AXPEntityCommandScope.Selected
11450
- : c.scope == AXPEntityCommandScope.Individual) ||
11451
- c.scope == AXPEntityCommandScope.TypeLevel));
11452
- });
11656
+ const action = this.findToolbarAction(commandName);
11453
11657
  const command = commandName.split('&')[0];
11454
11658
  const commandData = action?.scope == AXPEntityCommandScope.Selected
11455
11659
  ? this.selectedItems()
@@ -11515,6 +11719,29 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11515
11719
  });
11516
11720
  }
11517
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
+ }
11518
11745
  async evaluateToolbarExpressions(opts, expressionData) {
11519
11746
  if (!opts) {
11520
11747
  return {};
@@ -11527,6 +11754,92 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11527
11754
  };
11528
11755
  return (await this.expressionEvaluator.evaluate(opts, scope));
11529
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
+ }
11530
11843
  /**
11531
11844
  * Re-evaluates related-entity list filters from the live dialog form context (e.g. after create saves the main row id).
11532
11845
  */
@@ -11716,23 +12029,27 @@ class AXPEntityListWidgetViewComponent extends AXPValueWidgetComponent {
11716
12029
  mode: 'view',
11717
12030
  defaultValue: this.getValue()?.table,
11718
12031
  });
12032
+ const mergedToolbarFilters = this.getMergedToolbarFilters();
11719
12033
  this.toolbarNode.set({
11720
12034
  type: AXPWidgetsCatalog.listToolbar,
11721
12035
  path: `toolbar`,
11722
12036
  options: toolbarOptions,
11723
12037
  mode: 'view',
11724
12038
  defaultValue: {
11725
- filters: this.getValue()?.toolbar?.filters,
12039
+ filters: mergedToolbarFilters,
11726
12040
  sorts: this.getValue()?.toolbar?.sorts,
11727
12041
  columns: this.getValue()?.toolbar?.columns,
11728
12042
  },
11729
12043
  });
11730
12044
  queueMicrotask(() => {
11731
- void this.pushToolbarFiltersToDataSource();
12045
+ this.applyMergedRouteFiltersToList();
11732
12046
  });
11733
12047
  }, 100);
11734
12048
  }
11735
12049
  async ngAfterViewInit() {
12050
+ this.route.queryParamMap.pipe(takeUntil(this.destroyed)).subscribe(() => {
12051
+ this.applyMergedRouteFiltersToList();
12052
+ });
11736
12053
  this.workflow.events$
11737
12054
  .pipe(ofType(AXPRefreshEvent))
11738
12055
  .pipe(takeUntil(this.destroyed))
@@ -13524,6 +13841,14 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
13524
13841
  }
13525
13842
  });
13526
13843
  }
13844
+ outputs() {
13845
+ return [
13846
+ {
13847
+ name: 'selectedItems',
13848
+ value: this.selectedItems(),
13849
+ },
13850
+ ];
13851
+ }
13527
13852
  singleOrMultiple(values) {
13528
13853
  return this.multiple() ? values : values[0];
13529
13854
  }
@@ -17693,9 +18018,16 @@ class AXPPageListConverter extends AXPBaseRelatedEntityConverter {
17693
18018
  return result;
17694
18019
  };
17695
18020
  const flatActions = flattenActions(mergedActions);
17696
- const action = flatActions.find((a) => {
17697
- return a.name === command.name || a.name === commandName || a.name.split('&')[0] === commandName;
17698
- });
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
+ });
17699
18031
  if (!action) {
17700
18032
  console.warn(`Action ${commandName} not found in entity definition`);
17701
18033
  return {
@@ -20866,5 +21198,5 @@ var getEntityDetails_query = /*#__PURE__*/Object.freeze({
20866
21198
  * Generated bundle index. Do not edit.
20867
21199
  */
20868
21200
 
20869
- 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, getMasterInterfacePropertySortKey, isAXPMiddlewareAbortError, isCategoryEntity, isCategoryFilter, layoutOrderingMiddlewareFactory, layoutOrderingMiddlewareProvider, mergeForeignKeyFieldIntoCreateActions, provideEntity, resolveEntityPluginDetailPageOrder, runEntityQuery, 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 };
20870
21202
  //# sourceMappingURL=acorex-platform-layout-entity.mjs.map