@pega/angular-sdk-overrides 0.23.3 → 0.23.5

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.
@@ -0,0 +1,21 @@
1
+ <div class="field-group-container">
2
+ <div *ngIf="name" class="field-group-heading">
3
+ <span *ngIf="collapsible; else no_collapse" id="field-group-header" class="field-group-header" (click)="headerClickHandler()">
4
+ <mat-icon *ngIf="collapsed; else down_arrow" aria-hidden="false" aria-label="Arrow Right" fontIcon="keyboard_arrow_right"></mat-icon>
5
+ <ng-template #down_arrow>
6
+ <mat-icon aria-hidden="false" aria-label="Arrow Down" fontIcon="keyboard_arrow_down"></mat-icon>
7
+ </ng-template>
8
+ <b>{{ name }}</b>
9
+ </span>
10
+ <ng-template #no_collapse>
11
+ <span>{{ name }}</span>
12
+ </ng-template>
13
+ </div>
14
+
15
+ <div *ngIf="instructions && instructions !== 'none'" class="field-group-instructions">
16
+ <div key="instructions" id="instruction-text" [innerHTML]="instructions"></div>
17
+ </div>
18
+ <div *ngIf="!collapsed" class="field-group-content">
19
+ <ng-container [ngTemplateOutlet]="childrenTemplate"></ng-container>
20
+ </div>
21
+ </div>
@@ -0,0 +1,18 @@
1
+ .field-group-container {
2
+ .field-group-heading {
3
+ padding-top: 8px;
4
+ padding-bottom: 8px;
5
+ font-weight: bold;
6
+
7
+ .field-group-header {
8
+ gap: 5px;
9
+ display: flex;
10
+ align-items: center;
11
+ cursor: pointer;
12
+ }
13
+ }
14
+
15
+ .field-group-instructions {
16
+ padding: 5px 0;
17
+ }
18
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { FieldGroupComponent } from './field-group.component';
4
+
5
+ describe('FieldGroupComponent', () => {
6
+ let component: FieldGroupComponent;
7
+ let fixture: ComponentFixture<FieldGroupComponent>;
8
+
9
+ beforeEach(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [FieldGroupComponent]
12
+ });
13
+ fixture = TestBed.createComponent(FieldGroupComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,24 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, Input, TemplateRef } from '@angular/core';
3
+ import { MatGridListModule } from '@angular/material/grid-list';
4
+ import { MatIconModule } from '@angular/material/icon';
5
+
6
+ @Component({
7
+ selector: 'app-field-group',
8
+ templateUrl: './field-group.component.html',
9
+ styleUrls: ['./field-group.component.scss'],
10
+ standalone: true,
11
+ imports: [CommonModule, MatGridListModule, MatIconModule]
12
+ })
13
+ export class FieldGroupComponent {
14
+ @Input() name?: string;
15
+ @Input() collapsible = false;
16
+ @Input() instructions: string;
17
+ @Input() childrenTemplate: TemplateRef<any>;
18
+
19
+ collapsed = false;
20
+
21
+ headerClickHandler() {
22
+ this.collapsed = !this.collapsed;
23
+ }
24
+ }
@@ -1,8 +1,14 @@
1
1
  <div id="details-fields-list">
2
2
  <div *ngFor="let field of arFields$">
3
- <div *ngIf="field.type === 'reference'; else showDetails">
4
- <component-mapper name="View" [props]="{ pConn$: field.pConn }"></component-mapper>
3
+ <div *ngIf="field.type === 'group'; else noGroup">
4
+ <component-mapper name="Group" [props]="{ pConn$: field.pConn }"></component-mapper>
5
5
  </div>
6
+ <ng-template #noGroup>
7
+ <div *ngIf="field.type === 'reference'; else showDetails">
8
+ <component-mapper name="View" [props]="{ pConn$: field.pConn }"></component-mapper>
9
+ </div>
10
+ </ng-template>
11
+
6
12
  <ng-template #showDetails>
7
13
  <div class="psdk-grid-filter" *ngIf="field.config.label">
8
14
  <div class="psdk-details-fields-label">
@@ -1,5 +1,9 @@
1
1
  <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
2
+ <component-mapper
3
+ *ngIf="bVisible$ !== false"
4
+ name="FieldValueList"
5
+ [props]="{ label$: caption$, value$: value$ ? trueLabel$ : falseLabel$, displayMode$ }"
6
+ ></component-mapper>
3
7
  </div>
4
8
  <ng-template #noDisplayMode>
5
9
  <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
@@ -13,6 +13,8 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
13
13
  // Everything from PConnFieldProps except value and change type of value to boolean
14
14
  value: boolean;
15
15
  caption?: string;
16
+ trueLabel?: string;
17
+ falseLabel?: string;
16
18
  }
17
19
 
18
20
  @Component({
@@ -45,6 +47,8 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
45
47
  bHasForm$ = true;
46
48
  componentReference = '';
47
49
  helperText: string;
50
+ trueLabel$?: string;
51
+ falseLabel$?: string;
48
52
 
49
53
  fieldControl = new FormControl('', null);
50
54
 
@@ -116,6 +120,8 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
116
120
 
117
121
  this.caption$ = this.configProps$.caption;
118
122
  this.helperText = this.configProps$.helperText;
123
+ this.trueLabel$ = this.configProps$.trueLabel;
124
+ this.falseLabel$ = this.configProps$.falseLabel;
119
125
 
120
126
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
121
127
  setTimeout(() => {
@@ -1,5 +1,9 @@
1
1
  <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
2
+ <component-mapper
3
+ *ngIf="bVisible$ !== false"
4
+ name="FieldValueList"
5
+ [props]="{ label$, value$: getFormattedValue(), displayMode$ }"
6
+ ></component-mapper>
3
7
  </div>
4
8
  <ng-template #noDisplayMode>
5
9
  <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
@@ -14,6 +14,7 @@ import { Utils } from '@pega/angular-sdk-components';
14
14
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
15
15
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
16
16
  import { PConnFieldProps } from '@pega/angular-sdk-components';
17
+ import { format } from '@pega/angular-sdk-components';
17
18
 
18
19
  interface DateProps extends PConnFieldProps {
19
20
  // If any, enter additional props that only exist on Date here
@@ -242,4 +243,10 @@ export class DateComponent implements OnInit, OnDestroy {
242
243
  }
243
244
  return errMessage;
244
245
  }
246
+
247
+ getFormattedValue() {
248
+ return format(this.value$, 'date', {
249
+ format: this.theDateFormat.dateFormatString
250
+ });
251
+ }
245
252
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "Group",
3
+ "label": "Field Group",
4
+ "description": "Field Group",
5
+ "type": "Group",
6
+ "properties": []
7
+ }
@@ -0,0 +1,25 @@
1
+ <ng-container *ngIf="visibility$">
2
+ <component-mapper
3
+ name="FieldGroup"
4
+ [props]="{
5
+ name: showHeading$ ? heading$ : undefined,
6
+ collapsible: collapsible$,
7
+ instructions: instructions$,
8
+ childrenTemplate: childrenTemplate
9
+ }"
10
+ >
11
+ </component-mapper>
12
+
13
+ <ng-template #childrenTemplate>
14
+ <div *ngFor="let kid of arChildren$">
15
+ <component-mapper
16
+ [name]="kid.getPConnect().getComponentName()"
17
+ [props]="{
18
+ pConn$: kid.getPConnect(),
19
+ formGroup$: formGroup$
20
+ }"
21
+ errorMsg="Field Group wants component not yet available: {{ kid.getPConnect().getComponentName() }}"
22
+ ></component-mapper>
23
+ </div>
24
+ </ng-template>
25
+ </ng-container>
File without changes
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { GroupComponent } from './group.component';
4
+
5
+ describe('GroupComponent', () => {
6
+ let component: GroupComponent;
7
+ let fixture: ComponentFixture<GroupComponent>;
8
+
9
+ beforeEach(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [GroupComponent]
12
+ });
13
+ fixture = TestBed.createComponent(GroupComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,84 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, forwardRef, Input, OnInit } from '@angular/core';
3
+ import { FormGroup } from '@angular/forms';
4
+ import { ReferenceComponent } from '@pega/angular-sdk-components';
5
+ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
6
+ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
7
+ import { PConnFieldProps } from '@pega/angular-sdk-components';
8
+
9
+ interface GroupProps extends PConnFieldProps {
10
+ // If any, enter additional props that only exist on Group here
11
+ showHeading: boolean;
12
+ heading: string;
13
+ instructions: string;
14
+ collapsible: boolean;
15
+ }
16
+
17
+ @Component({
18
+ selector: 'app-group',
19
+ templateUrl: './group.component.html',
20
+ styleUrls: ['./group.component.scss'],
21
+ standalone: true,
22
+ imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
23
+ })
24
+ export class GroupComponent implements OnInit {
25
+ @Input() pConn$: typeof PConnect;
26
+ @Input() formGroup$: FormGroup;
27
+
28
+ arChildren$: any[];
29
+ visibility$?: boolean;
30
+ showHeading$?: boolean;
31
+ heading$: string;
32
+ instructions$: string;
33
+ collapsible$: boolean;
34
+
35
+ // Used with AngularPConnect
36
+ angularPConnectData: AngularPConnectData = {};
37
+ configProps$: GroupProps;
38
+
39
+ constructor(private angularPConnect: AngularPConnectService) {}
40
+
41
+ ngOnInit(): void {
42
+ this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
43
+
44
+ this.checkAndUpdate();
45
+ }
46
+
47
+ // Callback passed when subscribing to store change
48
+ onStateChange() {
49
+ this.checkAndUpdate();
50
+ }
51
+
52
+ checkAndUpdate() {
53
+ // Should always check the bridge to see if the component should
54
+ // update itself (re-render)
55
+ const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
56
+
57
+ // ONLY call updateSelf when the component should update
58
+ if (bUpdateSelf) {
59
+ this.updateSelf();
60
+ }
61
+ }
62
+
63
+ updateSelf(): void {
64
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as GroupProps;
65
+ this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren());
66
+ this.visibility$ = this.configProps$.visibility;
67
+ this.showHeading$ = this.configProps$.showHeading;
68
+ this.heading$ = this.configProps$.heading;
69
+ this.instructions$ = this.configProps$.instructions;
70
+ this.collapsible$ = this.configProps$.collapsible;
71
+
72
+ if (this.configProps$.displayMode === 'LABELS_LEFT') {
73
+ if (this.configProps$.visibility === undefined) this.visibility$ = true;
74
+
75
+ this.arChildren$.forEach(child => {
76
+ const pConn = child.getPConnect();
77
+ pConn.setInheritedProp('displayMode', 'LABELS_LEFT');
78
+ pConn.setInheritedProp('readOnly', true);
79
+
80
+ return child;
81
+ });
82
+ }
83
+ }
84
+ }
@@ -143,7 +143,7 @@ export class AppShellComponent implements OnInit, OnDestroy {
143
143
  this.sErrorMessages = this.sErrorMessages.concat(errorMessages.actionMessage).concat('\n');
144
144
 
145
145
  if (this.bOkDisplayError) {
146
- const config = { panelClass: ['snackbar-newline'] };
146
+ const config = { panelClass: ['snackbar-newline'], duration: 5000 };
147
147
  this.snackBarRef = this.snackBar.open(this.sErrorMessages, 'Ok', config);
148
148
  }
149
149
  }
@@ -159,7 +159,7 @@ export class AppShellComponent implements OnInit, OnDestroy {
159
159
  this.bOkDisplayError = true;
160
160
 
161
161
  if (this.bOkDisplayError) {
162
- const config = { panelClass: ['snackbar-newline'] };
162
+ const config = { panelClass: ['snackbar-newline'], duration: 5000 };
163
163
  this.snackBarRef = this.snackBar.open(this.sErrorMessages, 'Ok', config);
164
164
  }
165
165
  // this.snackBarRef.afterDismissed().subscribe( info => {
@@ -223,7 +223,7 @@ export class CaseViewComponent implements OnInit, OnDestroy {
223
223
  const actionsAPI = this.pConn$.getActionsApi();
224
224
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
225
225
 
226
- openLocalAction(editAction.ID, { ...editAction });
226
+ openLocalAction(editAction.ID, { ...editAction, containerName: 'modal', type: 'express' });
227
227
  }
228
228
 
229
229
  _menuActionClick(data) {
@@ -1,27 +1,31 @@
1
1
  .psdk-default-form-one-column {
2
2
  display: grid;
3
3
  grid-template-columns: repeat(1, minmax(0, 1fr));
4
- gap: calc(1rem);
4
+ column-gap: calc(1rem);
5
5
  }
6
6
 
7
7
  .psdk-default-form-two-column {
8
8
  display: grid;
9
9
  grid-template-columns: repeat(2, 1fr);
10
- gap: calc(1rem);
10
+ column-gap: calc(1rem);
11
11
  }
12
12
 
13
13
  .psdk-default-form-three-column {
14
14
  display: grid;
15
15
  grid-template-columns: repeat(3, 1fr);
16
- gap: calc(1rem);
16
+ column-gap: calc(1rem);
17
+ }
18
+
19
+ .psdk-default-form-three-column .grid-column {
20
+ grid-column: 1 / span 3;
17
21
  }
18
22
 
19
23
  .psdk-default-form-two-column .grid-column {
20
24
  grid-column: 1 / span 2;
21
25
  }
22
26
 
23
- .psdk-default-form-three-column .grid-column {
24
- grid-column: 1 / span 3;
27
+ .psdk-default-form-one-column .grid-column {
28
+ grid-column: 1;
25
29
  }
26
30
 
27
31
  .template-title-container {
@@ -76,7 +76,7 @@ export class DetailsComponent implements OnInit, OnDestroy {
76
76
  fields?.forEach(field => {
77
77
  const thePConn = field.getPConnect();
78
78
  const theCompType = thePConn.getComponentName().toLowerCase();
79
- if (theCompType === 'reference') {
79
+ if (theCompType === 'reference' || theCompType === 'group') {
80
80
  const configProps = thePConn.getConfigProps();
81
81
  configProps.readOnly = true;
82
82
  configProps.displayMode = 'LABELS_LEFT';
@@ -89,6 +89,7 @@ export class DetailsComponent implements OnInit, OnDestroy {
89
89
  };
90
90
  const viewContConfig = {
91
91
  meta: {
92
+ ...thePConn.getMetadata(),
92
93
  type: theCompType,
93
94
  config: configProps
94
95
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.23.3",
3
+ "version": "0.23.5",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"