@acorex/platform 20.6.0-next.9 → 21.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/auth/index.d.ts +91 -12
  2. package/common/index.d.ts +615 -44
  3. package/core/index.d.ts +718 -422
  4. package/fesm2022/acorex-platform-auth.mjs +152 -39
  5. package/fesm2022/acorex-platform-auth.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-common.mjs +1009 -112
  7. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-core.mjs +887 -408
  9. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-domain.mjs +99 -11
  11. package/fesm2022/acorex-platform-domain.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-builder.mjs +555 -492
  13. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-layout-components.mjs +2446 -2733
  15. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-layout-designer.mjs +9 -9
  17. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-layout-entity.mjs +9708 -4721
  19. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-layout-views.mjs +32 -26
  21. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  22. package/fesm2022/acorex-platform-layout-widget-core.mjs +252 -182
  23. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  24. package/fesm2022/{acorex-platform-layout-widgets-file-list-popup.component-D0y-9nE5.mjs → acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs} +2 -2
  25. package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs.map +1 -0
  26. package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs +30 -0
  27. package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs.map +1 -0
  28. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-C1l2KSDa.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs} +2 -2
  29. package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs.map +1 -0
  30. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-D-31ej0C.mjs → acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs} +2 -2
  31. package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-layout-widgets.mjs +9791 -6928
  33. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  34. package/fesm2022/acorex-platform-runtime.mjs +79 -3
  35. package/fesm2022/acorex-platform-runtime.mjs.map +1 -1
  36. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs +157 -0
  37. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs +1542 -0
  39. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs.map +1 -0
  40. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs +101 -0
  41. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-B_P0a5KW.mjs → acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs} +3 -3
  43. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-themes-default.mjs +282 -43
  45. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  46. package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs +55 -0
  47. package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs.map +1 -0
  48. package/fesm2022/acorex-platform-themes-shared.mjs +42 -137
  49. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  50. package/fesm2022/acorex-platform-workflow.mjs +658 -45
  51. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  52. package/layout/builder/index.d.ts +10 -34
  53. package/layout/components/index.d.ts +694 -375
  54. package/layout/designer/index.d.ts +4 -4
  55. package/layout/entity/index.d.ts +802 -183
  56. package/layout/views/index.d.ts +5 -58
  57. package/layout/widget-core/index.d.ts +63 -75
  58. package/layout/widgets/README.md +0 -1
  59. package/layout/widgets/index.d.ts +493 -129
  60. package/package.json +1 -1
  61. package/runtime/index.d.ts +36 -8
  62. package/themes/default/index.d.ts +44 -75
  63. package/themes/shared/index.d.ts +11 -49
  64. package/workflow/index.d.ts +401 -90
  65. package/fesm2022/acorex-platform-layout-entity-create-entity.command-DGeylNSY.mjs +0 -52
  66. package/fesm2022/acorex-platform-layout-entity-create-entity.command-DGeylNSY.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-edit.component-fhhZOWul.mjs +0 -50
  68. package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-edit.component-fhhZOWul.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-view.component-C3Qbs0fz.mjs +0 -42
  70. package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-view.component-C3Qbs0fz.mjs.map +0 -1
  71. package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-edit.component-CngQBUlN.mjs +0 -55
  72. package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-edit.component-CngQBUlN.mjs.map +0 -1
  73. package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-view.component-DSNo9e4W.mjs +0 -50
  74. package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-view.component-DSNo9e4W.mjs.map +0 -1
  75. package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-edit.component-CL0CwEHX.mjs +0 -48
  76. package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-edit.component-CL0CwEHX.mjs.map +0 -1
  77. package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-view.component-B6Fi0xTw.mjs +0 -42
  78. package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-view.component-B6Fi0xTw.mjs.map +0 -1
  79. package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-D0y-9nE5.mjs.map +0 -1
  80. package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-C1l2KSDa.mjs.map +0 -1
  81. package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-D-31ej0C.mjs.map +0 -1
  82. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-WbPPqDON.mjs +0 -115
  83. package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-WbPPqDON.mjs.map +0 -1
  84. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CD7rJIMh.mjs +0 -803
  85. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CD7rJIMh.mjs.map +0 -1
  86. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BTA6h7Xd.mjs +0 -101
  87. package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BTA6h7Xd.mjs.map +0 -1
  88. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-B_P0a5KW.mjs.map +0 -1
@@ -6,6 +6,7 @@ import { setSmart } from '@acorex/platform/core';
6
6
  import { AXPCommandService, AXPCommandRegistry, AXPQueryService, provideCommandSetups, AXP_COMMAND_SETUP } from '@acorex/platform/runtime';
7
7
  import { AXDialogService } from '@acorex/components/dialog';
8
8
  import { AXTranslationService } from '@acorex/core/translation';
9
+ import { AXPLayoutBuilderService } from '@acorex/platform/layout/builder';
9
10
  import { AXToastService } from '@acorex/components/toast';
10
11
  import { Router } from '@angular/router';
11
12
 
@@ -415,6 +416,162 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
415
416
  }]
416
417
  }] });
417
418
 
419
+ /**
420
+ * Injection token for workflow definition loaders.
421
+ * Multiple loaders can be provided (multi: true).
422
+ */
423
+ const AXP_WORKFLOW_DEFINITION_LOADER = new InjectionToken('AXP_WORKFLOW_DEFINITION_LOADER');
424
+ /**
425
+ * Resolver service for workflow definitions.
426
+ * Aggregates all registered loaders and resolves workflow definitions.
427
+ */
428
+ class AXPWorkflowDefinitionResolver {
429
+ constructor() {
430
+ this.loaders = inject(AXP_WORKFLOW_DEFINITION_LOADER, { optional: true });
431
+ }
432
+ /**
433
+ * Get workflow definition by name (unique key).
434
+ * Tries all registered loaders until one returns a definition.
435
+ * @param name - The workflow name (unique key)
436
+ * @returns Workflow definition or null if not found
437
+ */
438
+ async get(name) {
439
+ const loaderArray = Array.isArray(this.loaders) ? this.loaders : this.loaders ? [this.loaders] : [];
440
+ for (const loader of loaderArray) {
441
+ try {
442
+ const definition = await loader.get(name);
443
+ if (definition) {
444
+ return definition;
445
+ }
446
+ }
447
+ catch (error) {
448
+ console.warn(`[AXPWorkflowDefinitionResolver] Loader failed for ${name}:`, error);
449
+ }
450
+ }
451
+ return null;
452
+ }
453
+ /**
454
+ * Get all available workflow names from all loaders.
455
+ * @returns Array of unique workflow names
456
+ */
457
+ async getAllNames() {
458
+ const loaderArray = Array.isArray(this.loaders) ? this.loaders : this.loaders ? [this.loaders] : [];
459
+ const allNames = new Set();
460
+ for (const loader of loaderArray) {
461
+ if (loader.getAllNames) {
462
+ try {
463
+ const names = await loader.getAllNames();
464
+ names.forEach((name) => allNames.add(name));
465
+ }
466
+ catch (error) {
467
+ console.warn('[AXPWorkflowDefinitionResolver] Failed to get names from loader:', error);
468
+ }
469
+ }
470
+ }
471
+ return Array.from(allNames);
472
+ }
473
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowDefinitionResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
474
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowDefinitionResolver, providedIn: 'root' }); }
475
+ }
476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowDefinitionResolver, decorators: [{
477
+ type: Injectable,
478
+ args: [{ providedIn: 'root' }]
479
+ }] });
480
+
481
+ /**
482
+ * Registry service for workflow definitions.
483
+ * Caches loaded definitions and provides change notifications.
484
+ */
485
+ class AXPWorkflowDefinitionRegistryService {
486
+ constructor() {
487
+ this.resolver = inject(AXPWorkflowDefinitionResolver);
488
+ this.cache = new Map();
489
+ this.onChanged = new Subject();
490
+ }
491
+ /**
492
+ * Observable for workflow definition changes.
493
+ */
494
+ get onChanged$() {
495
+ return this.onChanged.asObservable();
496
+ }
497
+ /**
498
+ * Get workflow definition by name (unique key).
499
+ * Uses cache if available, otherwise loads from resolver.
500
+ * @param name - The workflow name (unique key)
501
+ * @returns Workflow definition or null if not found
502
+ */
503
+ async get(name) {
504
+ // Check cache first
505
+ if (this.cache.has(name)) {
506
+ return this.cache.get(name);
507
+ }
508
+ // Load from resolver
509
+ const definition = await this.resolver.get(name);
510
+ if (definition) {
511
+ this.cache.set(name, definition);
512
+ this.onChanged.next({ name, action: 'registered' });
513
+ }
514
+ return definition;
515
+ }
516
+ /**
517
+ * Register a workflow definition in the cache.
518
+ * @param definition - The workflow definition to register
519
+ */
520
+ register(definition) {
521
+ this.cache.set(definition.name, definition);
522
+ this.onChanged.next({ name: definition.name, action: 'registered' });
523
+ }
524
+ /**
525
+ * Update a workflow definition in the cache.
526
+ * @param definition - The updated workflow definition
527
+ */
528
+ update(definition) {
529
+ if (this.cache.has(definition.name)) {
530
+ this.cache.set(definition.name, definition);
531
+ this.onChanged.next({ name: definition.name, action: 'updated' });
532
+ }
533
+ }
534
+ /**
535
+ * Remove a workflow definition from the cache.
536
+ * @param name - The workflow name to remove
537
+ */
538
+ remove(name) {
539
+ if (this.cache.has(name)) {
540
+ this.cache.delete(name);
541
+ this.onChanged.next({ name, action: 'removed' });
542
+ }
543
+ }
544
+ /**
545
+ * Clear all cached workflow definitions.
546
+ */
547
+ clear() {
548
+ this.cache.clear();
549
+ }
550
+ /**
551
+ * Check if a workflow definition is cached.
552
+ * @param definitionId - The workflow definition ID
553
+ * @returns True if cached, false otherwise
554
+ */
555
+ has(definitionId) {
556
+ return this.cache.has(definitionId);
557
+ }
558
+ /**
559
+ * Get all cached workflow definition IDs.
560
+ * @returns Array of definition IDs (only those that have been loaded)
561
+ */
562
+ getAllIds() {
563
+ return Array.from(this.cache.keys());
564
+ }
565
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowDefinitionRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
566
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowDefinitionRegistryService, providedIn: 'root' }); }
567
+ }
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPWorkflowDefinitionRegistryService, decorators: [{
569
+ type: Injectable,
570
+ args: [{
571
+ providedIn: 'root',
572
+ }]
573
+ }] });
574
+
418
575
  // ============================================
419
576
  // WORKFLOW INSTANCE v3.0.0 TYPES
420
577
  // Based on Elsa Workflow Instance schema: https://elsaworkflows.io/schemas/workflow-instance/v3.0.0/schema.json
@@ -435,8 +592,11 @@ class Activity {
435
592
  */
436
593
  createResult(output, outcome = 'Done') {
437
594
  return {
438
- output,
439
- outcomes: { [outcome]: true }
595
+ success: true,
596
+ data: {
597
+ output,
598
+ outcomes: { [outcome]: true },
599
+ },
440
600
  };
441
601
  }
442
602
  }
@@ -720,7 +880,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
720
880
  * - Backend activities: Execute via API calls to backend
721
881
  * - State caching: Caches workflow state in client for performance
722
882
  *
723
- * ✅ Suitable for production use.
724
883
  */
725
884
  class WorkflowCoordinator {
726
885
  constructor() {
@@ -764,15 +923,17 @@ class WorkflowCoordinator {
764
923
  async startWorkflow(workflowId, input = {}) {
765
924
  try {
766
925
  const execution = await this.startWorkflowExecution(workflowId, input);
767
- return {
926
+ const result = {
768
927
  success: true,
769
928
  output: execution.state.output,
770
929
  nextTask: execution.pendingTask || null,
771
930
  executionId: execution.executionId,
772
931
  state: execution.state
773
932
  };
933
+ return result;
774
934
  }
775
935
  catch (error) {
936
+ console.error('[WorkflowCoordinator] ❌ Error in startWorkflow', error);
776
937
  return {
777
938
  success: false,
778
939
  error: error.message || 'Failed to start workflow',
@@ -933,8 +1094,9 @@ class WorkflowCoordinator {
933
1094
  async executeFrontendActivity(task) {
934
1095
  try {
935
1096
  // Check if command exists
936
- if (!this.commandService.exists(task.activityType)) {
937
- console.warn(`[WorkflowCoordinator] Frontend activity '${task.activityType}' is not registered. Skipping execution.`);
1097
+ const commandExists = this.commandService.exists(task.activityType);
1098
+ if (!commandExists) {
1099
+ console.warn(`[WorkflowCoordinator] ⚠️ Frontend activity '${task.activityType}' is not registered. Skipping execution.`);
938
1100
  return {
939
1101
  output: null,
940
1102
  outcome: 'Done'
@@ -942,20 +1104,40 @@ class WorkflowCoordinator {
942
1104
  }
943
1105
  // Execute activity via CommandBus
944
1106
  // Activities registered as AXPCommand return {output, outcomes}
945
- const result = await this.commandService.execute(task.activityType, task.input || task.config || {});
946
- // Extract outcome from outcomes (usually 'Done' or first key)
1107
+ // 🎯 Flatten properties if nested (workflow-studio format)
1108
+ let commandInput = task.input || task.config || {};
1109
+ if (commandInput['properties'] && typeof commandInput['properties'] === 'object') {
1110
+ // Flatten: {properties: {text: "..."}} -> {text: "..."}
1111
+ commandInput = { ...commandInput['properties'] };
1112
+ }
1113
+ const result = await this.commandService.execute(task.activityType, commandInput);
1114
+ if (!result) {
1115
+ return {
1116
+ output: null,
1117
+ outcome: 'Failed',
1118
+ };
1119
+ }
1120
+ if (!result.success) {
1121
+ return {
1122
+ output: {
1123
+ error: result.message?.text,
1124
+ },
1125
+ outcome: 'Failed',
1126
+ };
1127
+ }
1128
+ const commandResult = result.data;
1129
+ const outcomes = commandResult?.outcomes ?? {};
947
1130
  let outcome = 'Done';
948
- if (result?.outcomes) {
949
- // Prefer 'Done' if exists, otherwise use first outcome key
950
- outcome = result.outcomes['Done'] ? 'Done' : Object.keys(result.outcomes)[0] || 'Done';
1131
+ if (Object.keys(outcomes).length > 0) {
1132
+ outcome = outcomes['Done'] ? 'Done' : Object.keys(outcomes)[0] || 'Done';
951
1133
  }
952
1134
  return {
953
- output: result?.output || result,
954
- outcome
1135
+ output: commandResult?.output ?? null,
1136
+ outcome,
955
1137
  };
956
1138
  }
957
1139
  catch (error) {
958
- console.error(`[WorkflowCoordinator] Error executing frontend activity '${task.activityType}':`, error);
1140
+ console.error(`[WorkflowCoordinator] Error executing frontend activity '${task.activityType}':`, error);
959
1141
  return {
960
1142
  output: { error: error.message || 'Unknown error' },
961
1143
  outcome: 'Failed'
@@ -1043,7 +1225,19 @@ class Sequence extends Activity {
1043
1225
  async execute(input) {
1044
1226
  // Execute all activities in sequence
1045
1227
  for (const activity of this.activities) {
1046
- await activity.execute(input);
1228
+ const result = await activity.execute(input);
1229
+ if (!result.success) {
1230
+ return {
1231
+ success: false,
1232
+ message: result.message,
1233
+ data: {
1234
+ output: undefined,
1235
+ outcomes: {
1236
+ Failed: true,
1237
+ },
1238
+ },
1239
+ };
1240
+ }
1047
1241
  }
1048
1242
  return this.createResult(undefined, 'Done');
1049
1243
  }
@@ -1104,10 +1298,21 @@ class ShowConfirmDialog extends Activity {
1104
1298
  }
1105
1299
  catch (err) {
1106
1300
  console.error('[ShowConfirmDialog] Error showing dialog:', err);
1107
- return this.createResult({
1108
- result: false,
1109
- action: 'error'
1110
- }, 'Cancelled');
1301
+ return {
1302
+ success: false,
1303
+ message: {
1304
+ text: err instanceof Error ? err.message : 'Failed to show confirm dialog',
1305
+ },
1306
+ data: {
1307
+ output: {
1308
+ result: false,
1309
+ action: 'error',
1310
+ },
1311
+ outcomes: {
1312
+ Cancelled: true,
1313
+ },
1314
+ },
1315
+ };
1111
1316
  }
1112
1317
  }
1113
1318
  }
@@ -1164,10 +1369,21 @@ class ShowAlertDialog extends Activity {
1164
1369
  }
1165
1370
  catch (err) {
1166
1371
  console.error('[ShowAlertDialog] Error showing dialog:', err);
1167
- return this.createResult({
1168
- result: false,
1169
- action: 'error'
1170
- }, 'Done');
1372
+ return {
1373
+ success: false,
1374
+ message: {
1375
+ text: err instanceof Error ? err.message : 'Failed to show alert dialog',
1376
+ },
1377
+ data: {
1378
+ output: {
1379
+ result: false,
1380
+ action: 'error',
1381
+ },
1382
+ outcomes: {
1383
+ Failed: true,
1384
+ },
1385
+ },
1386
+ };
1171
1387
  }
1172
1388
  }
1173
1389
  }
@@ -1177,6 +1393,215 @@ var showAlertDialog_activity = /*#__PURE__*/Object.freeze({
1177
1393
  ShowAlertDialog: ShowAlertDialog
1178
1394
  });
1179
1395
 
1396
+ /**
1397
+ * Show Dialog Layout Builder Activity - Displays dialog using Layout Builder.
1398
+ *
1399
+ * This activity allows you to create custom dialogs using the Layout Builder API.
1400
+ * It accepts JSON-serializable content (AXPWidgetNode) and actions configuration.
1401
+ *
1402
+ * The content can be created using Layout Builder and then converted to JSON:
1403
+ * ```typescript
1404
+ * const builder = layoutBuilderService.create();
1405
+ * builder.flex(flex => {
1406
+ * flex.setDirection('column')
1407
+ * .formField('First Name', field => {
1408
+ * field.path('firstName');
1409
+ * field.textBox({ placeholder: 'Enter first name' });
1410
+ * });
1411
+ * });
1412
+ * const contentNode = builder.build();
1413
+ * ```
1414
+ *
1415
+ * Usage in Workflow:
1416
+ * ```typescript
1417
+ * const dialog = new ShowDialogLayoutBuilder();
1418
+ * await dialog.execute({
1419
+ * title: 'User Information',
1420
+ * size: 'md',
1421
+ * context: { firstName: '', lastName: '' },
1422
+ * content: {
1423
+ * type: 'flex-layout',
1424
+ * mode: 'edit',
1425
+ * options: {
1426
+ * flexDirection: 'column',
1427
+ * gap: '16px'
1428
+ * },
1429
+ * children: [
1430
+ * {
1431
+ * type: 'form-field',
1432
+ * mode: 'edit',
1433
+ * options: {
1434
+ * label: 'First Name',
1435
+ * showLabel: true
1436
+ * },
1437
+ * children: [{
1438
+ * type: 'text-editor',
1439
+ * path: 'firstName',
1440
+ * options: {
1441
+ * placeholder: 'Enter first name'
1442
+ * }
1443
+ * }]
1444
+ * }
1445
+ * ]
1446
+ * },
1447
+ * actions: {
1448
+ * cancel: '@general:actions.cancel.title',
1449
+ * submit: '@general:actions.submit.title',
1450
+ * custom: [{
1451
+ * title: 'Save Draft',
1452
+ * icon: 'fa-save',
1453
+ * color: 'secondary',
1454
+ * command: { name: 'save-draft' }
1455
+ * }]
1456
+ * }
1457
+ * });
1458
+ * ```
1459
+ *
1460
+ * Usage in JSON Workflow Definition:
1461
+ * ```json
1462
+ * {
1463
+ * "type": "ShowDialogLayoutBuilder",
1464
+ * "properties": {
1465
+ * "title": "User Information",
1466
+ * "size": "md",
1467
+ * "context": { "firstName": "", "lastName": "" },
1468
+ * "content": {
1469
+ * "type": "flex-layout",
1470
+ * "mode": "edit",
1471
+ * "options": {
1472
+ * "flexDirection": "column",
1473
+ * "gap": "16px"
1474
+ * },
1475
+ * "children": [
1476
+ * {
1477
+ * "type": "form-field",
1478
+ * "mode": "edit",
1479
+ * "options": {
1480
+ * "label": "First Name",
1481
+ * "showLabel": true
1482
+ * },
1483
+ * "children": [{
1484
+ * "type": "text-editor",
1485
+ * "path": "firstName",
1486
+ * "options": {
1487
+ * "placeholder": "Enter first name"
1488
+ * }
1489
+ * }]
1490
+ * }
1491
+ * ]
1492
+ * },
1493
+ * "actions": {
1494
+ * "cancel": "@general:actions.cancel.title",
1495
+ * "submit": "@general:actions.submit.title"
1496
+ * }
1497
+ * }
1498
+ * }
1499
+ * ```
1500
+ */
1501
+ class ShowDialogLayoutBuilder extends Activity {
1502
+ //#endregion
1503
+ constructor() {
1504
+ super('ShowDialogLayoutBuilder');
1505
+ //#region ---- Services & Dependencies ----
1506
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
1507
+ }
1508
+ async execute(input) {
1509
+ const { title = '', size = 'md', context = {}, closeButton = false, message, content, actions } = input;
1510
+ try {
1511
+ // Create dialog using layout builder
1512
+ const dialogRef = await this.layoutBuilder
1513
+ .create()
1514
+ .dialog(dialog => {
1515
+ // Set basic dialog options
1516
+ dialog
1517
+ .setTitle(title)
1518
+ .setSize(size)
1519
+ .setCloseButton(closeButton)
1520
+ .setContext(context);
1521
+ // Set message if provided
1522
+ if (message) {
1523
+ dialog.setMessage(message);
1524
+ }
1525
+ // Set content if provided
1526
+ if (content) {
1527
+ // If content is already a flex-layout, use it directly
1528
+ // Otherwise, wrap it in a flex container with column direction
1529
+ if (content.type === 'flex-layout') {
1530
+ // Set content layout directly (accessing internal state of DialogContainerBuilder)
1531
+ dialog.contentLayout = content;
1532
+ }
1533
+ else {
1534
+ // Wrap content in a flex container
1535
+ const wrappedContent = {
1536
+ type: 'flex-layout',
1537
+ mode: 'edit',
1538
+ options: {
1539
+ flexDirection: 'column',
1540
+ gap: '10px',
1541
+ },
1542
+ children: [content],
1543
+ };
1544
+ dialog.contentLayout = wrappedContent;
1545
+ }
1546
+ }
1547
+ // Set actions if provided
1548
+ if (actions) {
1549
+ dialog.setActions(actionBuilder => {
1550
+ if (actions.cancel) {
1551
+ actionBuilder.cancel(actions.cancel);
1552
+ }
1553
+ if (actions.submit) {
1554
+ actionBuilder.submit(actions.submit);
1555
+ }
1556
+ if (actions.custom) {
1557
+ actions.custom.forEach(action => {
1558
+ actionBuilder.custom(action);
1559
+ });
1560
+ }
1561
+ });
1562
+ }
1563
+ })
1564
+ .show();
1565
+ // Get user action and context
1566
+ const action = dialogRef.action() || 'cancel';
1567
+ const dialogContext = dialogRef.context();
1568
+ // Determine outcomes
1569
+ const cancelled = action === 'cancel';
1570
+ const confirmed = action === 'submit' || (!cancelled && action !== 'error');
1571
+ // Close dialog
1572
+ dialogRef.close();
1573
+ // Return result with appropriate outcome
1574
+ const outcome = cancelled ? 'Cancelled' : confirmed ? 'Confirmed' : 'Done';
1575
+ return this.createResult({
1576
+ context: dialogContext,
1577
+ action,
1578
+ cancelled,
1579
+ confirmed
1580
+ }, outcome);
1581
+ }
1582
+ catch (err) {
1583
+ console.error('[ShowDialogLayoutBuilder] Error showing dialog:', err);
1584
+ return {
1585
+ success: false,
1586
+ message: {
1587
+ text: err instanceof Error ? err.message : 'Failed to show dialog',
1588
+ },
1589
+ data: {
1590
+ output: {
1591
+ context: {},
1592
+ action: 'error',
1593
+ cancelled: true,
1594
+ confirmed: false,
1595
+ },
1596
+ outcomes: {
1597
+ Error: true,
1598
+ },
1599
+ },
1600
+ };
1601
+ }
1602
+ }
1603
+ }
1604
+
1180
1605
  /**
1181
1606
  * Show Toast Activity - Displays toast notification to user.
1182
1607
  *
@@ -1223,7 +1648,18 @@ class ShowToast extends Activity {
1223
1648
  }
1224
1649
  catch (err) {
1225
1650
  console.error('[ShowToast] Error showing toast:', err);
1226
- return this.createResult(undefined, 'Error');
1651
+ return {
1652
+ success: false,
1653
+ message: {
1654
+ text: err instanceof Error ? err.message : 'Failed to show toast',
1655
+ },
1656
+ data: {
1657
+ output: undefined,
1658
+ outcomes: {
1659
+ Failed: true,
1660
+ },
1661
+ },
1662
+ };
1227
1663
  }
1228
1664
  }
1229
1665
  }
@@ -1273,13 +1709,35 @@ class Navigate extends Activity {
1273
1709
  break;
1274
1710
  default:
1275
1711
  console.error(`[Navigate] Unknown navigation mode: ${mode}`);
1276
- return this.createResult(undefined, 'Error');
1712
+ return {
1713
+ success: false,
1714
+ message: {
1715
+ text: `Unknown navigation mode: ${mode}`,
1716
+ },
1717
+ data: {
1718
+ output: undefined,
1719
+ outcomes: {
1720
+ Failed: true,
1721
+ },
1722
+ },
1723
+ };
1277
1724
  }
1278
1725
  return this.createResult(undefined, 'Done');
1279
1726
  }
1280
1727
  catch (err) {
1281
1728
  console.error('[Navigate] Error navigating:', err);
1282
- return this.createResult(undefined, 'Error');
1729
+ return {
1730
+ success: false,
1731
+ message: {
1732
+ text: err instanceof Error ? err.message : 'Failed to navigate',
1733
+ },
1734
+ data: {
1735
+ output: undefined,
1736
+ outcomes: {
1737
+ Failed: true,
1738
+ },
1739
+ },
1740
+ };
1283
1741
  }
1284
1742
  }
1285
1743
  }
@@ -1315,7 +1773,18 @@ class SetVariable extends Activity {
1315
1773
  }
1316
1774
  catch (err) {
1317
1775
  console.error('[SetVariable] Error setting variable:', err);
1318
- return this.createResult(undefined, 'Error');
1776
+ return {
1777
+ success: false,
1778
+ message: {
1779
+ text: err instanceof Error ? err.message : 'Failed to set variable',
1780
+ },
1781
+ data: {
1782
+ output: undefined,
1783
+ outcomes: {
1784
+ Failed: true,
1785
+ },
1786
+ },
1787
+ };
1319
1788
  }
1320
1789
  }
1321
1790
  }
@@ -1351,7 +1820,18 @@ class DispatchEvent extends Activity {
1351
1820
  }
1352
1821
  catch (err) {
1353
1822
  console.error('[DispatchEvent] Error dispatching event:', err);
1354
- return this.createResult(undefined, 'Error');
1823
+ return {
1824
+ success: false,
1825
+ message: {
1826
+ text: err instanceof Error ? err.message : 'Failed to dispatch event',
1827
+ },
1828
+ data: {
1829
+ output: undefined,
1830
+ outcomes: {
1831
+ Failed: true,
1832
+ },
1833
+ },
1834
+ };
1355
1835
  }
1356
1836
  }
1357
1837
  }
@@ -1393,13 +1873,36 @@ class If extends Activity {
1393
1873
  }
1394
1874
  // Execute activities in the chosen branch
1395
1875
  for (const activity of activities) {
1396
- await activity.execute(input);
1876
+ const activityResult = await activity.execute(input);
1877
+ if (!activityResult.success) {
1878
+ return {
1879
+ success: false,
1880
+ message: activityResult.message,
1881
+ data: {
1882
+ output: { branch: conditionResult ? 'then' : 'else', failedActivity: activity },
1883
+ outcomes: {
1884
+ Failed: true,
1885
+ },
1886
+ },
1887
+ };
1888
+ }
1397
1889
  }
1398
1890
  return this.createResult(result, conditionResult ? 'Then' : 'Else');
1399
1891
  }
1400
1892
  catch (err) {
1401
1893
  console.error('[If] Error evaluating condition:', err);
1402
- return this.createResult({ branch: 'error' }, 'Error');
1894
+ return {
1895
+ success: false,
1896
+ message: {
1897
+ text: err instanceof Error ? err.message : 'Failed to evaluate condition',
1898
+ },
1899
+ data: {
1900
+ output: { branch: 'error' },
1901
+ outcomes: {
1902
+ Failed: true,
1903
+ },
1904
+ },
1905
+ };
1403
1906
  }
1404
1907
  }
1405
1908
  evaluateCondition(condition) {
@@ -1441,7 +1944,22 @@ class While extends Activity {
1441
1944
  while (conditionResult && iteration < maxIterations) {
1442
1945
  // Execute activities in the loop
1443
1946
  for (const activity of activities) {
1444
- await activity.execute(input);
1947
+ const activityResult = await activity.execute(input);
1948
+ if (!activityResult.success) {
1949
+ return {
1950
+ success: false,
1951
+ message: activityResult.message,
1952
+ data: {
1953
+ output: {
1954
+ iterations: iteration,
1955
+ completed: false,
1956
+ },
1957
+ outcomes: {
1958
+ Failed: true,
1959
+ },
1960
+ },
1961
+ };
1962
+ }
1445
1963
  }
1446
1964
  iteration++;
1447
1965
  conditionResult = this.evaluateCondition(condition);
@@ -1454,7 +1972,18 @@ class While extends Activity {
1454
1972
  }
1455
1973
  catch (err) {
1456
1974
  console.error('[While] Error in loop execution:', err);
1457
- return this.createResult({ iterations: 0, completed: false }, 'Error');
1975
+ return {
1976
+ success: false,
1977
+ message: {
1978
+ text: err instanceof Error ? err.message : 'Failed during loop execution',
1979
+ },
1980
+ data: {
1981
+ output: { iterations: 0, completed: false },
1982
+ outcomes: {
1983
+ Failed: true,
1984
+ },
1985
+ },
1986
+ };
1458
1987
  }
1459
1988
  }
1460
1989
  evaluateCondition(condition) {
@@ -1504,7 +2033,23 @@ class ForEach extends Activity {
1504
2033
  };
1505
2034
  // Execute activities for current item
1506
2035
  for (const activity of activities) {
1507
- await activity.execute(itemContext);
2036
+ const activityResult = await activity.execute(itemContext);
2037
+ if (!activityResult.success) {
2038
+ return {
2039
+ success: false,
2040
+ message: activityResult.message,
2041
+ data: {
2042
+ output: {
2043
+ totalItems: items.length,
2044
+ processedItems: results.length,
2045
+ results,
2046
+ },
2047
+ outcomes: {
2048
+ Failed: true,
2049
+ },
2050
+ },
2051
+ };
2052
+ }
1508
2053
  }
1509
2054
  results.push({
1510
2055
  item: currentItem,
@@ -1521,7 +2066,18 @@ class ForEach extends Activity {
1521
2066
  }
1522
2067
  catch (err) {
1523
2068
  console.error('[ForEach] Error in iteration:', err);
1524
- return this.createResult({ totalItems: 0, processedItems: 0, results: [] }, 'Error');
2069
+ return {
2070
+ success: false,
2071
+ message: {
2072
+ text: err instanceof Error ? err.message : 'Failed during iteration',
2073
+ },
2074
+ data: {
2075
+ output: { totalItems: 0, processedItems: 0, results: [] },
2076
+ outcomes: {
2077
+ Failed: true,
2078
+ },
2079
+ },
2080
+ };
1525
2081
  }
1526
2082
  }
1527
2083
  }
@@ -1566,20 +2122,66 @@ class ExecuteCommand extends Activity {
1566
2122
  }
1567
2123
  // Execute command through Command Bus
1568
2124
  const result = await this.commandService.execute(commandKey, commandInput);
2125
+ if (!result) {
2126
+ return {
2127
+ success: false,
2128
+ message: {
2129
+ text: `Command '${commandKey}' returned no result`,
2130
+ },
2131
+ data: {
2132
+ output: {
2133
+ commandKey,
2134
+ success: false,
2135
+ executedAt: new Date().toISOString(),
2136
+ },
2137
+ outcomes: {
2138
+ Failed: true,
2139
+ },
2140
+ },
2141
+ };
2142
+ }
2143
+ if (!result.success) {
2144
+ return {
2145
+ success: false,
2146
+ message: result.message,
2147
+ data: {
2148
+ output: {
2149
+ commandKey,
2150
+ success: false,
2151
+ executedAt: new Date().toISOString(),
2152
+ error: result.message?.text,
2153
+ },
2154
+ outcomes: {
2155
+ Failed: true,
2156
+ },
2157
+ },
2158
+ };
2159
+ }
1569
2160
  return this.createResult({
1570
2161
  commandKey,
1571
2162
  success: true,
1572
- output: result,
1573
- executedAt: new Date().toISOString()
2163
+ output: result.data,
2164
+ executedAt: new Date().toISOString(),
1574
2165
  }, 'Done');
1575
2166
  }
1576
2167
  catch (err) {
1577
2168
  console.error('[ExecuteCommand] Error executing command:', err);
1578
- return this.createResult({
1579
- commandKey,
2169
+ return {
1580
2170
  success: false,
1581
- error: err instanceof Error ? err.message : 'Unknown error'
1582
- }, 'Failed');
2171
+ message: {
2172
+ text: err instanceof Error ? err.message : 'Unknown error',
2173
+ },
2174
+ data: {
2175
+ output: {
2176
+ commandKey,
2177
+ success: false,
2178
+ error: err instanceof Error ? err.message : 'Unknown error',
2179
+ },
2180
+ outcomes: {
2181
+ Failed: true,
2182
+ },
2183
+ },
2184
+ };
1583
2185
  }
1584
2186
  }
1585
2187
  }
@@ -1635,11 +2237,22 @@ class ExecuteQuery extends Activity {
1635
2237
  }
1636
2238
  catch (err) {
1637
2239
  console.error('[ExecuteQuery] Error executing query:', err);
1638
- return this.createResult({
1639
- queryKey,
2240
+ return {
1640
2241
  success: false,
1641
- error: err instanceof Error ? err.message : 'Unknown error'
1642
- }, 'Failed');
2242
+ message: {
2243
+ text: err instanceof Error ? err.message : 'Unknown error',
2244
+ },
2245
+ data: {
2246
+ output: {
2247
+ queryKey,
2248
+ success: false,
2249
+ error: err instanceof Error ? err.message : 'Unknown error',
2250
+ },
2251
+ outcomes: {
2252
+ Failed: true,
2253
+ },
2254
+ },
2255
+ };
1643
2256
  }
1644
2257
  }
1645
2258
  }
@@ -1899,5 +2512,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
1899
2512
  * Generated bundle index. Do not edit.
1900
2513
  */
1901
2514
 
1902
- export { AXPActivityCategoryProviderService, AXPActivityProviderService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowExecutionService, AXPWorkflowFunction, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, Activity, ActivityRegistry, DispatchEvent, EndActivity, ExecuteCommand, ExecuteQuery, ForEach, If, Navigate, Sequence, SetVariable, ShowAlertDialog, ShowConfirmDialog, ShowToast, StartActivity, While, WorkflowCoordinator, WriteLine, createWorkFlowEvent, ofType, provideWorkflowActivityCommands };
2515
+ export { AXPActivityCategoryProviderService, AXPActivityProviderService, AXPWorkflowAction, AXPWorkflowContext, AXPWorkflowDefinitionRegistryService, AXPWorkflowDefinitionResolver, AXPWorkflowError, AXPWorkflowEventService, AXPWorkflowExecutionService, AXPWorkflowFunction, AXPWorkflowModule, AXPWorkflowRegistryService, AXPWorkflowService, AXP_ACTIVITY_CATEGORY_PROVIDER, AXP_ACTIVITY_PROVIDER, AXP_WORKFLOW_DEFINITION_LOADER, Activity, ActivityRegistry, DispatchEvent, EndActivity, ExecuteCommand, ExecuteQuery, ForEach, If, Navigate, Sequence, SetVariable, ShowAlertDialog, ShowConfirmDialog, ShowDialogLayoutBuilder, ShowToast, StartActivity, While, WorkflowCoordinator, WriteLine, createWorkFlowEvent, ofType, provideWorkflowActivityCommands };
1903
2516
  //# sourceMappingURL=acorex-platform-workflow.mjs.map