@masterteam/work-center 0.0.23 → 0.0.24
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.
|
@@ -17,18 +17,14 @@ import { DrawerController } from '@masterteam/components/dynamic-drawer';
|
|
|
17
17
|
import { ClientForm } from '@masterteam/forms/client-form';
|
|
18
18
|
import { Action, Selector, State, Store, select } from '@ngxs/store';
|
|
19
19
|
import { HttpClient } from '@angular/common/http';
|
|
20
|
-
import { handleApiRequest
|
|
20
|
+
import { handleApiRequest } from '@masterteam/components';
|
|
21
21
|
import { EntitiesPreview } from '@masterteam/components/entities';
|
|
22
22
|
import { Tabs } from '@masterteam/components/tabs';
|
|
23
23
|
import { DiscussionThread } from '@masterteam/discussion';
|
|
24
24
|
import { StructureBuilder } from '@masterteam/structure-builder';
|
|
25
|
+
import { RuntimeActionContextStore, RuntimeActionRunner, resolveActionLabel } from '@masterteam/components/runtime-action';
|
|
25
26
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
26
27
|
import { Drawer } from '@masterteam/components/drawer';
|
|
27
|
-
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
28
|
-
import { ToastService } from '@masterteam/components/toast';
|
|
29
|
-
import * as i1$1 from '@angular/forms';
|
|
30
|
-
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
31
|
-
import { DynamicForm } from '@masterteam/forms/dynamic-form';
|
|
32
28
|
|
|
33
29
|
class WorkCenterClientFormModal {
|
|
34
30
|
modal = inject(ModalService);
|
|
@@ -1294,7 +1290,7 @@ class WorkCenterEscalationInstanceType {
|
|
|
1294
1290
|
});
|
|
1295
1291
|
}
|
|
1296
1292
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterEscalationInstanceType, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1297
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterEscalationInstanceType, isStandalone: true, selector: "mt-work-center-escalation-instance-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'escalationDetails'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationDetails\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (preview()) {\r\n <mt-entities-preview [entities]=\"detailEntities()\" />\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDetailsUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'schema'\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationSchema\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (hasSchema()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg lg:h-full lg:min-h-0\"\r\n >\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [readonly]=\"true\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaContextUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"'EscalationInstance'\"\r\n [recordId]=\"resolvedInstanceId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }, { kind: "component", type: EntitiesPreview, selector: "mt-entities-preview", inputs: ["entities", "attachmentShape", "clickableKeys", "activeKeys"], outputs: ["entityClick"] }, { kind: "component", type: StructureBuilder, selector: "mt-structure-builder", inputs: ["availableNodes", "availableNodesLabel", "nodeForm", "nodeDialogFooterConfig", "connectionForm", "connectionFormulaSchemaId", "connectionFormulaConfig", "nodeActions", "nodeFields", "isAutoLayout", "readonly", "addModalType", "updateModalType", "addModalStyleClass", "updateModalStyleClass", "addModalHeader", "updateModalHeader", "appendTo", "availableTabsClass", "layoutDirection", "nodes", "connections", "nodeTemplate"], outputs: ["nodeActionsEvent", "action", "nodesChange", "connectionsChange"] }] });
|
|
1293
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterEscalationInstanceType, isStandalone: true, selector: "mt-work-center-escalation-instance-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'escalationDetails'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationDetails\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (preview()) {\r\n <mt-entities-preview [entities]=\"detailEntities()\" />\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDetailsUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'schema'\"\r\n >\r\n @if (canRenderDetails()) {\r\n @if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"loading.escalationSchema\") }}\r\n </p>\r\n </div>\r\n } @else if (error(); as error) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">\r\n {{ error }}\r\n </p>\r\n </div>\r\n } @else if (hasSchema()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg lg:h-full lg:min-h-0\"\r\n >\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [readonly]=\"true\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationSchemaContextUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"'EscalationInstance'\"\r\n [recordId]=\"resolvedInstanceId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.escalationDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }, { kind: "component", type: EntitiesPreview, selector: "mt-entities-preview", inputs: ["entities", "attachmentShape", "clickableKeys", "activeKeys", "clickableTooltip", "activeTooltip"], outputs: ["entityClick"] }, { kind: "component", type: StructureBuilder, selector: "mt-structure-builder", inputs: ["availableNodes", "availableNodesLabel", "nodeForm", "nodeDialogFooterConfig", "connectionForm", "connectionFormulaSchemaId", "connectionFormulaConfig", "nodeActions", "nodeFields", "isAutoLayout", "readonly", "addModalType", "updateModalType", "addModalStyleClass", "updateModalStyleClass", "addModalHeader", "updateModalHeader", "appendTo", "availableTabsClass", "layoutDirection", "nodes", "connections", "nodeTemplate"], outputs: ["nodeActionsEvent", "action", "nodesChange", "connectionsChange"] }] });
|
|
1298
1294
|
}
|
|
1299
1295
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterEscalationInstanceType, decorators: [{
|
|
1300
1296
|
type: Component,
|
|
@@ -1363,31 +1359,9 @@ function readString(value, key) {
|
|
|
1363
1359
|
return typeof result === 'string' && result.length ? result : undefined;
|
|
1364
1360
|
}
|
|
1365
1361
|
|
|
1366
|
-
class WorkCenterItemActionContextStore {
|
|
1367
|
-
clientForm = signal(null, ...(ngDevMode ? [{ debugName: "clientForm" }] : /* istanbul ignore next */ []));
|
|
1368
|
-
setClientForm(clientForm) {
|
|
1369
|
-
this.clientForm.set(clientForm);
|
|
1370
|
-
}
|
|
1371
|
-
resolveFormValues() {
|
|
1372
|
-
const values = this.clientForm()?.getSubmitValues();
|
|
1373
|
-
return Array.isArray(values)
|
|
1374
|
-
? values.map((value) => ({
|
|
1375
|
-
requestPropertyId: value.requestPropertyId,
|
|
1376
|
-
propertyKey: value.propertyKey,
|
|
1377
|
-
value: value.value,
|
|
1378
|
-
}))
|
|
1379
|
-
: [];
|
|
1380
|
-
}
|
|
1381
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemActionContextStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1382
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemActionContextStore });
|
|
1383
|
-
}
|
|
1384
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemActionContextStore, decorators: [{
|
|
1385
|
-
type: Injectable
|
|
1386
|
-
}] });
|
|
1387
|
-
|
|
1388
1362
|
class WorkCenterModuleType {
|
|
1389
1363
|
facade = inject(WorkCenterFacade);
|
|
1390
|
-
actionContext = inject(
|
|
1364
|
+
actionContext = inject(RuntimeActionContextStore, {
|
|
1391
1365
|
optional: true,
|
|
1392
1366
|
});
|
|
1393
1367
|
transloco = inject(TranslocoService);
|
|
@@ -1433,11 +1407,11 @@ class WorkCenterModuleType {
|
|
|
1433
1407
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1434
1408
|
.subscribe((lang) => this.activeLang.set(lang));
|
|
1435
1409
|
effect(() => {
|
|
1436
|
-
this.actionContext?.
|
|
1410
|
+
this.actionContext?.setFormSource(this.clientForm() ?? null);
|
|
1437
1411
|
});
|
|
1438
1412
|
}
|
|
1439
1413
|
ngOnDestroy() {
|
|
1440
|
-
this.actionContext?.
|
|
1414
|
+
this.actionContext?.setFormSource(null);
|
|
1441
1415
|
}
|
|
1442
1416
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterModuleType, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1443
1417
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterModuleType, isStandalone: true, selector: "mt-work-center-module-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "clientForm", first: true, predicate: ClientForm, descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'details'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderForm()) {\r\n <mt-client-form\r\n [moduleKey]=\"moduleKey()\"\r\n [operationKey]=\"operationKey()\"\r\n [moduleId]=\"moduleId()\"\r\n [levelId]=\"levelId()\"\r\n [levelDataId]=\"levelDataId()\"\r\n [moduleDataId]=\"moduleDataId()\"\r\n [readonly]=\"true\"\r\n [lookups]=\"lookups()\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.moduleFormUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"discussionModuleType()\"\r\n [recordId]=\"resolvedInstanceId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.moduleDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: ClientForm, selector: "mt-client-form", inputs: ["moduleKey", "operationKey", "moduleId", "levelId", "levelDataId", "moduleDataId", "requestSchemaId", "draftProcessId", "preview", "returnUrl", "defaultValues", "submitRequestMapper", "readonly", "autoLoad", "formMode", "renderMode", "showInternalStepActions", "confirmWarningsOnSubmit", "confirmWarningsOnStepChange", "lookups", "ignoredFieldKeys"], outputs: ["loaded", "submitted", "errored", "modeDetected", "formSourceDetected", "footerStateChanged"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }] });
|
|
@@ -1563,7 +1537,7 @@ function display(value) {
|
|
|
1563
1537
|
|
|
1564
1538
|
class WorkCenterProcessRequestType {
|
|
1565
1539
|
facade = inject(WorkCenterFacade);
|
|
1566
|
-
actionContext = inject(
|
|
1540
|
+
actionContext = inject(RuntimeActionContextStore, {
|
|
1567
1541
|
optional: true,
|
|
1568
1542
|
});
|
|
1569
1543
|
transloco = inject(TranslocoService);
|
|
@@ -1619,11 +1593,11 @@ class WorkCenterProcessRequestType {
|
|
|
1619
1593
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1620
1594
|
.subscribe((lang) => this.activeLang.set(lang));
|
|
1621
1595
|
effect(() => {
|
|
1622
|
-
this.actionContext?.
|
|
1596
|
+
this.actionContext?.setFormSource(this.clientForm() ?? null);
|
|
1623
1597
|
});
|
|
1624
1598
|
}
|
|
1625
1599
|
ngOnDestroy() {
|
|
1626
|
-
this.actionContext?.
|
|
1600
|
+
this.actionContext?.setFormSource(null);
|
|
1627
1601
|
}
|
|
1628
1602
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterProcessRequestType, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1629
1603
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterProcessRequestType, isStandalone: true, selector: "mt-work-center-process-request-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "clientForm", first: true, predicate: ClientForm, descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'requestDetails'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderForm()) {\r\n <mt-client-form\r\n [moduleKey]=\"moduleKey()\"\r\n [operationKey]=\"operationKey()\"\r\n [moduleId]=\"moduleId()\"\r\n [levelId]=\"levelId()\"\r\n [levelDataId]=\"levelDataId()\"\r\n [moduleDataId]=\"moduleDataId()\"\r\n [requestSchemaId]=\"requestSchemaId()\"\r\n [draftProcessId]=\"draftProcessId()\"\r\n [readonly]=\"true\"\r\n [lookups]=\"lookups()\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.requestFormUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'approvals'\"\r\n >\r\n @if (canRenderPreview()) {\r\n <mt-work-center-process-preview\r\n [requestId]=\"requestId()\"\r\n [view]=\"'approvals'\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.requestPreviewUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'schema'\"\r\n >\r\n @if (canRenderPreview()) {\r\n <mt-work-center-process-preview\r\n [requestId]=\"requestId()\"\r\n [view]=\"'schema'\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.requestPreviewUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"'ProcessRequest'\"\r\n [recordId]=\"discussionRecordId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.requestDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: ClientForm, selector: "mt-client-form", inputs: ["moduleKey", "operationKey", "moduleId", "levelId", "levelDataId", "moduleDataId", "requestSchemaId", "draftProcessId", "preview", "returnUrl", "defaultValues", "submitRequestMapper", "readonly", "autoLoad", "formMode", "renderMode", "showInternalStepActions", "confirmWarningsOnSubmit", "confirmWarningsOnStepChange", "lookups", "ignoredFieldKeys"], outputs: ["loaded", "submitted", "errored", "modeDetected", "formSourceDetected", "footerStateChanged"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }, { kind: "component", type: WorkCenterProcessPreview, selector: "mt-work-center-process-preview", inputs: ["requestId", "view"] }] });
|
|
@@ -1642,7 +1616,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1642
1616
|
|
|
1643
1617
|
class WorkCenterProcessStepType {
|
|
1644
1618
|
facade = inject(WorkCenterFacade);
|
|
1645
|
-
actionContext = inject(
|
|
1619
|
+
actionContext = inject(RuntimeActionContextStore, {
|
|
1646
1620
|
optional: true,
|
|
1647
1621
|
});
|
|
1648
1622
|
transloco = inject(TranslocoService);
|
|
@@ -1698,11 +1672,11 @@ class WorkCenterProcessStepType {
|
|
|
1698
1672
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1699
1673
|
.subscribe((lang) => this.activeLang.set(lang));
|
|
1700
1674
|
effect(() => {
|
|
1701
|
-
this.actionContext?.
|
|
1675
|
+
this.actionContext?.setFormSource(this.clientForm() ?? null);
|
|
1702
1676
|
});
|
|
1703
1677
|
}
|
|
1704
1678
|
ngOnDestroy() {
|
|
1705
|
-
this.actionContext?.
|
|
1679
|
+
this.actionContext?.setFormSource(null);
|
|
1706
1680
|
}
|
|
1707
1681
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterProcessStepType, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1708
1682
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterProcessStepType, isStandalone: true, selector: "mt-work-center-process-step-type", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "clientForm", first: true, predicate: ClientForm, descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n class=\"mt-modal-content flex h-full min-h-0 flex-col gap-4 p-4 lg:overflow-hidden\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <div\r\n class=\"flex flex-1 min-h-0 flex-col gap-4 lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6\"\r\n >\r\n @if (tabOptions().length > 1) {\r\n <mt-tabs\r\n [(active)]=\"activeTab\"\r\n [options]=\"tabOptions()\"\r\n mode=\"vertical\"\r\n size=\"small\"\r\n />\r\n }\r\n\r\n <div class=\"min-w-0 flex-1 min-h-0 lg:overflow-hidden\">\r\n <div\r\n class=\"h-full min-h-0 lg:overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'form'\"\r\n >\r\n <div\r\n class=\"min-w-0 h-full min-h-0 lg:overflow-y-auto lg:overscroll-contain lg:pr-2\"\r\n >\r\n @if (canRenderForm()) {\r\n <mt-client-form\r\n [moduleKey]=\"moduleKey()\"\r\n [operationKey]=\"operationKey()\"\r\n [moduleId]=\"moduleId()\"\r\n [levelId]=\"levelId()\"\r\n [levelDataId]=\"levelDataId()\"\r\n [moduleDataId]=\"moduleDataId()\"\r\n [requestSchemaId]=\"requestSchemaId()\"\r\n [draftProcessId]=\"draftProcessId()\"\r\n [lookups]=\"lookups()\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.processFormUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'approvals'\"\r\n >\r\n @if (canRenderPreview()) {\r\n <mt-work-center-process-preview\r\n [requestId]=\"requestId()\"\r\n [view]=\"'approvals'\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.processPreviewUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"flex-1 min-h-0 overflow-auto\"\r\n [hidden]=\"activeTab() !== 'schema'\"\r\n >\r\n @if (canRenderPreview()) {\r\n <mt-work-center-process-preview\r\n [requestId]=\"requestId()\"\r\n [view]=\"'schema'\"\r\n />\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.processPreviewUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n\r\n <div\r\n class=\"h-full min-h-0 overflow-hidden\"\r\n [hidden]=\"activeTab() !== 'discussion'\"\r\n >\r\n @if (canRenderDiscussion()) {\r\n <div\r\n class=\"h-[32rem] min-h-[22rem] overflow-hidden rounded-lg border border-surface-200 bg-surface-50 lg:h-full lg:min-h-0\"\r\n >\r\n <mt-discussion-thread\r\n [moduleType]=\"'ProcessRequest'\"\r\n [recordId]=\"discussionRecordId()\"\r\n [mentionSearchEndpoint]=\"'Identity/users'\"\r\n [mentionSearchParam]=\"'query'\"\r\n [mentionSearchDataPath]=\"'data'\"\r\n [uploadEndpoint]=\"'uploader'\"\r\n [attachmentDownloadEndpoint]=\"'uploader'\"\r\n [showParticipants]=\"true\"\r\n [autoMarkRead]=\"true\"\r\n [refreshIntervalMs]=\"0\"\r\n [styleClass]=\"'h-full'\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ t(\"context.processDiscussionUnavailable\") }}\r\n </p>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "size", "fluid", "disabled"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: ClientForm, selector: "mt-client-form", inputs: ["moduleKey", "operationKey", "moduleId", "levelId", "levelDataId", "moduleDataId", "requestSchemaId", "draftProcessId", "preview", "returnUrl", "defaultValues", "submitRequestMapper", "readonly", "autoLoad", "formMode", "renderMode", "showInternalStepActions", "confirmWarningsOnSubmit", "confirmWarningsOnStepChange", "lookups", "ignoredFieldKeys"], outputs: ["loaded", "submitted", "errored", "modeDetected", "formSourceDetected", "footerStateChanged"] }, { kind: "component", type: DiscussionThread, selector: "mt-discussion-thread", inputs: ["moduleType", "recordId", "title", "subtitle", "placeholder", "pageSize", "currentUserId", "requestContext", "mentionableUsers", "mentionSearchEndpoint", "mentionSearchParam", "mentionSearchDataPath", "allowAttachments", "uploadEndpoint", "attachmentDownloadEndpoint", "showParticipants", "autoMarkRead", "refreshIntervalMs", "styleClass", "disabled"], outputs: ["loaded", "errored", "commentCreated", "commentUpdated", "commentDeleted", "readStateChanged"] }, { kind: "component", type: WorkCenterProcessPreview, selector: "mt-work-center-process-preview", inputs: ["requestId", "view"] }] });
|
|
@@ -1738,164 +1712,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1738
1712
|
}, template: "<ng-container *transloco=\"let t; prefix: 'workCenter'\">\r\n @if (details().type === \"ProcessStep\") {\r\n <mt-work-center-process-step-type [details]=\"details()\" />\r\n } @else if (details().type === \"ProcessRequest\") {\r\n <mt-work-center-process-request-type [details]=\"details()\" />\r\n } @else if (details().type === \"EscalationInstance\") {\r\n <mt-work-center-escalation-instance-type [details]=\"details()\" />\r\n } @else if (details().type === \"Module\") {\r\n <mt-work-center-module-type [details]=\"details()\" />\r\n } @else {\r\n <div class=\"mt-modal-content flex h-full items-center justify-center p-4\">\r\n <p class=\"text-sm text-surface-500\">{{ t(\"modal.unsupportedType\") }}</p>\r\n </div>\r\n }\r\n</ng-container>\r\n" }]
|
|
1739
1713
|
}], propDecorators: { details: [{ type: i0.Input, args: [{ isSignal: true, alias: "details", required: true }] }] } });
|
|
1740
1714
|
|
|
1741
|
-
class WorkCenterItemActionConfirmDialog {
|
|
1742
|
-
ref = inject(ModalRef);
|
|
1743
|
-
modal = inject(ModalService);
|
|
1744
|
-
transloco = inject(TranslocoService);
|
|
1745
|
-
destroyRef = inject(DestroyRef);
|
|
1746
|
-
activeLang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "activeLang" }] : /* istanbul ignore next */ []));
|
|
1747
|
-
action = input.required(...(ngDevMode ? [{ debugName: "action" }] : /* istanbul ignore next */ []));
|
|
1748
|
-
formControl = new FormControl({});
|
|
1749
|
-
actionLabel = computed(() => this.action().actionName?.display || this.action().actionKey, ...(ngDevMode ? [{ debugName: "actionLabel" }] : /* istanbul ignore next */ []));
|
|
1750
|
-
formConfig = computed(() => {
|
|
1751
|
-
this.activeLang();
|
|
1752
|
-
return {
|
|
1753
|
-
sections: [
|
|
1754
|
-
{
|
|
1755
|
-
key: 'action-confirmation',
|
|
1756
|
-
type: 'none',
|
|
1757
|
-
fields: buildActionFields(this.action(), (key) => this.transloco.translate(key)),
|
|
1758
|
-
},
|
|
1759
|
-
],
|
|
1760
|
-
};
|
|
1761
|
-
}, ...(ngDevMode ? [{ debugName: "formConfig" }] : /* istanbul ignore next */ []));
|
|
1762
|
-
hasFormFields = computed(() => this.formConfig().sections[0]?.fields.length > 0, ...(ngDevMode ? [{ debugName: "hasFormFields" }] : /* istanbul ignore next */ []));
|
|
1763
|
-
constructor() {
|
|
1764
|
-
this.transloco.langChanges$
|
|
1765
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1766
|
-
.subscribe((lang) => this.activeLang.set(lang));
|
|
1767
|
-
}
|
|
1768
|
-
onCancel() {
|
|
1769
|
-
this.ref.close(null);
|
|
1770
|
-
}
|
|
1771
|
-
onConfirm() {
|
|
1772
|
-
if (this.formControl.invalid) {
|
|
1773
|
-
this.formControl.markAllAsTouched();
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
this.ref.close(this.formControl.getRawValue() ?? {});
|
|
1777
|
-
}
|
|
1778
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemActionConfirmDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1779
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterItemActionConfirmDialog, isStandalone: true, selector: "mt-work-center-item-action-confirm-dialog", inputs: { action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'workCenter'\">\r\n <div [class]=\"modal.contentClass + ' p-4'\">\r\n @if (hasFormFields()) {\r\n <mt-dynamic-form\r\n [formConfig]=\"formConfig()\"\r\n [formControl]=\"formControl\"\r\n />\r\n } @else {\r\n <p class=\"text-sm text-surface-500\">\r\n {{ t(\"modal.confirmAction\", { action: actionLabel() }) }}\r\n </p>\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('modal.cancel')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"onCancel()\"\r\n />\r\n <mt-button [label]=\"actionLabel()\" (onClick)=\"onConfirm()\" />\r\n </div>\r\n</ng-container>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: DynamicForm, selector: "mt-dynamic-form", inputs: ["formConfig", "forcedHiddenFieldKeys", "preserveForcedHiddenValues", "visibleSectionKeys"], outputs: ["runtimeMessagesChange"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }] });
|
|
1780
|
-
}
|
|
1781
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemActionConfirmDialog, decorators: [{
|
|
1782
|
-
type: Component,
|
|
1783
|
-
args: [{ selector: 'mt-work-center-item-action-confirm-dialog', standalone: true, imports: [
|
|
1784
|
-
CommonModule,
|
|
1785
|
-
ReactiveFormsModule,
|
|
1786
|
-
TranslocoDirective,
|
|
1787
|
-
DynamicForm,
|
|
1788
|
-
Button,
|
|
1789
|
-
], template: "<ng-container *transloco=\"let t; prefix: 'workCenter'\">\r\n <div [class]=\"modal.contentClass + ' p-4'\">\r\n @if (hasFormFields()) {\r\n <mt-dynamic-form\r\n [formConfig]=\"formConfig()\"\r\n [formControl]=\"formControl\"\r\n />\r\n } @else {\r\n <p class=\"text-sm text-surface-500\">\r\n {{ t(\"modal.confirmAction\", { action: actionLabel() }) }}\r\n </p>\r\n }\r\n </div>\r\n\r\n <div [class]=\"modal.footerClass\">\r\n <mt-button\r\n [label]=\"t('modal.cancel')\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n (onClick)=\"onCancel()\"\r\n />\r\n <mt-button [label]=\"actionLabel()\" (onClick)=\"onConfirm()\" />\r\n </div>\r\n</ng-container>\r\n" }]
|
|
1790
|
-
}], ctorParameters: () => [], propDecorators: { action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: true }] }] } });
|
|
1791
|
-
function buildActionFields(action, t) {
|
|
1792
|
-
const requestedKeys = new Set(action.payloadKeys ?? []);
|
|
1793
|
-
const requiredKeys = new Set(action.requiredPayloadKeys ?? []);
|
|
1794
|
-
const fields = [];
|
|
1795
|
-
const progressField = resolveProgressField(action);
|
|
1796
|
-
if (progressField) {
|
|
1797
|
-
fields.push({
|
|
1798
|
-
key: 'progress',
|
|
1799
|
-
type: 'slider',
|
|
1800
|
-
label: t('workCenter.field.progress'),
|
|
1801
|
-
min: 0,
|
|
1802
|
-
max: 100,
|
|
1803
|
-
step: 1,
|
|
1804
|
-
unit: '%',
|
|
1805
|
-
validators: buildRequiredValidators(requiredKeys.has('fields')),
|
|
1806
|
-
defaultValue: progressField.value,
|
|
1807
|
-
colSpan: 12,
|
|
1808
|
-
});
|
|
1809
|
-
}
|
|
1810
|
-
if (requestedKeys.has('delegatedUser')) {
|
|
1811
|
-
fields.push({
|
|
1812
|
-
key: 'delegatedUser',
|
|
1813
|
-
type: 'user-search',
|
|
1814
|
-
label: t('workCenter.field.delegatedUser'),
|
|
1815
|
-
placeholder: t('workCenter.field.delegatedUserPlaceholder'),
|
|
1816
|
-
apiUrl: 'Identity/users',
|
|
1817
|
-
optionLabel: 'displayName',
|
|
1818
|
-
optionValue: 'id',
|
|
1819
|
-
validators: buildRequiredValidators(requiredKeys.has('delegatedUser')),
|
|
1820
|
-
colSpan: 12,
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
if (requestedKeys.has('reason')) {
|
|
1824
|
-
fields.push({
|
|
1825
|
-
key: 'reason',
|
|
1826
|
-
type: 'textarea',
|
|
1827
|
-
label: t('workCenter.field.reason'),
|
|
1828
|
-
placeholder: t('workCenter.field.reasonPlaceholder'),
|
|
1829
|
-
rows: 4,
|
|
1830
|
-
validators: buildRequiredValidators(requiredKeys.has('reason')),
|
|
1831
|
-
colSpan: 12,
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
if (requestedKeys.has('note')) {
|
|
1835
|
-
fields.push({
|
|
1836
|
-
key: 'note',
|
|
1837
|
-
type: 'textarea',
|
|
1838
|
-
label: t('workCenter.field.note'),
|
|
1839
|
-
placeholder: t('workCenter.field.notePlaceholder'),
|
|
1840
|
-
rows: 4,
|
|
1841
|
-
validators: buildRequiredValidators(requiredKeys.has('note')),
|
|
1842
|
-
colSpan: 12,
|
|
1843
|
-
});
|
|
1844
|
-
}
|
|
1845
|
-
if (requestedKeys.has('attachments')) {
|
|
1846
|
-
fields.push({
|
|
1847
|
-
key: 'attachments',
|
|
1848
|
-
type: 'upload-file',
|
|
1849
|
-
label: t('workCenter.field.attachments'),
|
|
1850
|
-
endPoint: 'uploader',
|
|
1851
|
-
multiple: true,
|
|
1852
|
-
title: t('workCenter.field.uploadTitle'),
|
|
1853
|
-
description: t('workCenter.field.uploadDescription'),
|
|
1854
|
-
validators: buildRequiredValidators(requiredKeys.has('attachments')),
|
|
1855
|
-
colSpan: 12,
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
return fields;
|
|
1859
|
-
}
|
|
1860
|
-
function buildRequiredValidators(required) {
|
|
1861
|
-
return required ? [ValidatorConfig.required()] : [];
|
|
1862
|
-
}
|
|
1863
|
-
function resolveProgressField(action) {
|
|
1864
|
-
const fields = action.payloadTemplate
|
|
1865
|
-
?.fields;
|
|
1866
|
-
if (!Array.isArray(fields)) {
|
|
1867
|
-
return null;
|
|
1868
|
-
}
|
|
1869
|
-
const progressField = fields.find((field) => !!field &&
|
|
1870
|
-
typeof field === 'object' &&
|
|
1871
|
-
field.propertyKey === 'Progress');
|
|
1872
|
-
if (!progressField) {
|
|
1873
|
-
return null;
|
|
1874
|
-
}
|
|
1875
|
-
return {
|
|
1876
|
-
value: normalizeProgressValue(progressField.value),
|
|
1877
|
-
};
|
|
1878
|
-
}
|
|
1879
|
-
function normalizeProgressValue(value) {
|
|
1880
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
1881
|
-
return value;
|
|
1882
|
-
}
|
|
1883
|
-
if (typeof value !== 'string') {
|
|
1884
|
-
return undefined;
|
|
1885
|
-
}
|
|
1886
|
-
const normalized = Number(value.replace('%', '').trim());
|
|
1887
|
-
return Number.isFinite(normalized) ? normalized : undefined;
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
1715
|
class WorkCenterItemModalFooterActions {
|
|
1891
1716
|
http = inject(HttpClient);
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
toast = inject(ToastService);
|
|
1895
|
-
actionContext = inject(WorkCenterItemActionContextStore);
|
|
1717
|
+
runner = inject(RuntimeActionRunner);
|
|
1718
|
+
actionContext = inject(RuntimeActionContextStore);
|
|
1896
1719
|
loadSub;
|
|
1897
|
-
executeSub;
|
|
1898
1720
|
lastContextKey = null;
|
|
1721
|
+
currentExecution = null;
|
|
1899
1722
|
contextKey = input(null, ...(ngDevMode ? [{ debugName: "contextKey" }] : /* istanbul ignore next */ []));
|
|
1900
1723
|
actionExecuted = output();
|
|
1901
1724
|
visibilityChange = output();
|
|
@@ -1911,7 +1734,7 @@ class WorkCenterItemModalFooterActions {
|
|
|
1911
1734
|
!!normalizeMethod(action.httpMethod))
|
|
1912
1735
|
.map((action, index) => ({
|
|
1913
1736
|
...action,
|
|
1914
|
-
label: action
|
|
1737
|
+
label: resolveActionLabel(action),
|
|
1915
1738
|
severity: resolveActionSeverity(action.actionKey, index),
|
|
1916
1739
|
variant: resolveActionVariant(action.actionKey, index),
|
|
1917
1740
|
})), ...(ngDevMode ? [{ debugName: "displayActions" }] : /* istanbul ignore next */ []));
|
|
@@ -1945,192 +1768,47 @@ class WorkCenterItemModalFooterActions {
|
|
|
1945
1768
|
}
|
|
1946
1769
|
ngOnDestroy() {
|
|
1947
1770
|
this.loadSub?.unsubscribe();
|
|
1948
|
-
this.
|
|
1949
|
-
|
|
1950
|
-
executeAction(action) {
|
|
1951
|
-
const contextKey = this.contextKey();
|
|
1952
|
-
const method = normalizeMethod(action.httpMethod);
|
|
1953
|
-
const url = action.url?.trim();
|
|
1954
|
-
if (!contextKey ||
|
|
1955
|
-
!method ||
|
|
1956
|
-
!url ||
|
|
1957
|
-
action.isAvailable === false ||
|
|
1958
|
-
!!this.pendingActionKey()) {
|
|
1959
|
-
return;
|
|
1771
|
+
if (this.currentExecution) {
|
|
1772
|
+
this.currentExecution.cancelled = true;
|
|
1960
1773
|
}
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
}
|
|
1965
|
-
else {
|
|
1966
|
-
this.openSharedConfirmationDialog(action, method, url);
|
|
1967
|
-
}
|
|
1968
|
-
return;
|
|
1969
|
-
}
|
|
1970
|
-
const payload = this.buildActionPayload(action);
|
|
1971
|
-
if (!this.ensurePayloadIsReady(action, payload)) {
|
|
1774
|
+
}
|
|
1775
|
+
async executeAction(action) {
|
|
1776
|
+
if (this.pendingActionKey()) {
|
|
1972
1777
|
return;
|
|
1973
1778
|
}
|
|
1974
|
-
this.runActionRequest(action, method, url, payload);
|
|
1975
|
-
}
|
|
1976
|
-
openConfirmationDialog(action) {
|
|
1977
|
-
const ref = this.modal.openModal(WorkCenterItemActionConfirmDialog, 'dialog', {
|
|
1978
|
-
header: action.label,
|
|
1979
|
-
width: '40rem',
|
|
1980
|
-
dismissableMask: true,
|
|
1981
|
-
inputValues: {
|
|
1982
|
-
action,
|
|
1983
|
-
},
|
|
1984
|
-
});
|
|
1985
|
-
ref.onClose
|
|
1986
|
-
.pipe(take(1))
|
|
1987
|
-
.subscribe((formValue) => {
|
|
1988
|
-
if (formValue == null) {
|
|
1989
|
-
return;
|
|
1990
|
-
}
|
|
1991
|
-
const method = normalizeMethod(action.httpMethod);
|
|
1992
|
-
const url = action.url?.trim();
|
|
1993
|
-
if (!method || !url) {
|
|
1994
|
-
return;
|
|
1995
|
-
}
|
|
1996
|
-
const payload = this.buildActionPayload(action, formValue);
|
|
1997
|
-
if (!this.ensurePayloadIsReady(action, payload)) {
|
|
1998
|
-
return;
|
|
1999
|
-
}
|
|
2000
|
-
this.runActionRequest(action, method, url, payload);
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
openSharedConfirmationDialog(action, method, url) {
|
|
2004
|
-
this.confirmation.confirm({
|
|
2005
|
-
type: 'dialog',
|
|
2006
|
-
header: action.label,
|
|
2007
|
-
message: `Confirm ${action.label} for this item.`,
|
|
2008
|
-
acceptLabel: action.label,
|
|
2009
|
-
icon: 'alert.alert-triangle',
|
|
2010
|
-
acceptButton: {
|
|
2011
|
-
severity: action.severity,
|
|
2012
|
-
variant: undefined,
|
|
2013
|
-
},
|
|
2014
|
-
rejectButton: {
|
|
2015
|
-
severity: 'primary',
|
|
2016
|
-
variant: 'text',
|
|
2017
|
-
},
|
|
2018
|
-
accept: () => {
|
|
2019
|
-
const payload = this.buildActionPayload(action);
|
|
2020
|
-
if (!this.ensurePayloadIsReady(action, payload)) {
|
|
2021
|
-
return;
|
|
2022
|
-
}
|
|
2023
|
-
this.runActionRequest(action, method, url, payload);
|
|
2024
|
-
},
|
|
2025
|
-
});
|
|
2026
|
-
}
|
|
2027
|
-
runActionRequest(action, method, url, payload) {
|
|
2028
1779
|
this.error.set(null);
|
|
2029
1780
|
this.pendingActionKey.set(action.actionKey);
|
|
2030
|
-
|
|
2031
|
-
this.
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
const afterSuccess = resolveActionAfterSuccess(action);
|
|
2037
|
-
this.pendingActionKey.set(null);
|
|
2038
|
-
if (afterSuccess === 'refresh') {
|
|
2039
|
-
this.reloadTick.update((value) => value + 1);
|
|
2040
|
-
}
|
|
2041
|
-
this.actionExecuted.emit({
|
|
2042
|
-
actionKey: action.actionKey,
|
|
2043
|
-
afterSuccess,
|
|
2044
|
-
});
|
|
2045
|
-
},
|
|
2046
|
-
error: (error) => {
|
|
2047
|
-
const message = resolveHttpErrorMessage(error, `Failed to execute ${action.label}.`);
|
|
2048
|
-
this.pendingActionKey.set(null);
|
|
2049
|
-
this.error.set(message);
|
|
2050
|
-
this.toast.error(message);
|
|
1781
|
+
const execution = { actionKey: action.actionKey, cancelled: false };
|
|
1782
|
+
this.currentExecution = execution;
|
|
1783
|
+
const result = await this.runner.execute(action, {
|
|
1784
|
+
defaultAfterSuccess: 'refresh',
|
|
1785
|
+
externalPayloadResolvers: {
|
|
1786
|
+
values: () => this.actionContext.resolveFormValues(),
|
|
2051
1787
|
},
|
|
2052
1788
|
});
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
const templatePayload = this.buildTemplatePayload(action, formValue);
|
|
2056
|
-
if (templatePayload) {
|
|
2057
|
-
return templatePayload;
|
|
2058
|
-
}
|
|
2059
|
-
const payloadKeys = action.payloadKeys ?? [];
|
|
2060
|
-
if (!payloadKeys.length) {
|
|
2061
|
-
return undefined;
|
|
2062
|
-
}
|
|
2063
|
-
const payload = {};
|
|
2064
|
-
for (const key of payloadKeys) {
|
|
2065
|
-
const formFieldValue = formValue?.[key];
|
|
2066
|
-
if (formFieldValue !== undefined) {
|
|
2067
|
-
payload[key] = normalizePayloadValue(key, formFieldValue);
|
|
2068
|
-
continue;
|
|
2069
|
-
}
|
|
2070
|
-
const externalValue = this.resolveExternalPayloadValue(key, action);
|
|
2071
|
-
if (externalValue !== undefined) {
|
|
2072
|
-
payload[key] = externalValue;
|
|
2073
|
-
continue;
|
|
2074
|
-
}
|
|
2075
|
-
const defaultValue = resolveDefaultPayloadValue(key);
|
|
2076
|
-
if (defaultValue !== undefined) {
|
|
2077
|
-
payload[key] = defaultValue;
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
return Object.keys(payload).length ? payload : undefined;
|
|
2081
|
-
}
|
|
2082
|
-
buildTemplatePayload(action, formValue) {
|
|
2083
|
-
const template = action.payloadTemplate;
|
|
2084
|
-
if (!template || typeof template !== 'object') {
|
|
2085
|
-
return null;
|
|
1789
|
+
if (execution.cancelled) {
|
|
1790
|
+
return;
|
|
2086
1791
|
}
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
payload[key] = resolveTemplateFieldsValue(action, template, formValue);
|
|
2092
|
-
continue;
|
|
2093
|
-
}
|
|
2094
|
-
const formFieldValue = formValue?.[key];
|
|
2095
|
-
if (formFieldValue !== undefined) {
|
|
2096
|
-
payload[key] = normalizePayloadValue(key, formFieldValue);
|
|
2097
|
-
continue;
|
|
2098
|
-
}
|
|
2099
|
-
const externalValue = this.resolveExternalPayloadValue(key, action);
|
|
2100
|
-
if (externalValue !== undefined) {
|
|
2101
|
-
payload[key] = externalValue;
|
|
2102
|
-
continue;
|
|
2103
|
-
}
|
|
2104
|
-
if (template[key] !== undefined) {
|
|
2105
|
-
payload[key] = template[key];
|
|
2106
|
-
continue;
|
|
2107
|
-
}
|
|
2108
|
-
const defaultValue = resolveDefaultPayloadValue(key);
|
|
2109
|
-
if (defaultValue !== undefined) {
|
|
2110
|
-
payload[key] = defaultValue;
|
|
2111
|
-
}
|
|
1792
|
+
this.pendingActionKey.set(null);
|
|
1793
|
+
this.currentExecution = null;
|
|
1794
|
+
if (result.status === 'cancelled') {
|
|
1795
|
+
return;
|
|
2112
1796
|
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
return
|
|
1797
|
+
if (result.status === 'error') {
|
|
1798
|
+
const message = result.error instanceof Error
|
|
1799
|
+
? result.error.message
|
|
1800
|
+
: `Failed to execute ${action.label}.`;
|
|
1801
|
+
this.error.set(message);
|
|
1802
|
+
return;
|
|
2119
1803
|
}
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
return false;
|
|
2124
|
-
}
|
|
2125
|
-
resolveExternalPayloadValue(key, action) {
|
|
2126
|
-
switch (key) {
|
|
2127
|
-
case 'stepId':
|
|
2128
|
-
return action.stepIds?.[0];
|
|
2129
|
-
case 'values':
|
|
2130
|
-
return this.actionContext.resolveFormValues();
|
|
2131
|
-
default:
|
|
2132
|
-
return undefined;
|
|
1804
|
+
const afterSuccess = result.afterSuccess ?? 'refresh';
|
|
1805
|
+
if (afterSuccess === 'refresh') {
|
|
1806
|
+
this.reloadTick.update((value) => value + 1);
|
|
2133
1807
|
}
|
|
1808
|
+
this.actionExecuted.emit({
|
|
1809
|
+
actionKey: result.actionKey,
|
|
1810
|
+
afterSuccess,
|
|
1811
|
+
});
|
|
2134
1812
|
}
|
|
2135
1813
|
loadActions(contextKey) {
|
|
2136
1814
|
this.loadSub?.unsubscribe();
|
|
@@ -2169,18 +1847,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
2169
1847
|
class: 'flex w-full flex-1 flex-wrap items-center justify-end gap-2',
|
|
2170
1848
|
}, template: "<ng-container *transloco=\"let t; prefix: 'workCenter'\">\r\n @if (shouldRender()) {\r\n @if (error(); as error) {\r\n <span class=\"me-auto max-w-md text-sm text-red-600\">\r\n {{ error }}\r\n </span>\r\n } @else if (loading() && !displayActions().length) {\r\n <span class=\"me-auto text-sm text-surface-500\">{{\r\n t(\"modal.loadingActions\")\r\n }}</span>\r\n }\r\n\r\n @for (action of displayActions(); track action.actionKey + action.url) {\r\n <mt-button\r\n [label]=\"action.label\"\r\n [severity]=\"action.severity\"\r\n [variant]=\"action.variant\"\r\n [disabled]=\"loading() || !!pendingActionKey()\"\r\n [loading]=\"pendingActionKey() === action.actionKey\"\r\n (onClick)=\"executeAction(action)\"\r\n />\r\n }\r\n }\r\n</ng-container>\r\n" }]
|
|
2171
1849
|
}], ctorParameters: () => [], propDecorators: { contextKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextKey", required: false }] }], actionExecuted: [{ type: i0.Output, args: ["actionExecuted"] }], visibilityChange: [{ type: i0.Output, args: ["visibilityChange"] }] } });
|
|
2172
|
-
function buildRequestOptions(method, payload) {
|
|
2173
|
-
if (!payload || !methodSupportsBody(method)) {
|
|
2174
|
-
return { observe: 'body' };
|
|
2175
|
-
}
|
|
2176
|
-
return {
|
|
2177
|
-
body: payload,
|
|
2178
|
-
observe: 'body',
|
|
2179
|
-
};
|
|
2180
|
-
}
|
|
2181
|
-
function methodSupportsBody(method) {
|
|
2182
|
-
return ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);
|
|
2183
|
-
}
|
|
2184
1850
|
function normalizeMethod(value) {
|
|
2185
1851
|
if (!value || typeof value !== 'string') {
|
|
2186
1852
|
return null;
|
|
@@ -2188,72 +1854,6 @@ function normalizeMethod(value) {
|
|
|
2188
1854
|
const method = value.trim().toUpperCase();
|
|
2189
1855
|
return method.length ? method : null;
|
|
2190
1856
|
}
|
|
2191
|
-
function normalizePayloadValue(key, value) {
|
|
2192
|
-
if (key === 'attachments') {
|
|
2193
|
-
if (value == null) {
|
|
2194
|
-
return [];
|
|
2195
|
-
}
|
|
2196
|
-
return Array.isArray(value) ? value : [value];
|
|
2197
|
-
}
|
|
2198
|
-
return value;
|
|
2199
|
-
}
|
|
2200
|
-
function hasActionFormFields(action) {
|
|
2201
|
-
return ((action.payloadKeys ?? []).some((key) => ['delegatedUser', 'reason', 'note', 'attachments'].includes(key)) || hasProgressTemplateField(action));
|
|
2202
|
-
}
|
|
2203
|
-
function resolveTemplateFieldsValue(action, template, formValue) {
|
|
2204
|
-
const templateFields = template['fields'];
|
|
2205
|
-
if (!Array.isArray(templateFields)) {
|
|
2206
|
-
return formValue?.['fields'] ?? templateFields;
|
|
2207
|
-
}
|
|
2208
|
-
if (!hasProgressTemplateField(action)) {
|
|
2209
|
-
return formValue?.['fields'] ?? templateFields;
|
|
2210
|
-
}
|
|
2211
|
-
return templateFields.map((field) => {
|
|
2212
|
-
if (!field ||
|
|
2213
|
-
typeof field !== 'object' ||
|
|
2214
|
-
field.propertyKey !== 'Progress') {
|
|
2215
|
-
return field;
|
|
2216
|
-
}
|
|
2217
|
-
return {
|
|
2218
|
-
...field,
|
|
2219
|
-
value: formValue?.['progress'] ?? field.value,
|
|
2220
|
-
};
|
|
2221
|
-
});
|
|
2222
|
-
}
|
|
2223
|
-
function hasProgressTemplateField(action) {
|
|
2224
|
-
const fields = action.payloadTemplate
|
|
2225
|
-
?.fields;
|
|
2226
|
-
return (Array.isArray(fields) &&
|
|
2227
|
-
fields.some((field) => !!field &&
|
|
2228
|
-
typeof field === 'object' &&
|
|
2229
|
-
field.propertyKey === 'Progress'));
|
|
2230
|
-
}
|
|
2231
|
-
function resolveDefaultPayloadValue(key) {
|
|
2232
|
-
switch (key) {
|
|
2233
|
-
case 'attachments':
|
|
2234
|
-
return [];
|
|
2235
|
-
case 'delegatedUser':
|
|
2236
|
-
case 'note':
|
|
2237
|
-
case 'reason':
|
|
2238
|
-
return null;
|
|
2239
|
-
case 'values':
|
|
2240
|
-
return [];
|
|
2241
|
-
default:
|
|
2242
|
-
return undefined;
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
function isMissingPayloadValue(value) {
|
|
2246
|
-
if (value == null) {
|
|
2247
|
-
return true;
|
|
2248
|
-
}
|
|
2249
|
-
if (typeof value === 'string') {
|
|
2250
|
-
return value.trim().length === 0;
|
|
2251
|
-
}
|
|
2252
|
-
if (Array.isArray(value)) {
|
|
2253
|
-
return value.length === 0;
|
|
2254
|
-
}
|
|
2255
|
-
return false;
|
|
2256
|
-
}
|
|
2257
1857
|
function resolveActionSeverity(actionKey, index) {
|
|
2258
1858
|
const normalized = actionKey.trim().toLowerCase();
|
|
2259
1859
|
if (normalized === 'approve') {
|
|
@@ -2273,24 +1873,11 @@ function resolveActionVariant(actionKey, index) {
|
|
|
2273
1873
|
? undefined
|
|
2274
1874
|
: 'outlined';
|
|
2275
1875
|
}
|
|
2276
|
-
function resolveActionAfterSuccess(action) {
|
|
2277
|
-
return action.afterSuccess === 'close' ? 'close' : 'refresh';
|
|
2278
|
-
}
|
|
2279
1876
|
function resolveEnvelopeErrorMessage(response, fallback) {
|
|
2280
1877
|
return (response?.errors?.message ??
|
|
2281
1878
|
response?.message ??
|
|
2282
1879
|
fallback);
|
|
2283
1880
|
}
|
|
2284
|
-
function resolveActionSuccessMessage(response, fallback) {
|
|
2285
|
-
if (!response || typeof response !== 'object') {
|
|
2286
|
-
return fallback;
|
|
2287
|
-
}
|
|
2288
|
-
const apiResponse = response;
|
|
2289
|
-
if (typeof apiResponse.code === 'number' && apiResponse.code !== 1) {
|
|
2290
|
-
throw new Error(resolveEnvelopeErrorMessage(apiResponse, fallback));
|
|
2291
|
-
}
|
|
2292
|
-
return apiResponse.message?.trim() || fallback;
|
|
2293
|
-
}
|
|
2294
1881
|
function resolveHttpErrorMessage(error, fallback) {
|
|
2295
1882
|
if (!error || typeof error !== 'object') {
|
|
2296
1883
|
return fallback;
|
|
@@ -2440,7 +2027,7 @@ class WorkCenterItemModalRoute {
|
|
|
2440
2027
|
: null;
|
|
2441
2028
|
}
|
|
2442
2029
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemModalRoute, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2443
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterItemModalRoute, isStandalone: true, selector: "mt-work-center-item-modal-route", inputs: { contextKey: { classPropertyName: "contextKey", publicName: "contextKey", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2030
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: WorkCenterItemModalRoute, isStandalone: true, selector: "mt-work-center-item-modal-route", inputs: { contextKey: { classPropertyName: "contextKey", publicName: "contextKey", isSignal: true, isRequired: false, transformFunction: null } }, providers: [RuntimeActionContextStore], ngImport: i0, template: "<mt-drawer\r\n [visible]=\"drawerVisible()\"\r\n [loadingHeader]=\"loading()\"\r\n [title]=\"drawerTitle()\"\r\n [subtitle]=\"drawerSubtitle()\"\r\n styleClass=\"mt-work-center-item-drawer !absolute !w-[96vw] md:!w-[84vw] xl:!w-[70vw]\"\r\n position=\"right\"\r\n [modal]=\"true\"\r\n (visibleChange)=\"onVisibleChange($event)\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <ng-container content>\r\n @if (loading()) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] flex-col gap-5\">\r\n <div class=\"flex items-center gap-3\">\r\n <p-skeleton shape=\"circle\" size=\"3rem\" />\r\n <div class=\"flex flex-1 flex-col gap-2\">\r\n <p-skeleton width=\"12rem\" height=\"1rem\" />\r\n <p-skeleton width=\"8rem\" height=\"0.875rem\" />\r\n </div>\r\n </div>\r\n\r\n <div class=\"grid gap-3 md:grid-cols-2\">\r\n @for (_ of [1, 2, 3, 4]; track $index) {\r\n <p-skeleton height=\"5rem\" class=\"rounded-lg\" />\r\n }\r\n </div>\r\n\r\n <p-skeleton height=\"16rem\" class=\"rounded-lg\" />\r\n </div>\r\n </div>\r\n } @else if (error(); as errorMessage) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"max-w-xl text-sm font-medium text-red-600\">\r\n {{ errorMessage }}\r\n </p>\r\n </div>\r\n </div>\r\n } @else if (details(); as details) {\r\n <div [class]=\"modal.contentClass + ' h-full min-h-0'\">\r\n <mt-work-center-item-modal [details]=\"details\" />\r\n </div>\r\n } @else {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"text-sm font-medium text-surface-500\">\r\n {{ t(\"modal.noItemSelected\") }}\r\n </p>\r\n </div>\r\n </div>\r\n }\r\n </ng-container>\r\n\r\n @if (footerActionsMounted()) {\r\n <div footer [class]=\"modal.footerClass\">\r\n <mt-work-center-item-modal-footer-actions\r\n [contextKey]=\"resolvedContextKey()\"\r\n (actionExecuted)=\"onActionExecuted($event)\"\r\n (visibilityChange)=\"onFooterVisibilityChange($event)\"\r\n />\r\n </div>\r\n }\r\n</mt-drawer>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: Drawer, selector: "mt-drawer", inputs: ["visible", "position", "fullScreen", "closeOnEscape", "blockScroll", "dismissible", "title", "subtitle", "loadingHeader", "styleClass", "transitionOptions", "appendTo", "modal", "showMaximizeToggle", "maximizeTooltip", "restoreTooltip", "maximized"], outputs: ["visibleChange", "onShow", "onHide", "maximizedChange"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: WorkCenterItemModal, selector: "mt-work-center-item-modal", inputs: ["details"] }, { kind: "component", type: WorkCenterItemModalFooterActions, selector: "mt-work-center-item-modal-footer-actions", inputs: ["contextKey"], outputs: ["actionExecuted", "visibilityChange"] }] });
|
|
2444
2031
|
}
|
|
2445
2032
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: WorkCenterItemModalRoute, decorators: [{
|
|
2446
2033
|
type: Component,
|
|
@@ -2451,7 +2038,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
2451
2038
|
SkeletonModule,
|
|
2452
2039
|
WorkCenterItemModal,
|
|
2453
2040
|
WorkCenterItemModalFooterActions,
|
|
2454
|
-
], providers: [
|
|
2041
|
+
], providers: [RuntimeActionContextStore], template: "<mt-drawer\r\n [visible]=\"drawerVisible()\"\r\n [loadingHeader]=\"loading()\"\r\n [title]=\"drawerTitle()\"\r\n [subtitle]=\"drawerSubtitle()\"\r\n styleClass=\"mt-work-center-item-drawer !absolute !w-[96vw] md:!w-[84vw] xl:!w-[70vw]\"\r\n position=\"right\"\r\n [modal]=\"true\"\r\n (visibleChange)=\"onVisibleChange($event)\"\r\n *transloco=\"let t; prefix: 'workCenter'\"\r\n>\r\n <ng-container content>\r\n @if (loading()) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] flex-col gap-5\">\r\n <div class=\"flex items-center gap-3\">\r\n <p-skeleton shape=\"circle\" size=\"3rem\" />\r\n <div class=\"flex flex-1 flex-col gap-2\">\r\n <p-skeleton width=\"12rem\" height=\"1rem\" />\r\n <p-skeleton width=\"8rem\" height=\"0.875rem\" />\r\n </div>\r\n </div>\r\n\r\n <div class=\"grid gap-3 md:grid-cols-2\">\r\n @for (_ of [1, 2, 3, 4]; track $index) {\r\n <p-skeleton height=\"5rem\" class=\"rounded-lg\" />\r\n }\r\n </div>\r\n\r\n <p-skeleton height=\"16rem\" class=\"rounded-lg\" />\r\n </div>\r\n </div>\r\n } @else if (error(); as errorMessage) {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"max-w-xl text-sm font-medium text-red-600\">\r\n {{ errorMessage }}\r\n </p>\r\n </div>\r\n </div>\r\n } @else if (details(); as details) {\r\n <div [class]=\"modal.contentClass + ' h-full min-h-0'\">\r\n <mt-work-center-item-modal [details]=\"details\" />\r\n </div>\r\n } @else {\r\n <div class=\"p-4\" [class]=\"modal.contentClass\">\r\n <div class=\"flex min-h-[22rem] items-center justify-center\">\r\n <p class=\"text-sm font-medium text-surface-500\">\r\n {{ t(\"modal.noItemSelected\") }}\r\n </p>\r\n </div>\r\n </div>\r\n }\r\n </ng-container>\r\n\r\n @if (footerActionsMounted()) {\r\n <div footer [class]=\"modal.footerClass\">\r\n <mt-work-center-item-modal-footer-actions\r\n [contextKey]=\"resolvedContextKey()\"\r\n (actionExecuted)=\"onActionExecuted($event)\"\r\n (visibilityChange)=\"onFooterVisibilityChange($event)\"\r\n />\r\n </div>\r\n }\r\n</mt-drawer>\r\n" }]
|
|
2455
2042
|
}], ctorParameters: () => [], propDecorators: { contextKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextKey", required: false }] }] } });
|
|
2456
2043
|
|
|
2457
2044
|
const APP_STATES = [WorkCenterState];
|