@acorex/modules 21.0.0-next.83 → 21.0.0-next.85

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.
@@ -1,4 +1,4 @@
1
- import { AXPBroadcastEventService, AXPPlatformScope, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_MODULE_MANIFEST_PROVIDER } from '@acorex/platform/core';
1
+ import { AXPBroadcastEventService, AXPPlatformScope, applyFilterArray, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_MODULE_MANIFEST_PROVIDER } from '@acorex/platform/core';
2
2
  import { AXPEntityService, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER, entityMasterCrudActions, entityMasterDeleteAction, entityDetailsSimpleCondition, entityMasterRecordActions, entityDetailsCrudActions } from '@acorex/platform/layout/entity';
3
3
  import * as i1$1 from '@angular/common';
4
4
  import { CommonModule, DOCUMENT } from '@angular/common';
@@ -2372,6 +2372,13 @@ class AXMTaskBoardAssigneeDataSourceDefinition {
2372
2372
  this.sessionService = inject(AXPSessionService);
2373
2373
  this.translationService = inject(AXTranslationService);
2374
2374
  }
2375
+ /** Check whether a synthetic item survives the widget's current (search) filter. */
2376
+ matchesFilter(item, filter) {
2377
+ if (!filter || (!filter.field && !filter.filters?.length)) {
2378
+ return true;
2379
+ }
2380
+ return applyFilterArray([item], [filter], filter.logic ?? 'and').length > 0;
2381
+ }
2375
2382
  items() {
2376
2383
  return Promise.resolve([
2377
2384
  {
@@ -2380,13 +2387,14 @@ class AXMTaskBoardAssigneeDataSourceDefinition {
2380
2387
  source: () => {
2381
2388
  return new AXDataSource({
2382
2389
  key: 'id',
2383
- load: async () => {
2390
+ load: async (request) => {
2391
+ const skip = request?.skip ?? 0;
2384
2392
  const selfItem = resolveTaskBoardCurrentUserAssigneeItem(this.sessionService);
2385
2393
  if (!canViewAllTaskAssignees(this.sessionService)) {
2386
- if (!selfItem) {
2394
+ if (!selfItem || !this.matchesFilter(selfItem, request?.filter)) {
2387
2395
  return { items: [], total: 0 };
2388
2396
  }
2389
- return { items: [selfItem], total: 1 };
2397
+ return { items: skip === 0 ? [selfItem] : [], total: 1 };
2390
2398
  }
2391
2399
  const unassignedLabel = await this.translationService.translateAsync('@task-management:task-board.filter.unassigned');
2392
2400
  const unassignedItem = {
@@ -2394,13 +2402,15 @@ class AXMTaskBoardAssigneeDataSourceDefinition {
2394
2402
  displayName: unassignedLabel,
2395
2403
  username: '',
2396
2404
  };
2397
- const res = await this.userService.query();
2405
+ const includeUnassigned = this.matchesFilter(unassignedItem, request?.filter);
2406
+ const res = await this.userService.query(request ?? { skip: 0, take: 100 });
2398
2407
  const userItems = res.items.map((item) => ({
2399
2408
  ...item,
2400
2409
  displayName: item.displayName,
2401
2410
  }));
2402
- const items = [...userItems, unassignedItem];
2403
- return { items, total: items.length };
2411
+ const items = skip === 0 && includeUnassigned ? [unassignedItem, ...userItems] : userItems;
2412
+ const total = res.total + (includeUnassigned ? 1 : 0);
2413
+ return { items, total };
2404
2414
  },
2405
2415
  byKey: async (key) => {
2406
2416
  const userId = String(key);
@@ -2488,7 +2498,7 @@ function createAppRoute() {
2488
2498
  children: [
2489
2499
  {
2490
2500
  path: '',
2491
- loadComponent: () => import('./acorex-modules-task-management-task-board.page-Dx6oov4j.mjs').then((c) => c.AXMTaskBoardPage),
2501
+ loadComponent: () => import('./acorex-modules-task-management-task-board.page-D8kQVaxY.mjs').then((c) => c.AXMTaskBoardPage),
2492
2502
  },
2493
2503
  ],
2494
2504
  };