@pega/angular-sdk-overrides 0.23.5 → 0.24.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 (37) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +5 -2
  2. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +3 -1
  3. package/lib/designSystemExtension/operator/operator.component.ts +6 -4
  4. package/lib/field/auto-complete/auto-complete.component.ts +1 -1
  5. package/lib/field/check-box/check-box.component.html +16 -15
  6. package/lib/field/check-box/check-box.component.scss +14 -1
  7. package/lib/field/check-box/check-box.component.ts +127 -44
  8. package/lib/field/group/group.component.html +1 -1
  9. package/lib/field/group/group.component.ts +4 -0
  10. package/lib/field/multiselect/multiselect.component.html +34 -0
  11. package/lib/field/multiselect/multiselect.component.scss +7 -0
  12. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  13. package/lib/field/multiselect/multiselect.component.ts +363 -0
  14. package/lib/field/multiselect/utils.ts +209 -0
  15. package/lib/field/rich-text/rich-text.component.html +1 -1
  16. package/lib/field/time/time.component.html +1 -0
  17. package/lib/field/time/time.component.ts +2 -0
  18. package/lib/field/url/url.component.html +1 -0
  19. package/lib/field/url/url.component.ts +2 -0
  20. package/lib/infra/Containers/view-container/view-container.component.ts +7 -6
  21. package/lib/infra/multi-step/multi-step.component.scss +1 -0
  22. package/lib/infra/navbar/navbar.component.html +3 -3
  23. package/lib/infra/navbar/navbar.component.ts +4 -2
  24. package/lib/template/case-summary/case-summary.component.ts +37 -3
  25. package/lib/template/field-value-list/field-value-list.component.html +7 -2
  26. package/lib/template/field-value-list/field-value-list.component.ts +1 -0
  27. package/lib/template/list-view/list-view.component.html +4 -4
  28. package/lib/template/list-view/list-view.component.ts +21 -24
  29. package/lib/template/list-view/utils.ts +4 -2
  30. package/lib/template/simple-table-manual/helpers.ts +1 -1
  31. package/lib/template/simple-table-manual/simple-table-manual.component.html +1 -1
  32. package/lib/template/simple-table-manual/simple-table-manual.component.ts +44 -7
  33. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  34. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +2 -1
  35. package/lib/widget/attachment/attachment.component.html +9 -1
  36. package/lib/widget/attachment/attachment.component.ts +4 -1
  37. package/package.json +1 -1
@@ -28,11 +28,14 @@
28
28
  <dl *ngFor="let field of secondaryFields$" class="psdk-case-summary-fields-secondary">
29
29
  <div
30
30
  *ngIf="
31
- field.config?.label?.toLowerCase() == 'create operator' || field.config?.label?.toLowerCase() == 'update operator';
31
+ field.config?.label?.toLowerCase() == 'create operator' ||
32
+ field.displayLabel.toLowerCase() == 'create operator' ||
33
+ field.config?.label?.toLowerCase() == 'update operator' ||
34
+ field.displayLabel.toLowerCase() == 'update operator';
32
35
  else hasSecondaryValue
33
36
  "
34
37
  >
35
- <component-mapper name="Operator" [props]="{ pConn$: field?.kid }"></component-mapper>
38
+ <component-mapper name="Operator" [props]="{ pConn$: field?.kid, displayLabel: field?.displayLabel }"></component-mapper>
36
39
  </div>
37
40
  <ng-template #hasSecondaryValue>
38
41
  <div class="psdk-csf-secondary-field">
@@ -19,7 +19,8 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
19
19
  primaryFieldsWithStatus$: any[];
20
20
 
21
21
  constructor(private utils: Utils) {}
22
-
22
+ localizedVal = PCore.getLocaleUtils().getLocaleValue;
23
+ localeCategory = 'ModalContainer';
23
24
  ngOnInit(): void {
24
25
  this.updatePrimaryWithStatus();
25
26
  this.updateLabelAndDate(this.primaryFieldsWithStatus$);
@@ -63,6 +64,7 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
63
64
  updatePrimaryWithStatus() {
64
65
  this.primaryFieldsWithStatus$ = [];
65
66
  for (const prim of this.primaryFields$) {
67
+ prim.config.value = this.localizedVal(prim.config.value, this.localeCategory);
66
68
  this.primaryFieldsWithStatus$.push(prim);
67
69
  }
68
70
 
@@ -12,7 +12,7 @@ import { Utils } from '@pega/angular-sdk-components';
12
12
  })
13
13
  export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
14
14
  @Input() pConn$: typeof PConnect;
15
-
15
+ @Input() displayLabel;
16
16
  fields$: any[] = [];
17
17
  bShowPopover$: boolean;
18
18
  date$: string;
@@ -51,15 +51,17 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
51
51
 
52
52
  updateSelf(): void {
53
53
  const configProps$ = this.pConn$.getConfigProps() as any;
54
- if (configProps$?.label?.toLowerCase() == 'create operator') {
54
+ this.displayLabel = this.displayLabel?.toLowerCase();
55
+ const label = configProps$?.label?.toLowerCase();
56
+ if (label === 'create operator' || this.displayLabel === 'create operator') {
55
57
  this.name$ = configProps$.createOperator.userName;
56
58
  this.id$ = configProps$.createOperator.userId;
57
59
  this.label$ = configProps$.createLabel;
58
- } else if (configProps$?.label?.toLowerCase() == 'update operator') {
60
+ } else if (label === 'update operator' || this.displayLabel === 'update operator') {
59
61
  this.name$ = configProps$.updateOperator.userName;
60
62
  this.id$ = configProps$.updateOperator.userId;
61
63
  this.label$ = configProps$.updateLabel;
62
- } else if (configProps$?.label?.toLowerCase() == 'resolve operator') {
64
+ } else if (label === 'resolve operator' || this.displayLabel === 'resolve operator') {
63
65
  this.name$ = configProps$.resolveOperator.userName;
64
66
  this.id$ = configProps$.resolveOperator.userId;
65
67
  this.label$ = configProps$.resolveLabel;
@@ -118,7 +118,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
118
118
 
119
119
  private _filter(value: string): string[] {
120
120
  const filterVal = (value || this.filterValue).toLowerCase();
121
- return this.options$?.filter(option => option.value.toLowerCase().includes(filterVal));
121
+ return this.options$?.filter(option => option.value?.toLowerCase().includes(filterVal));
122
122
  }
123
123
 
124
124
  // Callback passed when subscribing to store change
@@ -6,36 +6,37 @@
6
6
  ></component-mapper>
7
7
  </div>
8
8
  <ng-template #noDisplayMode>
9
- <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
9
+ <div *ngIf="bHasForm$; else noEdit">
10
10
  <div [formGroup]="formGroup$" *ngIf="bVisible$">
11
11
  <div class="mat-form-field-infix" *ngIf="showLabel$">
12
12
  <span>
13
13
  <label class="mat-form-field-label psdk-label-readonly">{{ label$ }}</label>
14
14
  </span>
15
- <mat-checkbox
16
- [labelPosition]="'after'"
17
- [checked]="isChecked$"
18
- [disabled]="bDisabled$"
19
- [attr.data-test-id]="testId"
20
- [formControl]="fieldControl"
21
- (change)="fieldOnChange($event)"
22
- (blur)="fieldOnBlur($event)"
23
- >{{ caption$ }}</mat-checkbox
24
- >
25
15
  </div>
26
- <div class="mat-form-field-infix" *ngIf="!bReadonly$ && !showLabel$">
16
+ <div *ngIf="selectionMode === 'multi'; else single">
17
+ <mat-option *ngFor="let item of listOfCheckboxes" (click)="handleChangeMultiMode($event, item)">
18
+ <mat-checkbox
19
+ [labelPosition]="'after'"
20
+ [checked]="item.selected"
21
+ [attr.data-test-id]="testId + ':' + item.value"
22
+ (change)="handleChangeMultiMode($event, item)"
23
+ (blur)="fieldOnBlur($event)"
24
+ >{{ item.text ?? item.value }}
25
+ </mat-checkbox>
26
+ </mat-option>
27
+ </div>
28
+ <ng-template #single>
27
29
  <mat-checkbox
28
30
  [labelPosition]="'after'"
29
31
  [checked]="isChecked$"
30
- [disabled]="bDisabled$"
31
32
  [attr.data-test-id]="testId"
32
33
  [formControl]="fieldControl"
33
34
  (change)="fieldOnChange($event)"
34
35
  (blur)="fieldOnBlur($event)"
35
36
  >{{ caption$ }}</mat-checkbox
36
37
  >
37
- </div>
38
- <mat-hint *ngIf="helperText">{{ helperText }}</mat-hint>
38
+ <p *ngIf="helperText">{{ helperText }}</p>
39
+ </ng-template>
39
40
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
40
41
  </div>
41
42
  </div>
@@ -8,10 +8,10 @@
8
8
  top: 0rem;
9
9
  margin-top: 0.625rem;
10
10
  font-size: 0.875rem;
11
- display: block;
12
11
  transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px);
13
12
  -ms-transform: translateY(-1.28125em) scale(0.75);
14
13
  width: 133.33333%;
14
+ color: rgba(0, 0, 0, 0.6);
15
15
  }
16
16
 
17
17
  .psdk-data-readonly {
@@ -22,3 +22,16 @@
22
22
  ::ng-deep .mat-mdc-form-field-infix {
23
23
  width: auto;
24
24
  }
25
+
26
+ p {
27
+ font-size: 0.75rem;
28
+ color: rgba(0, 0, 0, 0.58);
29
+ }
30
+
31
+ mat-checkbox {
32
+ margin-left: -11px;
33
+ }
34
+
35
+ .mat-mdc-option {
36
+ margin-left: -16px;
37
+ }
@@ -3,10 +3,14 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatCheckboxModule } from '@angular/material/checkbox';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
+ import { MatOptionModule } from '@angular/material/core';
7
+ import { interval } from 'rxjs';
6
8
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
7
9
  import { Utils } from '@pega/angular-sdk-components';
8
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
11
  import { PConnFieldProps } from '@pega/angular-sdk-components';
12
+ import { deleteInstruction, insertInstruction, updateNewInstructions } from '@pega/angular-sdk-components';
13
+ import { handleEvent } from '@pega/angular-sdk-components';
10
14
 
11
15
  interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
12
16
  // If any, enter additional props that only exist on Checkbox here
@@ -15,6 +19,13 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
15
19
  caption?: string;
16
20
  trueLabel?: string;
17
21
  falseLabel?: string;
22
+ selectionMode?: string;
23
+ datasource?: any;
24
+ selectionKey?: string;
25
+ selectionList?: any;
26
+ primaryField: string;
27
+ readonlyContextList: any;
28
+ referenceList: string;
18
29
  }
19
30
 
20
31
  @Component({
@@ -22,7 +33,7 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
22
33
  templateUrl: './check-box.component.html',
23
34
  styleUrls: ['./check-box.component.scss'],
24
35
  standalone: true,
25
- imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, MatFormFieldModule, forwardRef(() => ComponentMapperComponent)]
36
+ imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, MatFormFieldModule, MatOptionModule, forwardRef(() => ComponentMapperComponent)]
26
37
  })
27
38
  export class CheckBoxComponent implements OnInit, OnDestroy {
28
39
  @Input() pConn$: typeof PConnect;
@@ -50,6 +61,17 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
50
61
  trueLabel$?: string;
51
62
  falseLabel$?: string;
52
63
 
64
+ selectionMode?: string;
65
+ datasource?: any;
66
+ selectionKey?: string;
67
+ selectionList?: any;
68
+ primaryField: string;
69
+ selectedvalues: any;
70
+ referenceList: string;
71
+ listOfCheckboxes: any[] = [];
72
+ actionsApi: any;
73
+ propName: any;
74
+
53
75
  fieldControl = new FormControl('', null);
54
76
 
55
77
  constructor(
@@ -69,6 +91,11 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
69
91
  // this.updateSelf();
70
92
  this.checkAndUpdate();
71
93
 
94
+ if (this.selectionMode === 'multi' && this.referenceList?.length > 0) {
95
+ this.pConn$.setReferenceList(this.selectionList);
96
+ updateNewInstructions(this.pConn$, this.selectionList);
97
+ }
98
+
72
99
  if (this.formGroup$) {
73
100
  // add control to formGroup
74
101
  this.formGroup$.addControl(this.controlName$, this.fieldControl);
@@ -111,68 +138,124 @@ export class CheckBoxComponent implements OnInit, OnDestroy {
111
138
  // moved this from ngOnInit() and call this from there instead...
112
139
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as CheckboxProps;
113
140
 
114
- if (this.configProps$.value != undefined) {
115
- this.value$ = this.configProps$.value;
116
- }
117
141
  this.testId = this.configProps$.testId;
118
- this.label$ = this.configProps$.label;
119
142
  this.displayMode$ = this.configProps$.displayMode;
143
+ this.label$ = this.configProps$.label;
144
+ if (this.label$ != '') {
145
+ this.showLabel$ = true;
146
+ }
120
147
 
121
- this.caption$ = this.configProps$.caption;
122
- this.helperText = this.configProps$.helperText;
123
- this.trueLabel$ = this.configProps$.trueLabel;
124
- this.falseLabel$ = this.configProps$.falseLabel;
125
-
126
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
127
- setTimeout(() => {
128
- if (this.configProps$.required != null) {
129
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
148
+ this.actionsApi = this.pConn$.getActionsApi();
149
+ this.propName = (this.pConn$.getStateProps() as any).value;
150
+
151
+ // multi case
152
+ this.selectionMode = this.configProps$.selectionMode;
153
+ if (this.selectionMode === 'multi') {
154
+ this.referenceList = this.configProps$.referenceList;
155
+ this.selectionList = this.configProps$.selectionList;
156
+ this.selectedvalues = this.configProps$.readonlyContextList;
157
+ this.primaryField = this.configProps$.primaryField;
158
+
159
+ this.datasource = this.configProps$.datasource;
160
+ this.selectionKey = this.configProps$.selectionKey;
161
+ const listSourceItems = this.datasource?.source ?? [];
162
+ const dataField: any = this.selectionKey?.split?.('.')[1];
163
+ const listToDisplay: any[] = [];
164
+ listSourceItems.forEach(element => {
165
+ element.selected = this.selectedvalues?.some?.(data => data[dataField] === element.key);
166
+ listToDisplay.push(element);
167
+ });
168
+ this.listOfCheckboxes = listToDisplay;
169
+ } else {
170
+ if (this.configProps$.value != undefined) {
171
+ this.value$ = this.configProps$.value;
130
172
  }
131
- this.cdRef.detectChanges();
132
- });
133
-
134
- if (this.configProps$.visibility != null) {
135
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
136
- }
137
173
 
138
- // disabled
139
- if (this.configProps$.disabled != undefined) {
140
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
141
- }
174
+ this.caption$ = this.configProps$.caption;
175
+ this.helperText = this.configProps$.helperText;
176
+ this.trueLabel$ = this.configProps$.trueLabel;
177
+ this.falseLabel$ = this.configProps$.falseLabel;
178
+
179
+ // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
180
+ setTimeout(() => {
181
+ if (this.configProps$.required != null) {
182
+ this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
183
+ }
184
+ this.cdRef.detectChanges();
185
+ });
186
+
187
+ if (this.configProps$.visibility != null) {
188
+ this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
189
+ }
142
190
 
143
- if (this.bDisabled$) {
144
- this.fieldControl.disable();
145
- } else {
146
- this.fieldControl.enable();
147
- }
191
+ // disabled
192
+ if (this.configProps$.disabled != undefined) {
193
+ this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
194
+ }
148
195
 
149
- if (this.configProps$.readOnly != null) {
150
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
151
- }
196
+ if (this.bDisabled$) {
197
+ this.fieldControl.disable();
198
+ } else {
199
+ this.fieldControl.enable();
200
+ }
152
201
 
153
- this.componentReference = (this.pConn$.getStateProps() as any).value;
202
+ if (this.configProps$.readOnly != null) {
203
+ this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
204
+ this.fieldControl.disable();
205
+ }
154
206
 
155
- if (this.label$ != '') {
156
- this.showLabel$ = true;
157
- }
207
+ this.componentReference = (this.pConn$.getStateProps() as any).value;
158
208
 
159
- // eslint-disable-next-line sonarjs/no-redundant-boolean
160
- if (this.value$ === 'true' || this.value$ == true) {
161
- this.isChecked$ = true;
162
- } else {
163
- this.isChecked$ = false;
209
+ // eslint-disable-next-line sonarjs/no-redundant-boolean
210
+ if (this.value$ === 'true' || this.value$ == true) {
211
+ this.isChecked$ = true;
212
+ } else {
213
+ this.isChecked$ = false;
214
+ }
215
+ // trigger display of error message with field control
216
+ if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
217
+ const timer = interval(100).subscribe(() => {
218
+ this.fieldControl.setErrors({ message: true });
219
+ this.fieldControl.markAsTouched();
220
+
221
+ timer.unsubscribe();
222
+ });
223
+ }
164
224
  }
165
225
  }
166
226
 
167
227
  fieldOnChange(event: any) {
168
228
  event.value = event.checked;
169
229
 
170
- this.angularPConnectData.actions?.onChange(this, event);
230
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, event.checked);
171
231
  }
172
232
 
173
233
  fieldOnBlur(event: any) {
174
- event.value = event.checked;
175
- this.angularPConnectData.actions?.onBlur(this, event);
234
+ if (this.selectionMode === 'multi') {
235
+ this.pConn$.getValidationApi().validate(this.selectedvalues, this.selectionList);
236
+ } else {
237
+ event.value = event.checked;
238
+ this.angularPConnectData.actions?.onBlur(this, event);
239
+ }
240
+ }
241
+
242
+ handleChangeMultiMode(event, element) {
243
+ if (!element.selected) {
244
+ insertInstruction(this.pConn$, this.selectionList, this.selectionKey, this.primaryField, {
245
+ id: element.key,
246
+ primary: element.text ?? element.value
247
+ });
248
+ } else {
249
+ deleteInstruction(this.pConn$, this.selectionList, this.selectionKey, {
250
+ id: element.key,
251
+ primary: element.text ?? element.value
252
+ });
253
+ }
254
+ this.pConn$.clearErrorMessages({
255
+ property: this.selectionList,
256
+ category: '',
257
+ context: ''
258
+ });
176
259
  }
177
260
 
178
261
  getErrorMessage() {
@@ -1,4 +1,4 @@
1
- <ng-container *ngIf="visibility$">
1
+ <ng-container *ngIf="visibility$ && arChildren$.length">
2
2
  <component-mapper
3
3
  name="FieldGroup"
4
4
  [props]="{
@@ -69,6 +69,10 @@ export class GroupComponent implements OnInit {
69
69
  this.instructions$ = this.configProps$.instructions;
70
70
  this.collapsible$ = this.configProps$.collapsible;
71
71
 
72
+ if (this.configProps$.visibility === undefined) {
73
+ this.visibility$ = this.pConn$.getComputedVisibility();
74
+ }
75
+
72
76
  if (this.configProps$.displayMode === 'LABELS_LEFT') {
73
77
  if (this.configProps$.visibility === undefined) this.visibility$ = true;
74
78
 
@@ -0,0 +1,34 @@
1
+ <div [formGroup]="formGroup$">
2
+ <mat-form-field class="psdk-full-width" subscriptSizing="dynamic">
3
+ <mat-label>{{ label$ }}</mat-label>
4
+ <mat-chip-grid #chipGrid>
5
+ <ng-container *ngFor="let select of selectedItems">
6
+ <mat-chip-row (removed)="removeChip(select)">
7
+ {{ select.primary }}
8
+ <button matChipRemove>
9
+ <mat-icon>cancel</mat-icon>
10
+ </button>
11
+ </mat-chip-row>
12
+ </ng-container>
13
+ </mat-chip-grid>
14
+ <input
15
+ matInput
16
+ [placeholder]="placeholder"
17
+ [formControl]="fieldControl"
18
+ [value]="value$"
19
+ [required]="bRequired$"
20
+ [matAutocomplete]="auto"
21
+ (input)="fieldOnChange($event)"
22
+ [matChipInputFor]="chipGrid"
23
+ #trigger="matAutocompleteTrigger"
24
+ />
25
+ <mat-autocomplete #auto="matAutocomplete">
26
+ <mat-option *ngFor="let item of itemsTree" [value]="item.primary" (click)="optionClicked($event, item, trigger)">
27
+ <mat-checkbox [checked]="item.selected" (click)="optionClicked($event, item, trigger)">
28
+ <span>{{ item.primary }}</span>
29
+ </mat-checkbox>
30
+ </mat-option>
31
+ </mat-autocomplete>
32
+ <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
33
+ </mat-form-field>
34
+ </div>
@@ -0,0 +1,7 @@
1
+ .psdk-full-width {
2
+ width: 100%;
3
+ }
4
+
5
+ ::ng-deep .mat-mdc-form-field-infix {
6
+ padding-left: 10px;
7
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { MultiselectComponent } from './multiselect.component';
4
+
5
+ describe('MultiselectComponent', () => {
6
+ let component: MultiselectComponent;
7
+ let fixture: ComponentFixture<MultiselectComponent>;
8
+
9
+ beforeEach(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [MultiselectComponent]
12
+ });
13
+ fixture = TestBed.createComponent(MultiselectComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });