@pega/angular-sdk-overrides 0.25.13 → 0.26.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 (55) hide show
  1. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +14 -2
  2. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +25 -1
  3. package/lib/field/check-box/check-box.component.html +1 -1
  4. package/lib/field/embedded-data-multi/embedded-data-multi.component.html +3 -0
  5. package/lib/field/embedded-data-multi/embedded-data-multi.component.scss +0 -0
  6. package/lib/field/embedded-data-multi/embedded-data-multi.component.ts +173 -0
  7. package/lib/field/group/group.component.ts +15 -4
  8. package/lib/field/multiselect/multiselect.component.ts +22 -3
  9. package/lib/field/multiselect/utils.ts +5 -3
  10. package/lib/field/object-reference/object-reference.component.html +30 -15
  11. package/lib/field/object-reference/object-reference.component.ts +816 -94
  12. package/lib/field/selectable-card/selectable-card.component.html +1 -0
  13. package/lib/field/selectable-card/selectable-card.component.ts +31 -16
  14. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  15. package/lib/infra/Containers/flow-container/flow-container.component.ts +2 -3
  16. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -3
  17. package/lib/infra/Containers/view-container/view-container.component.html +1 -1
  18. package/lib/infra/Containers/view-container/view-container.component.ts +5 -9
  19. package/lib/infra/assignment/assignment.component.ts +2 -7
  20. package/lib/infra/assignment-card/assignment-card.component.html +1 -0
  21. package/lib/infra/assignment-card/assignment-card.component.ts +2 -8
  22. package/lib/infra/defer-load/defer-load.component.ts +1 -2
  23. package/lib/infra/reference/reference.component.html +7 -1
  24. package/lib/infra/reference/reference.component.ts +64 -109
  25. package/lib/infra/region/region.component.ts +1 -3
  26. package/lib/infra/root-container/root-container.component.html +1 -0
  27. package/lib/infra/root-container/root-container.component.ts +2 -5
  28. package/lib/infra/view/view.component.ts +5 -8
  29. package/lib/template/banner-page/banner-page.component.ts +1 -2
  30. package/lib/template/base/details-template-base.ts +45 -0
  31. package/lib/template/base/form-template-base.ts +0 -2
  32. package/lib/template/case-summary/case-summary.component.ts +0 -6
  33. package/lib/template/case-view/case-view.component.html +1 -1
  34. package/lib/template/data-reference/search-form/search-form.component.ts +7 -1
  35. package/lib/template/default-form/default-form.component.html +1 -1
  36. package/lib/template/default-form/default-form.component.ts +1 -2
  37. package/lib/template/default-page/default-page.component.ts +1 -2
  38. package/lib/template/details/details.component.ts +1 -39
  39. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +2 -4
  40. package/lib/template/details-one-column/details-one-column.component.ts +1 -3
  41. package/lib/template/details-three-column/details-three-column.component.ts +3 -5
  42. package/lib/template/details-two-column/details-two-column.component.ts +2 -4
  43. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +2 -4
  44. package/lib/template/dynamic-tabs/dynamic-tabs.component.html +1 -0
  45. package/lib/template/field-group-template/field-group-template.component.ts +18 -4
  46. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -10
  47. package/lib/template/one-column/one-column.component.html +3 -0
  48. package/lib/template/one-column-tab/one-column-tab.component.html +1 -0
  49. package/lib/template/page/page.component.html +1 -0
  50. package/lib/template/simple-table/simple-table.component.ts +11 -1
  51. package/lib/template/simple-table-manual/helpers.ts +2 -2
  52. package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -2
  53. package/lib/template/simple-table-manual/simple-table-manual.component.ts +27 -19
  54. package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -3
  55. package/package.json +1 -1
@@ -5,12 +5,12 @@
5
5
  </div>
6
6
  <ng-template #noGroup>
7
7
  <div *ngIf="field.type === 'reference'; else showDetails">
8
- <component-mapper name="View" [props]="{ pConn$: field.pConn }"></component-mapper>
8
+ <component-mapper name="reference" [props]="{ pConn$: field.pConn }"></component-mapper>
9
9
  </div>
10
10
  </ng-template>
11
11
 
12
12
  <ng-template #showDetails>
13
- <div class="psdk-grid-filter" *ngIf="field.config.label && getVisibility(field.config)">
13
+ <div class="psdk-grid-filter" *ngIf="field.config.label && _getVisibility(field.config)">
14
14
  <div class="psdk-details-fields-label">
15
15
  {{ field.config.label }}
16
16
  </div>
@@ -20,6 +20,18 @@
20
20
  <a *ngSwitchCase="'phone'" class="psdk-primary-color" as="a" href="tel: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
21
21
  <a *ngSwitchCase="'email'" class="psdk-primary-color" href="mailto: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
22
22
  <span *ngSwitchCase="'date'" class="psdk-details-text-style">{{ _formatDate(field.config.value, field.type) }}</span>
23
+ <span *ngSwitchCase="'decimal'" class="psdk-details-text-style">{{ _formatDecimal(field) }}</span>
24
+ <span *ngSwitchCase="'currency'" class="psdk-details-text-style">{{ _formatCurrency(field) }}</span>
25
+ <span *ngSwitchCase="'richtext'" class="psdk-details-text-style" [innerHTML]="_getValue(field.config.value)"></span>
26
+ <ng-container *ngSwitchCase="'scalarlist'">
27
+ <span *ngIf="field.config.componentType?.toLowerCase() === 'decimal'" class="psdk-details-text-style">{{ _formatDecimal(field) }}</span>
28
+ <span *ngIf="field.config.componentType?.toLowerCase() === 'currency'" class="psdk-details-text-style">{{ _formatCurrency(field) }}</span>
29
+ <span
30
+ *ngIf="field.config.componentType?.toLowerCase() !== 'decimal' && field.config.componentType?.toLowerCase() !== 'currency'"
31
+ class="psdk-details-text-style"
32
+ >{{ _getValue(field.config.value) }}</span
33
+ >
34
+ </ng-container>
23
35
  <span *ngSwitchCase="'caseoperator'"></span>
24
36
  <span *ngSwitchDefault>{{ _getValue(field.config.value, field) }}</span>
25
37
  </div>
@@ -2,6 +2,8 @@ import { Component, Input, forwardRef } from '@angular/core';
2
2
  import { Utils } from '@pega/angular-sdk-components';
3
3
  import { CommonModule } from '@angular/common';
4
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
+ import { getCurrencyOptions } from '@pega/angular-sdk-components';
6
+ import { format } from '@pega/angular-sdk-components';
5
7
 
6
8
  @Component({
7
9
  selector: 'app-material-details-fields',
@@ -29,7 +31,29 @@ export class MaterialDetailsFieldsComponent {
29
31
  return this.utils.generateDate(dateValue, dateFormat);
30
32
  }
31
33
 
32
- getVisibility(config): boolean {
34
+ _formatDecimal(field: any): string {
35
+ const { currencyISOCode = '', formatter } = field.config;
36
+
37
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
38
+ const formatterLower = formatter?.toLowerCase() || 'decimal';
39
+ const formattedValue = format(field.config.value, formatterLower, theCurrencyOptions);
40
+
41
+ return formattedValue;
42
+ }
43
+
44
+ _formatCurrency(field: any): string {
45
+ const { currencyISOCode = 'USD', formatter } = field.config;
46
+
47
+ const formattedValue = format(
48
+ field.config.value,
49
+ formatter ? (formatter.toLowerCase() === 'defaultcurrency' ? 'currency' : formatter.toLowerCase()) : 'currency',
50
+ getCurrencyOptions(currencyISOCode)
51
+ );
52
+
53
+ return formattedValue;
54
+ }
55
+
56
+ _getVisibility(config): boolean {
33
57
  const { visibility = true } = config;
34
58
 
35
59
  return this.utils.getBooleanValue(visibility);
@@ -18,7 +18,7 @@
18
18
  </span>
19
19
  </div>
20
20
  <div *ngIf="selectionMode === 'multi'; else single">
21
- <mat-option *ngFor="let item of listOfCheckboxes" (click)="handleChangeMultiMode($event, item)">
21
+ <mat-option *ngFor="let item of listOfCheckboxes">
22
22
  <mat-checkbox
23
23
  [labelPosition]="'after'"
24
24
  [checked]="item.selected"
@@ -0,0 +1,3 @@
1
+ <div *ngIf="bVisible$ && simpleTableComponentName">
2
+ <component-mapper [name]="simpleTableComponentName" [props]="{ pConn$: simpleTablePConn, formGroup$ }"></component-mapper>
3
+ </div>
@@ -0,0 +1,173 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, Input, OnInit, OnDestroy, forwardRef } from '@angular/core';
3
+ import { FormGroup } from '@angular/forms';
4
+
5
+ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
6
+ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
7
+
8
+ interface EmbeddedDataMultiProps {
9
+ addEditAction?: string;
10
+ addEditView?: string;
11
+ displayAs?: string;
12
+ editAction?: string;
13
+ editMode?: string;
14
+ editType?: string;
15
+ editView?: string;
16
+ readOnly?: boolean;
17
+ repeatingView?: string;
18
+ targetObjectClass?: string;
19
+ useSeparateActionForEdit?: boolean;
20
+ useSeparateViewForEdit?: boolean;
21
+ visibility?: boolean;
22
+ }
23
+
24
+ @Component({
25
+ selector: 'app-embedded-data-multi',
26
+ templateUrl: './embedded-data-multi.component.html',
27
+ styleUrls: ['./embedded-data-multi.component.scss'],
28
+ imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
29
+ })
30
+ export class EmbeddedDataMultiComponent implements OnInit, OnDestroy {
31
+ @Input() pConn$: typeof PConnect;
32
+ @Input() formGroup$: FormGroup;
33
+
34
+ angularPConnectData: AngularPConnectData = {};
35
+ simpleTablePConn: typeof PConnect;
36
+ simpleTableComponentName = '';
37
+ bVisible$ = true;
38
+
39
+ constructor(private angularPConnect: AngularPConnectService) {}
40
+
41
+ ngOnInit(): void {
42
+ this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
43
+ this.checkAndUpdate();
44
+ }
45
+
46
+ ngOnDestroy(): void {
47
+ if (this.angularPConnectData.unsubscribeFn) {
48
+ this.angularPConnectData.unsubscribeFn();
49
+ }
50
+ }
51
+
52
+ onStateChange = () => {
53
+ this.checkAndUpdate();
54
+ };
55
+
56
+ checkAndUpdate() {
57
+ const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
58
+ if (bUpdateSelf) {
59
+ this.updateSelf();
60
+ }
61
+ }
62
+
63
+ updateSelf() {
64
+ const configProps = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as EmbeddedDataMultiProps;
65
+ const {
66
+ addEditAction,
67
+ addEditView,
68
+ displayAs,
69
+ editAction,
70
+ editMode,
71
+ editType,
72
+ editView,
73
+ readOnly = false,
74
+ repeatingView,
75
+ targetObjectClass,
76
+ useSeparateActionForEdit,
77
+ useSeparateViewForEdit,
78
+ visibility = true
79
+ } = configProps;
80
+
81
+ this.bVisible$ = visibility !== false;
82
+
83
+ const rawMetadata = this.pConn$.getRawMetadata();
84
+ const rawMetadataConfig = rawMetadata?.config as any;
85
+
86
+ if (!rawMetadataConfig) {
87
+ return;
88
+ }
89
+
90
+ const renderMode = readOnly ? 'ReadOnly' : 'Editable';
91
+
92
+ let columnsChildren;
93
+ if (displayAs === 'table' || displayAs === 'simpleTable') {
94
+ columnsChildren = [
95
+ {
96
+ children: rawMetadataConfig.columns || [],
97
+ name: 'Columns',
98
+ type: 'Region'
99
+ }
100
+ ];
101
+ }
102
+
103
+ let regionWithView: any[] = [];
104
+ if (displayAs === 'repeatingView') {
105
+ regionWithView = [
106
+ {
107
+ children: [
108
+ {
109
+ type: 'reference',
110
+ config: {
111
+ type: 'view',
112
+ name: repeatingView
113
+ }
114
+ }
115
+ ],
116
+ name: 'view',
117
+ type: 'Region'
118
+ }
119
+ ];
120
+ }
121
+
122
+ const { pagelistValue } = rawMetadataConfig;
123
+ const authorContext = pagelistValue?.startsWith('@P') ? pagelistValue?.substring(3) : pagelistValue;
124
+
125
+ const componentConfig = {
126
+ type: 'View',
127
+ config: {
128
+ template: 'SimpleTable',
129
+ type: 'multirecordlist',
130
+ authorContext,
131
+ name: authorContext?.substring(1),
132
+ renderMode,
133
+ multiRecordDisplayAs: displayAs === 'repeatingView' ? 'fieldGroup' : displayAs,
134
+ referenceList: pagelistValue,
135
+ contextClass: targetObjectClass,
136
+ editMode,
137
+ editModeConfig: {
138
+ editType,
139
+ defaultView: addEditView,
140
+ defaultAction: addEditAction,
141
+ useSeparateViewForEdit,
142
+ useSeparateActionForEdit,
143
+ editView,
144
+ editAction
145
+ },
146
+ label: rawMetadataConfig.label,
147
+ hideLabel: rawMetadataConfig.hideLabel,
148
+ children: columnsChildren,
149
+ displayField: rawMetadataConfig.displayField,
150
+ uniqueField: rawMetadataConfig.uniqueField,
151
+ targetClassLabel: rawMetadataConfig.targetClassLabel,
152
+ targetClassLabelOption: rawMetadataConfig.targetClassLabelOption,
153
+ fieldHeader: rawMetadataConfig.repeatingViewHeadingSource,
154
+ heading: rawMetadataConfig.repeatingViewHeading,
155
+ allowActions: {
156
+ allowAdd: rawMetadataConfig.allowAdd ?? true,
157
+ allowEdit: rawMetadataConfig.allowEdit ?? true,
158
+ allowDelete: rawMetadataConfig.allowDelete ?? true,
159
+ allowDragDrop: rawMetadataConfig.allowDragDrop ?? true
160
+ },
161
+ allowRowDelete: rawMetadataConfig.allowRowDelete ?? true,
162
+ allowRowEdit: rawMetadataConfig.allowRowEdit ?? true
163
+ },
164
+ children: regionWithView
165
+ };
166
+
167
+ const component = this.pConn$.createComponent(componentConfig as any, '', 0, {});
168
+ if (component) {
169
+ this.simpleTablePConn = component.getPConnect();
170
+ this.simpleTableComponentName = this.simpleTablePConn.getComponentName() ?? '';
171
+ }
172
+ }
173
+ }
@@ -1,7 +1,6 @@
1
1
  import { CommonModule } from '@angular/common';
2
- import { Component, forwardRef, Input, OnInit } from '@angular/core';
2
+ import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
3
3
  import { FormGroup } from '@angular/forms';
4
- import { ReferenceComponent } from '@pega/angular-sdk-components';
5
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
6
5
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
7
6
  import { PConnFieldProps } from '@pega/angular-sdk-components';
@@ -20,7 +19,7 @@ interface GroupProps extends PConnFieldProps {
20
19
  styleUrls: ['./group.component.scss'],
21
20
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
22
21
  })
23
- export class GroupComponent implements OnInit {
22
+ export class GroupComponent implements OnInit, OnDestroy {
24
23
  @Input() pConn$: typeof PConnect;
25
24
  @Input() formGroup$: FormGroup;
26
25
 
@@ -43,6 +42,12 @@ export class GroupComponent implements OnInit {
43
42
  this.checkAndUpdate();
44
43
  }
45
44
 
45
+ additionalProps() {
46
+ return {
47
+ visibility: this.pConn$.getComputedVisibility()
48
+ };
49
+ }
50
+
46
51
  // Callback passed when subscribing to store change
47
52
  onStateChange() {
48
53
  this.checkAndUpdate();
@@ -64,7 +69,7 @@ export class GroupComponent implements OnInit {
64
69
  */
65
70
  updateSelf(): void {
66
71
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as GroupProps;
67
- this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
72
+ this.arChildren$ = this.pConn$.getChildren();
68
73
  this.visibility$ = this.configProps$.visibility;
69
74
  this.showHeading$ = this.configProps$.showHeading;
70
75
  this.heading$ = this.configProps$.heading;
@@ -87,4 +92,10 @@ export class GroupComponent implements OnInit {
87
92
  });
88
93
  }
89
94
  }
95
+
96
+ ngOnDestroy(): void {
97
+ if (this.angularPConnectData.unsubscribeFn) {
98
+ this.angularPConnectData.unsubscribeFn();
99
+ }
100
+ }
90
101
  }
@@ -91,13 +91,32 @@ export class MultiselectComponent extends FieldBase {
91
91
  }
92
92
  ];
93
93
  let secondaryColumns: any = [];
94
- if (secondaryFields) {
95
- secondaryColumns = secondaryFields.map(secondaryField => ({
96
- value: secondaryField,
94
+ // Read columnsFormatter from raw (unresolved) metadata to get field property paths
95
+ // (e.g. "@P .pyLabel") instead of resolved data values (e.g. "New Complex Fields").
96
+ // This matches Constellation's approach: pConn.getRawMetadata()?.config?.columnsFormatter
97
+ const columnsFormatter = (this.pConn$.getRawMetadata()?.config as any)?.columnsFormatter;
98
+ const secondaryFieldsFromFormatter = columnsFormatter
99
+ ? columnsFormatter
100
+ .map(item => {
101
+ const property = item?.config?.value;
102
+ if (typeof property === 'string') {
103
+ if (property.startsWith('@USER ')) return property.substring(6);
104
+ if (property.startsWith('@P ')) return property.substring(3);
105
+ return property;
106
+ }
107
+ return undefined;
108
+ })
109
+ .filter(Boolean)
110
+ : undefined;
111
+ const updatedSecondaryFields = secondaryFieldsFromFormatter || secondaryFields;
112
+ if (updatedSecondaryFields) {
113
+ secondaryColumns = updatedSecondaryFields.map(secondaryField => ({
114
+ value: typeof secondaryField === 'string' ? secondaryField : undefined,
97
115
  display: 'true',
98
116
  secondary: 'true',
99
117
  useForSearch: 'true'
100
118
  }));
119
+ secondaryColumns = secondaryColumns.filter(col => col.value);
101
120
  } else {
102
121
  secondaryColumns = [
103
122
  {
@@ -11,9 +11,11 @@ export function setVisibilityForList(c11nEnv, visibility) {
11
11
  function preProcessColumns(columns) {
12
12
  return columns?.map(col => {
13
13
  const tempColObj = { ...col };
14
- tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
15
- if (tempColObj.setProperty) {
16
- tempColObj.setProperty = col.setProperty && col.setProperty.startsWith('.') ? col.setProperty.substring(1) : col.setProperty;
14
+ if (typeof col.value === 'string') {
15
+ tempColObj.value = col.value.startsWith('.') ? col.value.substring(1) : col.value;
16
+ }
17
+ if (typeof col.setProperty === 'string') {
18
+ tempColObj.setProperty = col.setProperty.startsWith('.') ? col.setProperty.substring(1) : col.setProperty;
17
19
  }
18
20
  return tempColObj;
19
21
  });
@@ -1,17 +1,32 @@
1
- <div *ngIf="isDisplayModeEnabled && !canBeChangedInReviewMode; else semanticLinkCheck">
2
- <component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$ }"></component-mapper>
3
- </div>
4
- <ng-template #semanticLinkCheck>
5
- <div *ngIf="type === 'SemanticLink' && !canBeChangedInReviewMode; else loadDynamicComp">
1
+ <ng-container *ngIf="bVisible$" [ngSwitch]="renderMode">
2
+ <!-- SingleReferenceReadOnly mode -->
3
+ <div *ngSwitchCase="'singleReferenceReadonly'">
4
+ <component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$ }"></component-mapper>
5
+ </div>
6
+
7
+ <!-- MultiReferenceReadonly mode -->
8
+ <div *ngSwitchCase="'multiReferenceReadonly'">
9
+ <component-mapper name="MultiReferenceReadOnly" [props]="{ pConn$ }"></component-mapper>
10
+ </div>
11
+
12
+ <!-- SemanticLink mode -->
13
+ <div *ngSwitchCase="'semanticLink'">
6
14
  <component-mapper name="SemanticLink" [props]="{ pConn$: newPconn }"></component-mapper>
7
15
  </div>
8
- </ng-template>
9
- <ng-template #loadDynamicComp>
10
- <component-mapper
11
- *ngIf="newComponentName"
12
- [name]="newComponentName"
13
- [props]="{ pConn$: newPconn, formGroup$ }"
14
- [parent]="this"
15
- [outputEvents]="{ onRecordChange: onRecordChange }"
16
- ></component-mapper>
17
- </ng-template>
16
+
17
+ <!-- SearchAndSelect mode -->
18
+ <div *ngSwitchCase="'searchAndSelect'">
19
+ <component-mapper name="SearchForm" [props]="{ pConn$, formGroup$, searchSelectCacheKey, type: 'ObjectReference' }"></component-mapper>
20
+ </div>
21
+
22
+ <!-- Dynamic component mode (Cards, Map, CheckboxGroup, Table, Multiselect, Dropdown, AutoComplete, etc.) -->
23
+ <div *ngSwitchCase="'dynamicComponent'">
24
+ <component-mapper
25
+ *ngIf="newComponentName"
26
+ [name]="newComponentName"
27
+ [props]="{ pConn$: newPconn, formGroup$ }"
28
+ [parent]="this"
29
+ [outputEvents]="useOutputEvents ? { onRecordChange: onRecordChange } : undefined"
30
+ ></component-mapper>
31
+ </div>
32
+ </ng-container>