@acorex-platform/module-document-management-client 0.0.61 → 0.0.62

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 (54) hide show
  1. package/fesm2022/{acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-DHVvb5hG.mjs → acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BiosmCuZ.mjs} +134 -50
  2. package/fesm2022/acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BiosmCuZ.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-document-management-client-attachment-view-skeleton.component-DD0Lceid.mjs → acorex-platform-module-document-management-client-attachment-view-skeleton.component-D-38wiyG.mjs} +2 -2
  4. package/fesm2022/{acorex-platform-module-document-management-client-attachment-view-skeleton.component-DD0Lceid.mjs.map → acorex-platform-module-document-management-client-attachment-view-skeleton.component-D-38wiyG.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-document-management-client-attachment-widget.component-YAoJdiMV.mjs → acorex-platform-module-document-management-client-attachment-widget.component-Bd48EHwE.mjs} +2 -2
  6. package/fesm2022/{acorex-platform-module-document-management-client-attachment-widget.component-YAoJdiMV.mjs.map → acorex-platform-module-document-management-client-attachment-widget.component-Bd48EHwE.mjs.map} +1 -1
  7. package/fesm2022/acorex-platform-module-document-management-client-contracts.mjs +172 -4
  8. package/fesm2022/acorex-platform-module-document-management-client-contracts.mjs.map +1 -1
  9. package/fesm2022/{acorex-platform-module-document-management-client-details-view.component-DVrr-Jcx.mjs → acorex-platform-module-document-management-client-details-view.component-DRCj5sJZ.mjs} +2 -2
  10. package/fesm2022/{acorex-platform-module-document-management-client-details-view.component-DVrr-Jcx.mjs.map → acorex-platform-module-document-management-client-details-view.component-DRCj5sJZ.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-document-management-client-distribute-document.command-dTEExoVn.mjs → acorex-platform-module-document-management-client-distribute-document.command-DgUgY_A1.mjs} +233 -83
  12. package/fesm2022/acorex-platform-module-document-management-client-distribute-document.command-DgUgY_A1.mjs.map +1 -0
  13. package/fesm2022/{acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs → acorex-platform-module-document-management-client-distribute-document.command.util-HCkpx2Hk.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs.map → acorex-platform-module-document-management-client-distribute-document.command.util-HCkpx2Hk.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-document-management-client-drive-choose.component-B-CVJk4t.mjs → acorex-platform-module-document-management-client-drive-choose.component-DxEWAigd.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-document-management-client-drive-choose.component-B-CVJk4t.mjs.map → acorex-platform-module-document-management-client-drive-choose.component-DxEWAigd.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view-skeleton.component-DLW69Mgy.mjs → acorex-platform-module-document-management-client-large-icons-view-skeleton.component-B8-WYaZN.mjs} +2 -2
  18. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view-skeleton.component-DLW69Mgy.mjs.map → acorex-platform-module-document-management-client-large-icons-view-skeleton.component-B8-WYaZN.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view.component-CSgo6Q03.mjs → acorex-platform-module-document-management-client-large-icons-view.component-dfZyrfST.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view.component-CSgo6Q03.mjs.map → acorex-platform-module-document-management-client-large-icons-view.component-dfZyrfST.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-document-management-client-large-tiles-view.component-CzlMERYd.mjs → acorex-platform-module-document-management-client-large-tiles-view.component-BxZdISS0.mjs} +2 -2
  22. package/fesm2022/{acorex-platform-module-document-management-client-large-tiles-view.component-CzlMERYd.mjs.map → acorex-platform-module-document-management-client-large-tiles-view.component-BxZdISS0.mjs.map} +1 -1
  23. package/fesm2022/{acorex-platform-module-document-management-client-list-view-skeleton.component-DgFCBi89.mjs → acorex-platform-module-document-management-client-list-view-skeleton.component-hOXMuPjS.mjs} +2 -2
  24. package/fesm2022/{acorex-platform-module-document-management-client-list-view-skeleton.component-DgFCBi89.mjs.map → acorex-platform-module-document-management-client-list-view-skeleton.component-hOXMuPjS.mjs.map} +1 -1
  25. package/fesm2022/{acorex-platform-module-document-management-client-list-view.component-bgDPFpLU.mjs → acorex-platform-module-document-management-client-list-view.component-iH0kvdWp.mjs} +2 -2
  26. package/fesm2022/{acorex-platform-module-document-management-client-list-view.component-bgDPFpLU.mjs.map → acorex-platform-module-document-management-client-list-view.component-iH0kvdWp.mjs.map} +1 -1
  27. package/fesm2022/{acorex-platform-module-document-management-client-open-document.command-CObrpooD.mjs → acorex-platform-module-document-management-client-open-document.command-IN2QSWDo.mjs} +45 -4
  28. package/fesm2022/acorex-platform-module-document-management-client-open-document.command-IN2QSWDo.mjs.map +1 -0
  29. package/fesm2022/{acorex-platform-module-document-management-client-request-document-review.command-DNq2mYIx.mjs → acorex-platform-module-document-management-client-request-document-review.command-CK5mJYR4.mjs} +3 -3
  30. package/fesm2022/{acorex-platform-module-document-management-client-request-document-review.command-DNq2mYIx.mjs.map → acorex-platform-module-document-management-client-request-document-review.command-CK5mJYR4.mjs.map} +1 -1
  31. package/fesm2022/{acorex-platform-module-document-management-client-sign-distributed-document.command-DpQ-Un7q.mjs → acorex-platform-module-document-management-client-sign-distributed-document.command-BqLS0leG.mjs} +2 -2
  32. package/fesm2022/{acorex-platform-module-document-management-client-sign-distributed-document.command-DpQ-Un7q.mjs.map → acorex-platform-module-document-management-client-sign-distributed-document.command-BqLS0leG.mjs.map} +1 -1
  33. package/fesm2022/{acorex-platform-module-document-management-client-sign-document-review.command-B08sgrRi.mjs → acorex-platform-module-document-management-client-sign-document-review.command-Ccl9iY7j.mjs} +2 -2
  34. package/fesm2022/{acorex-platform-module-document-management-client-sign-document-review.command-B08sgrRi.mjs.map → acorex-platform-module-document-management-client-sign-document-review.command-Ccl9iY7j.mjs.map} +1 -1
  35. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view-skeleton.component-CiYITmkk.mjs → acorex-platform-module-document-management-client-small-icons-view-skeleton.component-BABsshsn.mjs} +2 -2
  36. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view-skeleton.component-CiYITmkk.mjs.map → acorex-platform-module-document-management-client-small-icons-view-skeleton.component-BABsshsn.mjs.map} +1 -1
  37. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view.component-ILdKPBoz.mjs → acorex-platform-module-document-management-client-small-icons-view.component-BBo1iXfu.mjs} +2 -2
  38. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view.component-ILdKPBoz.mjs.map → acorex-platform-module-document-management-client-small-icons-view.component-BBo1iXfu.mjs.map} +1 -1
  39. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-DKOxhUoZ.mjs → acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-BsP4uJdA.mjs} +2 -2
  40. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-DKOxhUoZ.mjs.map → acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-BsP4uJdA.mjs.map} +1 -1
  41. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view.component-yv_uqUPM.mjs → acorex-platform-module-document-management-client-small-tiles-view.component-DrDYpNsF.mjs} +2 -2
  42. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view.component-yv_uqUPM.mjs.map → acorex-platform-module-document-management-client-small-tiles-view.component-DrDYpNsF.mjs.map} +1 -1
  43. package/fesm2022/{acorex-platform-module-document-management-client-upload-document.command-CrtRTjke.mjs → acorex-platform-module-document-management-client-upload-document.command-Dycu8sci.mjs} +2 -2
  44. package/fesm2022/{acorex-platform-module-document-management-client-upload-document.command-CrtRTjke.mjs.map → acorex-platform-module-document-management-client-upload-document.command-Dycu8sci.mjs.map} +1 -1
  45. package/fesm2022/acorex-platform-module-document-management-client.mjs +1 -1
  46. package/i18n/en-AU/document-management.json +9 -4
  47. package/i18n/en-US/document-management.json +9 -4
  48. package/i18n/fa-IR/document-management.json +9 -4
  49. package/package.json +2 -2
  50. package/types/acorex-platform-module-document-management-client-contracts.d.ts +23 -1
  51. package/types/acorex-platform-module-document-management-client.d.ts +2 -2
  52. package/fesm2022/acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-DHVvb5hG.mjs.map +0 -1
  53. package/fesm2022/acorex-platform-module-document-management-client-distribute-document.command-dTEExoVn.mjs.map +0 -1
  54. package/fesm2022/acorex-platform-module-document-management-client-open-document.command-CObrpooD.mjs.map +0 -1
@@ -6,11 +6,11 @@ import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acor
6
6
  import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
7
7
  import { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';
8
8
  import { buildAXPRecordWorkflowInfo } from '@acorex-platform/framework-shared/entity';
9
- import { RootConfig, AXPContentDocumentsPermissionKeys } from '@acorex-platform/module-document-management-client/contracts';
9
+ import { RootConfig, AXPContentDocumentsPermissionKeys, stampDocumentDistributionFormValues, AXM_DOCUMENT_DISTRIBUTION_VERSION_FIELD_NAME, isDocumentReviewRequired, isDocumentReviewMetadataComplete, highestDocumentVersionNumber, DOCUMENT_DISTRIBUTION_WORKFLOW_NAME } from '@acorex-platform/module-document-management-client/contracts';
10
10
  import * as i0 from '@angular/core';
11
11
  import { inject, Injectable } from '@angular/core';
12
- import { j as AXMDocumentManagerService } from './acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-DHVvb5hG.mjs';
13
- import { a as asTrimmedId, i as isTruthyFlag, b as asDisplayName, m as mapWithConcurrency, c as asUserIds, r as resolveCreatedEntityId } from './acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs';
12
+ import { j as AXMDocumentManagerService, m as AXPDocumentManagementService, s as sourcesAllowDocumentDistribution, n as collectDocumentTypeKeys } from './acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BiosmCuZ.mjs';
13
+ import { a as asTrimmedId, b as asDisplayName, c as asUserIds, r as resolveCreatedEntityId, m as mapWithConcurrency } from './acorex-platform-module-document-management-client-distribute-document.command.util-HCkpx2Hk.mjs';
14
14
 
15
15
  //#region ----- Imports -----
16
16
  //#endregion
@@ -21,20 +21,13 @@ const TASK_ENTITY_NAME = `${TASK_MODULE}.${TASK_ENTITY}`;
21
21
  const TASK_TYPE_ENTITY = 'TaskType';
22
22
  const TASK_STATUS_ENTITY = 'TaskStatus';
23
23
  const TASK_ASSIGNMENT_ENTITY = 'TaskAssignment';
24
- const DOCUMENT_DISTRIBUTION_WORKFLOW_NAME = 'document-distribution';
25
24
  const MOCK_DOCUMENT_DISTRIBUTION_TASK_TYPE_ID = 'pm-mock-task-type-document-distribution';
26
- const DOCUMENT_VERSION_ENTITY = `${RootConfig.module.name}.${RootConfig.entities.documentVersion.name}`;
25
+ const DOCUMENT_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.document.name}`;
26
+ const FOLDER_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.folder.name}`;
27
27
  const I18N = '@document-management:distribute';
28
28
  const ASSIGNEE_CREATE_CONCURRENCY = 3;
29
29
  //#endregion
30
30
  //#region ----- Helpers -----
31
- function resolveDocumentId(input = {}) {
32
- const data = input.data;
33
- const fromData = data && typeof data === 'object'
34
- ? asTrimmedId(data.documentId) ?? asTrimmedId(data.id)
35
- : undefined;
36
- return asTrimmedId(input.options?.documentId) ?? fromData ?? asTrimmedId(input.documentId);
37
- }
38
31
  function asItems(value) {
39
32
  if (Array.isArray(value)) {
40
33
  return value;
@@ -44,6 +37,12 @@ function asItems(value) {
44
37
  }
45
38
  return [];
46
39
  }
40
+ function asRecord(value) {
41
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
42
+ return null;
43
+ }
44
+ return value;
45
+ }
47
46
  function statusRef(row) {
48
47
  const id = asTrimmedId(row?.id);
49
48
  if (!id) {
@@ -51,6 +50,34 @@ function statusRef(row) {
51
50
  }
52
51
  return { id, title: row?.title, color: row?.color, icon: row?.icon };
53
52
  }
53
+ function resolveSubject(input = {}) {
54
+ const data = input.data;
55
+ const nodeType = data && typeof data === 'object' && 'type' in data ? data.type : undefined;
56
+ const fromDataId = data && typeof data === 'object' ? asTrimmedId(data.id) : undefined;
57
+ const documentId = asTrimmedId(input.options?.documentId) ??
58
+ asTrimmedId(input.documentId) ??
59
+ (data && typeof data === 'object' ? asTrimmedId(data.documentId) : undefined);
60
+ const folderId = asTrimmedId(input.options?.folderId) ??
61
+ asTrimmedId(input.folderId) ??
62
+ (data && typeof data === 'object' ? asTrimmedId(data.folderId) : undefined);
63
+ if (nodeType === 'folder' && fromDataId) {
64
+ return { kind: 'folder', id: fromDataId, title: asDisplayName(data.name) ?? fromDataId };
65
+ }
66
+ if (nodeType === 'file' && fromDataId) {
67
+ return { kind: 'file', id: fromDataId, title: asDisplayName(data.name) ?? fromDataId };
68
+ }
69
+ if (folderId) {
70
+ return { kind: 'folder', id: folderId, title: folderId };
71
+ }
72
+ if (documentId) {
73
+ return { kind: 'file', id: documentId, title: documentId };
74
+ }
75
+ return null;
76
+ }
77
+ function metaDataFormOf(record) {
78
+ const form = record['metaDataForm'];
79
+ return asRecord(form) ?? undefined;
80
+ }
54
81
  //#endregion
55
82
  //#region ----- Distribute document command -----
56
83
  class AXMDistributeDocumentCommand {
@@ -63,16 +90,23 @@ class AXMDistributeDocumentCommand {
63
90
  this.translationService = inject(AXTranslationService);
64
91
  this.workflowManager = inject(AXPWorkflowManager);
65
92
  this.driveService = inject(AXMDocumentManagerService);
93
+ this.documentApi = inject(AXPDocumentManagementService);
66
94
  this.loadingDialog = inject(AXLoadingDialogService);
67
95
  this.documentData = this.entityService
68
96
  .withEntity(RootConfig.module.name, RootConfig.entities.document.name)
69
97
  .data();
98
+ this.folderData = this.entityService
99
+ .withEntity(RootConfig.module.name, RootConfig.entities.folder.name)
100
+ .data();
70
101
  this.taskTypeData = this.entityService.withEntity(TASK_MODULE, TASK_TYPE_ENTITY).data();
71
102
  this.taskStatusData = this.entityService
72
103
  .withEntity(TASK_MODULE, TASK_STATUS_ENTITY)
73
104
  .data();
74
105
  this.taskData = this.entityService.withEntity(TASK_MODULE, TASK_ENTITY).data();
75
106
  this.assignmentData = this.entityService.withEntity(TASK_MODULE, TASK_ASSIGNMENT_ENTITY).data();
107
+ this.documentTypeData = this.entityService
108
+ .withEntity(RootConfig.module.name, RootConfig.entities.documentType.name)
109
+ .data();
76
110
  }
77
111
  //#endregion
78
112
  //#region ----- Command Implementation -----
@@ -81,27 +115,32 @@ class AXMDistributeDocumentCommand {
81
115
  await this.toastError('errors.forbidden');
82
116
  return { success: false, message: { text: `${I18N}.errors.forbidden` } };
83
117
  }
84
- const documentId = resolveDocumentId(input);
85
- if (!documentId) {
86
- await this.toastError('errors.document-required');
87
- return { success: false, message: { text: `${I18N}.errors.document-required` } };
118
+ const subjectHint = resolveSubject(input);
119
+ if (!subjectHint) {
120
+ await this.toastError('errors.subject-required');
121
+ return { success: false, message: { text: `${I18N}.errors.subject-required` } };
88
122
  }
89
- const document = await this.documentData.byKey(documentId);
90
- if (!document?.id) {
91
- await this.toastError('errors.document-required');
92
- return { success: false, message: { text: `${I18N}.errors.document-required` } };
123
+ const subject = await this.loadSubject(subjectHint);
124
+ if (!subject) {
125
+ await this.toastError('errors.subject-required');
126
+ return { success: false, message: { text: `${I18N}.errors.subject-required` } };
93
127
  }
94
- if (!isTruthyFlag(document.distributionEnabled) && !isTruthyFlag(document.documentType?.enableDistributionCapability)) {
128
+ const typeLoader = {
129
+ byNames: (names) => this.driveService.getDocumentTypesByNames(names),
130
+ byKey: (id) => this.documentTypeData.byKey(id),
131
+ };
132
+ const appliesTo = subject.kind === 'folder' ? 'folder' : 'document';
133
+ const allowsDistribution = await sourcesAllowDocumentDistribution([subject.record, input.data], typeLoader, appliesTo);
134
+ if (!allowsDistribution) {
95
135
  await this.toastError('errors.not-enabled');
96
136
  return { success: false, message: { text: `${I18N}.errors.not-enabled` } };
97
137
  }
98
- const versionId = asTrimmedId(document.versionId);
99
- if (!versionId) {
100
- await this.toastError('errors.version-required');
101
- return { success: false, message: { text: `${I18N}.errors.version-required` } };
138
+ if (await this.requiresUnfinishedReview(subject, typeLoader)) {
139
+ await this.toastError('errors.review-required');
140
+ return { success: false, message: { text: `${I18N}.errors.review-required` } };
102
141
  }
103
142
  const setupPromise = this.loadDistributionSetup();
104
- const form = await this.openDialog(document);
143
+ const form = await this.openDialog(subject.title);
105
144
  if (!form) {
106
145
  return { success: true, kind: 'object', data: { cancelled: true } };
107
146
  }
@@ -116,40 +155,15 @@ class AXMDistributeDocumentCommand {
116
155
  await this.toastError('errors.status-missing');
117
156
  return { success: false, message: { text: `${I18N}.errors.status-missing` } };
118
157
  }
119
- const firstAssigneeId = form.assigneeIds[0];
120
- const documentDisplayName = asDisplayName(document.name) ?? asDisplayName(document.title);
121
- const subjectRef = {
122
- type: DOCUMENT_VERSION_ENTITY,
123
- id: versionId,
124
- title: documentDisplayName,
125
- };
126
- const assignedBy = this.sessionService.user?.id;
127
- const total = form.assigneeIds.length;
128
- let completed = 0;
129
- const created = await mapWithConcurrency(form.assigneeIds, ASSIGNEE_CREATE_CONCURRENCY, async (userId) => {
130
- const row = await this.createAndStartForAssignee({
131
- userId,
132
- assignedBy: assignedBy ?? firstAssigneeId,
133
- form,
134
- taskType: setup.taskType,
135
- openStatus: setup.openStatus,
136
- signOffStatus: setup.signOffStatus,
137
- completedStatus: setup.completedStatus,
138
- subjectRef,
139
- document,
140
- versionId,
141
- documentDisplayName,
142
- workflowId: setup.workflowId,
143
- });
144
- completed += 1;
145
- await this.updateDistributeLoadingProgress(loading, completed, total);
146
- return row;
158
+ const version = await this.resolveHighestVersion(subject);
159
+ const created = await this.createParentAndSubtasks({
160
+ form,
161
+ setup,
162
+ subject,
163
+ version,
164
+ loading,
147
165
  });
148
- const createdTaskIds = created.map((row) => row.taskId);
149
- const createdInstanceIds = created
150
- .map((row) => row.instanceId)
151
- .filter((id) => typeof id === 'string' && id.length > 0);
152
- if (created.some((row) => row.pinFailed)) {
166
+ if (created.pinFailed) {
153
167
  await this.toastWarning('warnings.pin-failed');
154
168
  }
155
169
  const [title, content] = await Promise.all([
@@ -157,7 +171,15 @@ class AXMDistributeDocumentCommand {
157
171
  this.translationService.translateAsync(`${I18N}.success.description`),
158
172
  ]);
159
173
  this.toastService.show({ color: 'success', title, content, timeOut: 3000 });
160
- return { success: true, kind: 'object', data: { taskIds: createdTaskIds, instanceIds: createdInstanceIds } };
174
+ return {
175
+ success: true,
176
+ kind: 'object',
177
+ data: {
178
+ parentTaskId: created.parentTaskId,
179
+ taskIds: created.taskIds,
180
+ instanceIds: created.instanceIds,
181
+ },
182
+ };
161
183
  }
162
184
  catch (error) {
163
185
  const message = error instanceof Error ? error.message : undefined;
@@ -170,8 +192,7 @@ class AXMDistributeDocumentCommand {
170
192
  }
171
193
  //#endregion
172
194
  //#region ----- Dialog -----
173
- async openDialog(document) {
174
- const defaultTitle = asDisplayName(document.name) ?? asDisplayName(document.title) ?? '';
195
+ async openDialog(defaultTitle) {
175
196
  const dueDate = new Date();
176
197
  dueDate.setHours(0, 0, 0, 0);
177
198
  const result = await this.layoutBuilder
@@ -246,15 +267,76 @@ class AXMDistributeDocumentCommand {
246
267
  return resolveLayoutBuilderDialogResult(result);
247
268
  }
248
269
  //#endregion
249
- //#region ----- Create per assignee -----
270
+ //#region ----- Create parent and sub-tasks -----
271
+ async createParentAndSubtasks(params) {
272
+ const initiatorId = this.sessionService.user?.id ?? params.form.assigneeIds[0];
273
+ const subjectRef = {
274
+ type: params.subject.kind === 'folder' ? FOLDER_ENTITY_NAME : DOCUMENT_ENTITY_NAME,
275
+ id: params.subject.id,
276
+ title: params.subject.title,
277
+ };
278
+ const versionForm = stampDocumentDistributionFormValues(undefined, {
279
+ [AXM_DOCUMENT_DISTRIBUTION_VERSION_FIELD_NAME]: params.version,
280
+ });
281
+ const parentTask = await this.taskData.create({
282
+ title: params.form.title,
283
+ description: params.form.description,
284
+ taskTypeId: params.setup.taskType.id,
285
+ taskType: { id: params.setup.taskType.id, title: params.setup.taskType.title },
286
+ statusId: params.setup.openStatus.id,
287
+ status: statusRef(params.setup.openStatus),
288
+ priority: 'medium',
289
+ progress: 0,
290
+ order: 0,
291
+ startDate: params.form.dueDate,
292
+ dueDate: params.form.dueDate,
293
+ assigneeId: initiatorId,
294
+ assignee: { id: initiatorId },
295
+ subjectRef,
296
+ metaDataForm: versionForm,
297
+ isArchived: false,
298
+ });
299
+ const parentTaskId = resolveCreatedEntityId(parentTask);
300
+ let pinFailed = false;
301
+ await this.pinSubjectOnTask(parentTaskId, params.subject).catch((error) => {
302
+ console.warn('[AXMDistributeDocumentCommand] pin parent shortcut failed', error);
303
+ pinFailed = true;
304
+ });
305
+ const total = params.form.assigneeIds.length;
306
+ let completed = 0;
307
+ const created = await mapWithConcurrency(params.form.assigneeIds, ASSIGNEE_CREATE_CONCURRENCY, async (userId) => {
308
+ const row = await this.createAndStartForAssignee({
309
+ userId,
310
+ assignedBy: initiatorId,
311
+ form: params.form,
312
+ setup: params.setup,
313
+ subject: params.subject,
314
+ subjectRef,
315
+ parentTaskId,
316
+ parentTitle: params.form.title,
317
+ versionForm,
318
+ });
319
+ completed += 1;
320
+ await this.updateDistributeLoadingProgress(params.loading, completed, total);
321
+ return row;
322
+ });
323
+ return {
324
+ parentTaskId,
325
+ taskIds: created.map((row) => row.taskId),
326
+ instanceIds: created
327
+ .map((row) => row.instanceId)
328
+ .filter((id) => typeof id === 'string' && id.length > 0),
329
+ pinFailed: pinFailed || created.some((row) => row.pinFailed),
330
+ };
331
+ }
250
332
  async createAndStartForAssignee(params) {
251
333
  const createdTask = await this.taskData.create({
252
334
  title: params.form.title,
253
335
  description: params.form.description,
254
- taskTypeId: params.taskType.id,
255
- taskType: { id: params.taskType.id, title: params.taskType.title },
256
- statusId: params.openStatus.id,
257
- status: statusRef(params.openStatus),
336
+ taskTypeId: params.setup.taskType.id,
337
+ taskType: { id: params.setup.taskType.id, title: params.setup.taskType.title },
338
+ statusId: params.setup.openStatus.id,
339
+ status: statusRef(params.setup.openStatus),
258
340
  priority: 'medium',
259
341
  progress: 0,
260
342
  order: 0,
@@ -263,6 +345,9 @@ class AXMDistributeDocumentCommand {
263
345
  assigneeId: params.userId,
264
346
  assignee: { id: params.userId },
265
347
  subjectRef: params.subjectRef,
348
+ parentTaskId: params.parentTaskId,
349
+ parentTask: { id: params.parentTaskId, title: params.parentTitle },
350
+ metaDataForm: params.versionForm,
266
351
  isArchived: false,
267
352
  });
268
353
  const taskId = resolveCreatedEntityId(createdTask);
@@ -279,7 +364,7 @@ class AXMDistributeDocumentCommand {
279
364
  assignedAt: new Date(),
280
365
  isActive: true,
281
366
  });
282
- const pinPromise = this.pinDocumentOnTask(taskId, params.document, params.documentDisplayName).catch((error) => {
367
+ const pinPromise = this.pinSubjectOnTask(taskId, params.subject).catch((error) => {
283
368
  console.warn('[AXMDistributeDocumentCommand] pin document shortcut failed', error);
284
369
  pinFailed = true;
285
370
  });
@@ -291,20 +376,21 @@ class AXMDistributeDocumentCommand {
291
376
  return { taskId, instanceId, pinFailed };
292
377
  }
293
378
  async startWorkflowForAssignee(taskId, params) {
294
- const startResult = await this.workflowManager.start(params.workflowId, {
379
+ const startResult = await this.workflowManager.start(params.setup.workflowId, {
295
380
  taskId,
296
381
  taskTitle: params.form.title,
297
- documentId: params.document.id,
298
- documentVersionId: params.versionId,
382
+ documentId: params.subject.kind === 'file' ? params.subject.id : '',
383
+ folderId: params.subject.kind === 'folder' ? params.subject.id : '',
384
+ parentTaskId: params.parentTaskId,
299
385
  signerUserId: params.userId,
300
386
  signerUserIds: [params.userId],
301
387
  initiatorUserId: params.assignedBy,
302
- openStatusId: params.openStatus.id,
303
- openStatus: statusRef(params.openStatus),
304
- signOffStatusId: params.signOffStatus?.id ?? params.openStatus.id,
305
- signOffStatus: statusRef(params.signOffStatus) ?? statusRef(params.openStatus),
306
- completedStatusId: params.completedStatus?.id ?? params.openStatus.id,
307
- completedStatus: statusRef(params.completedStatus) ?? statusRef(params.openStatus),
388
+ openStatusId: params.setup.openStatus.id,
389
+ openStatus: statusRef(params.setup.openStatus),
390
+ signOffStatusId: params.setup.signOffStatus?.id ?? params.setup.openStatus.id,
391
+ signOffStatus: statusRef(params.setup.signOffStatus) ?? statusRef(params.setup.openStatus),
392
+ completedStatusId: params.setup.completedStatus?.id ?? params.setup.openStatus.id,
393
+ completedStatus: statusRef(params.setup.completedStatus) ?? statusRef(params.setup.openStatus),
308
394
  correlationId: taskId,
309
395
  refId: taskId,
310
396
  refType: TASK_ENTITY_NAME,
@@ -318,7 +404,7 @@ class AXMDistributeDocumentCommand {
318
404
  await this.taskData.update(taskId, {
319
405
  workflowInfo: buildAXPRecordWorkflowInfo({
320
406
  instanceId: startResult.instanceId,
321
- definitionId: params.workflowId,
407
+ definitionId: params.setup.workflowId,
322
408
  correlationId: taskId,
323
409
  }),
324
410
  });
@@ -330,19 +416,83 @@ class AXMDistributeDocumentCommand {
330
416
  return startResult.instanceId;
331
417
  }
332
418
  //#endregion
333
- //#region ----- Pin document -----
334
- async pinDocumentOnTask(taskId, document, nameOverride) {
419
+ //#region ----- Pin subject -----
420
+ async pinSubjectOnTask(taskId, subject) {
335
421
  const folder = await this.driveService.getRootByEntityRef(`${TASK_MODULE}.${TASK_ENTITY}`, taskId);
336
422
  const folderId = folder?.result?.id;
337
423
  if (!folderId) {
338
424
  throw new Error('Task document folder was not provisioned');
339
425
  }
340
- await this.driveService.createShortcut(document.id, 'file', folderId, {
341
- nameOverride: nameOverride ?? asDisplayName(document.name) ?? asDisplayName(document.title) ?? 'Document',
426
+ await this.driveService.createShortcut(subject.id, subject.kind === 'folder' ? 'folder' : 'file', folderId, {
427
+ nameOverride: subject.title,
342
428
  });
343
429
  }
344
430
  //#endregion
345
431
  //#region ----- Data Loading -----
432
+ async loadSubject(subject) {
433
+ if (subject.kind === 'folder') {
434
+ const folder = await this.folderData.byKey(subject.id);
435
+ if (!folder?.id) {
436
+ return null;
437
+ }
438
+ return {
439
+ kind: 'folder',
440
+ id: folder.id,
441
+ title: asDisplayName(folder.title) ?? subject.title,
442
+ record: folder,
443
+ };
444
+ }
445
+ const document = await this.documentData.byKey(subject.id);
446
+ if (!document?.id) {
447
+ return null;
448
+ }
449
+ return {
450
+ kind: 'file',
451
+ id: document.id,
452
+ title: asDisplayName(document.name) ?? asDisplayName(document.title) ?? subject.title,
453
+ record: document,
454
+ };
455
+ }
456
+ async requiresUnfinishedReview(subject, load) {
457
+ const types = await this.loadSubjectTypes(subject, load);
458
+ if (!types.some((type) => isDocumentReviewRequired(type.requiresReview))) {
459
+ return false;
460
+ }
461
+ return !isDocumentReviewMetadataComplete(metaDataFormOf(subject.record));
462
+ }
463
+ async loadSubjectTypes(subject, load) {
464
+ const keys = collectDocumentTypeKeys(subject.record);
465
+ const found = [];
466
+ for (const id of keys.ids) {
467
+ try {
468
+ const type = await load.byKey(id);
469
+ if (type) {
470
+ found.push(type);
471
+ }
472
+ }
473
+ catch {
474
+ // Keep checking remaining types when one lookup misses.
475
+ }
476
+ }
477
+ if (keys.names.length) {
478
+ const byName = await load.byNames(keys.names);
479
+ found.push(...byName);
480
+ }
481
+ return found;
482
+ }
483
+ async resolveHighestVersion(subject) {
484
+ if (subject.kind === 'file') {
485
+ return highestDocumentVersionNumber([subject.record]);
486
+ }
487
+ try {
488
+ const documents = await this.documentApi.listFolderReviewDocuments(subject.id);
489
+ return highestDocumentVersionNumber(documents);
490
+ }
491
+ catch (error) {
492
+ console.warn('[AXMDistributeDocumentCommand] list folder documents for version failed', error);
493
+ return 1;
494
+ }
495
+ }
346
496
  async loadDistributionSetup() {
347
497
  const taskType = await this.loadDistributionTaskType();
348
498
  if (!taskType?.id) {
@@ -442,4 +592,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
442
592
  }] });
443
593
 
444
594
  export { AXMDistributeDocumentCommand };
445
- //# sourceMappingURL=acorex-platform-module-document-management-client-distribute-document.command-dTEExoVn.mjs.map
595
+ //# sourceMappingURL=acorex-platform-module-document-management-client-distribute-document.command-DgUgY_A1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-document-management-client-distribute-document.command-DgUgY_A1.mjs","sources":["../../../../libs/modules/document-management/client/src/lib/features/commands/distribute-document.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXLoadingDialogService } from '@acorex/components/loading-dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';\nimport type { AXPEntityReference } from '@acorex-platform/framework-shared/core';\nimport { buildAXPRecordWorkflowInfo } from '@acorex-platform/framework-shared/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPContentDocumentsPermissionKeys,\n DOCUMENT_DISTRIBUTION_WORKFLOW_NAME,\n highestDocumentVersionNumber,\n isDocumentReviewMetadataComplete,\n isDocumentReviewRequired,\n RootConfig,\n stampDocumentDistributionFormValues,\n AXM_DOCUMENT_DISTRIBUTION_VERSION_FIELD_NAME,\n type AXMDocumentDto,\n type AXMDocumentManagementFolderEntityModel,\n} from '@acorex-platform/module-document-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMDocumentManagerService } from '../shared/document-manager.service';\nimport { AXPDocumentManagementService } from '../shared/document-management.service';\nimport type { AXMDocumentExplorerNode } from '../shared/document-manager.types';\nimport { sourcesAllowDocumentDistribution } from '../shared/document-distribution.util';\nimport { collectDocumentTypeKeys } from '../shared/document-review.util';\nimport {\n asDisplayName,\n asTrimmedId,\n asUserIds,\n mapWithConcurrency,\n resolveCreatedEntityId,\n} from './distribute-document.command.util';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMDistributeDocumentCommandInput {\n documentId?: string;\n folderId?: string;\n data?: AXMDocumentExplorerNode | { documentId?: string; folderId?: string; id?: string; type?: string };\n options?: { documentId?: string; folderId?: string };\n}\n\ninterface DistributeDialogResult {\n title: string;\n description?: string;\n dueDate: Date | string;\n assigneeIds: string[];\n}\n\ninterface TaskTypeRow {\n id: string;\n title?: string;\n workflowConfig?: {\n workflowDefinitionId?: string;\n workflowName?: string;\n } | null;\n}\n\ninterface TaskStatusRow {\n id: string;\n name?: string;\n title?: string;\n color?: string;\n icon?: string;\n isDefault?: boolean;\n isFinal?: boolean;\n taskTypeId?: string;\n}\n\ninterface DistributionSetup {\n taskType: TaskTypeRow;\n openStatus: TaskStatusRow;\n signOffStatus: TaskStatusRow | undefined;\n completedStatus: TaskStatusRow | undefined;\n workflowId: string;\n}\n\ninterface LoadingDialogRef {\n close: () => void;\n setProgressText?: (text: string) => void;\n}\n\ninterface DistributionSubject {\n kind: 'file' | 'folder';\n id: string;\n title: string;\n record: Record<string, unknown>;\n}\n\ninterface DocumentTypeRow {\n id: string;\n requiresReview?: unknown;\n enableDistributionCapability?: unknown;\n metaDataList?: unknown;\n}\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst TASK_MODULE = 'TaskManagement';\nconst TASK_ENTITY = 'Task';\nconst TASK_ENTITY_NAME = `${TASK_MODULE}.${TASK_ENTITY}`;\nconst TASK_TYPE_ENTITY = 'TaskType';\nconst TASK_STATUS_ENTITY = 'TaskStatus';\nconst TASK_ASSIGNMENT_ENTITY = 'TaskAssignment';\nconst MOCK_DOCUMENT_DISTRIBUTION_TASK_TYPE_ID = 'pm-mock-task-type-document-distribution';\nconst DOCUMENT_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.document.name}`;\nconst FOLDER_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.folder.name}`;\nconst I18N = '@document-management:distribute';\nconst ASSIGNEE_CREATE_CONCURRENCY = 3;\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction asItems<T>(value: unknown): T[] {\n if (Array.isArray(value)) {\n return value as T[];\n }\n if (value && typeof value === 'object' && Array.isArray((value as { items?: unknown }).items)) {\n return (value as { items: T[] }).items;\n }\n return [];\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\nfunction statusRef(\n row: TaskStatusRow | undefined,\n): { id: string; title?: string; color?: string; icon?: string } | undefined {\n const id = asTrimmedId(row?.id);\n if (!id) {\n return undefined;\n }\n return { id, title: row?.title, color: row?.color, icon: row?.icon };\n}\n\nfunction resolveSubject(input: AXMDistributeDocumentCommandInput = {}): {\n kind: 'file' | 'folder';\n id: string;\n title: string;\n} | null {\n const data = input.data;\n const nodeType =\n data && typeof data === 'object' && 'type' in data ? (data as { type?: unknown }).type : undefined;\n const fromDataId =\n data && typeof data === 'object' ? asTrimmedId((data as { id?: unknown }).id) : undefined;\n const documentId =\n asTrimmedId(input.options?.documentId) ??\n asTrimmedId(input.documentId) ??\n (data && typeof data === 'object' ? asTrimmedId((data as { documentId?: unknown }).documentId) : undefined);\n const folderId =\n asTrimmedId(input.options?.folderId) ??\n asTrimmedId(input.folderId) ??\n (data && typeof data === 'object' ? asTrimmedId((data as { folderId?: unknown }).folderId) : undefined);\n\n if (nodeType === 'folder' && fromDataId) {\n return { kind: 'folder', id: fromDataId, title: asDisplayName((data as { name?: unknown }).name) ?? fromDataId };\n }\n if (nodeType === 'file' && fromDataId) {\n return { kind: 'file', id: fromDataId, title: asDisplayName((data as { name?: unknown }).name) ?? fromDataId };\n }\n if (folderId) {\n return { kind: 'folder', id: folderId, title: folderId };\n }\n if (documentId) {\n return { kind: 'file', id: documentId, title: documentId };\n }\n return null;\n}\n\nfunction metaDataFormOf(record: Record<string, unknown>): Record<string, unknown> | undefined {\n const form = record['metaDataForm'];\n return asRecord(form) ?? undefined;\n}\n\n//#endregion\n\n//#region ----- Distribute document command -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMDistributeDocumentCommand implements AXPCommand<AXMDistributeDocumentCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly driveService = inject(AXMDocumentManagerService);\n private readonly documentApi = inject(AXPDocumentManagementService);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n\n private readonly documentData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.document.name)\n .data<string, AXMDocumentDto>();\n private readonly folderData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.folder.name)\n .data<string, AXMDocumentManagementFolderEntityModel>();\n private readonly taskTypeData = this.entityService.withEntity(TASK_MODULE, TASK_TYPE_ENTITY).data<string, TaskTypeRow>();\n private readonly taskStatusData = this.entityService\n .withEntity(TASK_MODULE, TASK_STATUS_ENTITY)\n .data<string, TaskStatusRow>();\n private readonly taskData = this.entityService.withEntity(TASK_MODULE, TASK_ENTITY).data<string>();\n private readonly assignmentData = this.entityService.withEntity(TASK_MODULE, TASK_ASSIGNMENT_ENTITY).data<string>();\n private readonly documentTypeData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.documentType.name)\n .data<string, DocumentTypeRow>();\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMDistributeDocumentCommandInput = {}): AXPCommandExecuteResultPromise {\n if (!this.sessionService.authorize(AXPContentDocumentsPermissionKeys.DistributeDocuments)) {\n await this.toastError('errors.forbidden');\n return { success: false, message: { text: `${I18N}.errors.forbidden` } };\n }\n\n const subjectHint = resolveSubject(input);\n if (!subjectHint) {\n await this.toastError('errors.subject-required');\n return { success: false, message: { text: `${I18N}.errors.subject-required` } };\n }\n\n const subject = await this.loadSubject(subjectHint);\n if (!subject) {\n await this.toastError('errors.subject-required');\n return { success: false, message: { text: `${I18N}.errors.subject-required` } };\n }\n\n const typeLoader = {\n byNames: (names: string[]) => this.driveService.getDocumentTypesByNames(names),\n byKey: (id: string) => this.documentTypeData.byKey(id),\n };\n const appliesTo = subject.kind === 'folder' ? 'folder' : 'document';\n const allowsDistribution = await sourcesAllowDocumentDistribution(\n [subject.record, input.data],\n typeLoader,\n appliesTo,\n );\n if (!allowsDistribution) {\n await this.toastError('errors.not-enabled');\n return { success: false, message: { text: `${I18N}.errors.not-enabled` } };\n }\n\n if (await this.requiresUnfinishedReview(subject, typeLoader)) {\n await this.toastError('errors.review-required');\n return { success: false, message: { text: `${I18N}.errors.review-required` } };\n }\n\n const setupPromise = this.loadDistributionSetup();\n const form = await this.openDialog(subject.title);\n if (!form) {\n return { success: true, kind: 'object', data: { cancelled: true } };\n }\n\n const loading = await this.showDistributeLoading(form.assigneeIds.length);\n try {\n const setup = await setupPromise;\n if (!setup?.taskType?.id) {\n await this.toastError('errors.task-type-missing');\n return { success: false, message: { text: `${I18N}.errors.task-type-missing` } };\n }\n if (!setup.openStatus?.id) {\n await this.toastError('errors.status-missing');\n return { success: false, message: { text: `${I18N}.errors.status-missing` } };\n }\n\n const version = await this.resolveHighestVersion(subject);\n const created = await this.createParentAndSubtasks({\n form,\n setup,\n subject,\n version,\n loading,\n });\n\n if (created.pinFailed) {\n await this.toastWarning('warnings.pin-failed');\n }\n\n const [title, content] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.success.title`),\n this.translationService.translateAsync(`${I18N}.success.description`),\n ]);\n this.toastService.show({ color: 'success', title, content, timeOut: 3000 });\n return {\n success: true,\n kind: 'object',\n data: {\n parentTaskId: created.parentTaskId,\n taskIds: created.taskIds,\n instanceIds: created.instanceIds,\n },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : undefined;\n await this.toastError('errors.failed', message);\n return { success: false, message: { text: message ?? `${I18N}.errors.failed` } };\n } finally {\n loading.close();\n }\n }\n\n //#endregion\n\n //#region ----- Dialog -----\n\n private async openDialog(defaultTitle: string): Promise<DistributeDialogResult | null> {\n const dueDate = new Date();\n dueDate.setHours(0, 0, 0, 0);\n const result = await this.layoutBuilder\n .create()\n .dialog<DistributeDialogResult | null>((dialog) => {\n dialog\n .setTitle(`${I18N}.dialog.title`)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n title: defaultTitle,\n description: '',\n dueDate,\n assigneeIds: [],\n })\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .formField(`${I18N}.fields.title`, (field) => {\n field.path('title');\n field.textBox({ validations: [{ rule: 'required' }] });\n })\n .formField(`${I18N}.fields.description`, (field) => {\n field.path('description');\n field.textBox({});\n })\n .formField(`${I18N}.fields.due-date`, (field) => {\n field.path('dueDate');\n field.dateTimeBox({ type: 'date', validations: [{ rule: 'required' }] });\n })\n .formField(`${I18N}.fields.assignees`, (field) => {\n field.path('assigneeIds');\n field.lookupBox({\n entity: 'SecurityManagement.User',\n multiple: true,\n look: 'lookup',\n validations: [{ rule: 'required' }],\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit(`${I18N}.dialog.submit`);\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n const ctx = dialogRef.context() as {\n title?: string;\n description?: string;\n dueDate?: Date | string | null;\n assigneeIds?: unknown;\n };\n const title = (ctx.title ?? '').trim();\n const assigneeIds = asUserIds(ctx.assigneeIds);\n if (!title) {\n throw new Error(`${I18N}.errors.title-required`);\n }\n if (!ctx.dueDate) {\n throw new Error(`${I18N}.errors.due-date-required`);\n }\n if (assigneeIds.length === 0) {\n throw new Error(`${I18N}.errors.assignees-required`);\n }\n dialogRef.setLoading(true);\n return {\n title,\n description: (ctx.description ?? '').trim() || undefined,\n dueDate: ctx.dueDate,\n assigneeIds,\n };\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<DistributeDialogResult>(result);\n }\n\n //#endregion\n\n //#region ----- Create parent and sub-tasks -----\n\n private async createParentAndSubtasks(params: {\n form: DistributeDialogResult;\n setup: DistributionSetup;\n subject: DistributionSubject;\n version: number;\n loading: LoadingDialogRef;\n }): Promise<{ parentTaskId: string; taskIds: string[]; instanceIds: string[]; pinFailed: boolean }> {\n const initiatorId = this.sessionService.user?.id ?? params.form.assigneeIds[0];\n const subjectRef: AXPEntityReference = {\n type: params.subject.kind === 'folder' ? FOLDER_ENTITY_NAME : DOCUMENT_ENTITY_NAME,\n id: params.subject.id,\n title: params.subject.title,\n };\n const versionForm = stampDocumentDistributionFormValues(undefined, {\n [AXM_DOCUMENT_DISTRIBUTION_VERSION_FIELD_NAME]: params.version,\n });\n\n const parentTask = await this.taskData.create({\n title: params.form.title,\n description: params.form.description,\n taskTypeId: params.setup.taskType.id,\n taskType: { id: params.setup.taskType.id, title: params.setup.taskType.title },\n statusId: params.setup.openStatus.id,\n status: statusRef(params.setup.openStatus),\n priority: 'medium',\n progress: 0,\n order: 0,\n startDate: params.form.dueDate,\n dueDate: params.form.dueDate,\n assigneeId: initiatorId,\n assignee: { id: initiatorId },\n subjectRef,\n metaDataForm: versionForm,\n isArchived: false,\n } as never);\n const parentTaskId = resolveCreatedEntityId(parentTask);\n\n let pinFailed = false;\n await this.pinSubjectOnTask(parentTaskId, params.subject).catch((error) => {\n console.warn('[AXMDistributeDocumentCommand] pin parent shortcut failed', error);\n pinFailed = true;\n });\n\n const total = params.form.assigneeIds.length;\n let completed = 0;\n const created = await mapWithConcurrency(params.form.assigneeIds, ASSIGNEE_CREATE_CONCURRENCY, async (userId) => {\n const row = await this.createAndStartForAssignee({\n userId,\n assignedBy: initiatorId,\n form: params.form,\n setup: params.setup,\n subject: params.subject,\n subjectRef,\n parentTaskId,\n parentTitle: params.form.title,\n versionForm,\n });\n completed += 1;\n await this.updateDistributeLoadingProgress(params.loading, completed, total);\n return row;\n });\n\n return {\n parentTaskId,\n taskIds: created.map((row) => row.taskId),\n instanceIds: created\n .map((row) => row.instanceId)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n pinFailed: pinFailed || created.some((row) => row.pinFailed),\n };\n }\n\n private async createAndStartForAssignee(params: {\n userId: string;\n assignedBy: string;\n form: DistributeDialogResult;\n setup: DistributionSetup;\n subject: DistributionSubject;\n subjectRef: AXPEntityReference;\n parentTaskId: string;\n parentTitle: string;\n versionForm: Record<string, unknown>;\n }): Promise<{ taskId: string; instanceId?: string; pinFailed: boolean }> {\n const createdTask = await this.taskData.create({\n title: params.form.title,\n description: params.form.description,\n taskTypeId: params.setup.taskType.id,\n taskType: { id: params.setup.taskType.id, title: params.setup.taskType.title },\n statusId: params.setup.openStatus.id,\n status: statusRef(params.setup.openStatus),\n priority: 'medium',\n progress: 0,\n order: 0,\n startDate: params.form.dueDate,\n dueDate: params.form.dueDate,\n assigneeId: params.userId,\n assignee: { id: params.userId },\n subjectRef: params.subjectRef,\n parentTaskId: params.parentTaskId,\n parentTask: { id: params.parentTaskId, title: params.parentTitle },\n metaDataForm: params.versionForm,\n isArchived: false,\n } as never);\n const taskId = resolveCreatedEntityId(createdTask);\n\n let pinFailed = false;\n const assignmentPromise = this.assignmentData.create({\n taskId,\n assignmentRef: {\n sourceKey: 'employee-user',\n refId: params.userId,\n displayName: params.userId,\n },\n role: 'reviewer',\n assignedBy: params.assignedBy,\n assignedAt: new Date(),\n isActive: true,\n } as never);\n\n const pinPromise = this.pinSubjectOnTask(taskId, params.subject).catch((error) => {\n console.warn('[AXMDistributeDocumentCommand] pin document shortcut failed', error);\n pinFailed = true;\n });\n\n const [, , instanceId] = await Promise.all([\n assignmentPromise,\n pinPromise,\n this.startWorkflowForAssignee(taskId, params),\n ]);\n return { taskId, instanceId, pinFailed };\n }\n\n private async startWorkflowForAssignee(\n taskId: string,\n params: {\n userId: string;\n assignedBy: string;\n form: DistributeDialogResult;\n setup: DistributionSetup;\n subject: DistributionSubject;\n parentTaskId: string;\n },\n ): Promise<string | undefined> {\n const startResult = await this.workflowManager.start(params.setup.workflowId, {\n taskId,\n taskTitle: params.form.title,\n documentId: params.subject.kind === 'file' ? params.subject.id : '',\n folderId: params.subject.kind === 'folder' ? params.subject.id : '',\n parentTaskId: params.parentTaskId,\n signerUserId: params.userId,\n signerUserIds: [params.userId],\n initiatorUserId: params.assignedBy,\n openStatusId: params.setup.openStatus.id,\n openStatus: statusRef(params.setup.openStatus),\n signOffStatusId: params.setup.signOffStatus?.id ?? params.setup.openStatus.id,\n signOffStatus: statusRef(params.setup.signOffStatus) ?? statusRef(params.setup.openStatus),\n completedStatusId: params.setup.completedStatus?.id ?? params.setup.openStatus.id,\n completedStatus: statusRef(params.setup.completedStatus) ?? statusRef(params.setup.openStatus),\n correlationId: taskId,\n refId: taskId,\n refType: TASK_ENTITY_NAME,\n dueDate: params.form.dueDate,\n });\n\n if (!startResult.success) {\n throw new Error(startResult.error ?? 'workflow-failed');\n }\n\n if (startResult.instanceId) {\n try {\n await this.taskData.update(taskId, {\n workflowInfo: buildAXPRecordWorkflowInfo({\n instanceId: startResult.instanceId,\n definitionId: params.setup.workflowId,\n correlationId: taskId,\n }),\n } as never);\n } catch (error) {\n console.warn('[AXMDistributeDocumentCommand] stamp workflowInfo failed', error);\n }\n }\n\n return startResult.instanceId;\n }\n\n //#endregion\n\n //#region ----- Pin subject -----\n\n private async pinSubjectOnTask(taskId: string, subject: DistributionSubject): Promise<void> {\n const folder = await this.driveService.getRootByEntityRef(`${TASK_MODULE}.${TASK_ENTITY}`, taskId);\n const folderId = folder?.result?.id;\n if (!folderId) {\n throw new Error('Task document folder was not provisioned');\n }\n await this.driveService.createShortcut(subject.id, subject.kind === 'folder' ? 'folder' : 'file', folderId, {\n nameOverride: subject.title,\n });\n }\n\n //#endregion\n\n //#region ----- Data Loading -----\n\n private async loadSubject(\n subject: { kind: 'file' | 'folder'; id: string; title: string },\n ): Promise<DistributionSubject | null> {\n if (subject.kind === 'folder') {\n const folder = await this.folderData.byKey(subject.id);\n if (!folder?.id) {\n return null;\n }\n return {\n kind: 'folder',\n id: folder.id,\n title: asDisplayName(folder.title) ?? subject.title,\n record: folder as unknown as Record<string, unknown>,\n };\n }\n const document = await this.documentData.byKey(subject.id);\n if (!document?.id) {\n return null;\n }\n return {\n kind: 'file',\n id: document.id,\n title: asDisplayName(document.name) ?? asDisplayName(document.title) ?? subject.title,\n record: document as unknown as Record<string, unknown>,\n };\n }\n\n private async requiresUnfinishedReview(\n subject: DistributionSubject,\n load: {\n byNames: (names: string[]) => Promise<DocumentTypeRow[]>;\n byKey: (id: string) => Promise<DocumentTypeRow | null | undefined>;\n },\n ): Promise<boolean> {\n const types = await this.loadSubjectTypes(subject, load);\n if (!types.some((type) => isDocumentReviewRequired(type.requiresReview))) {\n return false;\n }\n return !isDocumentReviewMetadataComplete(metaDataFormOf(subject.record));\n }\n\n private async loadSubjectTypes(\n subject: DistributionSubject,\n load: {\n byNames: (names: string[]) => Promise<DocumentTypeRow[]>;\n byKey: (id: string) => Promise<DocumentTypeRow | null | undefined>;\n },\n ): Promise<DocumentTypeRow[]> {\n const keys = collectDocumentTypeKeys(subject.record);\n const found: DocumentTypeRow[] = [];\n for (const id of keys.ids) {\n try {\n const type = await load.byKey(id);\n if (type) {\n found.push(type);\n }\n } catch {\n // Keep checking remaining types when one lookup misses.\n }\n }\n if (keys.names.length) {\n const byName = await load.byNames(keys.names);\n found.push(...byName);\n }\n return found;\n }\n\n private async resolveHighestVersion(subject: DistributionSubject): Promise<number> {\n if (subject.kind === 'file') {\n return highestDocumentVersionNumber([subject.record]);\n }\n try {\n const documents = await this.documentApi.listFolderReviewDocuments(subject.id);\n return highestDocumentVersionNumber(documents);\n } catch (error) {\n console.warn('[AXMDistributeDocumentCommand] list folder documents for version failed', error);\n return 1;\n }\n }\n\n private async loadDistributionSetup(): Promise<DistributionSetup | null> {\n const taskType = await this.loadDistributionTaskType();\n if (!taskType?.id) {\n return null;\n }\n const statuses = await this.loadStatuses(taskType.id);\n const openStatus = statuses.find((row) => row.isDefault) ?? statuses[0];\n const signOffStatus = statuses.find((row) => row.name === 'sign-off') ?? openStatus;\n const completedStatus = statuses.find((row) => row.isFinal) ?? signOffStatus;\n return {\n taskType,\n openStatus,\n signOffStatus,\n completedStatus,\n workflowId: taskType.workflowConfig?.workflowName?.trim() || DOCUMENT_DISTRIBUTION_WORKFLOW_NAME,\n };\n }\n\n private async loadDistributionTaskType(): Promise<TaskTypeRow | null> {\n try {\n const byId = await this.taskTypeData.byKey(MOCK_DOCUMENT_DISTRIBUTION_TASK_TYPE_ID);\n if (byId?.id) {\n return byId;\n }\n } catch {\n // hashed tenant copies use different ids\n }\n\n const result = await this.taskTypeData.query({ skip: 0, take: 200 });\n return (\n asItems<TaskTypeRow>(result).find(\n (row) => row.workflowConfig?.workflowName?.trim() === DOCUMENT_DISTRIBUTION_WORKFLOW_NAME,\n ) ?? null\n );\n }\n\n private async loadStatuses(taskTypeId: string): Promise<TaskStatusRow[]> {\n const result = await this.taskStatusData.query({\n skip: 0,\n take: 50,\n filter: { field: 'taskTypeId', operator: { type: 'equal' }, value: taskTypeId },\n });\n const rows = asItems<TaskStatusRow>(result);\n return rows.some((row) => row.taskTypeId === taskTypeId)\n ? rows.filter((row) => row.taskTypeId === taskTypeId)\n : rows;\n }\n\n private async showDistributeLoading(assigneeCount: number): Promise<LoadingDialogRef> {\n const [title, text] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.loading.title`),\n this.translationService.translateAsync(`${I18N}.loading.description`, {\n params: { count: assigneeCount },\n }),\n ]);\n return this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n progressColor: 'primary',\n text,\n }) as LoadingDialogRef;\n }\n\n private async updateDistributeLoadingProgress(\n loading: LoadingDialogRef,\n current: number,\n total: number,\n ): Promise<void> {\n if (!loading.setProgressText) {\n return;\n }\n const text = await this.translationService.translateAsync(`${I18N}.loading.progress`, {\n params: { current, total },\n });\n loading.setProgressText(text);\n }\n\n private async toastError(key: string, detail?: string): Promise<void> {\n const [title, fallback] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.errors.title`),\n this.translationService.translateAsync(`${I18N}.${key}`),\n ]);\n this.toastService.show({\n color: 'danger',\n title,\n content: detail?.trim() || fallback,\n closeButton: true,\n timeOut: 5000,\n });\n }\n\n private async toastWarning(key: string): Promise<void> {\n const [title, content] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.warnings.title`),\n this.translationService.translateAsync(`${I18N}.${key}`),\n ]);\n this.toastService.show({\n color: 'warning',\n title,\n content,\n closeButton: true,\n timeOut: 5000,\n });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AA2GA;AAEA;AAEA,MAAM,WAAW,GAAG,gBAAgB;AACpC,MAAM,WAAW,GAAG,MAAM;AAC1B,MAAM,gBAAgB,GAAG,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,WAAW,EAAE;AACxD,MAAM,gBAAgB,GAAG,UAAU;AACnC,MAAM,kBAAkB,GAAG,YAAY;AACvC,MAAM,sBAAsB,GAAG,gBAAgB;AAC/C,MAAM,uCAAuC,GAAG,yCAAyC;AACzF,MAAM,oBAAoB,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;AAC7F,MAAM,kBAAkB,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;AACzF,MAAM,IAAI,GAAG,iCAAiC;AAC9C,MAAM,2BAA2B,GAAG,CAAC;AAErC;AAEA;AAEA,SAAS,OAAO,CAAI,KAAc,EAAA;AAChC,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KA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AAA,WAAW,EAAE,IAAI;AACjB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA,CAAC;IACJ;8GAzlBW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -74,5 +74,5 @@ async function mapWithConcurrency(items, limit, mapper) {
74
74
  }
75
75
  //#endregion
76
76
 
77
- export { asTrimmedId as a, asDisplayName as b, asUserIds as c, isTruthyFlag as i, mapWithConcurrency as m, resolveCreatedEntityId as r };
78
- //# sourceMappingURL=acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs.map
77
+ export { asTrimmedId as a, asDisplayName as b, asUserIds as c, mapWithConcurrency as m, resolveCreatedEntityId as r };
78
+ //# sourceMappingURL=acorex-platform-module-document-management-client-distribute-document.command.util-HCkpx2Hk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs","sources":["../../../../libs/modules/document-management/client/src/lib/features/commands/distribute-document.command.util.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { coerceUnknownToMultiLanguageString, resolveMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ----- Helpers -----\n\nexport function asTrimmedId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n const id = (value as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim()) {\n return id.trim();\n }\n }\n return undefined;\n}\n\nexport function asUserIds(value: unknown): string[] {\n if (value == null || value === '') {\n return [];\n }\n const source = Array.isArray(value)\n ? value\n : value && typeof value === 'object' && Array.isArray((value as { selectedItems?: unknown }).selectedItems)\n ? ((value as { selectedItems: unknown[] }).selectedItems)\n : [value];\n const ids: string[] = [];\n for (const row of source) {\n const id = asTrimmedId(row);\n if (id && !ids.includes(id)) {\n ids.push(id);\n }\n }\n return ids;\n}\n\nexport function resolveCreatedEntityId(created: unknown): string {\n if (typeof created === 'string' && created.trim()) {\n return created.trim();\n }\n if (created && typeof created === 'object' && 'result' in created) {\n return resolveCreatedEntityId((created as { result: unknown }).result);\n }\n const id = asTrimmedId(created);\n if (!id) {\n throw new Error('Failed to resolve created entity id');\n }\n return id;\n}\n\nexport function isTruthyFlag(value: unknown): boolean {\n return value === true || value === 'true' || value === 1 || value === '1';\n}\n\nexport function asDisplayName(value: unknown): string | undefined {\n const resolved = resolveMultiLanguageString(coerceUnknownToMultiLanguageString(value), 'en-US').trim();\n return resolved || undefined;\n}\n\nexport async function mapWithConcurrency<T, R>(\n items: readonly T[],\n limit: number,\n mapper: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n if (items.length === 0) {\n return [];\n }\n const results: R[] = new Array(items.length);\n let nextIndex = 0;\n const workerCount = Math.min(Math.max(1, limit), items.length);\n await Promise.all(\n Array.from({ length: workerCount }, async () => {\n for (;;) {\n const index = nextIndex;\n nextIndex += 1;\n if (index >= items.length) {\n return;\n }\n results[index] = await mapper(items[index], index);\n }\n }),\n );\n return results;\n}\n\n//#endregion\n"],"names":[],"mappings":";;AAAA;AAIA;AAEA;AAEM,SAAU,WAAW,CAAC,KAAc,EAAA;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AAC7C,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;IACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAA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AAO,OAAO;AAChB;AAEA;;"}
1
+ {"version":3,"file":"acorex-platform-module-document-management-client-distribute-document.command.util-HCkpx2Hk.mjs","sources":["../../../../libs/modules/document-management/client/src/lib/features/commands/distribute-document.command.util.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { coerceUnknownToMultiLanguageString, resolveMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ----- Helpers -----\n\nexport function asTrimmedId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n const id = (value as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim()) {\n return id.trim();\n }\n }\n return undefined;\n}\n\nexport function asUserIds(value: unknown): string[] {\n if (value == null || value === '') {\n return [];\n }\n const source = Array.isArray(value)\n ? value\n : value && typeof value === 'object' && Array.isArray((value as { selectedItems?: unknown }).selectedItems)\n ? ((value as { selectedItems: unknown[] }).selectedItems)\n : [value];\n const ids: string[] = [];\n for (const row of source) {\n const id = asTrimmedId(row);\n if (id && !ids.includes(id)) {\n ids.push(id);\n }\n }\n return ids;\n}\n\nexport function resolveCreatedEntityId(created: unknown): string {\n if (typeof created === 'string' && created.trim()) {\n return created.trim();\n }\n if (created && typeof created === 'object' && 'result' in created) {\n return resolveCreatedEntityId((created as { result: unknown }).result);\n }\n const id = asTrimmedId(created);\n if (!id) {\n throw new Error('Failed to resolve created entity id');\n }\n return id;\n}\n\nexport function isTruthyFlag(value: unknown): boolean {\n return value === true || value === 'true' || value === 1 || value === '1';\n}\n\nexport function asDisplayName(value: unknown): string | undefined {\n const resolved = resolveMultiLanguageString(coerceUnknownToMultiLanguageString(value), 'en-US').trim();\n return resolved || undefined;\n}\n\nexport async function mapWithConcurrency<T, R>(\n items: readonly T[],\n limit: number,\n mapper: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n if (items.length === 0) {\n return [];\n }\n const results: R[] = new Array(items.length);\n let nextIndex = 0;\n const workerCount = Math.min(Math.max(1, limit), items.length);\n await Promise.all(\n Array.from({ length: workerCount }, async () => {\n for (;;) {\n const index = nextIndex;\n nextIndex += 1;\n if (index >= items.length) {\n return;\n }\n results[index] = await mapper(items[index], index);\n }\n }),\n );\n return results;\n}\n\n//#endregion\n"],"names":[],"mappings":";;AAAA;AAIA;AAEA;AAEM,SAAU,WAAW,CAAC,KAAc,EAAA;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AAC7C,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;IACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,EAAE;AACvD,QAAA,MAAM,EAAE,GAAI,KAA0B,CAAC,EAAE;QACzC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;AACvC,YAAA,OAAO,EAAE,CAAC,IAAI,EAAE;QAClB;IACF;AACA,IAAA,OAAO,SAAS;AAClB;AAEM,SAAU,SAAS,CAAC,KAAc,EAAA;IACtC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE;AACjC,QAAA,OAAO,EAAE;IACX;AACA,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK;AAChC,UAAE;AACF,UAAE,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAE,KAAqC,CAAC,aAAa;AACxG,eAAI,KAAsC,CAAC,aAAa;AACxD,cAAE,CAAC,KAAK,CAAC;IACb,MAAM,GAAG,GAAa,EAAE;AACxB,IAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;AACxB,QAAA,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC;QAC3B,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;AAC3B,YAAA,GAAG,CA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,CAAC,MAAM,CAAC;AAC9D,IAAA,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,YAAW;AAC7C,QAAA,SAAS;YACP,MAAM,KAAK,GAAG,SAAS;YACvB,SAAS,IAAI,CAAC;AACd,YAAA,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE;gBACzB;YACF;AACA,YAAA,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;QACpD;IACF,CAAC,CAAC,CACH;AACD,IAAA,OAAO,OAAO;AAChB;AAEA;;"}
@@ -28,7 +28,7 @@ import * as i0 from '@angular/core';
28
28
  import { inject, signal, viewChild, computed, effect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
29
29
  import { RouterModule } from '@angular/router';
30
30
  import { RootConfig } from '@acorex-platform/module-document-management-client/contracts';
31
- import { j as AXMDocumentManagerService, A as AXPDocumentExplorerViewModel, n as AXMDocumentExplorerComponent, o as AXMFolderPathBreadcrumbsComponent } from './acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-DHVvb5hG.mjs';
31
+ import { j as AXMDocumentManagerService, A as AXPDocumentExplorerViewModel, p as AXMDocumentExplorerComponent, q as AXMFolderPathBreadcrumbsComponent } from './acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BiosmCuZ.mjs';
32
32
 
33
33
  class AXMDocumentDriveChooseComponent extends AXBasePageComponent {
34
34
  constructor() {
@@ -258,4 +258,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
258
258
  }], propDecorators: { documentExplorer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXMDocumentExplorerComponent), { isSignal: true }] }] } });
259
259
 
260
260
  export { AXMDocumentDriveChooseComponent };
261
- //# sourceMappingURL=acorex-platform-module-document-management-client-drive-choose.component-B-CVJk4t.mjs.map
261
+ //# sourceMappingURL=acorex-platform-module-document-management-client-drive-choose.component-DxEWAigd.mjs.map