@acorex-platform/module-task-management-client 1.0.2 → 2.0.0-beta.1

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 (72) hide show
  1. package/fesm2022/acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-dfiarGtJ.mjs +2846 -0
  2. package/fesm2022/acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-dfiarGtJ.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-task-management-client-contracts-entities-task-type.mjs +148 -51
  4. package/fesm2022/acorex-platform-module-task-management-client-contracts-entities-task-type.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-module-task-management-client-contracts-entities-task.mjs +38 -1265
  6. package/fesm2022/acorex-platform-module-task-management-client-contracts-entities-task.mjs.map +1 -1
  7. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-DoR58GWa.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-CtNTQX14.mjs} +51 -11
  8. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-CtNTQX14.mjs.map +1 -0
  9. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity--TP_F87Y.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity-N_I7YGSn.mjs} +2 -2
  10. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity--TP_F87Y.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity-N_I7YGSn.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-sGrb0ZaR.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-4zrBmfHs.mjs} +2 -2
  12. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-sGrb0ZaR.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-4zrBmfHs.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-CLQw9kqg.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-B7nZyTo9.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-CLQw9kqg.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-B7nZyTo9.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-Ce9NZlK_.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-Kc0FDDhp.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-Ce9NZlK_.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-Kc0FDDhp.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-DKx2UHiz.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-CKmd8udh.mjs} +2 -2
  18. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-DKx2UHiz.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-CKmd8udh.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-CKY04iyS.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-DhBEzoof.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-CKY04iyS.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-DhBEzoof.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-BGKWiqU8.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-Ckuv9ei1.mjs} +150 -53
  22. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-Ckuv9ei1.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-BN0r7MWY.mjs +46 -0
  24. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-BN0r7MWY.mjs.map +1 -0
  25. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-Gne51DLu.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-D1jG-qG1.mjs} +2 -2
  26. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-Gne51DLu.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-D1jG-qG1.mjs.map} +1 -1
  27. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog.mjs +1 -1
  28. package/fesm2022/acorex-platform-module-task-management-client-contracts.mjs +251 -30
  29. package/fesm2022/acorex-platform-module-task-management-client-contracts.mjs.map +1 -1
  30. package/fesm2022/acorex-platform-module-task-management-client-create-subject-task.command-o5rIB4lp.mjs +25 -0
  31. package/fesm2022/acorex-platform-module-task-management-client-create-subject-task.command-o5rIB4lp.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-module-task-management-client-create-task-type.command-4VzqIkIc.mjs +46 -0
  33. package/fesm2022/acorex-platform-module-task-management-client-create-task-type.command-4VzqIkIc.mjs.map +1 -0
  34. package/fesm2022/{acorex-platform-module-task-management-client-list-task-board-assignees.query-CENurmLO.mjs → acorex-platform-module-task-management-client-list-task-board-assignees.query-BcNFYozj.mjs} +27 -7
  35. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-assignees.query-BcNFYozj.mjs.map +1 -0
  36. package/fesm2022/{acorex-platform-module-task-management-client-list-task-board-reporters.query-C3NAYa9b.mjs → acorex-platform-module-task-management-client-list-task-board-reporters.query-A0sbGwlB.mjs} +14 -4
  37. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-reporters.query-A0sbGwlB.mjs.map +1 -0
  38. package/fesm2022/{acorex-platform-module-task-management-client-list-task-types.query-DQ2MnsAK.mjs → acorex-platform-module-task-management-client-list-task-types.query-CZHSliWt.mjs} +20 -10
  39. package/fesm2022/acorex-platform-module-task-management-client-list-task-types.query-CZHSliWt.mjs.map +1 -0
  40. package/fesm2022/acorex-platform-module-task-management-client-open-task-workspace.command-1BlMwoWF.mjs +29 -0
  41. package/fesm2022/acorex-platform-module-task-management-client-open-task-workspace.command-1BlMwoWF.mjs.map +1 -0
  42. package/fesm2022/acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs +257 -0
  43. package/fesm2022/acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-module-task-management-client-task-board-lookup-search.util-il-mNHxd.mjs +42 -0
  45. package/fesm2022/acorex-platform-module-task-management-client-task-board-lookup-search.util-il-mNHxd.mjs.map +1 -0
  46. package/fesm2022/acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs +65 -0
  47. package/fesm2022/acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs.map +1 -0
  48. package/fesm2022/acorex-platform-module-task-management-client-task-lifecycle-popup.component-AxJHpj55.mjs +175 -0
  49. package/fesm2022/acorex-platform-module-task-management-client-task-lifecycle-popup.component-AxJHpj55.mjs.map +1 -0
  50. package/fesm2022/acorex-platform-module-task-management-client-task-workspace.popup-Cz8Hrp3r.mjs +220 -0
  51. package/fesm2022/acorex-platform-module-task-management-client-task-workspace.popup-Cz8Hrp3r.mjs.map +1 -0
  52. package/fesm2022/acorex-platform-module-task-management-client.mjs +1 -1
  53. package/i18n/en-AU/task-management.json +222 -5
  54. package/i18n/en-US/task-management.json +222 -5
  55. package/i18n/fa-IR/task-management.json +223 -6
  56. package/package.json +4 -3
  57. package/types/acorex-platform-module-task-management-client-contracts-entities-task.d.ts +2 -1
  58. package/types/acorex-platform-module-task-management-client-contracts.d.ts +442 -46
  59. package/types/acorex-platform-module-task-management-client.d.ts +311 -742
  60. package/fesm2022/acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-INIEvacu.mjs +0 -4457
  61. package/fesm2022/acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-INIEvacu.mjs.map +0 -1
  62. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-DoR58GWa.mjs.map +0 -1
  63. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-BGKWiqU8.mjs.map +0 -1
  64. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-CiKg52ey.mjs +0 -1273
  65. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-CiKg52ey.mjs.map +0 -1
  66. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-assignees.query-CENurmLO.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-module-task-management-client-list-task-board-reporters.query-C3NAYa9b.mjs.map +0 -1
  68. package/fesm2022/acorex-platform-module-task-management-client-list-task-types.query-DQ2MnsAK.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-module-task-management-client-start-task-flow.command-CR1JXr5r.mjs +0 -114
  70. package/fesm2022/acorex-platform-module-task-management-client-start-task-flow.command-CR1JXr5r.mjs.map +0 -1
  71. package/fesm2022/acorex-platform-module-task-management-client-task-board.page-xzDabJXk.mjs +0 -2744
  72. package/fesm2022/acorex-platform-module-task-management-client-task-board.page-xzDabJXk.mjs.map +0 -1
@@ -0,0 +1,2846 @@
1
+ import { AXPBroadcastEventService, AXPNetworkConnectivityService, objectKeyValueTransforms, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, AXP_CATALOG_SCOPE_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/core';
2
+ import * as i1 from '@angular/common';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as i0 from '@angular/core';
5
+ import { inject, Injectable, NgModule, computed, signal, effect, ChangeDetectionStrategy, Component, output, DestroyRef, viewChildren, untracked, afterRenderEffect, InjectionToken } from '@angular/core';
6
+ import { AXPDataRefreshService, AXP_PROTECTED_ROUTE_GUARDS, AXP_HOME_PAGES, AXPSettingsService, AXPSearchCommandProvider, AXP_MENU_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER } from '@acorex-platform/framework-client/common';
7
+ import { AXPSessionService, AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';
8
+ import { AXPFileViewerService, AXPWorkBoardProvider, TASK_BOARD_STATUS_DEFINITIONS, loadWorkBoardComponent, AXPWorkBoardViewModel, AXP_WORK_BOARD_HOST, AXPWorkBoardPageComponentProvider, AXP_PAGE_COMPONENT_PROVIDER, AXP_WORK_BOARD_PROVIDERS, AXPWorkBoardService, normalizeTaskBoardAssigneeIds, TASK_PRIORITY_ORDER, getTaskPriorityFilterKey, taskDueDate, AXPWorkBoardTaskPopoverOverlayService, AXMTaskDetailsSessionService, AXPWorkBoardRowComponent, patchWorkBoardSummary, resolveTaskBoardSchedulerLabels, patchWorkBoardItems, sameWorkBoardItem, AXPStateMessageComponent, AXPTaskBadgeProvider, AXPWorkBoardSettings, buildTaskBoardMenuPath, AXPWorkBoardTenantSettings, AXP_TASK_BADGE_PROVIDERS } from '@acorex-platform/framework-client/layout/components';
9
+ import { readRecordCapability, AXPEntityService, AXPEntityFormBuilderService, AXPEntityDefinitionRegistryService, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_MODIFIER } from '@acorex-platform/framework-client/layout/entity';
10
+ import { AXPQueryService, AXPCommandService, AXPRuntimeModule, provideCommandSetups, provideQuerySetups, AXPCommandEventsService } from '@acorex-platform/framework-client/runtime';
11
+ import { runtimeQueryPayloadData, createRandomUuid, AXPWidgetsCatalog, AXPPlatformScope, AXPWidgetsList } from '@acorex-platform/framework-shared/core';
12
+ import * as i2 from '@acorex/core/translation';
13
+ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
14
+ import { taskTimeStatus, taskAllDayEnd, AXPProjectsWorkPermissionKeys, personalTaskTypeId, AXPTaskManagementCommandKeys, AXP_TASK_UNASSIGNED_ASSIGNEE, AXMTaskManagementQueryKeys, AXPTaskManagementMenuKeys, RootConfig, TASK_MANAGEMENT_CATALOG_SCOPE_TASKS, AXP_TASK_RUNTIME_KEYS } from '@acorex-platform/module-task-management-client/contracts';
15
+ import { AXPopupService } from '@acorex/components/popup';
16
+ import { AXDialogService } from '@acorex/components/dialog';
17
+ import { AXPLayoutBuilderService, AXPDialogOpener } from '@acorex-platform/framework-client/layout/builder';
18
+ import { AXMCalendarManagementService, mapCalendarOccasionToHolidayDate, AXMCalendarManagementModule } from '@acorex-platform/module-calendar-management-client';
19
+ import { ROUTES, RouterLink } from '@angular/router';
20
+ import { AXPLayoutBaseWidgetComponent, AXPWidgetCoreModule, AXP_WIDGET_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/layout/widget-core';
21
+ import { AXButtonComponent } from '@acorex/components/button';
22
+ import { AXDecoratorIconComponent, AXDecoratorGenericComponent } from '@acorex/components/decorators';
23
+ import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
24
+ import { cloneProperty, AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';
25
+ import { AXP_APPEARANCE_PROPERTY_GROUP, AXP_DATA_PATH_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';
26
+ import { defineDashboardWidgetDimensions, layoutFromDimensions } from '@acorex-platform/module-dashboard-management-client';
27
+ import { AXFormatService } from '@acorex/core/format';
28
+ import { AXLocaleService } from '@acorex/core/locale';
29
+ import { concatMap, Subject, debounceTime, distinctUntilChanged } from 'rxjs';
30
+ import { AXPCommonPermissionGroupKeys, AXPCommonMenuKeys } from '@acorex-platform/module-common-client/contracts';
31
+ import { get, isNil } from 'lodash';
32
+
33
+ const PERSONAL_TASK_COMMANDS = {
34
+ Create: 'TaskManagement:PersonalTask:Create', Edit: 'TaskManagement:PersonalTask:Edit', Delete: 'TaskManagement:PersonalTask:Delete',
35
+ };
36
+
37
+ /** Render only the bounded primitive form contract supported by the standard Task UI. */
38
+ function validResultFields(value) {
39
+ if (!Array.isArray(value) || value.length > 30)
40
+ return false;
41
+ const names = new Set();
42
+ return value.every(field => {
43
+ if (!field || typeof field !== 'object' || Array.isArray(field) || typeof field.name !== 'string' || !field.name
44
+ || ['__proto__', 'prototype', 'constructor'].includes(field.name) || names.has(field.name)
45
+ || typeof field.title !== 'string' || typeof field.required !== 'boolean' || !['string', 'number', 'integer', 'boolean'].includes(field.type)
46
+ || field.maxLength !== undefined && (!Number.isSafeInteger(field.maxLength) || field.maxLength < 0)
47
+ || field.mustBeTrue !== undefined && typeof field.mustBeTrue !== 'boolean'
48
+ || field.choices !== undefined && (!Array.isArray(field.choices) || field.choices.length > 100 || field.choices.some((choice) => typeof choice !== 'string' && (typeof choice !== 'number' || !Number.isFinite(choice)))))
49
+ return false;
50
+ names.add(field.name);
51
+ return true;
52
+ });
53
+ }
54
+ /** Missing capabilities are unsupported; never probe Actions while rendering a Task row. */
55
+ async function taskPersonalCapability(record, operation) {
56
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
57
+ const key = operation === 'edit' ? AXP_TASK_RUNTIME_KEYS.UpdatePersonal : AXP_TASK_RUNTIME_KEYS.DeletePersonal;
58
+ return readRecordCapability(record, { action: key })?.allowed === true;
59
+ }
60
+ /** Only the menu for this exact record version may be rendered; no endpoint fallback on missing metadata. */
61
+ function taskActionMenuPlan(task) {
62
+ return taskRecordActionPlan({ id: String(task.id), title: typeof task.title === 'string' ? task.title : '', version: task.data?.['taskVersion'], meta: task.meta });
63
+ }
64
+ /** A single versioned Get response supplies both lifecycle menus and checklist authority. */
65
+ function taskRecordActionPlan(record) {
66
+ const value = record.meta?.['taskActions'];
67
+ if (!value || typeof value !== 'object' || Array.isArray(value))
68
+ return undefined;
69
+ const menu = value;
70
+ if (menu['taskId'] !== record.id || menu['version'] !== record.version || !Number.isSafeInteger(menu['version'])
71
+ || !Array.isArray(menu['actions']) || !menu['actions'].every(item => item && typeof item === 'object'
72
+ && ['start', 'complete', 'cancel', 'reopen'].includes(item.action)
73
+ && typeof item.targetStatusId === 'string' && item.targetStatusId.length > 0 && typeof item.enabled === 'boolean'
74
+ && (item.targetTitle === undefined || typeof item.targetTitle === 'string')
75
+ && (item.blockedBy === undefined || typeof item.blockedBy === 'string')
76
+ && (item.resultFields === undefined ? !(item.action === 'complete' && item.enabled) : validResultFields(item.resultFields))))
77
+ return undefined;
78
+ const checklist = menu['checklist'];
79
+ const validChecklist = checklist && typeof checklist === 'object' && !Array.isArray(checklist)
80
+ && typeof checklist['enabled'] === 'boolean' && typeof checklist['canAdd'] === 'boolean' && typeof checklist['canToggle'] === 'boolean';
81
+ return { taskId: record.id, version: menu['version'], title: record.title,
82
+ ...(Array.isArray(menu['moduleActions']) && menu['moduleActions'].length <= 10 && menu['moduleActions'].every(action => action && typeof action.name === 'string' && typeof action.title === 'string' && action.command && typeof action.command.name === 'string') ? { moduleActions: structuredClone(menu['moduleActions']) } : {}),
83
+ actions: structuredClone(menu['actions']), ...(typeof menu['error'] === 'string' ? { error: menu['error'] } : {}),
84
+ ...(typeof menu['canEdit'] === 'boolean' ? { canEdit: menu['canEdit'] } : {}),
85
+ ...(menu['attachments'] && typeof menu['attachments'] === 'object' && typeof menu['attachments']['enabled'] === 'boolean' && typeof menu['attachments']['canEdit'] === 'boolean' ? { attachments: menu['attachments'] } : {}),
86
+ ...(validChecklist ? { checklist: { enabled: checklist['enabled'], canAdd: checklist['canAdd'], canToggle: checklist['canToggle'] } } : {}) };
87
+ }
88
+
89
+ class AXPTaskChecklistUiService {
90
+ constructor() {
91
+ this.queries = inject(AXPQueryService);
92
+ this.commands = inject(AXPCommandService);
93
+ this.session = inject(AXPSessionService);
94
+ this.expanded = new Set();
95
+ this.scopeKey = '';
96
+ }
97
+ scope() {
98
+ const key = JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id, this.session.authorizationRevision]);
99
+ if (key !== this.scopeKey) {
100
+ this.expanded.clear();
101
+ this.scopeKey = key;
102
+ }
103
+ return key;
104
+ }
105
+ isExpanded(id) { this.scope(); return this.expanded.has(id); }
106
+ expand(id, open) { this.scope(); if (open)
107
+ this.expanded.add(id);
108
+ else
109
+ this.expanded.delete(id); }
110
+ async load(taskId, force = false) {
111
+ const scope = this.scope();
112
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
113
+ if (scope !== this.scope())
114
+ throw { code: 'forbidden' };
115
+ const options = { snapshot: false, dataExecution: { refreshOnInvalidate: false, ...(force ? { force: true } : {}) } };
116
+ const response = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.Get, { taskId }, options);
117
+ const record = runtimeQueryPayloadData(response);
118
+ if (scope !== this.scope() || !record)
119
+ throw { code: 'forbidden' };
120
+ const plan = taskRecordActionPlan(record);
121
+ if (record.id !== taskId || !Number.isSafeInteger(record.version) || record.version < 1 || !plan)
122
+ throw { code: 'conflict' };
123
+ if (plan.error)
124
+ throw { code: plan.error };
125
+ if (!plan.checklist)
126
+ throw { code: 'configuration_error' };
127
+ return { record, plan };
128
+ }
129
+ async save(taskId, expectedVersion, change, commandId = createRandomUuid()) {
130
+ const scope = this.scope();
131
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
132
+ if (scope !== this.scope())
133
+ throw { code: 'forbidden' };
134
+ const response = await this.commands.executeRemote(AXP_TASK_RUNTIME_KEYS.Checklist, { taskId, expectedVersion, change, commandId });
135
+ if (!response?.success)
136
+ throw response;
137
+ const result = runtimeQueryPayloadData(response);
138
+ if (scope !== this.scope() || result?.taskId !== taskId)
139
+ throw { code: 'forbidden' };
140
+ }
141
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskChecklistUiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
142
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskChecklistUiService, providedIn: 'root' }); }
143
+ }
144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskChecklistUiService, decorators: [{
145
+ type: Injectable,
146
+ args: [{ providedIn: 'root' }]
147
+ }] });
148
+
149
+ function taskPublishedDocumentId(record) {
150
+ if (!record.workflowInfo?.instanceId || record.statusCategory !== 'done')
151
+ return undefined;
152
+ const values = record.metadata?.['workflowValues'];
153
+ const id = values?.documentId ?? values?.dynamicFields?.documentId;
154
+ return typeof id === 'string' ? id.trim() || undefined : undefined;
155
+ }
156
+
157
+ const localDay = (date) => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
158
+ /** Only typed API inputs cross the transport boundary; never send client-side DB predicates. */
159
+ function taskBoardApiInput(options) {
160
+ if (options.tags?.length || options.subjectRefTypes?.length || options.subjectRefIds?.length)
161
+ throw new Error('Unsupported Task Board filter.');
162
+ const today = new Date();
163
+ today.setHours(0, 0, 0, 0);
164
+ const tomorrow = new Date(today), dayAfterTomorrow = new Date(today), weekEnd = new Date(today);
165
+ tomorrow.setDate(today.getDate() + 1);
166
+ dayAfterTomorrow.setDate(today.getDate() + 2);
167
+ weekEnd.setDate(today.getDate() + 6 - (today.getDay() - (options.weekStartsOn ?? 0) + 7) % 7);
168
+ weekEnd.setHours(23, 59, 59, 999);
169
+ return {
170
+ ...(options.priorities?.length ? { priorities: options.priorities } : {}),
171
+ ...(options.statusCategories?.length ? { statusCategories: options.statusCategories } : {}),
172
+ ...(options.subjectRefs?.length ? { subjectRefs: options.subjectRefs.map(ref => ({ ...ref })) } : {}),
173
+ ...(options.dueStatusKeys?.length ? { dueStatusKeys: options.dueStatusKeys,
174
+ calendar: { today: today.toISOString(), tomorrow: tomorrow.toISOString(), dayAfterTomorrow: dayAfterTomorrow.toISOString(), weekEnd: weekEnd.toISOString() } } : {}),
175
+ ...(options.subjectRef ? { subjectRef: { ...options.subjectRef } } : {}),
176
+ ...(options.includeUnscheduled !== undefined ? { includeUnscheduled: options.includeUnscheduled } : {}),
177
+ ...(options.unscheduledOnly !== undefined ? { unscheduledOnly: options.unscheduledOnly } : {}),
178
+ ...(options.categories !== undefined ? { categories: options.categories } : {}),
179
+ ...(options.types?.length ? { taskTypeIds: options.types } : {}),
180
+ ...(options.assigneeIds?.length ? { assigneeIds: options.assigneeIds.map(String) } : {}),
181
+ ...(options.reporterIds?.length ? { reporterIds: options.reporterIds.map(String) } : {}),
182
+ ...(options.range ? { range: { from: options.range.from.toISOString(), end: options.range.end.toISOString(), fromDate: localDay(options.range.from), endDate: localDay(options.range.end) } } : {}),
183
+ };
184
+ }
185
+ /** Keep realtime row patches in the same scope as server pages and totals. */
186
+ function matchesTaskBoardReadFilters(item, input, now = new Date()) {
187
+ const subject = item.data?.['subjectRef'];
188
+ if (input.subjectRefs?.length && !input.subjectRefs.some(ref => ref.type === subject?.type && ref.id === subject?.id))
189
+ return false;
190
+ if (input.statusCategories?.length && !input.statusCategories.includes(String(item.status.id)))
191
+ return false;
192
+ if (input.priorities?.length && !input.priorities.includes(item.priority ?? 'no_priority'))
193
+ return false;
194
+ if (input.dueStatusKeys?.length && input.calendar) {
195
+ const key = taskTimeStatus(item.data?.['deadlineAt'], String(item.status.id), now, input.calendar, !!item.data?.['allDayDate'] && item.data?.['timePolicy']?.overdueBasis === 'end');
196
+ if (!input.dueStatusKeys.includes(key))
197
+ return false;
198
+ }
199
+ return true;
200
+ }
201
+ function mapTaskRecordToBoard(row, statuses) {
202
+ const day = row.allDayDate?.split('-').map(Number);
203
+ const point = row.plannedStartAt ?? row.plannedEndAt ?? row.dueAt;
204
+ const startDate = day ? new Date(day[0], day[1] - 1, day[2]) : new Date(row.plannedStartAt ?? point ?? NaN);
205
+ const endDate = day ? new Date(day[0], day[1] - 1, day[2], 23, 59, 59, 999) : new Date(row.plannedEndAt ?? point ?? NaN);
206
+ const deadlineOnly = !day && !row.plannedStartAt && !row.plannedEndAt && !!row.dueAt;
207
+ const startAt = row.plannedStartAt ?? (day ? taskAllDayEnd(new Date(Date.UTC(day[0], day[1] - 1, day[2]) - 86400000).toISOString().slice(0, 10), row.calendarTimeZone) : null);
208
+ const status = statuses.find(s => s.key === row.statusCategory);
209
+ const workflowValues = row.metadata?.['workflowValues'];
210
+ const publishing = row.statusCategory === 'in_progress' && !!row.workflowInfo?.instanceId
211
+ && workflowValues?.status?.name === 'publishing';
212
+ const hasPublishedAttachment = !!taskPublishedDocumentId(row);
213
+ return {
214
+ id: row.id, code: row.code, typeId: row.taskTypeId, ...(row.meta ? { meta: row.meta } : {}),
215
+ auditInfo: row.auditInfo,
216
+ ...(hasPublishedAttachment ? { hasAttachments: true } : {}),
217
+ scheduleKind: day ? 'all-day' : row.plannedStartAt || row.plannedEndAt ? 'timed' : row.dueAt ? 'deadline' : 'unscheduled', index: 0, title: row.title, description: row.description ?? undefined,
218
+ status: { id: row.statusCategory, title: publishing ? '@task-management:workflow-publication.publishing' : status?.title ?? row.statusCategory, color: status?.color },
219
+ assignee: row.assigneeRef ?? undefined, reporter: row.reporterRef, assignedBy: row.assignedByRef ?? undefined, startDate, endDate, allDay: !!day,
220
+ priority: row.priority, progress: row.progress, tags: row.tags, provider: 'task-management.tasks',
221
+ // Drag/drop cannot silently bypass type-specific transitions or completion rules.
222
+ readonly: true,
223
+ data: { timePolicy: row.timePolicy, deadlineAt: row.deadlineAt, startAt, endAt: row.plannedEndAt ?? taskAllDayEnd(row.allDayDate, row.calendarTimeZone),
224
+ markerKind: deadlineOnly ? 'due' : !day && (!row.plannedStartAt || !row.plannedEndAt) ? row.plannedStartAt ? 'start' : row.plannedEndAt ? 'end' : undefined : undefined,
225
+ taskVersion: row.version, taskTypeId: row.taskTypeId, subjectRef: row.subjectRef, entityId: row.id,
226
+ taskStatusCategory: row.statusCategory, isUnscheduled: !Number.isFinite(startDate.getTime()),
227
+ hasExplicitDueDate: row.dueAt !== null, dueAt: row.dueAt, plannedStartAt: row.plannedStartAt,
228
+ plannedEndAt: row.plannedEndAt, allDayDate: row.allDayDate, checklist: row.checklist ?? [] },
229
+ };
230
+ }
231
+
232
+ const codes = new Set(['forbidden', 'conflict', 'invalid_transition', 'validation_failed', 'blocked_by_dependency', 'checklist_incomplete', 'children_incomplete', 'timer_running', 'form_required', 'storage_unavailable', 'configuration_error']);
233
+ function taskActionErrorCode(error) {
234
+ const e = error;
235
+ const code = e?.code ?? e?.message?.code ?? e?.error?.code;
236
+ if (code === 'RECORD_CONCURRENCY_REQUIRED' || code === 'RECORD_CONCURRENCY_UNSUPPORTED')
237
+ return 'storage_unavailable';
238
+ if (code && codes.has(code))
239
+ return code;
240
+ if (code === 'RECORD_WRITE_CONFLICT' || code === 'RECORD_PRECONDITION_REQUIRED' || e?.status === 409)
241
+ return 'conflict';
242
+ return 'failed';
243
+ }
244
+ const taskActionErrorKey = (error) => `@task-management:task-board.action-errors.${taskActionErrorCode(error)}`;
245
+ /** Builds only declared fields, keeping enums/numbers/false typed and omitting empty optional inputs. */
246
+ function taskCompletionResult(fields, values) {
247
+ const result = Object.create(null);
248
+ for (const field of fields) {
249
+ const value = values[field.name];
250
+ if (value === undefined || value === null || value === '') {
251
+ if (field.required)
252
+ throw { code: 'validation_failed' };
253
+ continue;
254
+ }
255
+ if (['__proto__', 'constructor', 'prototype'].includes(field.name))
256
+ throw { code: 'validation_failed' };
257
+ if (field.choices && !field.choices.includes(value) || field.type === 'boolean' && typeof value !== 'boolean' || ['number', 'integer'].includes(field.type) && (typeof value !== 'number' || !Number.isFinite(value) || field.type === 'integer' && !Number.isInteger(value)) || field.type === 'string' && typeof value !== 'string')
258
+ throw { code: 'validation_failed' };
259
+ if (field.mustBeTrue && value !== true || typeof value === 'string' && (field.required && !value.trim() || field.maxLength !== undefined && value.length > field.maxLength))
260
+ throw { code: 'validation_failed' };
261
+ result[field.name] = value;
262
+ }
263
+ return result;
264
+ }
265
+ function taskActionStillAvailable(plan, expectedVersion, action, targetStatusId) {
266
+ if (plan.version !== expectedVersion)
267
+ throw { code: 'conflict' };
268
+ const found = plan.actions.find(item => item.action === action && item.targetStatusId === targetStatusId);
269
+ if (!found)
270
+ throw { code: 'forbidden' };
271
+ if (!found.enabled)
272
+ throw { code: found.blockedBy ?? 'forbidden' };
273
+ return found;
274
+ }
275
+
276
+ //#region ----- Imports -----
277
+ //#endregion
278
+ //#region ----- Constants -----
279
+ const TASK_ATTACHMENT_WIDGET_OPTIONS = { multiple: true, maxFileSize: 10 * 1024 * 1024, plugins: [], excludePlugins: ['document', 'upload-document-from-drive', 'attachments.default.edit'], destination: 'storage', fileEditable: false };
280
+ //#endregion
281
+ class TaskAttachmentsUiService {
282
+ constructor() {
283
+ //#region ----- Services & Dependencies -----
284
+ this.viewer = inject(AXPFileViewerService);
285
+ this.layouts = inject(AXPLayoutBuilderService);
286
+ this.queries = inject(AXPQueryService);
287
+ this.commands = inject(AXPCommandService);
288
+ this.session = inject(AXPSessionService);
289
+ this.events = inject(AXPBroadcastEventService);
290
+ this.translations = inject(AXTranslationService);
291
+ this.entities = inject(AXPEntityService);
292
+ }
293
+ //#endregion
294
+ //#region ----- Attachment Data -----
295
+ scope() { return JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id, this.session.authorizationRevision]); }
296
+ files(attachments = [], status = 'attached') {
297
+ return (attachments ?? []).map(file => ({ id: file.fileId, name: file.name, size: file.size, meta: { mimeType: file.mimeType }, status, source: { kind: 'fileId', value: file.fileId } }));
298
+ }
299
+ async input(files) {
300
+ if (!Array.isArray(files))
301
+ throw { code: 'validation_failed' };
302
+ const active = files.filter(file => file.status !== 'deleted');
303
+ const uploadBytes = active.reduce((sum, file) => sum + (file.source?.kind === 'blob' && file.source.value instanceof Blob ? file.source.value.size : 0), 0);
304
+ if (active.length > 20 || uploadBytes > 25 * 1024 * 1024)
305
+ throw { code: 'validation_failed' };
306
+ return Promise.all(active.map(async (file) => {
307
+ if (file.source?.kind === 'fileId' && typeof file.source.value === 'string')
308
+ return { fileId: file.source.value.replace(/^file:/, '') };
309
+ if (file.source?.kind !== 'blob' || !(file.source.value instanceof Blob) || file.source.value.size > 10 * 1024 * 1024)
310
+ throw { code: 'validation_failed' };
311
+ const blob = file.source.value;
312
+ const contentBase64 = await new Promise((resolve, reject) => {
313
+ const reader = new FileReader();
314
+ reader.onerror = () => reject(reader.error);
315
+ reader.onload = () => resolve(String(reader.result).split(',')[1] ?? '');
316
+ reader.readAsDataURL(blob);
317
+ });
318
+ return { name: file.name, mimeType: blob.type || 'application/octet-stream', contentBase64 };
319
+ }));
320
+ }
321
+ async load(taskId) {
322
+ const scope = this.scope();
323
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
324
+ const response = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.Get, { taskId }, { snapshot: false, dataExecution: { force: true, refreshOnInvalidate: false } });
325
+ const record = runtimeQueryPayloadData(response);
326
+ if (scope !== this.scope() || record?.id !== taskId || !taskRecordActionPlan(record))
327
+ throw { code: 'forbidden' };
328
+ return record;
329
+ }
330
+ async metadata(taskId, snapshot) {
331
+ const scope = this.scope();
332
+ const record = snapshot ?? await this.load(taskId);
333
+ if (scope !== this.scope() || record.id !== taskId)
334
+ throw { code: 'forbidden' };
335
+ const plan = taskRecordActionPlan(record);
336
+ if (!plan)
337
+ return null;
338
+ const uploaded = plan.attachments?.enabled ? this.files(record.attachments, 'uploaded') : [];
339
+ const published = await this.publishedDocument(record);
340
+ if (scope !== this.scope())
341
+ throw { code: 'forbidden' };
342
+ if (!plan.attachments?.enabled && !published)
343
+ return null;
344
+ const attachments = published ? [...uploaded, published] : uploaded;
345
+ return { context: { attachments, canViewAttachments: uploaded.length > 0, canEditAttachments: !!(plan.attachments?.enabled && plan.attachments.canEdit), hasAttachments: attachments.length > 0 }, fields: [{
346
+ name: 'attachments', title: '@general:widgets.file-uploader.attachments.title',
347
+ node: { type: 'attachments', path: 'attachments', options: { ...TASK_ATTACHMENT_WIDGET_OPTIONS, mini: true } },
348
+ }] };
349
+ }
350
+ async publishedDocument(record) {
351
+ const id = taskPublishedDocumentId(record);
352
+ if (!id)
353
+ return undefined;
354
+ // Resolve via the regular document read policy, even when the task itself is readable.
355
+ const document = await this.entities.withEntity('DocumentManagement', 'Document')
356
+ .data().byKey(id).catch(() => undefined);
357
+ if (document?.id !== id || !document.fileInfo)
358
+ return undefined;
359
+ const name = document.fileInfo.name || document.name || document.title;
360
+ if (!name)
361
+ return undefined;
362
+ return {
363
+ id, name, size: document.fileInfo.size, status: 'uploaded', readOnly: true,
364
+ source: { kind: 'reference', value: { id, type: 'document' } },
365
+ };
366
+ }
367
+ //#endregion
368
+ //#region ----- View & Edit -----
369
+ async view(taskId) {
370
+ const record = await this.load(taskId);
371
+ if (!taskRecordActionPlan(record)?.attachments?.enabled)
372
+ throw { code: 'forbidden' };
373
+ await this.viewer.openFiles(this.files(record.attachments));
374
+ }
375
+ async edit(taskId) {
376
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
377
+ const scope = this.scope(), record = await this.load(taskId);
378
+ if (!taskRecordActionPlan(record)?.attachments?.canEdit)
379
+ throw { code: 'forbidden' };
380
+ let fingerprint = '', commandId = '', submitting = false;
381
+ await this.layouts.create().dialog(dialog => {
382
+ dialog.setTitle('@general:widgets.file-uploader.attachments.title').setSize('md').setCloseButton(true)
383
+ .setContext({ attachments: this.files(record.attachments) }).confirmCloseWhenDirty(true)
384
+ .content(flex => flex.formField('@general:widgets.file-uploader.attachments.title', field => field.path('attachments').customWidget('attachments', TASK_ATTACHMENT_WIDGET_OPTIONS)))
385
+ .setActions(actions => { actions.cancel(); actions.submit('@general:actions.save.title'); })
386
+ .onAction(async (ref) => {
387
+ if (ref.action() !== 'submit')
388
+ return { success: false, metadata: { outcome: 'cancelled' } };
389
+ if (submitting)
390
+ throw { code: 'conflict' };
391
+ submitting = true;
392
+ ref.setLoading(true);
393
+ try {
394
+ if (scope !== this.scope())
395
+ throw { code: 'forbidden' };
396
+ const attachments = await this.input(ref.context().attachments);
397
+ if (scope !== this.scope())
398
+ throw { code: 'forbidden' };
399
+ const next = JSON.stringify(attachments);
400
+ if (next !== fingerprint) {
401
+ fingerprint = next;
402
+ commandId = createRandomUuid();
403
+ }
404
+ const response = await this.commands.executeRemote(AXP_TASK_RUNTIME_KEYS.Attachments, { taskId, expectedVersion: record.version, attachments, commandId });
405
+ if (!response?.success)
406
+ throw response;
407
+ const result = runtimeQueryPayloadData(response);
408
+ if (scope !== this.scope() || result?.taskId !== taskId)
409
+ throw { code: 'forbidden' };
410
+ this.events.publish('task-board.refresh', { provider: 'task-management.tasks', preserveRows: true, itemIds: [taskId] });
411
+ return response;
412
+ }
413
+ catch (error) {
414
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey(error)));
415
+ }
416
+ finally {
417
+ submitting = false;
418
+ ref.setLoading(false);
419
+ }
420
+ });
421
+ }).show();
422
+ }
423
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: TaskAttachmentsUiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
424
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: TaskAttachmentsUiService, providedIn: 'root' }); }
425
+ }
426
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: TaskAttachmentsUiService, decorators: [{
427
+ type: Injectable,
428
+ args: [{ providedIn: 'root' }]
429
+ }] });
430
+
431
+ /** Platform date widgets use ISO strings; existing form seeds may also contain Dates. */
432
+ function taskInputInstant(value) {
433
+ if (value == null || value === '')
434
+ return null;
435
+ const invalid = () => { throw { code: 'validation_failed' }; };
436
+ const date = value instanceof Date ? value : typeof value === 'string' ? new Date(value) : invalid();
437
+ return Number.isFinite(date.getTime()) ? date.toISOString() : invalid();
438
+ }
439
+ /** The Task API accepts explicit UTC instants and local all-day dates. */
440
+ function taskEntitySchedule(data) {
441
+ const invalid = () => { throw { code: 'validation_failed' }; };
442
+ const rawDay = data['allDayDate'];
443
+ // The date widget emits an ISO instant even when it displays only a calendar day.
444
+ const day = typeof rawDay === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(rawDay)
445
+ ? new Date(taskInputInstant(rawDay)) : rawDay;
446
+ const allDayDate = day instanceof Date ? `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}` : day || null;
447
+ if (allDayDate !== null && (typeof allDayDate !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(allDayDate)))
448
+ invalid();
449
+ return { dueAt: taskInputInstant(data['dueAt']), plannedStartAt: taskInputInstant(data['plannedStartAt']), plannedEndAt: taskInputInstant(data['plannedEndAt']), allDayDate: allDayDate,
450
+ calendarTimeZone: allDayDate ? String(data['calendarTimeZone'] || Intl.DateTimeFormat().resolvedOptions().timeZone) : null, estimatedMinutes: data['estimatedMinutes'] == null ? null : data['estimatedMinutes'] };
451
+ }
452
+
453
+ const entityName = 'TaskManagement.Task';
454
+ class TaskEntityUiService {
455
+ constructor() {
456
+ this.attachments = inject(TaskAttachmentsUiService);
457
+ this.forms = inject(AXPEntityFormBuilderService);
458
+ this.registry = inject(AXPEntityDefinitionRegistryService);
459
+ this.queries = inject(AXPQueryService);
460
+ this.commands = inject(AXPCommandService);
461
+ this.session = inject(AXPSessionService);
462
+ this.translations = inject(AXTranslationService);
463
+ this.events = inject(AXPBroadcastEventService);
464
+ this.pending = new Map();
465
+ }
466
+ scope() { return JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id]); }
467
+ async query(key, input) {
468
+ const response = await this.queries.fetch(key, input, { snapshot: false, dataExecution: { refreshOnInvalidate: false } });
469
+ const data = runtimeQueryPayloadData(response);
470
+ if (!data)
471
+ throw response;
472
+ return data;
473
+ }
474
+ fields(form, fields, path) {
475
+ for (const field of fields)
476
+ form.field('information', `${path}.${field.name}`, f => {
477
+ f.setLabel(field.title + (field.required ? ' *' : ''));
478
+ const type = field.choices ? AXPWidgetsCatalog.select : field.type === 'boolean' ? AXPWidgetsCatalog.checkbox : ['integer', 'number'].includes(field.type) ? AXPWidgetsCatalog.number : (field.maxLength ?? 0) > 500 ? AXPWidgetsCatalog.largeText : AXPWidgetsCatalog.text;
479
+ f.customWidget(type, field.choices ? { valueField: 'id', textField: 'title', dataSource: field.choices.map(id => ({ id, title: String(id) })) } : { maxLength: field.maxLength, ...(field.type === 'integer' ? { decimals: 0 } : {}) });
480
+ });
481
+ }
482
+ async create(input) {
483
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
484
+ const scope = this.scope();
485
+ const plan = await this.query(AXP_TASK_RUNTIME_KEYS.CreatePlan, { taskTypeId: input.taskTypeId, subjectRef: input.subjectRef });
486
+ if (plan.taskTypeId !== input.taskTypeId || scope !== this.scope())
487
+ throw { code: 'forbidden' };
488
+ const seed = { timePolicy: plan.timePolicy, taskTypeId: input.taskTypeId, subjectRef: input.subjectRef, assigneeRef: { id: this.session.user?.id }, priority: 'normal', metadata: {}, attachments: [], _taskAttachmentsEnabled: plan.hasAttachments === true, _taskCommandId: createRandomUuid() };
489
+ const definition = await this.registry.resolve('TaskManagement', 'Task');
490
+ const form = this.forms.entity(entityName).create(seed).readonlyProperties('taskTypeId');
491
+ this.fields(form, plan.metadataFields, 'metadata');
492
+ if (plan.hasAttachments)
493
+ form.field('information', 'attachments', field => field.setLabel('@general:widgets.file-uploader.attachments.title').customWidget('attachments', TASK_ATTACHMENT_WIDGET_OPTIONS));
494
+ const outcome = await form.onAction(async (ref) => {
495
+ if (ref.action() !== 'submit')
496
+ return { success: false, metadata: { outcome: 'cancelled' } };
497
+ if (scope !== this.scope())
498
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey({ code: 'forbidden' })));
499
+ const data = { ...seed, ...ref.context() };
500
+ data.metadata = await this.information(plan.metadataFields, data.metadata);
501
+ ref.setLoading(true);
502
+ try {
503
+ const save = definition.commands?.create?.execute;
504
+ const saved = await save(data);
505
+ return { success: true, kind: 'object', data: saved, metadata: { refresh: true } };
506
+ }
507
+ finally {
508
+ ref.setLoading(false);
509
+ }
510
+ }).show();
511
+ return outcome;
512
+ }
513
+ open(id, edit) {
514
+ const key = `${edit}:${id}`;
515
+ const existing = this.pending.get(key);
516
+ if (existing)
517
+ return existing;
518
+ const work = this.openForm(id, edit).finally(() => this.pending.delete(key));
519
+ this.pending.set(key, work);
520
+ return work;
521
+ }
522
+ async openForm(id, edit) {
523
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
524
+ const scope = this.scope();
525
+ const record = await this.query(AXP_TASK_RUNTIME_KEYS.Get, { taskId: id });
526
+ const plan = await this.query(AXP_TASK_RUNTIME_KEYS.Actions, { taskId: id });
527
+ if (scope !== this.scope() || record.version !== plan.version)
528
+ throw { code: 'conflict' };
529
+ const seed = { ...record, attachments: this.attachments.files(record.attachments), _taskAttachmentsEnabled: plan.attachments?.enabled === true, _taskCommandId: createRandomUuid() };
530
+ const form = edit ? this.forms.entity(entityName).update(seed) : this.forms.entity(entityName).single(seed);
531
+ this.fields(form, plan.details?.informationFields ?? [], 'metadata');
532
+ if (plan.attachments?.enabled)
533
+ form.field('information', 'attachments', field => field.setLabel('@general:widgets.file-uploader.attachments.title').customWidget('attachments', TASK_ATTACHMENT_WIDGET_OPTIONS));
534
+ if (!edit && plan.details?.result)
535
+ this.fields(form, plan.details.resultFields, 'completionResult');
536
+ const definition = await this.registry.resolve('TaskManagement', 'Task');
537
+ const outcome = await form.onAction(async (ref) => {
538
+ if (!edit || ref.action() !== 'submit')
539
+ return { success: false, metadata: { outcome: 'cancelled' } };
540
+ if (scope !== this.scope())
541
+ throw { code: 'forbidden' };
542
+ const data = { ...seed, ...ref.context(), version: record.version };
543
+ const fields = plan.details?.informationFields ?? [];
544
+ const retained = Object.fromEntries(Object.entries(record.metadata ?? {}).filter(([key]) => !fields.some(field => field.name === key)));
545
+ data.metadata = { ...retained, ...await this.information(fields, data.metadata) };
546
+ ref.setLoading(true);
547
+ try {
548
+ const save = definition.commands?.update?.execute;
549
+ return { success: true, kind: 'object', data: await save(data), metadata: { refresh: true } };
550
+ }
551
+ finally {
552
+ ref.setLoading(false);
553
+ }
554
+ }).show();
555
+ return outcome;
556
+ }
557
+ async information(fields, values) {
558
+ try {
559
+ return taskCompletionResult(fields, values);
560
+ }
561
+ catch (error) {
562
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey(error)));
563
+ }
564
+ }
565
+ async persist(data, edit) {
566
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
567
+ const scope = this.scope();
568
+ let schedule;
569
+ try {
570
+ schedule = taskEntitySchedule(data);
571
+ if (data['timePolicy']?.dueMode === 'disabled')
572
+ schedule.dueAt = null;
573
+ }
574
+ catch (error) {
575
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey(error)));
576
+ }
577
+ const input = { ...(data['_taskAttachmentsEnabled'] ? { attachments: await this.attachments.input(data['attachments']) } : {}), title: data['title'], description: data['description'] || null, priority: data['priority'], metadata: data['metadata'] ?? {}, ...schedule };
578
+ if (scope !== this.scope())
579
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey({ code: 'forbidden' })));
580
+ const response = await this.commands.executeRemote(edit ? AXP_TASK_RUNTIME_KEYS.Update : AXP_TASK_RUNTIME_KEYS.Create, edit ? { commandId: data['_taskCommandId'], taskId: data['id'], expectedVersion: data['version'], input } : { commandId: data['_taskCommandId'], taskTypeId: data['taskTypeId'], input: { ...input, subjectRef: data['subjectRef'], assigneeRef: { id: this.session.user?.id } } });
581
+ if (!response?.success)
582
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey(response)));
583
+ const result = runtimeQueryPayloadData(response);
584
+ if (!result?.taskId || scope !== this.scope())
585
+ throw new Error(await this.translations.translateAsync(taskActionErrorKey({ code: 'forbidden' })));
586
+ this.events.publish('task-board.refresh', {});
587
+ return this.query(AXP_TASK_RUNTIME_KEYS.Get, { taskId: result.taskId });
588
+ }
589
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: TaskEntityUiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
590
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: TaskEntityUiService, providedIn: 'root' }); }
591
+ }
592
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: TaskEntityUiService, decorators: [{
593
+ type: Injectable,
594
+ args: [{ providedIn: 'root' }]
595
+ }] });
596
+
597
+ const TASK_BOARD_LIFECYCLE_COMMAND = 'TaskManagement:TaskBoard:Lifecycle';
598
+ class AXPTaskLifecycleUiService {
599
+ constructor() {
600
+ this.queries = inject(AXPQueryService);
601
+ this.commands = inject(AXPCommandService);
602
+ this.popups = inject(AXPopupService);
603
+ this.dialogs = inject(AXDialogService);
604
+ this.translations = inject(AXTranslationService);
605
+ this.session = inject(AXPSessionService);
606
+ this.events = inject(AXPBroadcastEventService);
607
+ this.entityUi = inject(TaskEntityUiService);
608
+ this.pending = new Map();
609
+ }
610
+ async actions(taskId, force = false) {
611
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
612
+ const scope = this.scope();
613
+ const response = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.Get, { taskId }, { snapshot: false, dataExecution: { refreshOnInvalidate: false, ...(force ? { force: true } : {}) } });
614
+ if (scope !== this.scope())
615
+ throw { code: 'forbidden' };
616
+ const record = runtimeQueryPayloadData(response);
617
+ const plan = record && record.id === taskId ? taskRecordActionPlan(record) : undefined;
618
+ if (!plan)
619
+ throw { code: 'conflict' };
620
+ if (plan.error)
621
+ throw { code: plan.error };
622
+ return plan;
623
+ }
624
+ async view(taskId) {
625
+ return this.entityUi.open(taskId, false);
626
+ }
627
+ open(selection) {
628
+ const pending = this.pending.get(selection.taskId);
629
+ if (pending)
630
+ return pending;
631
+ const request = this.openAction(selection).finally(() => { if (this.pending.get(selection.taskId) === request)
632
+ this.pending.delete(selection.taskId); });
633
+ this.pending.set(selection.taskId, request);
634
+ return request;
635
+ }
636
+ scope() {
637
+ return JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id, this.session.authorizationRevision]);
638
+ }
639
+ refresh(taskId) {
640
+ this.events.publish('task-board.close', {});
641
+ this.events.publish('task-board.refresh', { provider: 'task-management.tasks', preserveRows: true, itemIds: [taskId] });
642
+ }
643
+ async openAction(selection) {
644
+ try {
645
+ const scope = this.scope();
646
+ if (selection.scope !== undefined && selection.scope !== scope)
647
+ throw { code: 'forbidden' };
648
+ const plan = selection.plan ? taskRecordActionPlan({ id: selection.taskId, version: selection.expectedVersion, title: selection.plan.title, meta: { taskActions: selection.plan } }) : await this.actions(selection.taskId);
649
+ if (!plan)
650
+ throw { code: 'conflict' };
651
+ if ('error' in plan && typeof plan.error === 'string')
652
+ throw { code: plan.error };
653
+ if (this.scope() !== scope)
654
+ throw { code: 'forbidden' };
655
+ const action = taskActionStillAvailable(plan, selection.expectedVersion, selection.action, selection.targetStatusId);
656
+ const { AXMTaskLifecyclePopupComponent } = await import('./acorex-platform-module-task-management-client-task-lifecycle-popup.component-AxJHpj55.mjs');
657
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
658
+ let lastPayload = '', commandId = '';
659
+ let submitting = false;
660
+ const submit = async (payload) => {
661
+ if (submitting)
662
+ throw { code: 'failed' };
663
+ if (this.scope() !== scope)
664
+ throw { code: 'forbidden' };
665
+ const key = JSON.stringify(payload);
666
+ if (!commandId || key !== lastPayload) {
667
+ lastPayload = key;
668
+ commandId = createRandomUuid();
669
+ }
670
+ submitting = true;
671
+ try {
672
+ const response = await this.commands.executeRemote(AXP_TASK_RUNTIME_KEYS.Lifecycle, {
673
+ taskId: selection.taskId, expectedVersion: selection.expectedVersion, action: selection.action, targetStatusId: selection.targetStatusId,
674
+ ...payload, commandId,
675
+ });
676
+ if (!response?.success)
677
+ throw response;
678
+ if (this.scope() !== scope)
679
+ throw { code: 'forbidden' };
680
+ const result = runtimeQueryPayloadData(response);
681
+ if (!result || result.taskId !== selection.taskId)
682
+ throw { code: 'failed' };
683
+ this.refresh(selection.taskId);
684
+ return result;
685
+ }
686
+ catch (error) {
687
+ if (taskActionErrorCode(error) === 'conflict')
688
+ this.refresh(selection.taskId);
689
+ throw error;
690
+ }
691
+ finally {
692
+ submitting = false;
693
+ }
694
+ };
695
+ const title = await this.translations.translateAsync(`@task-management:task-board.actions.${selection.action}`);
696
+ if (this.scope() !== scope)
697
+ throw { code: 'forbidden' };
698
+ const closed = await this.popups.open(AXMTaskLifecyclePopupComponent, {
699
+ title,
700
+ size: 'sm', closeButton: false, closeOnEscape: false, closeOnBackdropClick: false,
701
+ data: { taskTitle: plan.title, action, submit },
702
+ });
703
+ return closed.data?.saved ? { success: true, kind: 'object', data: closed.data.result } : { success: false, metadata: { outcome: 'cancelled' } };
704
+ }
705
+ catch (error) {
706
+ if (taskActionErrorCode(error) === 'conflict')
707
+ this.refresh(selection.taskId);
708
+ await this.dialogs.alert(await this.translations.translateAsync('@task-management:task-board.actions-title'), await this.translations.translateAsync(taskActionErrorKey(error)), 'warning');
709
+ return { success: false };
710
+ }
711
+ }
712
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskLifecycleUiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
713
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskLifecycleUiService, providedIn: 'root' }); }
714
+ }
715
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskLifecycleUiService, decorators: [{
716
+ type: Injectable,
717
+ args: [{ providedIn: 'root' }]
718
+ }] });
719
+
720
+ /**
721
+ * The secured Task API owns data; the Board and badge own their mounted refresh subscriptions.
722
+ * These reads reuse shared snapshots without retaining old view/filter variants as live consumers.
723
+ */
724
+ class AXPTaskManagementEntityTaskProvider extends AXPWorkBoardProvider {
725
+ constructor() {
726
+ super(...arguments);
727
+ this.itemEntity = 'TaskManagement.Task';
728
+ this.attachmentUi = inject(TaskAttachmentsUiService);
729
+ this.attachments = {
730
+ load: (task, snapshot) => this.attachmentUi.metadata(String(task.id), snapshot?.record),
731
+ edit: (task) => this.attachmentUi.edit(String(task.id)),
732
+ view: (task) => this.attachmentUi.view(String(task.id)),
733
+ };
734
+ this.restoreChecklistOnMount = false;
735
+ this.checklistUi = inject(AXPTaskChecklistUiService);
736
+ this.refreshData = inject(AXPDataRefreshService);
737
+ this.definitionEntities = ['TaskManagement.TaskType'];
738
+ this.realtimeEntities = ['TaskManagement.Task', 'TaskManagement.TaskAssignment', 'TaskManagement.TaskType'];
739
+ this.checklist = {
740
+ load: async (id, force = false) => {
741
+ const snapshot = await this.checklistUi.load(id, force);
742
+ const task = mapTaskRecordToBoard(snapshot.record, await this.getStatuses());
743
+ return { ...snapshot, actions: await this.actionsFromPlan(task, snapshot.plan) };
744
+ },
745
+ save: (id, version, change, commandId) => this.checklistUi.save(id, version, change, commandId),
746
+ };
747
+ this.queries = inject(AXPQueryService);
748
+ this.commands = inject(AXPCommandService);
749
+ this.entities = inject(AXPEntityService);
750
+ this.session = inject(AXPSessionService, { optional: true });
751
+ this.translations = inject(AXTranslationService);
752
+ this.lifecycle = inject(AXPTaskLifecycleUiService);
753
+ }
754
+ async refreshReadCache(options) {
755
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
756
+ await Promise.all([AXP_TASK_RUNTIME_KEYS.List, AXP_TASK_RUNTIME_KEYS.Get, AXP_TASK_RUNTIME_KEYS.Summary, AXP_TASK_RUNTIME_KEYS.Actions].map(key => this.refreshData.query(key)));
757
+ if (options?.definitions !== false)
758
+ this.refreshData.entity('TaskManagement.TaskType');
759
+ }
760
+ readScope() { return this.session?.isReadyForAppScopedApi === false ? null : JSON.stringify([this.session?.user?.id, this.session?.tenant?.id, this.session?.application?.id, this.session?.authorizationRevision]); }
761
+ assertReadScope(scope) { if (scope === null || scope !== this.readScope())
762
+ throw new Error('Data session changed'); }
763
+ get name() { return 'task-management.tasks'; }
764
+ async getTitle() { return this.translations.translateAsync('@task-management:task-board.title'); }
765
+ async getIcon() { return 'fa-light fa-clipboard-check'; }
766
+ async getCreateActions(context) {
767
+ if (!this.session?.authorize(AXPProjectsWorkPermissionKeys.Access))
768
+ return [];
769
+ const tenantId = this.session.tenant?.id;
770
+ const applicationId = this.session.application?.id;
771
+ if (!tenantId || !applicationId)
772
+ return [];
773
+ const scope = this.readScope();
774
+ this.assertReadScope(scope);
775
+ const personalId = personalTaskTypeId(tenantId, applicationId);
776
+ const items = [];
777
+ for (let skip = 0;; skip += 200) {
778
+ const page = await this.entities.withEntity('TaskManagement', 'TaskType').data().query({
779
+ skip, take: 200, fields: ['id', 'title', 'icon', 'showInTaskCreate', 'workflowConfig.workflowName'],
780
+ sort: [{ field: 'title', dir: 'asc' }],
781
+ filter: { logic: 'and', filters: [
782
+ { field: 'isActive', operator: { type: 'equal' }, value: true },
783
+ { field: 'showInTaskCreate', operator: { type: 'equal' }, value: true },
784
+ ] },
785
+ });
786
+ this.assertReadScope(scope);
787
+ for (const type of page.items) {
788
+ if (type.showInTaskCreate !== true)
789
+ continue;
790
+ const configured = type.id === personalId || !!type.workflowConfig?.workflowName?.trim();
791
+ if (!configured)
792
+ continue;
793
+ items.push({ name: `task-type-create-${type.id}`, provider: this.name, execution: 'command',
794
+ title: this.translations.resolve(type.title) || type.id, icon: type.icon || 'fa-light fa-plus',
795
+ command: { name: AXPTaskManagementCommandKeys.TaskType.Create, options: { taskTypeId: type.id, context } },
796
+ });
797
+ }
798
+ if (page.items.length < 200)
799
+ break;
800
+ }
801
+ return items;
802
+ }
803
+ async getTypeOptions() {
804
+ const items = [];
805
+ for (let skip = 0;; skip += 200) {
806
+ const page = await this.entities.withEntity('TaskManagement', 'TaskType').data().query({ skip, take: 200,
807
+ fields: ['id', 'title', 'icon', 'color', 'hasChecklist', 'hasAttachments'],
808
+ filter: { field: 'isActive', operator: { type: 'equal' }, value: true } });
809
+ const rows = page.items;
810
+ items.push(...rows.map(row => ({ name: row.id, title: this.translations.resolve(row.title) ?? row.id, icon: row.icon ?? 'fa-light fa-clipboard-check', color: row.color, hasChecklist: row.hasChecklist === true, hasAttachments: row.hasAttachments === true })));
811
+ if (rows.length < 200)
812
+ break;
813
+ }
814
+ return items;
815
+ }
816
+ async getTasks(options = {}) {
817
+ const scope = this.readScope();
818
+ this.assertReadScope(scope);
819
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
820
+ const input = taskBoardApiInput(options);
821
+ const fetchPage = async (skip, take) => {
822
+ this.assertReadScope(scope);
823
+ const result = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.List, { ...input, skip, take }, { dataExecution: { refreshOnInvalidate: false, ...(options.dueStatusKeys?.length ? { force: true } : {}) } });
824
+ const page = runtimeQueryPayloadData(result);
825
+ this.assertReadScope(scope);
826
+ if (!page || !Array.isArray(page.items) || !Number.isSafeInteger(page.total))
827
+ throw new Error('Task list could not be loaded.');
828
+ return page;
829
+ };
830
+ // Grid requests one server page. Full-range consumers retain every row,
831
+ // with at most four pages in flight instead of a long serial request chain.
832
+ const size = Math.min(options.take ?? 500, 500);
833
+ const first = await fetchPage(options.skip ?? 0, size);
834
+ const rows = [...first.items];
835
+ const target = Math.min(options.take ?? first.total, Math.max(0, first.total - (options.skip ?? 0)));
836
+ while (rows.length < target) {
837
+ const start = rows.length;
838
+ const requests = Array.from({ length: Math.min(4, Math.ceil((target - start) / 500)) }, (_, index) => {
839
+ const offset = start + index * 500;
840
+ return fetchPage((options.skip ?? 0) + offset, Math.min(500, target - offset));
841
+ });
842
+ const pages = await Promise.all(requests);
843
+ for (const page of pages)
844
+ rows.push(...page.items);
845
+ // A changing collection may shorten a page. Do not skip its missing rows
846
+ // by advancing later offsets or publish an apparently complete board.
847
+ if (pages.some((page, index) => page.items.length < Math.min(500, target - start - index * 500))) {
848
+ throw new Error('Task list changed while loading. Please refresh the board.');
849
+ }
850
+ }
851
+ const statuses = await this.getStatuses();
852
+ const items = rows.map(row => mapTaskRecordToBoard(row, statuses));
853
+ // Expand display labels through secured entity reads, grouped by subject type (not per row).
854
+ const groups = new Map();
855
+ for (const row of rows)
856
+ if (row.subjectRef) {
857
+ const ids = groups.get(row.subjectRef.type) ?? new Set();
858
+ ids.add(row.subjectRef.id);
859
+ groups.set(row.subjectRef.type, ids);
860
+ }
861
+ const titles = new Map();
862
+ const projectCodes = new Map();
863
+ await Promise.all([...groups].map(async ([type, ids]) => {
864
+ const [module, entity, extra] = type.split('.');
865
+ if (!module || !entity || extra)
866
+ return;
867
+ try {
868
+ const allIds = [...ids];
869
+ for (let offset = 0; offset < allIds.length; offset += 200) {
870
+ const page = await this.entities.withEntity(module, entity).data().query({ skip: 0, take: 200,
871
+ ...(type === 'ProjectManagement.Project' ? { fields: ['id', 'title', 'code'] } : {}),
872
+ filter: { field: 'id', operator: { type: 'in' }, value: allIds.slice(offset, offset + 200) } });
873
+ for (const row of page.items) {
874
+ const title = this.translations.resolve(row.title);
875
+ if (title)
876
+ titles.set(`${type}:${row.id}`, title);
877
+ if (type === 'ProjectManagement.Project' && typeof row.code === 'string' && row.code.trim()) {
878
+ projectCodes.set(`${type}:${row.id}`, row.code.trim());
879
+ }
880
+ }
881
+ }
882
+ }
883
+ catch { /* A visible Task does not imply permission to expand its subject. */ }
884
+ }));
885
+ for (const [index, item] of items.entries()) {
886
+ const ref = rows[index].subjectRef;
887
+ if (ref) {
888
+ item.data['subjectTitle'] = titles.get(`${ref.type}:${ref.id}`);
889
+ item.data['subjectCode'] = projectCodes.get(`${ref.type}:${ref.id}`);
890
+ }
891
+ }
892
+ this.assertReadScope(scope);
893
+ return { items, total: first.total };
894
+ }
895
+ async getItem(id, previous) {
896
+ const scope = this.readScope();
897
+ this.assertReadScope(scope);
898
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
899
+ try {
900
+ const response = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.Get, { taskId: id }, { dataExecution: { force: true, refreshOnInvalidate: false } });
901
+ this.assertReadScope(scope);
902
+ const row = runtimeQueryPayloadData(response);
903
+ if (!row || row.id !== id || !Number.isSafeInteger(row.version))
904
+ throw response;
905
+ if (row.archivedAt)
906
+ return null;
907
+ const item = mapTaskRecordToBoard(row, await this.getStatuses());
908
+ this.assertReadScope(scope);
909
+ const before = previous?.data?.['subjectRef'];
910
+ if (before?.type === row.subjectRef?.type && before?.id === row.subjectRef?.id) {
911
+ item.data['subjectTitle'] = previous?.data?.['subjectTitle'];
912
+ item.data['subjectCode'] = previous?.data?.['subjectCode'];
913
+ }
914
+ return item;
915
+ }
916
+ catch (error) {
917
+ this.assertReadScope(scope);
918
+ const e = error;
919
+ if (e?.status === 403 || e?.status === 404 || e?.code === 'forbidden' || e?.error?.code === 'forbidden')
920
+ return null;
921
+ throw error;
922
+ }
923
+ }
924
+ matchesItem(item, filter) {
925
+ const userId = this.session?.user?.id;
926
+ if (userId && !this.session?.authorize(AXPProjectsWorkPermissionKeys.ViewAllTasks)
927
+ && item.assignee?.id !== userId && item.reporter.id !== userId)
928
+ return false;
929
+ if (!matchesTaskBoardReadFilters(item, taskBoardApiInput(filter)))
930
+ return false;
931
+ if (item.provider !== this.name)
932
+ return false;
933
+ const subject = item.data?.['subjectRef'];
934
+ if (filter.subjectRef && (subject?.type !== filter.subjectRef.type || subject?.id !== filter.subjectRef.id))
935
+ return false;
936
+ if (filter.types?.length && !filter.types.includes(String(item.typeId)))
937
+ return false;
938
+ if (filter.assigneeIds?.length && !filter.assigneeIds.map(String).includes(item.assignee?.id ?? AXP_TASK_UNASSIGNED_ASSIGNEE))
939
+ return false;
940
+ if (filter.reporterIds?.length && !filter.reporterIds.map(String).includes(item.reporter.id))
941
+ return false;
942
+ const categories = filter.categories ?? ['todo', 'in_progress'];
943
+ if (categories.length && !categories.includes(String(item.status.id)))
944
+ return false;
945
+ const data = item.data ?? {};
946
+ const unscheduled = !data['plannedStartAt'] && !data['plannedEndAt'] && !data['allDayDate'] && !data['dueAt'];
947
+ if (filter.unscheduledOnly)
948
+ return unscheduled;
949
+ if (!filter.range)
950
+ return true;
951
+ if (unscheduled)
952
+ return filter.includeUnscheduled === true;
953
+ const from = filter.range.from.getTime(), end = filter.range.end.getTime();
954
+ if (data['plannedStartAt'] || data['plannedEndAt'])
955
+ return item.startDate.getTime() <= end && item.endDate.getTime() >= from;
956
+ if (data['allDayDate']) {
957
+ const day = String(data['allDayDate']);
958
+ const range = taskBoardApiInput(filter).range;
959
+ return day >= range.fromDate && day <= range.endDate;
960
+ }
961
+ const due = Date.parse(String(data['dueAt']));
962
+ return due >= from && due <= end;
963
+ }
964
+ compareItems(a, b) {
965
+ const due = (item) => item.data?.['deadlineAt'] ? Date.parse(String(item.data['deadlineAt'])) : Infinity;
966
+ return (due(a) === due(b) ? 0 : due(a) < due(b) ? -1 : 1) || String(a.id).localeCompare(String(b.id));
967
+ }
968
+ async getSummary(options = {}) {
969
+ const scope = this.readScope();
970
+ this.assertReadScope(scope);
971
+ const { AXP_TASK_RUNTIME_KEYS } = await import('@acorex-platform/module-task-management-client/contracts');
972
+ this.assertReadScope(scope);
973
+ const result = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.Summary, taskBoardApiInput(options), { dataExecution: { refreshOnInvalidate: false, ...(options.dueStatusKeys?.length ? { force: true } : {}) } });
974
+ const summary = runtimeQueryPayloadData(result);
975
+ if (!summary)
976
+ throw new Error('Task summary could not be loaded.');
977
+ return summary;
978
+ }
979
+ async getStatuses() {
980
+ return Promise.all(TASK_BOARD_STATUS_DEFINITIONS.map(async ({ key, title, color }, index) => ({ key, index,
981
+ title: await this.translations.translateAsync(title), color })));
982
+ }
983
+ async getExtraFields() { return []; }
984
+ async updateTasks() { throw new Error('Use Task Management lifecycle or scheduling commands.'); }
985
+ async executeCommand(command) {
986
+ if (command.name === 'TaskManagement:TaskBoard:Information')
987
+ return this.lifecycle.view(String(command.options?.['taskId']));
988
+ if (command.name === TASK_BOARD_LIFECYCLE_COMMAND)
989
+ return this.lifecycle.open(command.options);
990
+ if (command.name === 'TaskManagement:TaskBoard:Refresh') {
991
+ this.refresh();
992
+ return { success: true, kind: 'object', data: undefined };
993
+ }
994
+ return await this.commands.execute(command.name, command.options ?? {}) ?? { success: false };
995
+ }
996
+ async getActions(task) {
997
+ if (!task)
998
+ return [];
999
+ const plan = taskActionMenuPlan(task);
1000
+ const actions = await this.actionsFromPlan(task, plan);
1001
+ if (plan?.error)
1002
+ actions.push({ name: 'refresh', title: '@task-management:task-board.actions-retry', command: { name: 'TaskManagement:TaskBoard:Refresh' } });
1003
+ return actions;
1004
+ }
1005
+ /** Reuse an already-authorized plan when a checklist edit updates just one row. */
1006
+ async actionsFromPlan(task, plan) {
1007
+ const actions = [];
1008
+ if (await taskPersonalCapability(task, 'edit'))
1009
+ actions.push({ name: 'personal-task-edit', title: '@general:actions.edit.title', icon: 'fa-light fa-pen',
1010
+ command: { name: PERSONAL_TASK_COMMANDS.Edit, options: { taskId: task.id } } });
1011
+ const canDelete = await taskPersonalCapability(task, 'delete');
1012
+ const finish = () => {
1013
+ if (canDelete) {
1014
+ const previous = actions.at(-1);
1015
+ if (previous)
1016
+ previous.break = true;
1017
+ actions.push({ name: 'personal-task-delete', title: '@general:actions.delete.title', icon: 'fa-light fa-trash', color: 'danger',
1018
+ command: { name: PERSONAL_TASK_COMMANDS.Delete, options: { taskId: task.id } } });
1019
+ }
1020
+ return actions;
1021
+ };
1022
+ if (!plan)
1023
+ return finish();
1024
+ if (plan.taskId !== String(task.id) || plan.version !== task.data?.['taskVersion']) {
1025
+ actions.push({ name: 'refresh', title: '@task-management:task-board.retry', command: { name: 'TaskManagement:TaskBoard:Refresh' } });
1026
+ return finish();
1027
+ }
1028
+ for (const action of plan.moduleActions ?? [])
1029
+ actions.push({ ...action, command: structuredClone(action.command) });
1030
+ const previous = actions.at(-1);
1031
+ if (previous && plan.actions.length)
1032
+ previous.break = true;
1033
+ for (const item of plan.actions) {
1034
+ const title = await this.translations.translateAsync(`@task-management:task-board.actions.${item.action}`);
1035
+ const reason = item.blockedBy ? await this.translations.translateAsync(`@task-management:task-board.action-errors.${item.blockedBy}`) : '';
1036
+ const targets = plan.actions.filter(other => other.action === item.action).length;
1037
+ actions.push({ name: `task-${item.action}-${item.targetStatusId}`, title: title + (targets > 1 ? ` — ${item.targetTitle ?? item.targetStatusId}` : ''),
1038
+ disabledReason: reason || undefined,
1039
+ priority: item.action === 'start' || item.action === 'complete' ? 'primary' : 'secondary',
1040
+ disabled: !item.enabled, icon: ({ start: 'fa-light fa-play', complete: 'fa-light fa-check', cancel: 'fa-light fa-ban', reopen: 'fa-light fa-rotate-left' })[item.action],
1041
+ color: { start: 'primary', complete: 'success', cancel: 'danger', reopen: 'warning' }[item.action],
1042
+ command: { name: TASK_BOARD_LIFECYCLE_COMMAND, options: { taskId: plan.taskId, expectedVersion: plan.version, action: item.action, targetStatusId: item.targetStatusId,
1043
+ plan: structuredClone(plan), scope: this.readScope() } } });
1044
+ }
1045
+ return finish();
1046
+ }
1047
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskManagementEntityTaskProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1048
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskManagementEntityTaskProvider, providedIn: 'root' }); }
1049
+ }
1050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskManagementEntityTaskProvider, decorators: [{
1051
+ type: Injectable,
1052
+ args: [{ providedIn: 'root' }]
1053
+ }] });
1054
+
1055
+ function createTaskBoardHost() {
1056
+ const calendar = inject(AXMCalendarManagementService);
1057
+ return {
1058
+ moduleName: RootConfig.module.name, menuKey: AXPTaskManagementMenuKeys.TaskBoard,
1059
+ viewAllPermission: AXPProjectsWorkPermissionKeys.ViewAllTasks, filterQueries: AXMTaskManagementQueryKeys,
1060
+ getEvents: async (range, ids) => (await calendar.getOccasions(range, ids)).map(mapCalendarOccasionToHolidayDate),
1061
+ getCalendars: () => calendar.getCalendars(),
1062
+ };
1063
+ }
1064
+ function createAppRoute(scope = 'mine') {
1065
+ const config = inject(AXP_ENTITY_CONFIG_TOKEN);
1066
+ const all = scope === 'all';
1067
+ return {
1068
+ path: all ? ':app/TaskManagement/tasks' : ':app/TaskManagement/task-board',
1069
+ canActivate: [...AXP_PROTECTED_ROUTE_GUARDS],
1070
+ data: {
1071
+ rootLayout: true,
1072
+ requiredFeature: RootConfig.module.name,
1073
+ requiredPermission: [AXPProjectsWorkPermissionKeys.Access, ...(all ? [AXPProjectsWorkPermissionKeys.ViewAllTasks] : [])],
1074
+ },
1075
+ providers: [
1076
+ AXPWorkBoardViewModel,
1077
+ { provide: AXP_WORK_BOARD_HOST, useFactory: () => ({
1078
+ ...createTaskBoardHost(),
1079
+ taskScope: scope,
1080
+ menuKey: all ? AXPTaskManagementMenuKeys.Tasks : AXPTaskManagementMenuKeys.TaskBoard,
1081
+ routePath: all ? 'tasks' : 'task-board',
1082
+ pageTitle: all ? '@task-management:task-board.all-page-title' : '@task-management:task-board.page-title',
1083
+ }) },
1084
+ ],
1085
+ loadComponent: () => {
1086
+ return config.viewers.root();
1087
+ },
1088
+ children: [
1089
+ {
1090
+ path: '',
1091
+ loadComponent: loadWorkBoardComponent,
1092
+ },
1093
+ ],
1094
+ };
1095
+ }
1096
+ function routesFactory() {
1097
+ const routes = [createAppRoute(), createAppRoute('all')];
1098
+ return routes;
1099
+ }
1100
+ class AXPTaskBoardModule {
1101
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1102
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardModule, imports: [AXPRuntimeModule] }); }
1103
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardModule, providers: [
1104
+ { provide: AXP_PAGE_COMPONENT_PROVIDER, useClass: AXPWorkBoardPageComponentProvider, multi: true },
1105
+ { provide: AXP_WORK_BOARD_PROVIDERS, useExisting: AXPTaskManagementEntityTaskProvider, multi: true },
1106
+ { provide: AXP_WORK_BOARD_HOST, useFactory: createTaskBoardHost },
1107
+ provideCommandSetups([
1108
+ {
1109
+ key: AXPTaskManagementCommandKeys.TaskBoard.ResetFiltersAssignToCurrentUser,
1110
+ command: () => Promise.resolve().then(function () { return resetFiltersAssignToCurrentUser_command; }).then((c) => c.ResetTaskBoardFiltersAssignToCurrentUserCommand),
1111
+ },
1112
+ ]),
1113
+ {
1114
+ provide: AXP_HOME_PAGES,
1115
+ multi: true,
1116
+ useFactory: () => [
1117
+ {
1118
+ key: 'task-board',
1119
+ title: 'My Tasks',
1120
+ route: createAppRoute(),
1121
+ },
1122
+ ],
1123
+ },
1124
+ {
1125
+ provide: ROUTES,
1126
+ multi: true,
1127
+ useFactory: routesFactory,
1128
+ },
1129
+ provideQuerySetups([
1130
+ {
1131
+ key: AXMTaskManagementQueryKeys.ListTaskTypes,
1132
+ loader: () => import('./acorex-platform-module-task-management-client-list-task-types.query-CZHSliWt.mjs').then((c) => c.AXMListTaskTypesQuery),
1133
+ },
1134
+ {
1135
+ key: AXMTaskManagementQueryKeys.TaskBoardAssignees,
1136
+ loader: () => import('./acorex-platform-module-task-management-client-list-task-board-assignees.query-BcNFYozj.mjs').then((c) => c.AXMListTaskBoardAssigneesQuery),
1137
+ },
1138
+ {
1139
+ key: AXMTaskManagementQueryKeys.TaskBoardReporters,
1140
+ loader: () => import('./acorex-platform-module-task-management-client-list-task-board-reporters.query-A0sbGwlB.mjs').then((c) => c.AXMListTaskBoardReportersQuery),
1141
+ },
1142
+ ]),
1143
+ ], imports: [AXPRuntimeModule] }); }
1144
+ }
1145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardModule, decorators: [{
1146
+ type: NgModule,
1147
+ args: [{
1148
+ imports: [AXPRuntimeModule],
1149
+ providers: [
1150
+ { provide: AXP_PAGE_COMPONENT_PROVIDER, useClass: AXPWorkBoardPageComponentProvider, multi: true },
1151
+ { provide: AXP_WORK_BOARD_PROVIDERS, useExisting: AXPTaskManagementEntityTaskProvider, multi: true },
1152
+ { provide: AXP_WORK_BOARD_HOST, useFactory: createTaskBoardHost },
1153
+ provideCommandSetups([
1154
+ {
1155
+ key: AXPTaskManagementCommandKeys.TaskBoard.ResetFiltersAssignToCurrentUser,
1156
+ command: () => Promise.resolve().then(function () { return resetFiltersAssignToCurrentUser_command; }).then((c) => c.ResetTaskBoardFiltersAssignToCurrentUserCommand),
1157
+ },
1158
+ ]),
1159
+ {
1160
+ provide: AXP_HOME_PAGES,
1161
+ multi: true,
1162
+ useFactory: () => [
1163
+ {
1164
+ key: 'task-board',
1165
+ title: 'My Tasks',
1166
+ route: createAppRoute(),
1167
+ },
1168
+ ],
1169
+ },
1170
+ {
1171
+ provide: ROUTES,
1172
+ multi: true,
1173
+ useFactory: routesFactory,
1174
+ },
1175
+ provideQuerySetups([
1176
+ {
1177
+ key: AXMTaskManagementQueryKeys.ListTaskTypes,
1178
+ loader: () => import('./acorex-platform-module-task-management-client-list-task-types.query-CZHSliWt.mjs').then((c) => c.AXMListTaskTypesQuery),
1179
+ },
1180
+ {
1181
+ key: AXMTaskManagementQueryKeys.TaskBoardAssignees,
1182
+ loader: () => import('./acorex-platform-module-task-management-client-list-task-board-assignees.query-BcNFYozj.mjs').then((c) => c.AXMListTaskBoardAssigneesQuery),
1183
+ },
1184
+ {
1185
+ key: AXMTaskManagementQueryKeys.TaskBoardReporters,
1186
+ loader: () => import('./acorex-platform-module-task-management-client-list-task-board-reporters.query-A0sbGwlB.mjs').then((c) => c.AXMListTaskBoardReportersQuery),
1187
+ },
1188
+ ]),
1189
+ ],
1190
+ }]
1191
+ }] });
1192
+
1193
+ class AXPTaskBoardShortcutViewComponent extends AXPLayoutBaseWidgetComponent {
1194
+ constructor() {
1195
+ super(...arguments);
1196
+ this.taskBoardService = inject(AXPWorkBoardService);
1197
+ this.sessionService = inject(AXPSessionService);
1198
+ this.connectivity = inject(AXPNetworkConnectivityService);
1199
+ this.sessionUser = toSignal(this.sessionService.user$, { initialValue: this.sessionService.user });
1200
+ this.sessionApplication = toSignal(this.sessionService.application$, { initialValue: this.sessionService.application });
1201
+ this.sessionAuthorization = toSignal(this.sessionService.authorizationRevision$, { initialValue: this.sessionService.authorizationRevision });
1202
+ this.sessionReady = toSignal(this.sessionService.isReadyForAppScopedApi$, { initialValue: this.sessionService.isReadyForAppScopedApi });
1203
+ this.canViewAll = computed(() => {
1204
+ this.sessionAuthorization();
1205
+ return this.sessionReady() && this.sessionService.authorize(AXPProjectsWorkPermissionKeys.ViewAllTasks);
1206
+ }, /* @ts-ignore */
1207
+ ...(ngDevMode ? [{ debugName: "canViewAll" }] : /* istanbul ignore next */ []));
1208
+ this.boardLink = computed(() => {
1209
+ const application = this.sessionApplication()?.name;
1210
+ return application ? ['/' + application, 'TaskManagement', this.canViewAll() ? 'tasks' : 'task-board'] : null;
1211
+ }, /* @ts-ignore */
1212
+ ...(ngDevMode ? [{ debugName: "boardLink" }] : /* istanbul ignore next */ []));
1213
+ this.tasksCount = signal(0, /* @ts-ignore */
1214
+ ...(ngDevMode ? [{ debugName: "tasksCount" }] : /* istanbul ignore next */ []));
1215
+ this.assignee = computed(() => this.options()?.['assignee'] ?? [], /* @ts-ignore */
1216
+ ...(ngDevMode ? [{ debugName: "assignee" }] : /* istanbul ignore next */ []));
1217
+ this.priority = computed(() => this.options()?.['priority'] ?? [], /* @ts-ignore */
1218
+ ...(ngDevMode ? [{ debugName: "priority" }] : /* istanbul ignore next */ []));
1219
+ this.selectedTaskTypes = computed(() => this.options()?.['taskTypes'] ?? [], /* @ts-ignore */
1220
+ ...(ngDevMode ? [{ debugName: "selectedTaskTypes" }] : /* istanbul ignore next */ []));
1221
+ this.dateRange = computed(() => this.options()?.['dateRange'] ?? { title: 'This Month', name: 'this-month' }, /* @ts-ignore */
1222
+ ...(ngDevMode ? [{ debugName: "dateRange" }] : /* istanbul ignore next */ []));
1223
+ this.title = computed(() => {
1224
+ const types = this.selectedTaskTypes()
1225
+ .map((t) => t.title)
1226
+ .join(', ');
1227
+ return types === '' ? this.canViewAll() ? '@task-management:task-board.all-page-title' : '@task-management:task-board.page-title' : types;
1228
+ }, /* @ts-ignore */
1229
+ ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
1230
+ this.queryParams = computed(() => {
1231
+ const dateRange = this.dateRange().name;
1232
+ const assignee = this.canViewAll() ? normalizeTaskBoardAssigneeIds(this.sessionService, this.assignee().map((a) => a.id)).map(String) : [this.sessionUser()?.id ?? ''];
1233
+ const priority = this.priority().map((p) => p.name);
1234
+ const type = this.selectedTaskTypes().map((t) => t.name);
1235
+ return { type, priority, assignee, dateRange };
1236
+ }, /* @ts-ignore */
1237
+ ...(ngDevMode ? [{ debugName: "queryParams" }] : /* istanbul ignore next */ []));
1238
+ this.#taskCounter = effect(onCleanup => {
1239
+ if (!this.sessionReady() || !this.sessionUser()?.id) {
1240
+ this.tasksCount.set(0);
1241
+ return;
1242
+ }
1243
+ this.connectivity.recoveredRevision();
1244
+ let active = true;
1245
+ onCleanup(() => { active = false; });
1246
+ const params = this.queryParams();
1247
+ const range = this.taskBoardService.rangeCalculator(params.dateRange);
1248
+ const options = {
1249
+ range,
1250
+ types: params.type,
1251
+ priorities: params.priority,
1252
+ assigneeIds: params.assignee,
1253
+ };
1254
+ this.taskBoardService.getTasks(options).then(t => { if (active)
1255
+ this.tasksCount.set(t.total); })
1256
+ .catch(() => { if (active)
1257
+ this.tasksCount.set(0); });
1258
+ }, /* @ts-ignore */
1259
+ ...(ngDevMode ? [{ debugName: "#taskCounter" }] : /* istanbul ignore next */ []));
1260
+ }
1261
+ #taskCounter;
1262
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardShortcutViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1263
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXPTaskBoardShortcutViewComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class=\"flex flex-col gap-3 px-6 pt-3 pb-6 h-full\">\n <h1 class=\"text-start text-lg font-medium truncate h-9\">{{ title() | translate | async }}</h1>\n <div class=\"w-full h-full relative\">\n <div class=\"flex flex-col gap-2 text-start\">\n <h3 class=\"text-xl text-primary text-nowrap\">{{ dateRange().title | translate | async }}</h3>\n <h1 class=\"text-6xl font-bold\">{{ tasksCount() }}</h1>\n </div>\n <a\n [queryParams]=\"queryParams()\"\n class=\"absolute bottom-0 right-0\"\n [routerLink]=\"boardLink()\"\n >\n <ax-button [text]=\"'View all'\" [look]=\"'link'\" class=\"ax-sm\" [color]=\"'primary'\">\n <ax-suffix> <ax-icon class=\"fa-solid fa-external-link\"></ax-icon> </ax-suffix>\n </ax-button>\n </a>\n </div>\n</div>\n", styles: ["/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1264
+ }
1265
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardShortcutViewComponent, decorators: [{
1266
+ type: Component,
1267
+ args: [{ imports: [
1268
+ CommonModule,
1269
+ AXButtonComponent,
1270
+ AXDecoratorIconComponent,
1271
+ AXDecoratorGenericComponent,
1272
+ RouterLink,
1273
+ AXTranslationModule,
1274
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col gap-3 px-6 pt-3 pb-6 h-full\">\n <h1 class=\"text-start text-lg font-medium truncate h-9\">{{ title() | translate | async }}</h1>\n <div class=\"w-full h-full relative\">\n <div class=\"flex flex-col gap-2 text-start\">\n <h3 class=\"text-xl text-primary text-nowrap\">{{ dateRange().title | translate | async }}</h3>\n <h1 class=\"text-6xl font-bold\">{{ tasksCount() }}</h1>\n </div>\n <a\n [queryParams]=\"queryParams()\"\n class=\"absolute bottom-0 right-0\"\n [routerLink]=\"boardLink()\"\n >\n <ax-button [text]=\"'View all'\" [look]=\"'link'\" class=\"ax-sm\" [color]=\"'primary'\">\n <ax-suffix> <ax-icon class=\"fa-solid fa-external-link\"></ax-icon> </ax-suffix>\n </ax-button>\n </a>\n </div>\n</div>\n", styles: ["/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */\n"] }]
1275
+ }] });
1276
+
1277
+ var taskBoardShortcut_component = /*#__PURE__*/Object.freeze({
1278
+ __proto__: null,
1279
+ AXPTaskBoardShortcutViewComponent: AXPTaskBoardShortcutViewComponent
1280
+ });
1281
+
1282
+ /**
1283
+ * Parent tab for task-management dashboard widgets in the widget gallery.
1284
+ */
1285
+ const AXP_TASK_MANAGEMENT_DASHBOARD_WIDGET_CATEGORY = {
1286
+ name: 'tasks',
1287
+ order: 4,
1288
+ title: '@task-management:dashboard-widgets.widget-picker-category.tasks',
1289
+ };
1290
+
1291
+ const SUB = '@task-management:dashboard-widgets.widget-picker-sub-categories';
1292
+ //#region ---- Task dashboard widget picker sub-categories ----
1293
+ const AXP_TASK_MANAGEMENT_DASHBOARD_SUB_SHORTCUT = {
1294
+ name: 'task-dashboard-shortcut',
1295
+ order: 1,
1296
+ title: `${SUB}.shortcut`,
1297
+ };
1298
+ const AXP_TASK_MANAGEMENT_DASHBOARD_SUB_BOARD = {
1299
+ name: 'task-dashboard-board',
1300
+ order: 2,
1301
+ title: `${SUB}.board`,
1302
+ };
1303
+ //#endregion
1304
+
1305
+ //#region ----- Imports -----
1306
+ //#endregion
1307
+ //#region ----- Task dashboard presets -----
1308
+ const TASK_BOARD_SIZES = [
1309
+ [4, 4],
1310
+ [3, 4],
1311
+ [5, 4],
1312
+ ];
1313
+ /** Task board list tile. */
1314
+ const AXP_TASK_BOARD_DIMENSIONS = defineDashboardWidgetDimensions({
1315
+ sm: [[1, 7], [1, 6]],
1316
+ md: TASK_BOARD_SIZES,
1317
+ lg: TASK_BOARD_SIZES,
1318
+ });
1319
+ /** Filtered task-board shortcut launcher. */
1320
+ const AXP_TASK_BOARD_SHORTCUT_DIMENSIONS = defineDashboardWidgetDimensions({
1321
+ sm: [[1, 2]],
1322
+ md: [
1323
+ [2, 2],
1324
+ [3, 2],
1325
+ ],
1326
+ lg: [
1327
+ [2, 2],
1328
+ [3, 2],
1329
+ ],
1330
+ xl: [
1331
+ [2, 2],
1332
+ [3, 2],
1333
+ ],
1334
+ '2xl': [
1335
+ [2, 2],
1336
+ [3, 2],
1337
+ ],
1338
+ '3xl': [
1339
+ [2, 2],
1340
+ [3, 2],
1341
+ ],
1342
+ '4xl': [
1343
+ [2, 2],
1344
+ [3, 2],
1345
+ ],
1346
+ });
1347
+ //#endregion
1348
+
1349
+ const VALID_PRIORITIES = [
1350
+ { title: 'Urgent', name: 'urgent' },
1351
+ { title: 'High', name: 'high' },
1352
+ { title: 'Normal', name: 'normal' },
1353
+ { title: 'Low', name: 'low' },
1354
+ { title: 'No Priority', name: 'no_priority' },
1355
+ ];
1356
+ const VALID_DATE_RANGES = [
1357
+ { title: 'Today', name: 'today' },
1358
+ { title: 'This Week', name: 'this-week' },
1359
+ { title: 'This Month', name: 'this-month' },
1360
+ ];
1361
+ const AXPTaskBoardShortcut = {
1362
+ name: RootConfig.widgets.taskBoardShortcut,
1363
+ title: '@dashboard:widgets.task-board-shortcut.widget-title',
1364
+ description: '@dashboard:widgets.task-board-shortcut.widget-description',
1365
+ categories: [AXP_TASK_MANAGEMENT_DASHBOARD_WIDGET_CATEGORY],
1366
+ subCategory: AXP_TASK_MANAGEMENT_DASHBOARD_SUB_SHORTCUT,
1367
+ groups: [AXPWidgetGroupEnum.DashboardWidget],
1368
+ type: 'dashboard',
1369
+ icon: 'fa-light fa-clipboard-list-check',
1370
+ properties: [
1371
+ cloneProperty(AXP_DATA_PATH_PROPERTY, { visible: false }),
1372
+ // ====== Task Type ======
1373
+ {
1374
+ order: 0,
1375
+ name: 'taskTypes',
1376
+ title: '@task-management:task-board.filter.task-type',
1377
+ group: AXP_APPEARANCE_PROPERTY_GROUP,
1378
+ schema: {
1379
+ dataType: 'object',
1380
+ interface: {
1381
+ name: 'taskTypes',
1382
+ path: 'options.taskTypes',
1383
+ type: AXPWidgetsCatalog.select,
1384
+ options: {
1385
+ multiple: true,
1386
+ textField: 'title',
1387
+ valueField: 'name',
1388
+ dataSource: AXMTaskManagementQueryKeys.ListTaskTypes,
1389
+ },
1390
+ },
1391
+ },
1392
+ visible: true,
1393
+ },
1394
+ // ====== Asigned To ======
1395
+ {
1396
+ order: 1,
1397
+ name: 'assignee',
1398
+ title: '@task-management:task-board.filter.assignee',
1399
+ group: AXP_APPEARANCE_PROPERTY_GROUP,
1400
+ schema: {
1401
+ dataType: 'object',
1402
+ interface: {
1403
+ name: 'assignee',
1404
+ path: 'options.assignee',
1405
+ type: AXPWidgetsCatalog.select,
1406
+ options: {
1407
+ multiple: true,
1408
+ valueField: 'id',
1409
+ allowSearch: true,
1410
+ dataSource: AXMTaskManagementQueryKeys.TaskBoardAssignees,
1411
+ textField: 'displayName',
1412
+ },
1413
+ },
1414
+ },
1415
+ visible: true,
1416
+ },
1417
+ // ====== Priority ======
1418
+ {
1419
+ order: 2,
1420
+ name: 'priority',
1421
+ title: '@task-management:task-board.filter.priority',
1422
+ group: AXP_APPEARANCE_PROPERTY_GROUP,
1423
+ schema: {
1424
+ dataType: 'object',
1425
+ interface: {
1426
+ name: 'priority',
1427
+ path: 'options.priority',
1428
+ type: AXPWidgetsCatalog.select,
1429
+ options: {
1430
+ multiple: true,
1431
+ textField: 'title',
1432
+ valueField: 'name',
1433
+ dataSource: VALID_PRIORITIES,
1434
+ },
1435
+ },
1436
+ },
1437
+ visible: true,
1438
+ },
1439
+ // ====== Date Range ======
1440
+ {
1441
+ order: 3,
1442
+ name: 'dateRange',
1443
+ title: '@task-management:task-board.filter.date-range',
1444
+ group: AXP_APPEARANCE_PROPERTY_GROUP,
1445
+ schema: {
1446
+ dataType: 'object',
1447
+ defaultValue: { title: 'This Month', name: 'this-month' },
1448
+ interface: {
1449
+ name: 'dateRange',
1450
+ path: 'options.dateRange',
1451
+ type: AXPWidgetsCatalog.select,
1452
+ options: {
1453
+ textField: 'title',
1454
+ valueField: 'name',
1455
+ dataSource: VALID_DATE_RANGES,
1456
+ },
1457
+ },
1458
+ },
1459
+ visible: true,
1460
+ },
1461
+ ],
1462
+ components: {
1463
+ view: {
1464
+ component: () => Promise.resolve().then(function () { return taskBoardShortcut_component; }).then((c) => c.AXPTaskBoardShortcutViewComponent),
1465
+ },
1466
+ },
1467
+ meta: {
1468
+ dimensions: AXP_TASK_BOARD_SHORTCUT_DIMENSIONS,
1469
+ },
1470
+ toString: `value == null || value === '' ? '' : display(value)`,
1471
+ };
1472
+
1473
+ function taskWidgetPageSize(value) {
1474
+ return typeof value === 'number' && Number.isFinite(value) ? Math.max(1, Math.min(50, Math.floor(value))) : 10;
1475
+ }
1476
+ /** Planned end dates are not deadlines. Undated work sorts after dated work. */
1477
+ function sortTaskWidgetItems(items, sortBy) {
1478
+ const priority = (a, b) => TASK_PRIORITY_ORDER[getTaskPriorityFilterKey(a)] - TASK_PRIORITY_ORDER[getTaskPriorityFilterKey(b)];
1479
+ const due = (a, b) => {
1480
+ const left = taskDueDate(a)?.getTime() ?? Infinity;
1481
+ const right = taskDueDate(b)?.getTime() ?? Infinity;
1482
+ return left === right ? 0 : left < right ? -1 : 1;
1483
+ };
1484
+ return [...items].sort((a, b) => (sortBy === 'priority' ? priority(a, b) || due(a, b) : due(a, b) || priority(a, b))
1485
+ || String(a.id).localeCompare(String(b.id)));
1486
+ }
1487
+
1488
+ class AXPTaskBoardWidgetViewComponent extends AXPLayoutBaseWidgetComponent {
1489
+ async loadMore() { await Promise.all(this.groups().filter(group => group.items.length < group.total).map(group => this.loadGroup(group.key))); }
1490
+ constructor() {
1491
+ super();
1492
+ this.taskClick = output();
1493
+ this.board = inject(AXPWorkBoardService);
1494
+ this.details = inject(AXPWorkBoardTaskPopoverOverlayService);
1495
+ this.detailsSession = inject(AXMTaskDetailsSessionService);
1496
+ this.settings = inject(AXPSettingsService);
1497
+ this.formatter = inject(AXFormatService);
1498
+ this.translations = inject(AXTranslationService);
1499
+ this.locale = inject(AXLocaleService);
1500
+ this.session = inject(AXPSessionService);
1501
+ this.connectivity = inject(AXPNetworkConnectivityService);
1502
+ this.destroyRef = inject(DestroyRef);
1503
+ this.sessionUser = toSignal(this.session.user$, { initialValue: this.session.user });
1504
+ this.sessionTenant = toSignal(this.session.tenant$, { initialValue: this.session.tenant });
1505
+ this.sessionApplication = toSignal(this.session.application$, { initialValue: this.session.application });
1506
+ this.sessionReady = toSignal(this.session.isReadyForAppScopedApi$, { initialValue: this.session.isReadyForAppScopedApi });
1507
+ this.sessionAuthorization = toSignal(this.session.authorizationRevision$, { initialValue: this.session.authorizationRevision });
1508
+ this.canReadTasks = computed(() => {
1509
+ this.sessionAuthorization();
1510
+ return this.sessionReady() && this.session.authorize(AXPProjectsWorkPermissionKeys.Access);
1511
+ }, /* @ts-ignore */
1512
+ ...(ngDevMode ? [{ debugName: "canReadTasks" }] : /* istanbul ignore next */ []));
1513
+ this.rows = viewChildren(AXPWorkBoardRowComponent, /* @ts-ignore */
1514
+ ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
1515
+ this.generation = 0;
1516
+ this.loadedScope = '';
1517
+ this.loadedAuthorityScope = '';
1518
+ this.pendingItemChanges = [];
1519
+ this.itemCountVersion = 0;
1520
+ this.groupId = `task-widget-${createRandomUuid()}`;
1521
+ this.pageSize = computed(() => taskWidgetPageSize(this.options()?.['maxItems']), /* @ts-ignore */
1522
+ ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
1523
+ this.sortBy = computed(() => this.options()?.['sortBy']?.name === 'dueDate' ? 'dueDate' : 'priority', /* @ts-ignore */
1524
+ ...(ngDevMode ? [{ debugName: "sortBy" }] : /* istanbul ignore next */ []));
1525
+ this.scope = computed(() => {
1526
+ this.sessionUser();
1527
+ const rawTypes = this.options()?.['taskTypes'] ?? this.options()?.['taskType'] ?? [];
1528
+ const types = Array.isArray(rawTypes) ? rawTypes : [rawTypes];
1529
+ return {
1530
+ assigneeIds: this.session.user?.id ? [this.session.user.id] : [],
1531
+ types: types.map((type) => type.name),
1532
+ includeUnscheduled: true,
1533
+ };
1534
+ }, /* @ts-ignore */
1535
+ ...(ngDevMode ? [{ debugName: "scope" }] : /* istanbul ignore next */ []));
1536
+ this.boardLink = computed(() => {
1537
+ const application = this.sessionApplication()?.name;
1538
+ return application ? ['/' + application, 'TaskManagement', 'task-board'] : null;
1539
+ }, /* @ts-ignore */
1540
+ ...(ngDevMode ? [{ debugName: "boardLink" }] : /* istanbul ignore next */ []));
1541
+ // An explicit empty type clears saved board filters when this widget shows all types.
1542
+ this.boardQuery = computed(() => ({ view: 'table', layout: 'simple', assignee: this.scope().assigneeIds, type: this.scope().types?.length ? this.scope().types : [''] }), /* @ts-ignore */
1543
+ ...(ngDevMode ? [{ debugName: "boardQuery" }] : /* istanbul ignore next */ []));
1544
+ this.pages = signal({}, /* @ts-ignore */
1545
+ ...(ngDevMode ? [{ debugName: "pages" }] : /* istanbul ignore next */ []));
1546
+ this.summary = signal(null, /* @ts-ignore */
1547
+ ...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
1548
+ this.loading = signal(true, /* @ts-ignore */
1549
+ ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
1550
+ this.error = signal(false, /* @ts-ignore */
1551
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
1552
+ this.collapsedGroups = signal(new Set(['done', 'cancelled']), /* @ts-ignore */
1553
+ ...(ngDevMode ? [{ debugName: "collapsedGroups" }] : /* istanbul ignore next */ []));
1554
+ this.groups = computed(() => TASK_BOARD_STATUS_DEFINITIONS.filter(definition => ['todo', 'in_progress'].includes(definition.key)).map(definition => {
1555
+ const page = this.pages()[definition.key];
1556
+ return { ...definition, items: sortTaskWidgetItems(page?.items ?? [], this.sortBy()), total: page?.total ?? this.summary()?.[definition.key] ?? 0,
1557
+ loading: page?.loading ?? false, error: page?.error ?? false };
1558
+ }).filter(group => group.total > 0 || group.error), /* @ts-ignore */
1559
+ ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
1560
+ this.hasMore = computed(() => this.groups().some(group => !group.error && group.items.length < group.total), /* @ts-ignore */
1561
+ ...(ngDevMode ? [{ debugName: "hasMore" }] : /* istanbul ignore next */ []));
1562
+ this.pageError = computed(() => this.groups().some(group => group.error), /* @ts-ignore */
1563
+ ...(ngDevMode ? [{ debugName: "pageError" }] : /* istanbul ignore next */ []));
1564
+ this.taskItems = computed(() => sortTaskWidgetItems(this.groups().flatMap(group => group.items), this.sortBy()), /* @ts-ignore */
1565
+ ...(ngDevMode ? [{ debugName: "taskItems" }] : /* istanbul ignore next */ []));
1566
+ effect(() => {
1567
+ const ready = this.canReadTasks();
1568
+ this.connectivity.recoveredRevision();
1569
+ const authorization = this.sessionAuthorization();
1570
+ const identity = this.sessionUser()?.id;
1571
+ const tenant = this.sessionTenant()?.id;
1572
+ const application = this.sessionApplication()?.id;
1573
+ const scope = this.scope();
1574
+ const pageSize = this.pageSize();
1575
+ const locale = this.locale.activeProfile().localeInfo?.code;
1576
+ untracked(() => {
1577
+ const authorityScope = JSON.stringify([identity, tenant, application, authorization]);
1578
+ const key = JSON.stringify([identity, tenant, application, authorization, scope, pageSize, locale]);
1579
+ if (!ready || key !== this.loadedScope) {
1580
+ const active = this.details.getActiveTask();
1581
+ if ((!ready || authorityScope !== this.loadedAuthorityScope) && active && this.containsTask(active))
1582
+ this.details.close();
1583
+ ++this.generation;
1584
+ this.pages.set({});
1585
+ this.summary.set(null);
1586
+ this.pendingItemChanges.length = 0;
1587
+ this.loading.set(false);
1588
+ this.error.set(false);
1589
+ this.loadedScope = key;
1590
+ this.loadedAuthorityScope = authorityScope;
1591
+ }
1592
+ if (ready)
1593
+ void this.reloadTasks();
1594
+ });
1595
+ });
1596
+ afterRenderEffect(() => {
1597
+ const active = this.details.getActiveTask();
1598
+ if (!active)
1599
+ return;
1600
+ for (const row of this.rows()) {
1601
+ if (row.task().id !== active.id || row.task().provider !== active.provider)
1602
+ continue;
1603
+ const anchor = row.getDetailsAnchor();
1604
+ if (anchor)
1605
+ this.detailsSession.setAnchor(anchor);
1606
+ }
1607
+ });
1608
+ this.board.refresh$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => { void this.refreshTasks(); });
1609
+ this.board.itemChanges$.pipe(concatMap(change => {
1610
+ const generation = this.generation;
1611
+ return this.reconcileItem(change).catch(() => { if (this.isCurrent(generation))
1612
+ this.error.set(true); });
1613
+ }), takeUntilDestroyed(this.destroyRef)).subscribe();
1614
+ this.board.close$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(event => {
1615
+ const active = this.details.getActiveTask();
1616
+ if (active && this.containsTask(active) && (!event.provider || event.provider === active.provider))
1617
+ this.details.close();
1618
+ });
1619
+ this.destroyRef.onDestroy(() => { ++this.generation; });
1620
+ }
1621
+ async reconcileItem(change) {
1622
+ if (!this.canReadTasks())
1623
+ return;
1624
+ if (change.scope && !this.board.isCurrentItemChange(change))
1625
+ return;
1626
+ if (this.loading() || Object.values(this.pages()).some(page => page?.loading)) {
1627
+ this.pendingItemChanges.push(change);
1628
+ return;
1629
+ }
1630
+ const provider = this.board.getProvider(change.provider);
1631
+ if (!provider)
1632
+ return;
1633
+ const generation = this.generation, version = ++this.itemCountVersion;
1634
+ const matches = (item) => provider.matchesItem(item, { ...this.scope(), categories: [] });
1635
+ const summary = patchWorkBoardSummary(this.summary(), change, matches) ?? await this.board.getSummary(this.scope()).catch(() => null);
1636
+ if (!this.isCurrent(generation) || version !== this.itemCountVersion || change.scope && !this.board.isCurrentItemChange(change))
1637
+ return;
1638
+ if (!summary) {
1639
+ await this.reloadTasks();
1640
+ return;
1641
+ }
1642
+ this.summary.set(summary);
1643
+ const item = change.item ? (await resolveTaskBoardSchedulerLabels([change.item], this.translations, this.formatter, this.settings))[0] : null;
1644
+ if (!this.isCurrent(generation) || version !== this.itemCountVersion || change.scope && !this.board.isCurrentItemChange(change))
1645
+ return;
1646
+ this.pages.update(pages => {
1647
+ const next = { ...pages };
1648
+ for (const { key } of TASK_BOARD_STATUS_DEFINITIONS) {
1649
+ const page = pages[key];
1650
+ if (!page && this.collapsedGroups().has(key))
1651
+ continue;
1652
+ const items = patchWorkBoardItems(page?.items ?? [], { ...change, item }, task => matches(task) && task.status.id === key, (a, b) => provider.compareItems(a, b), !!page && page.items.length < page.total);
1653
+ next[key] = { items, total: summary[key], loading: false, error: false };
1654
+ }
1655
+ return next;
1656
+ });
1657
+ const active = this.details.getActiveTask();
1658
+ if (active && sameWorkBoardItem(active, change)) {
1659
+ if (item && matches(item))
1660
+ await this.details.refreshTask(item);
1661
+ else
1662
+ this.details.close();
1663
+ }
1664
+ }
1665
+ async drainItemChanges() {
1666
+ if (this.loading() || Object.values(this.pages()).some(page => page?.loading))
1667
+ return;
1668
+ // A page read may already include the mutation; revalidate counts rather than
1669
+ // subtracting its previous state from an overlapping server snapshot twice.
1670
+ for (const change of this.pendingItemChanges.splice(0))
1671
+ await this.reconcileItem({ ...change, previous: undefined });
1672
+ }
1673
+ async toggleGroup(key) {
1674
+ const wasCollapsed = this.collapsedGroups().has(key);
1675
+ this.collapsedGroups.update(current => {
1676
+ const next = new Set(current);
1677
+ if (wasCollapsed)
1678
+ next.delete(key);
1679
+ else
1680
+ next.add(key);
1681
+ return next;
1682
+ });
1683
+ if (wasCollapsed && !this.pages()[key]?.items.length)
1684
+ await this.loadGroup(key);
1685
+ }
1686
+ async onTaskClick(task, event) {
1687
+ if (!this.canReadTasks() || !(event.currentTarget instanceof HTMLElement))
1688
+ return;
1689
+ await this.details.open({ task, anchor: event.currentTarget, offsetX: 12, offsetY: 12, adaptivityEnabled: true });
1690
+ this.taskClick.emit(task);
1691
+ }
1692
+ async reloadTasks() {
1693
+ if (!this.canReadTasks())
1694
+ return;
1695
+ const generation = ++this.generation;
1696
+ this.loading.set(true);
1697
+ this.error.set(false);
1698
+ // Keep visible rows and scroll while superseding older refresh requests.
1699
+ this.pages.update(pages => Object.fromEntries(Object.entries(pages).map(([key, page]) => [key, { ...page, loading: false }])));
1700
+ try {
1701
+ await this.board.getTaskTypes().catch(() => undefined);
1702
+ if (!this.isCurrent(generation) || !this.sessionReady())
1703
+ return;
1704
+ // Each open page supplies its own total when the optional summary is unavailable.
1705
+ const summary = await this.board.getSummary(this.scope()).catch(() => null);
1706
+ if (!this.isCurrent(generation))
1707
+ return;
1708
+ this.summary.set(summary);
1709
+ await Promise.all(TASK_BOARD_STATUS_DEFINITIONS.filter(({ key }) => ['todo', 'in_progress'].includes(key)).filter(({ key }) => !this.collapsedGroups().has(key) || this.pages()[key]?.items.length)
1710
+ .map(({ key }) => this.loadGroup(key, true, generation)));
1711
+ }
1712
+ catch {
1713
+ if (this.isCurrent(generation))
1714
+ this.error.set(true);
1715
+ }
1716
+ finally {
1717
+ if (this.isCurrent(generation)) {
1718
+ this.loading.set(false);
1719
+ await this.drainItemChanges();
1720
+ }
1721
+ }
1722
+ }
1723
+ async loadGroup(key, refresh = false, generation = this.generation) {
1724
+ const previous = this.pages()[key];
1725
+ if (!this.canReadTasks() || previous?.loading)
1726
+ return;
1727
+ this.pages.update(pages => ({ ...pages, [key]: { items: previous?.items ?? [], total: previous?.total ?? 0, loading: true, error: false } }));
1728
+ try {
1729
+ const result = await this.board.getTasks({ ...this.scope(), categories: [key], skip: refresh ? 0 : previous?.items.length ?? 0,
1730
+ take: refresh ? Math.max(this.pageSize(), previous?.items.length ?? 0) : this.pageSize() });
1731
+ const items = await resolveTaskBoardSchedulerLabels(result.items, this.translations, this.formatter, this.settings);
1732
+ if (!this.isCurrent(generation))
1733
+ return;
1734
+ const records = new Map((refresh ? [] : previous?.items ?? []).map(task => [task.id, task]));
1735
+ for (const task of items)
1736
+ records.set(task.id, task);
1737
+ this.pages.update(pages => ({ ...pages, [key]: { items: [...records.values()], total: result.total, loading: false, error: false } }));
1738
+ }
1739
+ catch {
1740
+ if (this.isCurrent(generation))
1741
+ this.pages.update(pages => ({ ...pages, [key]: { items: previous?.items ?? [], total: previous?.total ?? 0, loading: false, error: true } }));
1742
+ }
1743
+ finally {
1744
+ if (this.isCurrent(generation))
1745
+ await this.drainItemChanges();
1746
+ }
1747
+ }
1748
+ isCurrent(generation) { return !this.destroyRef.destroyed && this.canReadTasks() && generation === this.generation; }
1749
+ containsTask(task) {
1750
+ return Object.values(this.pages()).some(page => page?.items.some(item => item.id === task.id && item.provider === task.provider));
1751
+ }
1752
+ async refreshTasks() {
1753
+ if (!this.canReadTasks())
1754
+ return;
1755
+ const active = this.details.getActiveTask();
1756
+ const ownsActive = !!active && this.containsTask(active);
1757
+ const generation = this.generation + 1;
1758
+ this.board.invalidateTaskCache();
1759
+ await this.reloadTasks();
1760
+ const current = this.details.getActiveTask();
1761
+ if (!this.isCurrent(generation) || !active || !ownsActive || this.error() || current?.id !== active.id || current?.provider !== active.provider)
1762
+ return;
1763
+ const updated = Object.values(this.pages()).flatMap(page => page?.items ?? []).find(task => task.id === active.id && task.provider === active.provider);
1764
+ if (updated)
1765
+ await this.details.refreshTask(updated);
1766
+ else
1767
+ this.details.close();
1768
+ }
1769
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardWidgetViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1770
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPTaskBoardWidgetViewComponent, isStandalone: true, selector: "ng-component", outputs: { taskClick: "taskClick" }, viewQueries: [{ propertyName: "rows", predicate: AXPWorkBoardRowComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (!sessionReady()) {\n <div class=\"task-widget__loading\" role=\"status\">{{ '@task-management:task-board.widget.loading' | translate | async }}</div>\n} @else if (!canReadTasks()) {\n <axp-state-message look=\"widget\" icon=\"fa-light fa-lock\" [title]=\"'@general:messages.network.forbidden.title'\" />\n} @else {\n<div class=\"task-widget\">\n <div class=\"task-widget__scroll\" [attr.aria-busy]=\"loading()\">\n @if (loading() && !summary()) {\n <div class=\"task-widget__loading\" role=\"status\">{{ '@task-management:task-board.widget.loading' | translate | async }}</div>\n } @else {\n <div role=\"list\">\n @for (task of taskItems(); track task.id) {\n <axm-task-board-row role=\"listitem\" [task]=\"task\" layout=\"widget\" [grouped]=\"false\" (openTask)=\"onTaskClick(task, $event)\" />\n } @empty {\n @if (!error() && !pageError()) { <axp-state-message look=\"widget\" icon=\"fa-light fa-clipboard-list-check\" [title]=\"'@dashboard:task-board.no-tasks-found.title'\" /> }\n }\n </div>\n @for (group of groups(); track group.key) {\n @if (group.error && connectivity.isOnline()) { <div role=\"alert\"><button type=\"button\" (click)=\"loadGroup(group.key, true)\">{{ '@task-management:task-board.retry' | translate | async }}</button></div> }\n }\n @if (hasMore()) {\n <button type=\"button\" class=\"task-widget__more\" (click)=\"loadMore()\">{{ '@task-management:task-board.feed.more' | translate | async }}</button>\n }\n\n }\n @if ((pageError() || error()) && !connectivity.isOnline()) {\n <div class=\"task-widget__message\" role=\"status\">{{ '@general:work-board.offline-page' | translate | async }}</div>\n } @else if (error()) {\n <div class=\"task-widget__message\" role=\"alert\"><span>{{ '@task-management:task-board.load-error' | translate | async }}</span><button type=\"button\" (click)=\"reloadTasks()\">{{ '@task-management:task-board.retry' | translate | async }}</button></div>\n }\n </div>\n <footer class=\"task-widget__footer\">\n <a [routerLink]=\"boardLink()\" [queryParams]=\"boardQuery()\"><span>{{ '@task-management:task-board.widget.view-all' | translate | async }}</span><i class=\"fa-light fa-arrow-right\" aria-hidden=\"true\"></i></a>\n </footer>\n</div>\n}\n", styles: [":host{display:block;width:100%;height:100%;min-width:0;min-height:0;container-type:inline-size}.task-widget{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;color:rgba(var(--ax-sys-color-on-lightest-surface))}.task-widget__scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.task-widget__group-title{margin:0;position:sticky;top:0;z-index:1;font-size:.875rem;font-weight:500}.task-widget__group-toggle{display:flex;width:100%;align-items:center;gap:10px;padding:8px 12px;min-height:38px;border:0;border-inline-start:3px solid var(--task-status-accent);border-radius:0;background:var(--task-status-bg);color:var(--task-status-text);font:inherit;cursor:pointer;text-align:start}.task-widget__group-toggle>i{font-size:.8125rem}.task-widget__count{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;border:1px solid var(--task-status-accent);border-radius:5px;padding-inline:5px;font-size:.75rem;font-variant-numeric:tabular-nums}@supports (color: color-mix(in lab,red,red)){.task-widget__count{border:1px solid color-mix(in srgb,var(--task-status-accent) 35%,transparent)}}.task-widget__footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;gap:8px 12px;padding:6px clamp(8px,4cqi,14px);border-top:1px solid rgba(var(--ax-sys-color-border-lightest-surface));font-size:.75rem}.task-widget__footer>span{color:rgba(var(--ax-sys-color-on-lightest-surface),.65)}.task-widget__footer a,.task-widget__more,.task-widget__message button{color:light-dark(rgba(var(--ax-sys-color-primary-700)),rgba(var(--ax-sys-color-primary-300)))}.task-widget__footer a{display:inline-flex;align-items:center;gap:8px;min-width:0;min-height:28px;overflow-wrap:anywhere;text-decoration:none}.task-widget__footer a i{flex-shrink:0}.task-widget__footer a:hover{text-decoration:underline}.task-widget__more,.task-widget__message button{border:0;background:transparent;cursor:pointer;font:inherit;padding:8px 12px}.task-widget__more{display:block;margin-inline-start:clamp(0px,7cqi,28px);font-size:.75rem}.task-widget__message,.task-widget__loading{padding:12px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:.8125rem}.task-widget button:focus-visible,.task-widget a:focus-visible{outline:2px solid rgba(var(--ax-sys-color-primary-surface));outline-offset:-2px}:host-context([dir=\"rtl\"]) .task-widget__footer i,:host-context([dir=\"rtl\"]) .task-widget__group-toggle .fa-chevron-right{transform:scaleX(-1)}@media(any-pointer:coarse){.task-widget__group-toggle,.task-widget__footer a,.task-widget__more,.task-widget__message button{min-height:44px}}\n/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "titleParams", "descriptionParams", "look"] }, { kind: "component", type: AXPWorkBoardRowComponent, selector: "axm-task-board-row", inputs: ["task", "colorBy", "layout", "grouped", "showSubject", "showPriority"], outputs: ["openTask"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1771
+ }
1772
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskBoardWidgetViewComponent, decorators: [{
1773
+ type: Component,
1774
+ args: [{ imports: [CommonModule, RouterLink, AXTranslationModule, AXPStateMessageComponent, AXPWorkBoardRowComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (!sessionReady()) {\n <div class=\"task-widget__loading\" role=\"status\">{{ '@task-management:task-board.widget.loading' | translate | async }}</div>\n} @else if (!canReadTasks()) {\n <axp-state-message look=\"widget\" icon=\"fa-light fa-lock\" [title]=\"'@general:messages.network.forbidden.title'\" />\n} @else {\n<div class=\"task-widget\">\n <div class=\"task-widget__scroll\" [attr.aria-busy]=\"loading()\">\n @if (loading() && !summary()) {\n <div class=\"task-widget__loading\" role=\"status\">{{ '@task-management:task-board.widget.loading' | translate | async }}</div>\n } @else {\n <div role=\"list\">\n @for (task of taskItems(); track task.id) {\n <axm-task-board-row role=\"listitem\" [task]=\"task\" layout=\"widget\" [grouped]=\"false\" (openTask)=\"onTaskClick(task, $event)\" />\n } @empty {\n @if (!error() && !pageError()) { <axp-state-message look=\"widget\" icon=\"fa-light fa-clipboard-list-check\" [title]=\"'@dashboard:task-board.no-tasks-found.title'\" /> }\n }\n </div>\n @for (group of groups(); track group.key) {\n @if (group.error && connectivity.isOnline()) { <div role=\"alert\"><button type=\"button\" (click)=\"loadGroup(group.key, true)\">{{ '@task-management:task-board.retry' | translate | async }}</button></div> }\n }\n @if (hasMore()) {\n <button type=\"button\" class=\"task-widget__more\" (click)=\"loadMore()\">{{ '@task-management:task-board.feed.more' | translate | async }}</button>\n }\n\n }\n @if ((pageError() || error()) && !connectivity.isOnline()) {\n <div class=\"task-widget__message\" role=\"status\">{{ '@general:work-board.offline-page' | translate | async }}</div>\n } @else if (error()) {\n <div class=\"task-widget__message\" role=\"alert\"><span>{{ '@task-management:task-board.load-error' | translate | async }}</span><button type=\"button\" (click)=\"reloadTasks()\">{{ '@task-management:task-board.retry' | translate | async }}</button></div>\n }\n </div>\n <footer class=\"task-widget__footer\">\n <a [routerLink]=\"boardLink()\" [queryParams]=\"boardQuery()\"><span>{{ '@task-management:task-board.widget.view-all' | translate | async }}</span><i class=\"fa-light fa-arrow-right\" aria-hidden=\"true\"></i></a>\n </footer>\n</div>\n}\n", styles: [":host{display:block;width:100%;height:100%;min-width:0;min-height:0;container-type:inline-size}.task-widget{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;color:rgba(var(--ax-sys-color-on-lightest-surface))}.task-widget__scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.task-widget__group-title{margin:0;position:sticky;top:0;z-index:1;font-size:.875rem;font-weight:500}.task-widget__group-toggle{display:flex;width:100%;align-items:center;gap:10px;padding:8px 12px;min-height:38px;border:0;border-inline-start:3px solid var(--task-status-accent);border-radius:0;background:var(--task-status-bg);color:var(--task-status-text);font:inherit;cursor:pointer;text-align:start}.task-widget__group-toggle>i{font-size:.8125rem}.task-widget__count{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;border:1px solid var(--task-status-accent);border-radius:5px;padding-inline:5px;font-size:.75rem;font-variant-numeric:tabular-nums}@supports (color: color-mix(in lab,red,red)){.task-widget__count{border:1px solid color-mix(in srgb,var(--task-status-accent) 35%,transparent)}}.task-widget__footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;gap:8px 12px;padding:6px clamp(8px,4cqi,14px);border-top:1px solid rgba(var(--ax-sys-color-border-lightest-surface));font-size:.75rem}.task-widget__footer>span{color:rgba(var(--ax-sys-color-on-lightest-surface),.65)}.task-widget__footer a,.task-widget__more,.task-widget__message button{color:light-dark(rgba(var(--ax-sys-color-primary-700)),rgba(var(--ax-sys-color-primary-300)))}.task-widget__footer a{display:inline-flex;align-items:center;gap:8px;min-width:0;min-height:28px;overflow-wrap:anywhere;text-decoration:none}.task-widget__footer a i{flex-shrink:0}.task-widget__footer a:hover{text-decoration:underline}.task-widget__more,.task-widget__message button{border:0;background:transparent;cursor:pointer;font:inherit;padding:8px 12px}.task-widget__more{display:block;margin-inline-start:clamp(0px,7cqi,28px);font-size:.75rem}.task-widget__message,.task-widget__loading{padding:12px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:.8125rem}.task-widget button:focus-visible,.task-widget a:focus-visible{outline:2px solid rgba(var(--ax-sys-color-primary-surface));outline-offset:-2px}:host-context([dir=\"rtl\"]) .task-widget__footer i,:host-context([dir=\"rtl\"]) .task-widget__group-toggle .fa-chevron-right{transform:scaleX(-1)}@media(any-pointer:coarse){.task-widget__group-toggle,.task-widget__footer a,.task-widget__more,.task-widget__message button{min-height:44px}}\n/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */\n"] }]
1775
+ }], ctorParameters: () => [], propDecorators: { taskClick: [{ type: i0.Output, args: ["taskClick"] }], rows: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => AXPWorkBoardRowComponent), { isSignal: true }] }] } });
1776
+
1777
+ var taskBoardWidget_component = /*#__PURE__*/Object.freeze({
1778
+ __proto__: null,
1779
+ AXPTaskBoardWidgetViewComponent: AXPTaskBoardWidgetViewComponent
1780
+ });
1781
+
1782
+ //#region ----- Imports -----
1783
+ //#endregion
1784
+ //#region ----- Constants -----
1785
+ const TASK_BOARD_WIDGET_TITLE = '@dashboard:widgets.task-board-widget.widget-title';
1786
+ //#endregion
1787
+ //#region ----- Widget Definition -----
1788
+ const AXPTaskBoardWidget = {
1789
+ name: RootConfig.widgets.taskBoard,
1790
+ title: TASK_BOARD_WIDGET_TITLE,
1791
+ description: '@dashboard:widgets.task-board-widget.widget-description',
1792
+ categories: [AXP_TASK_MANAGEMENT_DASHBOARD_WIDGET_CATEGORY],
1793
+ subCategory: AXP_TASK_MANAGEMENT_DASHBOARD_SUB_BOARD,
1794
+ groups: [AXPWidgetGroupEnum.DashboardWidget],
1795
+ type: 'dashboard',
1796
+ icon: 'fa-light fa-clipboard-list-check',
1797
+ options: { title: TASK_BOARD_WIDGET_TITLE, hasConfiguration: false },
1798
+ components: {
1799
+ view: {
1800
+ component: () => Promise.resolve().then(function () { return taskBoardWidget_component; }).then((c) => c.AXPTaskBoardWidgetViewComponent),
1801
+ },
1802
+ },
1803
+ meta: {
1804
+ dimensions: AXP_TASK_BOARD_DIMENSIONS,
1805
+ freeResize: true,
1806
+ },
1807
+ toString: `value == null || value === '' ? '' : display(value)`,
1808
+ };
1809
+ //#endregion
1810
+
1811
+ //#endregion
1812
+ //#region ---- Task Management Widgets Provider ----
1813
+ const TASK_WIDGETS = [AXPTaskBoardWidget, AXPTaskBoardShortcut];
1814
+ class AXMTaskManagementWidgetsProvider {
1815
+ getWidgets() {
1816
+ return TASK_WIDGETS;
1817
+ }
1818
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementWidgetsProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1819
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementWidgetsProvider }); }
1820
+ }
1821
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementWidgetsProvider, decorators: [{
1822
+ type: Injectable
1823
+ }] });
1824
+
1825
+ //#endregion
1826
+ //#region ---- Permission Definition Provider ----
1827
+ /**
1828
+ * Registers task capabilities into the shared Projects & Work group.
1829
+ */
1830
+ class AXMPermissionDefinitionProvider {
1831
+ async define(context) {
1832
+ const keys = AXPProjectsWorkPermissionKeys;
1833
+ const groups = AXPCommonPermissionGroupKeys;
1834
+ const P = '@common:projects-work.permissions';
1835
+ const G = '@common:permission-groups';
1836
+ context.addGroup(groups.ProjectsWork.Root, `${G}.projects-work.title`, `${G}.projects-work.description`, { order: 60 });
1837
+ context
1838
+ .addGroup(groups.ProjectsWork.Tasks, `${G}.projects-work-tasks.title`, `${G}.projects-work-tasks.description`, { parent: groups.ProjectsWork.Root, order: 20 })
1839
+ .addPermission(keys.MaintainTasks, `${P}.maintain-tasks.title`, `${P}.maintain-tasks.description`)
1840
+ .endPermission()
1841
+ .addPermission(keys.ViewAllTasks, `${P}.view-all-tasks.title`, `${P}.view-all-tasks.description`)
1842
+ .endPermission()
1843
+ .endGroup();
1844
+ }
1845
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPermissionDefinitionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1846
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPermissionDefinitionProvider }); }
1847
+ }
1848
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPermissionDefinitionProvider, decorators: [{
1849
+ type: Injectable
1850
+ }] });
1851
+
1852
+ //#region ----- Imports -----
1853
+ //#endregion
1854
+ //#region ----- Constants -----
1855
+ /** Persisted task rows shown on the task board. */
1856
+ const TASK_BOARD_TASK_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.task.name}`;
1857
+ /** Assignment rows that change who a task is assigned to. */
1858
+ const TASK_BOARD_TASK_ASSIGNMENT_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.taskAssignment.name}`;
1859
+ const TASK_BOARD_TASK_TYPE_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.taskType.name}`;
1860
+ /**
1861
+ * Workflow human-task cards come from suspended instance bookmarks, not Task rows.
1862
+ * Keep this string in sync with `WorkflowManagement.WorkflowInstance` (do not import workflow-management — it already depends on this package).
1863
+ */
1864
+ const TASK_BOARD_WORKFLOW_INSTANCE_ENTITY = 'WorkflowManagement.WorkflowInstance';
1865
+ const TASK_BOARD_REALTIME_ENTITIES = new Set([
1866
+ TASK_BOARD_TASK_ENTITY,
1867
+ TASK_BOARD_TASK_ASSIGNMENT_ENTITY,
1868
+ TASK_BOARD_TASK_TYPE_ENTITY,
1869
+ TASK_BOARD_WORKFLOW_INSTANCE_ENTITY,
1870
+ ]);
1871
+ //#endregion
1872
+ //#region ----- Helpers -----
1873
+ /** True when a layout-refresh / entity-mutation name should refresh the task board or its menu badge. */
1874
+ function isTaskBoardRealtimeEntity(name) {
1875
+ return name != null && TASK_BOARD_REALTIME_ENTITIES.has(name);
1876
+ }
1877
+ //#endregion
1878
+
1879
+ //#region ----- Imports -----
1880
+ //#endregion
1881
+ //#region ----- Constants -----
1882
+ /** Menu `badgeKey` for Task Board. */
1883
+ const AXM_TASK_BOARD_BADGE_KEY = 'task-management-task-board-badge';
1884
+ const TASK_MANAGEMENT_COMMAND_PREFIX = `${RootConfig.module.name}.`;
1885
+ const WORKFLOW_MANAGEMENT_COMMAND_PREFIX = 'WorkflowManagement.';
1886
+ //#endregion
1887
+ //#region ----- Task badge provider -----
1888
+ /**
1889
+ * Shows the current user's assigned task count on the Task Board menu item.
1890
+ *
1891
+ * On user switch, clear the badge and read the new user's scoped summary.
1892
+ * In-flight counts from a previous user are ignored.
1893
+ *
1894
+ * Refreshes after:
1895
+ * - task-management / workflow-management commands
1896
+ * - entity CRUD for Task (`Entity:Insert:Default` etc.)
1897
+ * - the Work Board's coalesced refresh after shared cache invalidation
1898
+ */
1899
+ class AXMTaskBoardBadgeProvider extends AXPTaskBadgeProvider {
1900
+ //#endregion
1901
+ constructor() {
1902
+ super();
1903
+ //#region ----- Services & Dependencies -----
1904
+ this.taskBoardService = inject(AXPWorkBoardService);
1905
+ this.sessionService = inject(AXPSessionService);
1906
+ this.commandEvents = inject(AXPCommandEventsService);
1907
+ this.destroyRef = inject(DestroyRef);
1908
+ //#endregion
1909
+ //#region ----- Signals & Properties -----
1910
+ this.key = AXM_TASK_BOARD_BADGE_KEY;
1911
+ this.count = signal(0, /* @ts-ignore */
1912
+ ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
1913
+ /** Bumped on every refresh so stale async results cannot overwrite a newer user/session. */
1914
+ this.refreshGeneration = 0;
1915
+ this.countReady = false;
1916
+ /** Collapses task, instance, and layout events from one workflow step into a single count. */
1917
+ this.queuedRefresh = new Subject();
1918
+ this.queuedRefresh.pipe(debounceTime(300), takeUntilDestroyed(this.destroyRef)).subscribe(() => {
1919
+ void this.refresh();
1920
+ });
1921
+ // User switch / login: update immediately (no debounce).
1922
+ this.sessionService.user$
1923
+ .pipe(distinctUntilChanged((prev, next) => prev?.id === next?.id), takeUntilDestroyed(this.destroyRef))
1924
+ .subscribe((user) => {
1925
+ // Clear stale badge from previous user right away.
1926
+ this.count.set(0);
1927
+ this.countReady = false;
1928
+ this.refreshGeneration++;
1929
+ if (user?.id != null && this.sessionService.isReadyForAppScopedApi) {
1930
+ void this.refresh();
1931
+ }
1932
+ });
1933
+ // Identity alone is not an app-scoped session. Wait for tenant, application
1934
+ // and authorization before reading the badge, including a second login.
1935
+ this.sessionService.isReadyForAppScopedApi$
1936
+ .pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
1937
+ .subscribe((ready) => {
1938
+ this.refreshGeneration++;
1939
+ if (ready) {
1940
+ void this.refresh();
1941
+ }
1942
+ else {
1943
+ this.count.set(0);
1944
+ }
1945
+ });
1946
+ const unsubscribeCommands = this.commandEvents.listen((event) => {
1947
+ if (this.isRelevantCommandEvent(event)) {
1948
+ this.handleCommandEvent(event);
1949
+ }
1950
+ });
1951
+ this.taskBoardService.refresh$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
1952
+ this.queuedRefresh.next();
1953
+ });
1954
+ this.taskBoardService.itemChanges$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(change => this.reconcileItem(change));
1955
+ this.destroyRef.onDestroy(() => {
1956
+ unsubscribeCommands();
1957
+ });
1958
+ }
1959
+ reconcileItem(change) {
1960
+ if (!this.sessionService.isReadyForAppScopedApi)
1961
+ return;
1962
+ if (change.scope && !this.taskBoardService.isCurrentItemChange(change))
1963
+ return;
1964
+ this.refreshGeneration++;
1965
+ if (!this.countReady || !change.previous) {
1966
+ this.queuedRefresh.next();
1967
+ return;
1968
+ }
1969
+ const mine = (item) => !!item && item.assignee?.id === this.sessionService.user?.id && ['todo', 'in_progress'].includes(String(item.status.id));
1970
+ this.count.update(count => Math.max(0, count + Number(mine(change.item)) - Number(mine(change.previous))));
1971
+ }
1972
+ //#region ----- Badge actions -----
1973
+ async refresh() {
1974
+ const generation = ++this.refreshGeneration;
1975
+ this.countReady = false;
1976
+ const currentUserId = this.sessionService.user?.id;
1977
+ if (currentUserId == null || !this.sessionService.isReadyForAppScopedApi) {
1978
+ if (generation === this.refreshGeneration) {
1979
+ this.count.set(0);
1980
+ }
1981
+ return;
1982
+ }
1983
+ try {
1984
+ const result = await this.taskBoardService.getSummary({
1985
+ assigneeIds: [currentUserId],
1986
+ });
1987
+ if (generation !== this.refreshGeneration) {
1988
+ return;
1989
+ }
1990
+ if (!this.sessionService.isReadyForAppScopedApi || this.sessionService.user?.id !== currentUserId) {
1991
+ return;
1992
+ }
1993
+ this.count.set(result.open);
1994
+ this.countReady = true;
1995
+ }
1996
+ catch {
1997
+ if (generation === this.refreshGeneration) {
1998
+ this.count.set(0);
1999
+ }
2000
+ }
2001
+ }
2002
+ isRelevantCommandEvent(event) {
2003
+ if (event.key.startsWith(TASK_MANAGEMENT_COMMAND_PREFIX) ||
2004
+ event.key.startsWith('TaskManagement:Task:') ||
2005
+ event.key.startsWith(WORKFLOW_MANAGEMENT_COMMAND_PREFIX)) {
2006
+ return true;
2007
+ }
2008
+ const input = event.input;
2009
+ const entity = get(input, 'entity');
2010
+ if (entity === TASK_BOARD_TASK_ENTITY) {
2011
+ return true;
2012
+ }
2013
+ const entityInfo = get(input, 'entityInfo');
2014
+ return (get(entityInfo, 'source') === TASK_BOARD_TASK_ENTITY ||
2015
+ (get(entityInfo, 'module') === RootConfig.module.name &&
2016
+ get(entityInfo, 'name') === RootConfig.entities.task.name));
2017
+ }
2018
+ handleCommandEvent(event) {
2019
+ if (!event || event.stage !== 'after' || !event.success || event.result?.success === false) {
2020
+ return;
2021
+ }
2022
+ if (this.commandSkipsTaskRefresh(event)) {
2023
+ return;
2024
+ }
2025
+ const taskId = event.key?.startsWith('TaskManagement:') ? get(event.result, 'data.taskId') ?? get(event.input, 'taskId') : undefined;
2026
+ if (typeof taskId === 'string')
2027
+ this.taskBoardService.requestRefresh('task-management.tasks', true, [taskId]);
2028
+ else
2029
+ this.taskBoardService.requestRefresh(undefined, true);
2030
+ }
2031
+ /** Cancelled or unchanged commands must not reload the task board. */
2032
+ commandSkipsTaskRefresh(event) {
2033
+ const metadata = event.result?.metadata;
2034
+ if (metadata?.['refresh'] === false) {
2035
+ return true;
2036
+ }
2037
+ const outcome = metadata?.['outcome'];
2038
+ return typeof outcome === 'string' && outcome.toLowerCase() === 'cancelled';
2039
+ }
2040
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskBoardBadgeProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2041
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskBoardBadgeProvider, providedIn: 'root' }); }
2042
+ }
2043
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskBoardBadgeProvider, decorators: [{
2044
+ type: Injectable,
2045
+ args: [{ providedIn: 'root' }]
2046
+ }], ctorParameters: () => [] });
2047
+
2048
+ class AXMTaskManagementMenuProvider {
2049
+ constructor() {
2050
+ this.entityService = inject(AXPEntityService);
2051
+ this.sessionService = inject(AXPSessionService);
2052
+ this.settingsService = inject(AXPSettingsService);
2053
+ }
2054
+ async provide(context) {
2055
+ const module = RootConfig.module;
2056
+ const keys = AXPProjectsWorkPermissionKeys;
2057
+ const applicationName = this.sessionService.application?.name ?? '';
2058
+ const taskBoardPaths = await this.resolveTaskBoardMenuPaths(applicationName, module.name);
2059
+ context.addItems([
2060
+ {
2061
+ name: AXPTaskManagementMenuKeys.TaskBoard,
2062
+ priority: 0,
2063
+ text: '@task-management:task-board.page-title',
2064
+ type: 'menu',
2065
+ icon: 'fa-light fa-list-check',
2066
+ path: taskBoardPaths.mine,
2067
+ badgeKey: AXM_TASK_BOARD_BADGE_KEY,
2068
+ policy: {
2069
+ features: [module.name],
2070
+ permissions: [keys.Access],
2071
+ },
2072
+ },
2073
+ {
2074
+ name: AXPTaskManagementMenuKeys.Tasks,
2075
+ priority: 1,
2076
+ text: '@task-management:task-board.all-page-title',
2077
+ type: 'menu',
2078
+ icon: 'fa-light fa-clipboard-list',
2079
+ path: taskBoardPaths.all,
2080
+ policy: {
2081
+ features: [module.name],
2082
+ permissions: [keys.Access, keys.ViewAllTasks],
2083
+ },
2084
+ },
2085
+ // {
2086
+ // name: AXPTaskManagementMenuKeys.Cartable,
2087
+ // text: '@task-management:cartable.menu-title',
2088
+ // type: 'menu',
2089
+ // icon: 'fa-light fa-inbox',
2090
+ // path: `${this.sessionService.application?.name}/${RootConfig.module.name}/cartable`,
2091
+ // policy: {
2092
+ // features: [module.name],
2093
+ // },
2094
+ // },
2095
+ // {
2096
+ // name: AXPTaskManagementMenuKeys.Root,
2097
+ // priority: 9003,
2098
+ // text: '@task-management:root-menu',
2099
+ // icon: module.icon,
2100
+ // children: [
2101
+ // {
2102
+ // name: AXPTaskManagementMenuKeys.Tasks,
2103
+ // text: '@task-management:task.plural-title',
2104
+ // path: this.entityService.createPath(module.name, RootConfig.entities.task.name),
2105
+ // icon: RootConfig.entities.task.icon,
2106
+ // priority: 1,
2107
+ // },
2108
+ // {
2109
+ // name: AXPTaskManagementMenuKeys.TaskTemplates,
2110
+ // text: '@task-management:task-template.plural-title',
2111
+ // path: this.entityService.createPath(module.name, RootConfig.entities.taskTemplate.name),
2112
+ // icon: RootConfig.entities.taskTemplate.icon,
2113
+ // priority: 2,
2114
+ // },
2115
+ // {
2116
+ // text: ``,
2117
+ // type: 'break',
2118
+ // priority: 5,
2119
+ // },
2120
+ // {
2121
+ // name: AXPTaskManagementMenuKeys.TaskTypes,
2122
+ // text: '@task-management:task-type.plural-title',
2123
+ // path: this.entityService.createPath(module.name, RootConfig.entities.taskType.name),
2124
+ // icon: RootConfig.entities.taskType.icon,
2125
+ // priority: 6,
2126
+ // },
2127
+ // ],
2128
+ // },
2129
+ ]);
2130
+ context.find(AXPCommonMenuKeys.Projects).addItems([
2131
+ {
2132
+ name: `${AXPTaskManagementMenuKeys.TaskTypes}:divider`,
2133
+ text: '',
2134
+ type: 'break',
2135
+ priority: 5,
2136
+ },
2137
+ {
2138
+ name: AXPTaskManagementMenuKeys.TaskTypes,
2139
+ text: RootConfig.entities.taskType.titlePlural,
2140
+ icon: RootConfig.entities.taskType.icon,
2141
+ priority: 10,
2142
+ path: this.entityService.createPath(module.name, RootConfig.entities.taskType.name),
2143
+ policy: {
2144
+ features: [module.name],
2145
+ permissions: [keys.Setup],
2146
+ },
2147
+ },
2148
+ ]);
2149
+ }
2150
+ async resolveTaskBoardMenuPaths(applicationName, moduleName) {
2151
+ const userSettings = this.settingsService.scope(AXPPlatformScope.User);
2152
+ const [viewMode, calendarLayout, timelineLayout, tableLayout, period] = await Promise.all([
2153
+ userSettings.get(AXPWorkBoardSettings.ViewMode),
2154
+ userSettings.get(AXPWorkBoardSettings.CalendarLayout),
2155
+ userSettings.get(AXPWorkBoardSettings.TimelineLayout),
2156
+ userSettings.get(AXPWorkBoardSettings.TableLayout),
2157
+ userSettings.get(AXPWorkBoardSettings.Period),
2158
+ ]);
2159
+ const layouts = {
2160
+ calendar: calendarLayout,
2161
+ timeline: timelineLayout,
2162
+ table: tableLayout,
2163
+ period,
2164
+ };
2165
+ return {
2166
+ mine: buildTaskBoardMenuPath(applicationName, moduleName, viewMode, layouts),
2167
+ all: buildTaskBoardMenuPath(applicationName, moduleName, viewMode, { ...layouts, routePath: 'tasks' }),
2168
+ };
2169
+ }
2170
+ }
2171
+
2172
+ //#region ---- Imports ----
2173
+ //#endregion
2174
+ //#region ---- Settings Provider ----
2175
+ const TENANT_I18N = '@task-management:settings.tasks';
2176
+ const timeMode = `{{ (context.eval('${AXPWorkBoardTenantSettings.ColorBy}')?.name ?? context.eval('${AXPWorkBoardTenantSettings.ColorBy}') ?? 'time') === 'time' }}`;
2177
+ const otherColorMode = timeMode.replace("=== 'time'", "!== 'time'");
2178
+ const I18N = `@${RootConfig.config.i18n}:settings`;
2179
+ class AXMSettingProvider {
2180
+ async provide(context) {
2181
+ context
2182
+ .addGroup('task-management', `${I18N}.task-management.group.nav-title`, `${I18N}.task-management.group.description`, RootConfig.module.icon, `${I18N}.task-management.group.title`, 90)
2183
+ .addSection('colors', `${TENANT_I18N}.colors.title`, `${TENANT_I18N}.colors.description`)
2184
+ .addSetting({
2185
+ key: AXPWorkBoardTenantSettings.ColorBy,
2186
+ title: `${TENANT_I18N}.color-mode.title`, description: `${TENANT_I18N}.color-mode.description`,
2187
+ scope: 'T', overridableAt: [], isInherited: false, defaultValue: 'time',
2188
+ valueTransforms: objectKeyValueTransforms('name'),
2189
+ widget: { type: AXPWidgetsList.Editors.SelectBox, options: {
2190
+ valueField: 'name', textField: 'title', allowClear: false,
2191
+ dataSource: ['time', 'priority', 'status'].map(name => ({ name, title: `@general:work-board.color-by.${name}` })),
2192
+ } },
2193
+ })
2194
+ .endSection()
2195
+ .addSection('time-colors', `${TENANT_I18N}.time.title`, `${TENANT_I18N}.time.description`)
2196
+ .addSetting({
2197
+ key: AXPWorkBoardTenantSettings.TimeBasis,
2198
+ title: `${TENANT_I18N}.time-basis.title`, description: `${TENANT_I18N}.time-basis.description`,
2199
+ scope: 'T', overridableAt: [], isInherited: false, defaultValue: 'timePolicy',
2200
+ valueTransforms: objectKeyValueTransforms('name'),
2201
+ widget: { type: AXPWidgetsList.Editors.SelectBox, options: {
2202
+ valueField: 'name', textField: 'title', allowClear: false, disabled: otherColorMode,
2203
+ dataSource: ['timePolicy', 'startDate', 'endDate', 'dueDate'].map(name => ({ name, title: `${TENANT_I18N}.time-basis.options.${name}` })),
2204
+ } },
2205
+ })
2206
+ .addSetting({
2207
+ key: AXPWorkBoardTenantSettings.WarningDays,
2208
+ title: `${TENANT_I18N}.warning-days.title`, description: `${TENANT_I18N}.warning-days.description`,
2209
+ scope: 'T', overridableAt: [], isInherited: false, defaultValue: 14,
2210
+ widget: { type: AXPWidgetsList.Editors.NumberBox, options: {
2211
+ minValue: 0, maxValue: 365, step: 1, decimals: 0, disabled: otherColorMode,
2212
+ } }, validationRules: [{ rule: 'required' }],
2213
+ })
2214
+ .endSection()
2215
+ .addSection('my-tasks', `${TENANT_I18N}.my-tasks.title`, `${TENANT_I18N}.my-tasks.description`)
2216
+ .addSetting({
2217
+ key: AXPWorkBoardTenantSettings.MyTasksFilterBar,
2218
+ title: `${TENANT_I18N}.filter-bar.title`, description: `${TENANT_I18N}.filter-bar.description`,
2219
+ scope: 'T', overridableAt: [], isInherited: false, defaultValue: true,
2220
+ widget: { type: AXPWidgetsList.Editors.ToggleSwitch, options: { label: '' } },
2221
+ })
2222
+ .addSetting({
2223
+ key: AXPWorkBoardTenantSettings.MyTasksSettingsButton,
2224
+ title: `${TENANT_I18N}.settings-button.title`, description: `${TENANT_I18N}.settings-button.description`,
2225
+ scope: 'T', overridableAt: [], isInherited: false, defaultValue: true,
2226
+ widget: { type: AXPWidgetsList.Editors.ToggleSwitch, options: { label: '' } },
2227
+ })
2228
+ .endSection()
2229
+ .addSection('taskboard', `${I18N}.task-management.taskboard.section.title`, `${I18N}.task-management.taskboard.section.description`)
2230
+ .addSetting({
2231
+ key: AXPWorkBoardSettings.VisibleCalendar,
2232
+ title: `${I18N}.task-management.taskboard.parts.calendar.title`,
2233
+ scope: 'U',
2234
+ overridableAt: [],
2235
+ isInherited: true,
2236
+ defaultValue: true,
2237
+ widget: { type: AXPWidgetsList.Editors.ToggleSwitch, options: { visibility: false } },
2238
+ description: `${I18N}.task-management.taskboard.parts.calendar.description`,
2239
+ })
2240
+ .addSetting({
2241
+ key: AXPWorkBoardSettings.VisibleTimeline,
2242
+ title: `${I18N}.task-management.taskboard.parts.timeline.title`,
2243
+ scope: 'U',
2244
+ overridableAt: [],
2245
+ isInherited: true,
2246
+ defaultValue: true,
2247
+ widget: { type: AXPWidgetsList.Editors.ToggleSwitch, options: { visibility: false } },
2248
+ description: `${I18N}.task-management.taskboard.parts.timeline.description`,
2249
+ })
2250
+ .addSetting({
2251
+ key: AXPWorkBoardSettings.VisibleTable,
2252
+ title: `${I18N}.task-management.taskboard.parts.table.title`,
2253
+ scope: 'U',
2254
+ overridableAt: [],
2255
+ isInherited: true,
2256
+ defaultValue: true,
2257
+ widget: { type: AXPWidgetsList.Editors.ToggleSwitch, options: { visibility: false } },
2258
+ description: `${I18N}.task-management.taskboard.parts.table.description`,
2259
+ })
2260
+ .addSetting({
2261
+ key: AXPWorkBoardSettings.VisibleKanban,
2262
+ title: `${I18N}.task-management.taskboard.parts.kanban.title`,
2263
+ scope: 'U',
2264
+ overridableAt: [],
2265
+ isInherited: true,
2266
+ defaultValue: true,
2267
+ widget: { type: AXPWidgetsList.Editors.ToggleSwitch, options: { visibility: false } },
2268
+ description: `${I18N}.task-management.taskboard.parts.kanban.description`,
2269
+ })
2270
+ .addSetting({
2271
+ key: AXPWorkBoardSettings.ColorBy,
2272
+ title: `${I18N}.task-management.taskboard.color-by.title`,
2273
+ scope: 'U',
2274
+ overridableAt: [],
2275
+ isInherited: true,
2276
+ defaultValue: undefined,
2277
+ widget: {
2278
+ type: AXPWidgetsList.Editors.SelectBox,
2279
+ options: {
2280
+ visibility: false,
2281
+ valueField: 'name',
2282
+ textField: 'title',
2283
+ dataSource: [
2284
+ { name: 'time', title: '@general:work-board.color-by.time' },
2285
+ { name: 'priority', title: `${I18N}.task-management.taskboard.color-by.priority` },
2286
+ { name: 'status', title: `${I18N}.task-management.taskboard.color-by.status` },
2287
+ ],
2288
+ },
2289
+ },
2290
+ description: `${I18N}.task-management.taskboard.color-by.description`,
2291
+ })
2292
+ .endSection()
2293
+ .endGroup();
2294
+ }
2295
+ }
2296
+ //#endregion
2297
+
2298
+ class AXMSearchCommandProvider extends AXPSearchCommandProvider {
2299
+ constructor() {
2300
+ super(...arguments);
2301
+ this.commands = [
2302
+ // {
2303
+ // group: 'command',
2304
+ // title: 'New Form Template',
2305
+ // icon: RootConfig.entities.template.icon,
2306
+ // description: 'Create a new form template for designing reusable forms.', // Added description
2307
+ // commands: {
2308
+ // 'create-entity': {
2309
+ // entity: `${RootConfig.module.name}.${RootConfig.entities.template.name}`,
2310
+ // },
2311
+ // },
2312
+ // }
2313
+ ];
2314
+ }
2315
+ }
2316
+
2317
+ //#endregion
2318
+ //#region ---- Constants ----
2319
+ const WORKFLOW_DEFINITION = 'WorkflowManagement.WorkflowDefinition';
2320
+ //#endregion
2321
+ //#region ---- Provider ----
2322
+ class AXMTaskManagementCatalogScopeDefinitionProvider {
2323
+ async items() {
2324
+ return [
2325
+ {
2326
+ name: TASK_MANAGEMENT_CATALOG_SCOPE_TASKS,
2327
+ title: '@task-management:catalog-scopes.tasks.title',
2328
+ description: '@task-management:catalog-scopes.tasks.description',
2329
+ targets: [WORKFLOW_DEFINITION],
2330
+ icon: 'fa-light fa-clipboard-check',
2331
+ cssClass: 'primary-lighter-surface',
2332
+ order: 20,
2333
+ },
2334
+ ];
2335
+ }
2336
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementCatalogScopeDefinitionProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2337
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementCatalogScopeDefinitionProvider }); }
2338
+ }
2339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementCatalogScopeDefinitionProvider, decorators: [{
2340
+ type: Injectable
2341
+ }] });
2342
+
2343
+ /** The standard Entity form/list uses Task commands, never unrestricted Entity:Insert/Update. */
2344
+ const taskEntityModifier = {
2345
+ entityName: 'Task', order: 100,
2346
+ modifier: async (ctx) => {
2347
+ if (ctx.module.get() !== 'TaskManagement')
2348
+ return;
2349
+ const ui = inject(TaskEntityUiService);
2350
+ const { AXPTaskManagementCommandKeys } = await import('@acorex-platform/module-task-management-client/contracts');
2351
+ ctx.commands.update(commands => ({ ...commands, create: { execute: (data) => ui.persist(data, false) }, update: { execute: (data) => ui.persist(data, true) } }));
2352
+ ctx.interfaces.master.list.update(list => ({ ...list, views: list?.views ?? [], actions: (list?.actions ?? []).map(action => {
2353
+ const key = typeof action.command === 'string' ? action.command : action.command?.name;
2354
+ return key === 'Entity:Edit' ? { ...action, command: AXPTaskManagementCommandKeys.Task.Edit, hidden: '{{ !(await TaskManagement.CanEdit(context.eval("id"), context.eval("version"))) }}' } : key === 'Entity:OpenDetails' ? { ...action, command: AXPTaskManagementCommandKeys.Task.View } : action;
2355
+ }) }));
2356
+ },
2357
+ };
2358
+
2359
+ /** Row expressions request action data through the shared lifecycle data boundary. */
2360
+ class TaskEntityActionsProvider {
2361
+ constructor() {
2362
+ this.lifecycle = inject(AXPTaskLifecycleUiService);
2363
+ this.session = inject(AXPSessionService);
2364
+ }
2365
+ async provide(context) {
2366
+ const scope = () => JSON.stringify([this.session.user?.id, this.session.tenant?.id, this.session.application?.id, this.session.authorizationRevision]);
2367
+ const read = (id, _version) => {
2368
+ if (!id)
2369
+ return Promise.resolve(null);
2370
+ const actorScope = scope();
2371
+ return this.lifecycle.actions(id).then(plan => scope() === actorScope ? plan : null).catch(() => null);
2372
+ };
2373
+ context.addScope('TaskManagement', {
2374
+ CanEdit: async (id, version) => !!(await read(id, version))?.canEdit,
2375
+ HasAction: async (id, version, action) => !!(await read(id, version))?.actions.some(a => a.action === action),
2376
+ ActionEnabled: async (id, version, action) => !!(await read(id, version))?.actions.find(a => a.action === action)?.enabled,
2377
+ });
2378
+ }
2379
+ }
2380
+
2381
+ class AXMTaskFeatureModule {
2382
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskFeatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2383
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskFeatureModule, imports: [CommonModule, AXPRuntimeModule] }); }
2384
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskFeatureModule, providers: [
2385
+ { provide: AXP_ENTITY_MODIFIER, useValue: taskEntityModifier, multi: true },
2386
+ { provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, useClass: TaskEntityActionsProvider, multi: true },
2387
+ provideCommandSetups([
2388
+ { key: AXPTaskManagementCommandKeys.TaskType.Create, command: () => import('./acorex-platform-module-task-management-client-create-task-type.command-4VzqIkIc.mjs').then(c => c.CreateTaskTypeCommand) },
2389
+ { key: PERSONAL_TASK_COMMANDS.Create, command: () => import('./acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs').then(c => c.CreatePersonalTaskCommand) },
2390
+ { key: PERSONAL_TASK_COMMANDS.Edit, command: () => import('./acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs').then(c => c.EditPersonalTaskCommand) },
2391
+ { key: PERSONAL_TASK_COMMANDS.Delete, command: () => import('./acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs').then(c => c.DeletePersonalTaskCommand) },
2392
+ {
2393
+ key: AXPTaskManagementCommandKeys.Task.CreateFromSubject,
2394
+ command: () => import('./acorex-platform-module-task-management-client-create-subject-task.command-o5rIB4lp.mjs').then((c) => c.CreateSubjectTaskCommand),
2395
+ },
2396
+ { key: AXPTaskManagementCommandKeys.Task.Edit, command: () => import('./acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs').then(c => c.EditTaskEntityCommand) },
2397
+ { key: AXPTaskManagementCommandKeys.Task.View, command: () => import('./acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs').then(c => c.ViewTaskEntityCommand) },
2398
+ { key: TASK_BOARD_LIFECYCLE_COMMAND, command: () => import('./acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs').then(c => c.TaskEntityLifecycleCommand) },
2399
+ { key: AXPTaskManagementCommandKeys.Task.OpenWorkspace, command: () => import('./acorex-platform-module-task-management-client-open-task-workspace.command-1BlMwoWF.mjs').then(c => c.OpenTaskWorkspaceCommand) },
2400
+ ]),
2401
+ ], imports: [CommonModule, AXPRuntimeModule] }); }
2402
+ }
2403
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskFeatureModule, decorators: [{
2404
+ type: NgModule,
2405
+ args: [{
2406
+ imports: [CommonModule, AXPRuntimeModule],
2407
+ providers: [
2408
+ { provide: AXP_ENTITY_MODIFIER, useValue: taskEntityModifier, multi: true },
2409
+ { provide: AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, useClass: TaskEntityActionsProvider, multi: true },
2410
+ provideCommandSetups([
2411
+ { key: AXPTaskManagementCommandKeys.TaskType.Create, command: () => import('./acorex-platform-module-task-management-client-create-task-type.command-4VzqIkIc.mjs').then(c => c.CreateTaskTypeCommand) },
2412
+ { key: PERSONAL_TASK_COMMANDS.Create, command: () => import('./acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs').then(c => c.CreatePersonalTaskCommand) },
2413
+ { key: PERSONAL_TASK_COMMANDS.Edit, command: () => import('./acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs').then(c => c.EditPersonalTaskCommand) },
2414
+ { key: PERSONAL_TASK_COMMANDS.Delete, command: () => import('./acorex-platform-module-task-management-client-personal-task.command-BubXfozR.mjs').then(c => c.DeletePersonalTaskCommand) },
2415
+ {
2416
+ key: AXPTaskManagementCommandKeys.Task.CreateFromSubject,
2417
+ command: () => import('./acorex-platform-module-task-management-client-create-subject-task.command-o5rIB4lp.mjs').then((c) => c.CreateSubjectTaskCommand),
2418
+ },
2419
+ { key: AXPTaskManagementCommandKeys.Task.Edit, command: () => import('./acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs').then(c => c.EditTaskEntityCommand) },
2420
+ { key: AXPTaskManagementCommandKeys.Task.View, command: () => import('./acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs').then(c => c.ViewTaskEntityCommand) },
2421
+ { key: TASK_BOARD_LIFECYCLE_COMMAND, command: () => import('./acorex-platform-module-task-management-client-task-entity-record.command-BCL_Ctpw.mjs').then(c => c.TaskEntityLifecycleCommand) },
2422
+ { key: AXPTaskManagementCommandKeys.Task.OpenWorkspace, command: () => import('./acorex-platform-module-task-management-client-open-task-workspace.command-1BlMwoWF.mjs').then(c => c.OpenTaskWorkspaceCommand) },
2423
+ ]),
2424
+ ],
2425
+ }]
2426
+ }] });
2427
+
2428
+ class AXMTaskManagementModule {
2429
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2430
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementModule, imports: [CommonModule,
2431
+ AXPTaskBoardModule,
2432
+ AXMCalendarManagementModule,
2433
+ AXPWidgetCoreModule,
2434
+ AXMTaskFeatureModule] }); }
2435
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementModule, providers: [
2436
+ {
2437
+ provide: AXP_PERMISSION_DEFINITION_PROVIDER,
2438
+ useClass: AXMPermissionDefinitionProvider,
2439
+ multi: true,
2440
+ },
2441
+ {
2442
+ provide: AXP_MENU_PROVIDER,
2443
+ useClass: AXMTaskManagementMenuProvider,
2444
+ multi: true,
2445
+ },
2446
+ {
2447
+ // useExisting keeps a single root instance (avoids a second copy that never refreshes).
2448
+ provide: AXP_TASK_BADGE_PROVIDERS,
2449
+ useExisting: AXMTaskBoardBadgeProvider,
2450
+ multi: true,
2451
+ },
2452
+ {
2453
+ provide: AXP_SETTING_DEFINITION_PROVIDER,
2454
+ useClass: AXMSettingProvider,
2455
+ multi: true,
2456
+ },
2457
+ {
2458
+ provide: AXP_SEARCH_PROVIDER,
2459
+ useClass: AXMSearchCommandProvider,
2460
+ multi: true,
2461
+ },
2462
+ {
2463
+ provide: AXP_WIDGET_DEFINITION_PROVIDER,
2464
+ useClass: AXMTaskManagementWidgetsProvider,
2465
+ multi: true,
2466
+ },
2467
+ {
2468
+ provide: AXP_CATALOG_SCOPE_DEFINITION_PROVIDER,
2469
+ useClass: AXMTaskManagementCatalogScopeDefinitionProvider,
2470
+ multi: true,
2471
+ },
2472
+ ], imports: [CommonModule,
2473
+ AXPTaskBoardModule,
2474
+ AXMCalendarManagementModule,
2475
+ AXPWidgetCoreModule,
2476
+ AXMTaskFeatureModule] }); }
2477
+ }
2478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskManagementModule, decorators: [{
2479
+ type: NgModule,
2480
+ args: [{
2481
+ imports: [
2482
+ CommonModule,
2483
+ AXPTaskBoardModule,
2484
+ AXMCalendarManagementModule,
2485
+ AXPWidgetCoreModule,
2486
+ AXMTaskFeatureModule,
2487
+ ],
2488
+ providers: [
2489
+ {
2490
+ provide: AXP_PERMISSION_DEFINITION_PROVIDER,
2491
+ useClass: AXMPermissionDefinitionProvider,
2492
+ multi: true,
2493
+ },
2494
+ {
2495
+ provide: AXP_MENU_PROVIDER,
2496
+ useClass: AXMTaskManagementMenuProvider,
2497
+ multi: true,
2498
+ },
2499
+ {
2500
+ // useExisting keeps a single root instance (avoids a second copy that never refreshes).
2501
+ provide: AXP_TASK_BADGE_PROVIDERS,
2502
+ useExisting: AXMTaskBoardBadgeProvider,
2503
+ multi: true,
2504
+ },
2505
+ {
2506
+ provide: AXP_SETTING_DEFINITION_PROVIDER,
2507
+ useClass: AXMSettingProvider,
2508
+ multi: true,
2509
+ },
2510
+ {
2511
+ provide: AXP_SEARCH_PROVIDER,
2512
+ useClass: AXMSearchCommandProvider,
2513
+ multi: true,
2514
+ },
2515
+ {
2516
+ provide: AXP_WIDGET_DEFINITION_PROVIDER,
2517
+ useClass: AXMTaskManagementWidgetsProvider,
2518
+ multi: true,
2519
+ },
2520
+ {
2521
+ provide: AXP_CATALOG_SCOPE_DEFINITION_PROVIDER,
2522
+ useClass: AXMTaskManagementCatalogScopeDefinitionProvider,
2523
+ multi: true,
2524
+ },
2525
+ ],
2526
+ }]
2527
+ }] });
2528
+
2529
+ //#region ----- Imports -----
2530
+ //#endregion
2531
+ //#region ----- Builders -----
2532
+ function buildTaskBoardWidget(id, x, y, size = [6, 4], title = 'Tasks') {
2533
+ const { config, meta } = layoutFromDimensions(id, AXP_TASK_BOARD_DIMENSIONS, { x, y, lg: size });
2534
+ return {
2535
+ config: { ...config, title },
2536
+ node: {
2537
+ type: 'TaskManagement:Widget:Dashboard:TaskBoard',
2538
+ options: { title, maxItems: 10 },
2539
+ meta,
2540
+ name: `TaskManagement:Widget:Dashboard:TaskBoard-${id}`,
2541
+ path: `TaskManagement:Widget:Dashboard:TaskBoard-${id}`,
2542
+ },
2543
+ };
2544
+ }
2545
+ function buildTaskBoardShortcutWidget(id, x, y, size = [3, 2]) {
2546
+ const { config, meta } = layoutFromDimensions(id, AXP_TASK_BOARD_SHORTCUT_DIMENSIONS, { x, y, lg: size });
2547
+ return {
2548
+ config,
2549
+ node: {
2550
+ type: 'TaskManagement:Widget:Dashboard:TaskBoardShortcut',
2551
+ options: {
2552
+ dateRange: { title: 'This Month', name: 'this-month' },
2553
+ },
2554
+ meta,
2555
+ name: `TaskManagement:Widget:Dashboard:TaskBoardShortcut-${id}`,
2556
+ path: `TaskManagement:Widget:Dashboard:TaskBoardShortcut-${id}`,
2557
+ },
2558
+ };
2559
+ }
2560
+ //#endregion
2561
+
2562
+ //#region ---- Imports ----
2563
+ const RESET_TASK_BOARD_FILTERS_ASSIGN_TO_CURRENT_USER_COMMAND_KEY = AXPTaskManagementCommandKeys.TaskBoard.ResetFiltersAssignToCurrentUser;
2564
+ //#endregion
2565
+ /**
2566
+ * Clears task-board filters, scopes assignee to the signed-in user, and requests a board refresh.
2567
+ */
2568
+ class ResetTaskBoardFiltersAssignToCurrentUserCommand {
2569
+ constructor() {
2570
+ //#region ---- Services & Dependencies ----
2571
+ this.sessionService = inject(AXPSessionService);
2572
+ this.taskBoardService = inject(AXPWorkBoardService);
2573
+ this.vm = inject(AXPWorkBoardViewModel);
2574
+ }
2575
+ //#endregion
2576
+ //#region ---- Command Implementation ----
2577
+ async execute(_input) {
2578
+ const currentUserId = this.sessionService.user?.id;
2579
+ if (isNil(currentUserId)) {
2580
+ return { success: false, message: { text: 'Current user is not available.' } };
2581
+ }
2582
+ this.vm.setSelectedTaskTypeNames([], false);
2583
+ this.vm.setSelectedReporterIds([], false);
2584
+ this.vm.setSelectedPriorities([], false);
2585
+ this.vm.setSelectedDueStatusKeys([], false);
2586
+ this.vm.setSelectedAssigneeIds([currentUserId], false, true);
2587
+ this.ensureTaskTypeForGroupedViews();
2588
+ this.taskBoardService.requestRefresh();
2589
+ return { success: true, kind: 'object', data: undefined };
2590
+ }
2591
+ //#endregion
2592
+ //#region ---- Helpers ----
2593
+ ensureTaskTypeForGroupedViews() {
2594
+ const viewMode = this.vm.currentViewMode();
2595
+ if (viewMode !== 'kanban' && viewMode !== 'status-grouped-grid') {
2596
+ return;
2597
+ }
2598
+ if (this.vm.selectedTaskTypeNames().length > 0) {
2599
+ return;
2600
+ }
2601
+ const firstTaskType = this.vm.taskTypes()[0];
2602
+ if (firstTaskType) {
2603
+ this.vm.setSelectedTaskTypeNames([firstTaskType.name]);
2604
+ }
2605
+ }
2606
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ResetTaskBoardFiltersAssignToCurrentUserCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2607
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ResetTaskBoardFiltersAssignToCurrentUserCommand, providedIn: 'root' }); }
2608
+ }
2609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ResetTaskBoardFiltersAssignToCurrentUserCommand, decorators: [{
2610
+ type: Injectable,
2611
+ args: [{ providedIn: 'root' }]
2612
+ }] });
2613
+
2614
+ var resetFiltersAssignToCurrentUser_command = /*#__PURE__*/Object.freeze({
2615
+ __proto__: null,
2616
+ RESET_TASK_BOARD_FILTERS_ASSIGN_TO_CURRENT_USER_COMMAND_KEY: RESET_TASK_BOARD_FILTERS_ASSIGN_TO_CURRENT_USER_COMMAND_KEY,
2617
+ ResetTaskBoardFiltersAssignToCurrentUserCommand: ResetTaskBoardFiltersAssignToCurrentUserCommand
2618
+ });
2619
+
2620
+ //#region ----- Imports -----
2621
+ const AXP_TASK_WORKSPACE_CONTENT = new InjectionToken('AXP_TASK_WORKSPACE_CONTENT');
2622
+ const AXP_TASK_WORKSPACE_STEPPED_TYPES = new InjectionToken('Task types with a stepped workspace on compact screens');
2623
+ //#endregion
2624
+
2625
+ //#region ----- Imports -----
2626
+ //#endregion
2627
+ //#region ----- Bridge -----
2628
+ /** Content hosts finish the task window through the popup that provided this bridge. */
2629
+ class AXPTaskWorkspaceBridge {
2630
+ constructor() {
2631
+ this.readiness = signal('loading', /* @ts-ignore */
2632
+ ...(ngDevMode ? [{ debugName: "readiness" }] : /* istanbul ignore next */ []));
2633
+ this.state = this.readiness.asReadonly();
2634
+ this.failure = signal(null, /* @ts-ignore */
2635
+ ...(ngDevMode ? [{ debugName: "failure" }] : /* istanbul ignore next */ []));
2636
+ this.errorKey = this.failure.asReadonly();
2637
+ this.finishHandler = null;
2638
+ }
2639
+ ready(data) {
2640
+ this.contentData = data;
2641
+ this.failure.set(null);
2642
+ this.reportError?.(null);
2643
+ this.readiness.set('ready');
2644
+ }
2645
+ fail(errorKey) {
2646
+ this.contentData = undefined;
2647
+ this.failure.set(errorKey);
2648
+ this.reportError?.(errorKey);
2649
+ this.readiness.set('failed');
2650
+ }
2651
+ data() {
2652
+ return this.contentData;
2653
+ }
2654
+ bind(handler, reportError) {
2655
+ this.finishHandler = handler;
2656
+ this.reportError = reportError;
2657
+ }
2658
+ finish(result) {
2659
+ if (result.cancelled || result.errorKey || this.state() === 'ready')
2660
+ this.finishHandler?.(result);
2661
+ }
2662
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskWorkspaceBridge, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2663
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskWorkspaceBridge }); }
2664
+ }
2665
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPTaskWorkspaceBridge, decorators: [{
2666
+ type: Injectable
2667
+ }] });
2668
+
2669
+ //#region ----- Imports -----
2670
+ //#endregion
2671
+ //#region ----- Constants -----
2672
+ const STATUS_KEYS = new Set(['todo', 'in_progress', 'done', 'cancelled']);
2673
+ const PRIORITY_KEYS = new Set(['low', 'normal', 'high', 'urgent']);
2674
+ //#endregion
2675
+ //#region ----- Summary -----
2676
+ function text(value) {
2677
+ return typeof value === 'string' ? value.trim() : '';
2678
+ }
2679
+ function personLabel(person) {
2680
+ if (!person || typeof person !== 'object') {
2681
+ return undefined;
2682
+ }
2683
+ const row = person;
2684
+ return text(row.fullName) || text(row.displayName) || text(row.username) || undefined;
2685
+ }
2686
+ function personId(person) {
2687
+ if (!person || typeof person !== 'object') {
2688
+ return undefined;
2689
+ }
2690
+ const id = text(person.id);
2691
+ return id || undefined;
2692
+ }
2693
+ function instant(value) {
2694
+ if (value instanceof Date && Number.isFinite(value.getTime())) {
2695
+ return value.toISOString();
2696
+ }
2697
+ const raw = text(value);
2698
+ return raw || undefined;
2699
+ }
2700
+ function readTaskWorkspaceSummary(row) {
2701
+ if (!row || typeof row !== 'object') {
2702
+ return null;
2703
+ }
2704
+ const task = row;
2705
+ const title = text(task['title']);
2706
+ const status = text(task['statusCategory']);
2707
+ const priority = text(task['priority']);
2708
+ const audit = task['auditInfo'] && typeof task['auditInfo'] === 'object'
2709
+ ? task['auditInfo']
2710
+ : undefined;
2711
+ if (!title && !status && !personLabel(task['assigneeRef'])) {
2712
+ return null;
2713
+ }
2714
+ return {
2715
+ title,
2716
+ code: text(task['code']) || undefined,
2717
+ taskTypeId: text(task['taskTypeId']) || undefined,
2718
+ status: STATUS_KEYS.has(status) ? status : undefined,
2719
+ statusKey: STATUS_KEYS.has(status) ? `@task-management:task-board.lifecycle.${status}` : undefined,
2720
+ priority: PRIORITY_KEYS.has(priority) ? priority : undefined,
2721
+ assignee: personLabel(task['assigneeRef']),
2722
+ assigneeId: personId(task['assigneeRef']),
2723
+ reporter: personLabel(task['reporterRef']),
2724
+ reporterId: personId(task['reporterRef']),
2725
+ createdAt: instant(audit?.created?.at),
2726
+ dueAt: instant(task['dueAt']),
2727
+ };
2728
+ }
2729
+ /** Overdue and due-soon follow the task board window for an open task. */
2730
+ function taskWorkspaceDueState(dueAt, status, now = Date.now(), warningDays = 14) {
2731
+ if (!dueAt || status === 'done' || status === 'cancelled') {
2732
+ return null;
2733
+ }
2734
+ const due = Date.parse(dueAt);
2735
+ if (!Number.isFinite(due)) {
2736
+ return null;
2737
+ }
2738
+ if (due <= now) {
2739
+ return 'overdue';
2740
+ }
2741
+ const warningEnd = new Date(now);
2742
+ warningEnd.setDate(warningEnd.getDate() + warningDays);
2743
+ return due <= warningEnd.getTime() ? 'due-soon' : null;
2744
+ }
2745
+ function readTaskWorkspaceResult(value) {
2746
+ if (!value || typeof value !== 'object') {
2747
+ return null;
2748
+ }
2749
+ const row = value;
2750
+ if (typeof row['cancelled'] !== 'boolean') {
2751
+ return null;
2752
+ }
2753
+ const errorKey = text(row['errorKey']);
2754
+ if (errorKey)
2755
+ return { cancelled: true, errorKey };
2756
+ if (row['cancelled'])
2757
+ return { cancelled: true };
2758
+ const values = row['values'] && typeof row['values'] === 'object' && !Array.isArray(row['values']) ? row['values'] : undefined;
2759
+ const content = row['content'] && typeof row['content'] === 'object' && !Array.isArray(row['content']) ? row['content'] : undefined;
2760
+ const action = text(row['action']);
2761
+ return {
2762
+ cancelled: false,
2763
+ ...(action ? { action } : {}),
2764
+ ...(values ? { values } : {}),
2765
+ ...(content ? { content } : {}),
2766
+ };
2767
+ }
2768
+ //#endregion
2769
+
2770
+ //#region ----- Imports -----
2771
+ //#endregion
2772
+ //#region ----- Workspace service -----
2773
+ class AXMTaskWorkspaceService {
2774
+ constructor() {
2775
+ //#region ----- Services & Dependencies -----
2776
+ this.queries = inject(AXPQueryService);
2777
+ this.translation = inject(AXTranslationService);
2778
+ this.popup = inject(AXPopupService);
2779
+ this.dialogOpener = inject(AXPDialogOpener);
2780
+ this.steppedTypes = inject(AXP_TASK_WORKSPACE_STEPPED_TYPES, { optional: true }) ?? [];
2781
+ }
2782
+ //#endregion
2783
+ //#region ----- Open -----
2784
+ async open(request) {
2785
+ const taskId = request.taskId?.trim();
2786
+ const summary = request.summary !== undefined ? request.summary : taskId ? await this.loadTask(taskId) : null;
2787
+ const title = await this.displayTitle(request.title || summary?.title || '');
2788
+ const stepped = !!summary?.taskTypeId && this.steppedTypes.includes(summary.taskTypeId)
2789
+ && !!request.content && !!request.layout && !!request.actions?.length;
2790
+ let errorKey = null;
2791
+ const popupData = {
2792
+ summary,
2793
+ messageKey: request.messageKey ?? null,
2794
+ reportError: (key) => { errorKey = key; },
2795
+ content: request.content ?? null,
2796
+ layout: request.layout ?? null,
2797
+ actions: request.actions ?? [],
2798
+ stepped,
2799
+ };
2800
+ const closed = await this.dialogOpener.openPopup({
2801
+ load: () => import('./acorex-platform-module-task-management-client-task-workspace.popup-Cz8Hrp3r.mjs').then((module) => module.AXMTaskWorkspacePopupComponent),
2802
+ data: { taskId, title, ...popupData },
2803
+ show: (component) => this.popup.open(component, {
2804
+ title: title || '@task-management:workspace.title',
2805
+ size: 'full',
2806
+ closeButton: true,
2807
+ footer: false,
2808
+ draggable: false,
2809
+ panelClass: ['axm-task-workspace-overlay'],
2810
+ data: popupData,
2811
+ }),
2812
+ });
2813
+ return errorKey ? { cancelled: true, errorKey } : readTaskWorkspaceResult(closed?.data) ?? { cancelled: true };
2814
+ }
2815
+ //#endregion
2816
+ //#region ----- Task -----
2817
+ async loadTask(taskId) {
2818
+ try {
2819
+ const response = await this.queries.fetch(AXP_TASK_RUNTIME_KEYS.Get, { taskId }, { dataExecution: { force: true, refreshOnInvalidate: false } });
2820
+ return readTaskWorkspaceSummary(runtimeQueryPayloadData(response));
2821
+ }
2822
+ catch {
2823
+ return null;
2824
+ }
2825
+ }
2826
+ async displayTitle(title) {
2827
+ const resolved = title.trim();
2828
+ if (!resolved) {
2829
+ return '';
2830
+ }
2831
+ return resolved.startsWith('@') ? this.translation.translateAsync(resolved) : resolved;
2832
+ }
2833
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskWorkspaceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2834
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskWorkspaceService, providedIn: 'root' }); }
2835
+ }
2836
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMTaskWorkspaceService, decorators: [{
2837
+ type: Injectable,
2838
+ args: [{ providedIn: 'root' }]
2839
+ }] });
2840
+
2841
+ /**
2842
+ * Generated bundle index. Do not edit.
2843
+ */
2844
+
2845
+ export { AXP_TASK_WORKSPACE_CONTENT as A, AXP_TASK_WORKSPACE_STEPPED_TYPES as B, ResetTaskBoardFiltersAssignToCurrentUserCommand as C, buildTaskBoardShortcutWidget as D, buildTaskBoardWidget as E, taskBoardApiInput as F, PERSONAL_TASK_COMMANDS as P, RESET_TASK_BOARD_FILTERS_ASSIGN_TO_CURRENT_USER_COMMAND_KEY as R, TaskAttachmentsUiService as T, AXPTaskWorkspaceBridge as a, taskInputInstant as b, taskPersonalCapability as c, taskActionErrorKey as d, taskRecordActionPlan as e, TASK_ATTACHMENT_WIDGET_OPTIONS as f, TaskEntityUiService as g, AXPTaskLifecycleUiService as h, AXMTaskWorkspaceService as i, taskCompletionResult as j, AXMSearchCommandProvider as k, AXMSettingProvider as l, AXMTaskManagementMenuProvider as m, AXMTaskManagementModule as n, AXPTaskBoardModule as o, AXPTaskBoardShortcut as p, AXPTaskBoardShortcutViewComponent as q, AXPTaskBoardWidget as r, AXPTaskBoardWidgetViewComponent as s, taskWorkspaceDueState as t, AXPTaskManagementEntityTaskProvider as u, AXP_TASK_BOARD_DIMENSIONS as v, AXP_TASK_BOARD_SHORTCUT_DIMENSIONS as w, AXP_TASK_MANAGEMENT_DASHBOARD_SUB_BOARD as x, AXP_TASK_MANAGEMENT_DASHBOARD_SUB_SHORTCUT as y, AXP_TASK_MANAGEMENT_DASHBOARD_WIDGET_CATEGORY as z };
2846
+ //# sourceMappingURL=acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-dfiarGtJ.mjs.map