@pega/angular-sdk-overrides 0.26.2 → 0.26.4

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 (68) hide show
  1. package/lib/designSystemExtension/field-group/field-group.component.ts +11 -3
  2. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +12 -3
  3. package/lib/field/auto-complete/auto-complete.component.html +44 -4
  4. package/lib/field/auto-complete/auto-complete.component.scss +92 -0
  5. package/lib/field/auto-complete/auto-complete.component.ts +341 -16
  6. package/lib/field/cancel-alert/cancel-alert.component.ts +38 -15
  7. package/lib/field/group/group.component.html +1 -1
  8. package/lib/field/group/group.component.ts +1 -3
  9. package/lib/field/semantic-link/semantic-link.component.html +1 -1
  10. package/lib/field/semantic-link/semantic-link.component.scss +4 -0
  11. package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
  12. package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.html +12 -0
  13. package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.spec.ts +130 -0
  14. package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.ts +77 -0
  15. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +35 -8
  16. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +179 -184
  17. package/lib/infra/assignment/assignment.component.html +2 -1
  18. package/lib/infra/assignment/assignment.component.ts +30 -13
  19. package/lib/infra/defer-load/defer-load.component.ts +6 -3
  20. package/lib/infra/multi-step/multi-step.component.html +25 -33
  21. package/lib/infra/multi-step/multi-step.component.scss +48 -0
  22. package/lib/infra/multi-step/multi-step.component.ts +11 -0
  23. package/lib/infra/view/view.component.ts +17 -39
  24. package/lib/template/base/details-template-base.ts +35 -54
  25. package/lib/template/case-summary/case-summary.component.ts +15 -1
  26. package/lib/template/case-view/case-view.component.html +13 -1
  27. package/lib/template/case-view/case-view.component.spec.ts +119 -10
  28. package/lib/template/case-view/case-view.component.ts +52 -3
  29. package/lib/template/data-reference/data-reference.component.ts +27 -18
  30. package/lib/template/data-reference/search-form/search-form.component.html +1 -1
  31. package/lib/template/data-reference/search-form/search-form.component.ts +2 -0
  32. package/lib/template/details/details.component.html +23 -3
  33. package/lib/template/details/details.component.scss +9 -2
  34. package/lib/template/details/details.component.ts +3 -32
  35. package/lib/template/details-narrow-wide/details-narrow-wide.component.html +21 -2
  36. package/lib/template/details-narrow-wide/details-narrow-wide.component.scss +8 -1
  37. package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +3 -37
  38. package/lib/template/details-one-column/details-one-column.component.html +23 -1
  39. package/lib/template/details-one-column/details-one-column.component.scss +14 -0
  40. package/lib/template/details-one-column/details-one-column.component.ts +3 -38
  41. package/lib/template/details-three-column/details-three-column.component.html +21 -2
  42. package/lib/template/details-three-column/details-three-column.component.scss +8 -1
  43. package/lib/template/details-three-column/details-three-column.component.ts +3 -46
  44. package/lib/template/details-two-column/details-two-column.component.html +21 -2
  45. package/lib/template/details-two-column/details-two-column.component.scss +8 -1
  46. package/lib/template/details-two-column/details-two-column.component.ts +3 -44
  47. package/lib/template/details-wide-narrow/details-wide-narrow.component.html +21 -2
  48. package/lib/template/details-wide-narrow/details-wide-narrow.component.scss +8 -1
  49. package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +3 -41
  50. package/lib/template/field-value-list/field-value-list.component.scss +17 -0
  51. package/lib/template/list-view/list-view.component.ts +39 -0
  52. package/lib/template/self-service-case-view/self-service-case-view.component.html +13 -1
  53. package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +96 -11
  54. package/lib/template/self-service-case-view/self-service-case-view.component.ts +52 -3
  55. package/lib/template/simple-table-manual/helpers.ts +27 -6
  56. package/lib/template/simple-table-manual/simple-table-manual.component.html +1 -3
  57. package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -0
  58. package/lib/template/simple-table-manual/simple-table-manual.component.ts +51 -20
  59. package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +0 -4
  60. package/package.json +1 -1
  61. package/lib/designSystemExtension/material-details/material-details.component.html +0 -40
  62. package/lib/designSystemExtension/material-details/material-details.component.scss +0 -116
  63. package/lib/designSystemExtension/material-details/material-details.component.spec.ts +0 -24
  64. package/lib/designSystemExtension/material-details/material-details.component.ts +0 -31
  65. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +0 -50
  66. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +0 -34
  67. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts +0 -22
  68. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +0 -61
@@ -17,7 +17,7 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
17
17
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
18
18
  import { DatapageService } from '@pega/angular-sdk-components';
19
19
  import { getReferenceList } from '@pega/angular-sdk-components';
20
- import { buildFieldsForTable, filterDataByCommonFields, filterDataByDate, getContext } from './helpers';
20
+ import { buildFieldsForTable, filterDataByCommonFields, filterDataByDate, getConfigFields, getContext, isPrimaryFieldsValue } from './helpers';
21
21
  import { evaluateAllowRowAction } from '@pega/angular-sdk-components';
22
22
  import { Utils } from '@pega/angular-sdk-components';
23
23
  import { getSeconds } from '@pega/angular-sdk-components';
@@ -47,7 +47,8 @@ interface SimpleTableManualProps {
47
47
  displayMode?: string;
48
48
  useSeparateViewForEdit: any;
49
49
  viewForEditModal: any;
50
- targetClassLabel: string;
50
+ targetClassLabel?: string;
51
+ uniqueField?: string;
51
52
  }
52
53
 
53
54
  class Group {
@@ -115,6 +116,9 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
115
116
  elementsData: MatTableDataSource<any>;
116
117
  originalElementsData: MatTableDataSource<any>;
117
118
  rawFields: any;
119
+ configFields: any[] = [];
120
+ uniqueField?: string;
121
+ normalizedUniqueField?: string;
118
122
  label?: string = '';
119
123
  searchIcon$: string;
120
124
 
@@ -172,7 +176,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
172
176
  settingsSvgIcon$: string;
173
177
 
174
178
  isInitialized = false;
175
- targetClassLabel: string;
179
+ targetClassLabel = '';
180
+ addButtonLabel$ = '';
176
181
  localizedVal = PCore.getLocaleUtils().getLocaleValue;
177
182
  localeCategory = 'SimpleTable';
178
183
  hideEditRow: any;
@@ -261,9 +266,15 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
261
266
  displayMode,
262
267
  useSeparateViewForEdit,
263
268
  viewForEditModal,
264
- targetClassLabel
269
+ targetClassLabel,
270
+ uniqueField
265
271
  } = this.configProps$;
266
272
 
273
+ // uniqueField is authored as a property reference (ex: ".EmbedListUUID__"); page instructions expect it
274
+ // with the leading dot while the inserted row payload expects the bare property name.
275
+ this.uniqueField = uniqueField;
276
+ this.normalizedUniqueField = uniqueField?.startsWith('.') ? uniqueField.substring(1) : uniqueField;
277
+
267
278
  const simpleTableManualProps: any = {};
268
279
  if (this.checkIfAllowActionsOrRowEditingExist(allowActions) && editMode) {
269
280
  simpleTableManualProps.hideAddRow = allowActions?.allowAdd === false;
@@ -279,7 +290,8 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
279
290
  this.referenceListStr = getContext(this.pConn$).referenceListStr;
280
291
  this.label = labelProp || propertyLabel;
281
292
  this.parameters = fieldMetadata?.datasource?.parameters;
282
- this.targetClassLabel = targetClassLabel;
293
+ this.targetClassLabel = targetClassLabel ?? '';
294
+ this.addButtonLabel$ = this.getAddButtonLabel();
283
295
  let { contextClass } = this.configProps$;
284
296
  this.referenceList = referenceList;
285
297
  if (!contextClass) {
@@ -316,7 +328,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
316
328
  this.readOnlyMode = renderMode === 'ReadOnly';
317
329
  this.editableMode = renderMode === 'Editable';
318
330
  const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
319
- this.showAddRowButton = !this.readOnlyMode && !simpleTableManualProps.hideAddRow;
331
+ this.showAddRowButton = this.getShowAddRowButton(simpleTableManualProps.hideAddRow);
320
332
  this.hideEditRow = simpleTableManualProps.hideEditRow;
321
333
  this.hideDeleteRow = simpleTableManualProps.hideDeleteRow;
322
334
  this.allowEditingInModal =
@@ -333,9 +345,14 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
333
345
  this.defaultActionId = this.editType === 'action' ? editModeConfig?.defaultAction : undefined;
334
346
  this.editActionId =
335
347
  this.editType === 'action' && editModeConfig?.useSeparateActionForEdit ? editModeConfig?.editAction : editModeConfig?.defaultAction;
336
- const primaryFieldsViewIndex = resolvedFields.findIndex(field => field.config.value === 'pyPrimaryFields');
348
+ const primaryFieldsViewIndex = resolvedFields?.findIndex(field => isPrimaryFieldsValue(field.config.value)) ?? -1;
337
349
  // const showDeleteButton = !this.readOnlyMode && !hideDeleteRow;
338
350
 
351
+ // "pyPrimaryFields" is a single authored column that expands into several real columns, so the
352
+ // resolved/raw children can no longer be used directly - configFields is the expanded column list.
353
+ const configFields = getConfigFields(rawFields, contextClass, primaryFieldsViewIndex);
354
+ this.configFields = configFields.filter(field => !(field?.config?.hide === true));
355
+
339
356
  // Nebula has other handling for isReadOnlyMode but has Cosmos-specific code
340
357
  // so ignoring that for now...
341
358
  // fieldDefs will be an array where each entry will have a "name" which will be the
@@ -344,7 +361,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
344
361
  // Nebula does). It will also have the "label", and "meta" contains the original,
345
362
  // unchanged config info. For now, much of the info here is carried over from
346
363
  // Nebula and we may not end up using it all.
347
- this.fieldDefs = buildFieldsForTable(rawFields, this.pConn$, this.showActionColumn, {
364
+ this.fieldDefs = buildFieldsForTable(configFields, this.pConn$, this.showActionColumn, {
348
365
  primaryFieldsViewIndex,
349
366
  fields: resolvedFields
350
367
  });
@@ -360,7 +377,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
360
377
  return field.name ? field.name : field.cellRenderer;
361
378
  });
362
379
 
363
- // And now we can process the resolvedFields to add in the "name"
380
+ // And now we can process the configFields to add in the "name"
364
381
  // from from the fieldDefs. This "name" is the value that
365
382
  // we'll share to connect things together in the table.
366
383
 
@@ -368,12 +385,9 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
368
385
  return { ...acc, [curr.name]: curr.label };
369
386
  }, {});
370
387
 
371
- this.processedFields = [];
372
-
373
- this.processedFields = resolvedFields.map((field, i) => {
374
- field.config.name = this.displayedColumns[i]; // .config["value"].replace(/ ./g,"_"); // replace space dot with underscore
375
- field.config.label = labelsMap[field.config.name] || field.config.label;
376
- return field;
388
+ this.processedFields = this.configFields.map((field, i) => {
389
+ const name = this.displayedColumns[i];
390
+ return { ...field, config: { ...field.config, name, label: labelsMap[name] || field.config.label } };
377
391
  });
378
392
 
379
393
  // for adding rows to table when editable and not modal view
@@ -419,11 +433,12 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
419
433
  this.pConn$.getListActions().initDefaultPageInstructions(
420
434
  this.pConn$.getReferenceList(),
421
435
  // Temporary filter for attachments to align with constellation payload behavior.
422
- this.fieldDefs.filter(item => item.name && item.meta?.type !== 'Attachment').map(item => item.name)
436
+ this.fieldDefs.filter(item => item.name && item.meta?.type !== 'Attachment').map(item => item.name),
437
+ this.uniqueField
423
438
  );
424
439
  } else {
425
- // @ts-ignore - An argument for 'propertyNames' was not provided.
426
- this.pConn$.getListActions().initDefaultPageInstructions(this.pConn$.getReferenceList());
440
+ // @ts-ignore - 'propertyNames' is optional at runtime; uniqueField is passed as the 3rd argument.
441
+ this.pConn$.getListActions().initDefaultPageInstructions(this.pConn$.getReferenceList(), undefined, this.uniqueField);
427
442
  }
428
443
  }
429
444
 
@@ -1030,7 +1045,11 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
1030
1045
  this.defaultActionId
1031
1046
  );
1032
1047
  } else {
1033
- this.pConn$.getListActions().insert({ classID: this.contextClass }, this.referenceList.length);
1048
+ const payload: any = { classID: this.contextClass };
1049
+ if (this.normalizedUniqueField) {
1050
+ payload[this.normalizedUniqueField] = crypto.randomUUID();
1051
+ }
1052
+ this.pConn$.getListActions().insert(payload, this.referenceList.length);
1034
1053
  }
1035
1054
 
1036
1055
  this.pConn$.clearErrorMessages({
@@ -1038,6 +1057,18 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
1038
1057
  });
1039
1058
  }
1040
1059
 
1060
+ getAddButtonLabel(): string {
1061
+ const addLabel = this.targetClassLabel
1062
+ ? this.localizedVal('Add {0}', this.localeCategory).replace('{0}', this.targetClassLabel)
1063
+ : this.localizedVal('Add', this.localeCategory);
1064
+
1065
+ return this.localizedVal(addLabel, this.localeCategory);
1066
+ }
1067
+
1068
+ getShowAddRowButton(hideAddRow?: boolean): boolean {
1069
+ return !this.readOnlyMode && !hideAddRow;
1070
+ }
1071
+
1041
1072
  editRecord(data, index) {
1042
1073
  if (data && Number.isInteger(index) && index >= 0 && index < this.referenceList.length) {
1043
1074
  const viewForEdit = this.bUseSeparateViewForEdit ? this.editView : this.defaultView;
@@ -1070,7 +1101,7 @@ export class SimpleTableManualComponent implements OnInit, OnDestroy {
1070
1101
  const isRowEditable = evaluateAllowRowAction(allowRowEdit, element);
1071
1102
  const data: any = [];
1072
1103
  data.__originalIndex = index;
1073
- this.rawFields?.forEach(item => {
1104
+ this.configFields?.forEach(item => {
1074
1105
  if (!item?.config?.hide) {
1075
1106
  item = {
1076
1107
  ...item,
@@ -7,10 +7,6 @@
7
7
  margin-top: 1rem;
8
8
  }
9
9
 
10
- .psdk-grid-nondisplay {
11
- margin-top: 1rem;
12
- }
13
-
14
10
  .psdk-details-reference-value {
15
11
  margin-top: 0;
16
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.26.2",
3
+ "version": "0.26.4",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,40 +0,0 @@
1
- <div id="details-fields-list">
2
- <div
3
- *ngIf="arHighlightedFields && arHighlightedFields.length > 0"
4
- [ngClass]="{
5
- 'psdk-grid-filter-1': this.layout === 'one-column',
6
- 'psdk-grid-filter-2': this.layout === 'two-column',
7
- 'psdk-grid-filter-3': this.layout === 'three-column',
8
- 'psdk-grid-filter-wide-narrow': this.layout === 'wide-narrow',
9
- 'psdk-grid-filter-narrow-wide': this.layout === 'narrow-wide'
10
- }"
11
- >
12
- <div *ngFor="let field of arHighlightedFields">
13
- <div class="psdk-details-fields-label">
14
- {{ field.config.label }}
15
- </div>
16
- <div [ngSwitch]="field.type.toLowerCase()" class="psdk-csf-primary-field-value">
17
- <span *ngSwitchCase="'textinput'" class="psdk-details-text-style-hf">{{ _getValue(field.config.value) }}</span>
18
- <span *ngSwitchCase="'status'" class="psdk-details-status-style-hf">{{ _getValue(field.config.value) }}</span>
19
- <a *ngSwitchCase="'phone'" as="a" href="tel: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
20
- <a *ngSwitchCase="'email'" href="mailto: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
21
- <span *ngSwitchCase="'date'" class="psdk-details-text-style-hf">{{ _formatDate(field.config.value, field.type) }}</span>
22
- <span *ngSwitchCase="'caseoperator'"></span>
23
- <span *ngSwitchDefault>{{ _getValue(field.config.value) }}</span>
24
- </div>
25
- </div>
26
- </div>
27
- <div
28
- [ngClass]="{
29
- 'psdk-grid-filter-1': this.layout === 'one-column',
30
- 'psdk-grid-filter-2': this.layout === 'two-column',
31
- 'psdk-grid-filter-3': this.layout === 'three-column',
32
- 'psdk-grid-filter-wide-narrow': this.layout === 'wide-narrow',
33
- 'psdk-grid-filter-narrow-wide': this.layout === 'narrow-wide'
34
- }"
35
- >
36
- <component-mapper *ngIf="arFields$" name="DetailsFields" [props]="{ arFields$: arFields$ }"></component-mapper>
37
- <component-mapper *ngIf="arFields2$" name="DetailsFields" [props]="{ arFields$: arFields2$ }"></component-mapper>
38
- <component-mapper *ngIf="arFields3$" name="DetailsFields" [props]="{ arFields$: arFields3$ }"></component-mapper>
39
- </div>
40
- </div>
@@ -1,116 +0,0 @@
1
- .psdk-details-group {
2
- display: flex;
3
- flex-direction: row;
4
- justify-content: space-between;
5
- }
6
- .psdk-details-fields {
7
- padding: calc(2 * 0.5rem);
8
- grid-row-gap: calc(2 * 0.5rem);
9
- }
10
-
11
- .psdk-details-fields-primary {
12
- width: 100%;
13
- display: grid;
14
- grid-template-columns: 1fr;
15
- grid-column-gap: calc(2 * 0.5rem);
16
- grid-row-gap: calc(1 * 0.5rem);
17
- }
18
-
19
- .psdk-details-fields-single {
20
- display: grid;
21
- grid-template-columns: 20ch 1fr;
22
- grid-column-gap: calc(2 * 0.5rem);
23
- }
24
-
25
- .psdk-details-fields-label {
26
- margin: 8px 0px;
27
- }
28
-
29
- .psdk-details-fields-value {
30
- word-break: break-word;
31
- grid-column-start: 2;
32
- grid-row-start: 1;
33
- }
34
-
35
- span.psdk-details-text-style-hf {
36
- font-weight: 500;
37
- font-size: 1.25rem;
38
- }
39
-
40
- span.psdk-details-text-style {
41
- font-weight: 400;
42
- }
43
-
44
- span.psdk-details-status-style {
45
- border-radius: calc(0.25 * 0.5rem);
46
- display: inline-block;
47
- font-size: 0.75rem;
48
- font-weight: bold;
49
- line-height: calc(0.5rem * 2.5);
50
- height: calc(0.5rem * 2.5);
51
- padding: 0 0.5rem;
52
- text-transform: uppercase;
53
- }
54
-
55
- .psdk-grid-filter {
56
- display: grid;
57
- grid-template-columns: repeat(2, minmax(0, 1fr));
58
- column-gap: calc(2 * 0.5rem);
59
- row-gap: calc(2 * 0.5rem);
60
- align-items: start;
61
- }
62
-
63
- .psdk-csf-primary-field-value {
64
- margin: 8px 0;
65
- }
66
-
67
- span.psdk-details-status-style-hf {
68
- border-radius: calc(0.25 * 0.5rem);
69
- display: inline-block;
70
- font-size: 1.25rem;
71
- font-weight: 500;
72
- line-height: calc(0.5rem * 2.5);
73
- height: calc(0.5rem * 2.5);
74
- padding: 0 0.5rem;
75
- text-transform: uppercase;
76
- }
77
-
78
- .psdk-grid-filter-1 {
79
- display: grid;
80
- grid-template-columns: repeat(1, minmax(0, 1fr));
81
- column-gap: calc(2 * 0.5rem);
82
- row-gap: calc(2 * 0.5rem);
83
- align-items: start;
84
- }
85
-
86
- .psdk-grid-filter-2 {
87
- display: grid;
88
- grid-template-columns: repeat(2, minmax(0, 1fr));
89
- column-gap: calc(2 * 0.5rem);
90
- row-gap: calc(2 * 0.5rem);
91
- align-items: start;
92
- }
93
-
94
- .psdk-grid-filter-3 {
95
- display: grid;
96
- grid-template-columns: repeat(3, minmax(0, 1fr));
97
- column-gap: calc(2 * 0.5rem);
98
- row-gap: calc(2 * 0.5rem);
99
- align-items: start;
100
- }
101
-
102
- .psdk-grid-filter-wide-narrow {
103
- display: grid;
104
- grid-template-columns: 7fr 3fr;
105
- column-gap: calc(2 * 0.5rem);
106
- row-gap: calc(2 * 0.5rem);
107
- align-items: start;
108
- }
109
-
110
- .psdk-grid-filter-narrow-wide {
111
- display: grid;
112
- grid-template-columns: 3fr 7fr;
113
- column-gap: calc(2 * 0.5rem);
114
- row-gap: calc(2 * 0.5rem);
115
- align-items: start;
116
- }
@@ -1,24 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { MaterialDetailsComponent } from './material-details.component';
4
-
5
- describe('MaterialDetailsComponent', () => {
6
- let component: MaterialDetailsComponent;
7
- let fixture: ComponentFixture<MaterialDetailsComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [MaterialDetailsComponent]
12
- }).compileComponents();
13
- });
14
-
15
- beforeEach(() => {
16
- fixture = TestBed.createComponent(MaterialDetailsComponent);
17
- component = fixture.componentInstance;
18
- fixture.detectChanges();
19
- });
20
-
21
- it('should create', () => {
22
- expect(component).toBeTruthy();
23
- });
24
- });
@@ -1,31 +0,0 @@
1
- import { Component, Input, forwardRef } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { Utils } from '@pega/angular-sdk-components';
4
- import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
-
6
- @Component({
7
- selector: 'app-material-details',
8
- templateUrl: './material-details.component.html',
9
- styleUrls: ['./material-details.component.scss'],
10
- imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
11
- })
12
- export class MaterialDetailsComponent {
13
- constructor(private utils: Utils) {}
14
-
15
- @Input() arFields$: any[];
16
- @Input() arFields2$: any[];
17
- @Input() arFields3$: any[];
18
- @Input() arHighlightedFields: any[];
19
- @Input() layout: any;
20
-
21
- _getValue(configValue) {
22
- if (configValue && configValue != '') {
23
- return configValue;
24
- }
25
- return '---';
26
- }
27
-
28
- _formatDate(dateValue: string, dateFormat: string): string {
29
- return this.utils.generateDate(dateValue, dateFormat);
30
- }
31
- }
@@ -1,50 +0,0 @@
1
- <div id="details-fields-list">
2
- <div *ngFor="let field of arFields$">
3
- <div *ngIf="field.type === 'group'; else noGroup">
4
- <component-mapper name="Group" [props]="{ pConn$: field.pConn }"></component-mapper>
5
- </div>
6
- <ng-template #noGroup>
7
- <div *ngIf="field.type === 'reference'; else showDetails">
8
- <component-mapper name="reference" [props]="{ pConn$: field.pConn }"></component-mapper>
9
- </div>
10
- </ng-template>
11
-
12
- <ng-template #showDetails>
13
- <div class="psdk-grid-filter" *ngIf="field.config.label && _getVisibility(field.config)">
14
- <div class="psdk-details-fields-label">
15
- {{ field.config.label }}
16
- </div>
17
- <ng-container *ngIf="field.type.toLowerCase() === 'objectreference'; else standardFieldValue">
18
- <div>
19
- <component-mapper name="ObjectReference" [props]="{ pConn$: field.pConn, isDetails$: true }"></component-mapper>
20
- </div>
21
- </ng-container>
22
- <ng-template #standardFieldValue>
23
- <div [ngSwitch]="field.type.toLowerCase()" class="psdk-csf-primary-field-value">
24
- <span *ngSwitchCase="'textinput'" class="psdk-details-text-style">{{ _getValue(field.config.value) }}</span>
25
- <span *ngSwitchCase="'status'" class="psdk-details-status-style">{{ _getValue(field.config.value) }}</span>
26
- <a *ngSwitchCase="'phone'" class="psdk-primary-color" as="a" href="tel: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
27
- <a *ngSwitchCase="'email'" class="psdk-primary-color" href="mailto: {{ field.config.value }}">{{ _getValue(field.config.value) }}</a>
28
- <span *ngSwitchCase="'date'" class="psdk-details-text-style">{{ _formatDate(field.config.value, field.type) }}</span>
29
- <span *ngSwitchCase="'decimal'" class="psdk-details-text-style">{{ _formatDecimal(field) }}</span>
30
- <span *ngSwitchCase="'currency'" class="psdk-details-text-style">{{ _formatCurrency(field) }}</span>
31
- <span *ngSwitchCase="'richtext'" class="psdk-details-text-style" [innerHTML]="_getValue(field.config.value)"></span>
32
- <ng-container *ngSwitchCase="'scalarlist'">
33
- <span *ngIf="field.config.componentType?.toLowerCase() === 'decimal'" class="psdk-details-text-style">{{ _formatDecimal(field) }}</span>
34
- <span *ngIf="field.config.componentType?.toLowerCase() === 'currency'" class="psdk-details-text-style">{{
35
- _formatCurrency(field)
36
- }}</span>
37
- <span
38
- *ngIf="field.config.componentType?.toLowerCase() !== 'decimal' && field.config.componentType?.toLowerCase() !== 'currency'"
39
- class="psdk-details-text-style"
40
- >{{ _getValue(field.config.value) }}</span
41
- >
42
- </ng-container>
43
- <span *ngSwitchCase="'caseoperator'"></span>
44
- <span *ngSwitchDefault>{{ _getValue(field.config.value, field) }}</span>
45
- </div>
46
- </ng-template>
47
- </div>
48
- </ng-template>
49
- </div>
50
- </div>
@@ -1,34 +0,0 @@
1
- .psdk-details-fields-label {
2
- margin: 8px 0px;
3
- }
4
-
5
- span.psdk-details-text-style-hf {
6
- font-weight: bold;
7
- }
8
-
9
- span.psdk-details-status-style-hf {
10
- border-radius: calc(0.25 * 0.5rem);
11
- display: inline-block;
12
- font-size: 0.75rem;
13
- font-weight: bold;
14
- line-height: calc(0.5rem * 2.5);
15
- height: calc(0.5rem * 2.5);
16
- padding: 0 0.5rem;
17
- text-transform: uppercase;
18
- }
19
-
20
- .psdk-grid-filter {
21
- display: grid;
22
- grid-template-columns: repeat(2, minmax(0, 1fr));
23
- column-gap: calc(2 * 0.5rem);
24
- row-gap: calc(2 * 0.5rem);
25
- align-items: start;
26
- }
27
-
28
- .psdk-csf-primary-field-value {
29
- margin: 8px 0;
30
- }
31
-
32
- .psdk-primary-color {
33
- color: var(--mat-sys-primary);
34
- }
@@ -1,22 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { MaterialDetailsFieldsComponent } from './material-details-fields.component';
4
-
5
- describe('MaterialDetailsFieldsComponent', () => {
6
- let component: MaterialDetailsFieldsComponent;
7
- let fixture: ComponentFixture<MaterialDetailsFieldsComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [MaterialDetailsFieldsComponent]
12
- }).compileComponents();
13
-
14
- fixture = TestBed.createComponent(MaterialDetailsFieldsComponent);
15
- component = fixture.componentInstance;
16
- fixture.detectChanges();
17
- });
18
-
19
- it('should create', () => {
20
- expect(component).toBeTruthy();
21
- });
22
- });
@@ -1,61 +0,0 @@
1
- import { Component, Input, forwardRef } from '@angular/core';
2
- import { Utils } from '@pega/angular-sdk-components';
3
- import { CommonModule } from '@angular/common';
4
- import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
- import { getCurrencyOptions } from '@pega/angular-sdk-components';
6
- import { format } from '@pega/angular-sdk-components';
7
-
8
- @Component({
9
- selector: 'app-material-details-fields',
10
- templateUrl: './material-details-fields.component.html',
11
- styleUrls: ['./material-details-fields.component.scss'],
12
- imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
13
- })
14
- export class MaterialDetailsFieldsComponent {
15
- constructor(private utils: Utils) {}
16
-
17
- @Input() arFields$: any[];
18
- @Input() arHighlightedFields: any[];
19
-
20
- _getValue(configValue, field: any = {}) {
21
- if (field?.type === 'userreference') {
22
- return configValue.userName;
23
- }
24
- if (configValue && configValue != '') {
25
- return configValue;
26
- }
27
- return '---';
28
- }
29
-
30
- _formatDate(dateValue: string, dateFormat: string): string {
31
- return this.utils.generateDate(dateValue, dateFormat);
32
- }
33
-
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 {
57
- const { visibility = true } = config;
58
-
59
- return this.utils.getBooleanValue(visibility);
60
- }
61
- }