@pega/angular-sdk-overrides 23.1.10 → 24.1.10

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 (85) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +7 -4
  2. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +3 -1
  3. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html +1 -1
  4. package/lib/designSystemExtension/operator/operator.component.ts +10 -5
  5. package/lib/field/auto-complete/auto-complete.component.ts +1 -1
  6. package/lib/field/cancel-alert/cancel-alert.component.ts +0 -2
  7. package/lib/field/check-box/check-box.component.html +16 -15
  8. package/lib/field/check-box/check-box.component.scss +14 -1
  9. package/lib/field/check-box/check-box.component.ts +126 -44
  10. package/lib/field/currency/currency.component.html +15 -6
  11. package/lib/field/currency/currency.component.ts +36 -18
  12. package/lib/field/date-time/date-time.component.html +5 -5
  13. package/lib/field/date-time/date-time.component.ts +15 -37
  14. package/lib/field/decimal/decimal.component.html +14 -4
  15. package/lib/field/decimal/decimal.component.ts +42 -5
  16. package/lib/field/dropdown/dropdown.component.ts +0 -3
  17. package/lib/field/group/group.component.html +1 -1
  18. package/lib/field/group/group.component.ts +4 -0
  19. package/lib/field/multiselect/multiselect.component.html +33 -0
  20. package/lib/field/multiselect/multiselect.component.scss +7 -0
  21. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  22. package/lib/field/multiselect/multiselect.component.ts +359 -0
  23. package/lib/field/multiselect/utils.ts +209 -0
  24. package/lib/field/percentage/percentage.component.html +15 -4
  25. package/lib/field/percentage/percentage.component.ts +29 -5
  26. package/lib/field/radio-buttons/radio-buttons.component.ts +0 -3
  27. package/lib/field/rich-text/config-ext.json +10 -0
  28. package/lib/field/rich-text/rich-text.component.html +1 -1
  29. package/lib/field/scalar-list/scalar-list.component.ts +2 -1
  30. package/lib/field/text-area/text-area.component.ts +0 -2
  31. package/lib/field/time/time.component.html +1 -0
  32. package/lib/field/time/time.component.ts +2 -0
  33. package/lib/field/url/url.component.html +1 -0
  34. package/lib/field/url/url.component.ts +2 -0
  35. package/lib/field/user-reference/user-reference.component.html +50 -45
  36. package/lib/field/user-reference/user-reference.component.ts +33 -15
  37. package/lib/infra/Containers/base-components/flow-container-base.component.ts +22 -0
  38. package/lib/infra/Containers/base-components/helper.ts +89 -0
  39. package/lib/infra/Containers/flow-container/flow-container.component.html +8 -3
  40. package/lib/infra/Containers/flow-container/flow-container.component.ts +30 -29
  41. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +40 -8
  42. package/lib/infra/Containers/view-container/view-container.component.ts +0 -1
  43. package/lib/infra/assignment/assignment.component.ts +38 -39
  44. package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
  45. package/lib/infra/defer-load/defer-load.component.ts +5 -8
  46. package/lib/infra/multi-step/multi-step.component.html +1 -1
  47. package/lib/infra/multi-step/multi-step.component.scss +1 -0
  48. package/lib/infra/navbar/navbar.component.html +4 -4
  49. package/lib/infra/navbar/navbar.component.ts +6 -3
  50. package/lib/infra/view/view.component.ts +1 -1
  51. package/lib/template/banner-page/config-ext.json +9 -0
  52. package/lib/template/case-summary/case-summary.component.ts +37 -3
  53. package/lib/template/case-view/case-view.component.html +3 -3
  54. package/lib/template/case-view/case-view.component.scss +2 -0
  55. package/lib/template/case-view/case-view.component.ts +0 -6
  56. package/lib/template/data-reference/data-reference.component.ts +1 -3
  57. package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +0 -1
  58. package/lib/template/field-group-template/field-group-template.component.ts +4 -12
  59. package/lib/template/field-value-list/field-value-list.component.html +7 -2
  60. package/lib/template/field-value-list/field-value-list.component.ts +1 -0
  61. package/lib/template/inline-dashboard-page/config-ext.json +9 -0
  62. package/lib/template/list-view/list-view.component.html +6 -6
  63. package/lib/template/list-view/list-view.component.ts +36 -28
  64. package/lib/template/list-view/listViewHelpers.ts +0 -1
  65. package/lib/template/repeating-structures/repeating-structures.component.ts +1 -2
  66. package/lib/template/simple-table/simple-table.component.ts +0 -2
  67. package/lib/template/simple-table-manual/helpers.ts +1 -1
  68. package/lib/template/simple-table-manual/simple-table-manual.component.html +1 -1
  69. package/lib/template/simple-table-manual/simple-table-manual.component.ts +49 -19
  70. package/lib/template/simple-table-select/simple-table-select.component.ts +2 -4
  71. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  72. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +2 -1
  73. package/lib/widget/attachment/attachment.component.html +50 -26
  74. package/lib/widget/attachment/attachment.component.scss +118 -0
  75. package/lib/widget/attachment/attachment.component.ts +256 -501
  76. package/lib/widget/case-history/case-history.component.ts +1 -2
  77. package/lib/widget/feed-container/feed-container.component.ts +0 -4
  78. package/lib/widget/file-utility/file-utility.component.html +2 -2
  79. package/lib/widget/file-utility/file-utility.component.ts +13 -17
  80. package/lib/widget/list-utility/list-utility.component.html +1 -1
  81. package/lib/widget/quick-create/config-ext.json +9 -0
  82. package/lib/widget/quick-create/quick-create.component.ts +1 -1
  83. package/lib/widget/todo/todo.component.html +6 -5
  84. package/lib/widget/todo/todo.component.ts +7 -6
  85. package/package.json +1 -1
@@ -1,44 +1,21 @@
1
- /* eslint-disable max-classes-per-file */
2
1
  import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
3
2
  import { CommonModule } from '@angular/common';
4
3
  import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
5
- import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
6
- import { NgxMatMomentModule } from '@angular-material-components/moment-adapter';
7
- import { MomentDateModule } from '@angular/material-moment-adapter';
8
4
  import { MatDatepickerModule } from '@angular/material/datepicker';
9
5
  import { MatInputModule } from '@angular/material/input';
10
6
  import { MatFormFieldModule } from '@angular/material/form-field';
7
+ import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
11
8
  import { interval } from 'rxjs';
12
9
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
13
10
  import { Utils } from '@pega/angular-sdk-components';
14
11
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
15
12
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
16
- import { handleEvent } from '@pega/angular-sdk-components';
17
13
  import { PConnFieldProps } from '@pega/angular-sdk-components';
18
14
 
19
15
  interface DateTimeProps extends PConnFieldProps {
20
16
  // If any, enter additional props that only exist on DateTime here
21
17
  }
22
18
 
23
- class MyFormat {
24
- theDateFormat: any = getDateFormatInfo();
25
-
26
- get display() {
27
- return {
28
- dateInput: `${this.theDateFormat.dateFormatString}, LT`,
29
- monthYearLabel: 'MMM YYYY',
30
- dateA11yLabel: 'LL',
31
- monthYearA11yLabel: 'MMMM YYYY'
32
- };
33
- }
34
-
35
- get parse() {
36
- return {
37
- dateInput: `${this.theDateFormat.dateFormatString}, LT`
38
- };
39
- }
40
- }
41
-
42
19
  @Component({
43
20
  selector: 'app-date-time',
44
21
  templateUrl: './date-time.component.html',
@@ -50,13 +27,10 @@ class MyFormat {
50
27
  MatFormFieldModule,
51
28
  MatInputModule,
52
29
  MatDatepickerModule,
53
- NgxMatMomentModule,
54
- NgxMatDatetimePickerModule,
55
- NgxMatTimepickerModule,
56
- MomentDateModule,
30
+ OwlDateTimeModule,
31
+ OwlNativeDateTimeModule,
57
32
  forwardRef(() => ComponentMapperComponent)
58
- ],
59
- providers: [{ provide: NGX_MAT_DATE_FORMATS, useClass: MyFormat }]
33
+ ]
60
34
  })
61
35
  export class DateTimeComponent implements OnInit, OnDestroy {
62
36
  @Input() pConn$: typeof PConnect;
@@ -194,16 +168,20 @@ export class DateTimeComponent implements OnInit, OnDestroy {
194
168
  }
195
169
  }
196
170
 
197
- fieldOnChange(event: any) {
198
- const value = event.value && event.value.isValid() ? event.value : null;
199
- const actionsApi = this.pConn$?.getActionsApi();
200
- const propName = (this.pConn$?.getStateProps() as any).value;
201
- handleEvent(actionsApi, 'changeNblur', propName, value?.toISOString());
171
+ fieldOnDateChange(event: any) {
172
+ // this comes from the date pop up
173
+ if (typeof event.value === 'object') {
174
+ // convert date to pega "date" format
175
+ event.value = event.value?.toISOString();
176
+ }
177
+ this.angularPConnectData.actions?.onChange(this, { value: event.value });
202
178
  }
203
179
 
204
180
  fieldOnBlur(event: any) {
205
- // PConnect wants to use eventHandler for onBlur
206
- if (event.target.value) event.value = event.target.value;
181
+ if (typeof event.value === 'object') {
182
+ // convert date to pega "date" format
183
+ event.value = event.value?.toISOString();
184
+ }
207
185
 
208
186
  this.angularPConnectData.actions?.onBlur(this, event);
209
187
  }
@@ -1,22 +1,32 @@
1
1
  <div *ngIf="displayMode$; else noDisplayMode">
2
- <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
2
+ <component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$: formattedValue, displayMode$ }"></component-mapper>
3
3
  </div>
4
4
  <ng-template #noDisplayMode>
5
- <div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
5
+ <div *ngIf="bHasForm$; else noEdit">
6
6
  <div [formGroup]="formGroup$" *ngIf="bVisible$">
7
7
  <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
8
8
  <mat-label>{{ label$ }}</mat-label>
9
9
  <input
10
10
  type="text"
11
11
  matInput
12
- appThousandSeparator
12
+ currencyMask
13
+ [options]="{
14
+ prefix: bReadonly$ && formatter === 'Currency' ? currSym : '',
15
+ thousands: currSep,
16
+ decimal: currDec,
17
+ align: 'left',
18
+ nullable: true,
19
+ precision: decimalPrecision,
20
+ inputMode: inputMode
21
+ }"
13
22
  [placeholder]="placeholder"
14
23
  step="0.01"
15
- [value]="value$"
24
+ [formControlName]="controlName$"
16
25
  [required]="bRequired$"
17
26
  [formControl]="fieldControl"
18
27
  [attr.data-test-id]="testId"
19
28
  (blur)="fieldOnBlur($event)"
29
+ [readonly]="bReadonly$"
20
30
  />
21
31
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
22
32
  </mat-form-field>
@@ -3,18 +3,21 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
+ import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
6
7
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
7
8
  import { Utils } from '@pega/angular-sdk-components';
8
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
10
  import { handleEvent } from '@pega/angular-sdk-components';
10
- import { ThousandSeparatorDirective } from '@pega/angular-sdk-components';
11
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/angular-sdk-components';
11
12
  import { PConnFieldProps } from '@pega/angular-sdk-components';
13
+ import { format } from '@pega/angular-sdk-components';
12
14
 
13
15
  interface DecimalProps extends PConnFieldProps {
14
16
  // If any, enter additional props that only exist on Decimal here
15
17
  currencyISOCode?: string;
16
18
  decimalPrecision?: number;
17
19
  showGroupSeparators?: string;
20
+ formatter?: string;
18
21
  }
19
22
 
20
23
  @Component({
@@ -28,7 +31,7 @@ interface DecimalProps extends PConnFieldProps {
28
31
  FormsModule,
29
32
  MatFormFieldModule,
30
33
  MatInputModule,
31
- ThousandSeparatorDirective,
34
+ NgxCurrencyDirective,
32
35
  forwardRef(() => ComponentMapperComponent)
33
36
  ]
34
37
  })
@@ -41,7 +44,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
41
44
  configProps$: DecimalProps;
42
45
 
43
46
  label$ = '';
44
- value$: number;
47
+ value$: any;
45
48
  bRequired$ = false;
46
49
  bReadonly$ = false;
47
50
  bDisabled$ = false;
@@ -55,6 +58,13 @@ export class DecimalComponent implements OnInit, OnDestroy {
55
58
  placeholder: string;
56
59
 
57
60
  fieldControl = new FormControl<number | null>(null, null);
61
+ currDec: string;
62
+ currSep: string;
63
+ currSym: string;
64
+ decimalPrecision: number | undefined;
65
+ formatter;
66
+ formattedValue: any;
67
+ inputMode: any;
58
68
 
59
69
  constructor(
60
70
  private angularPConnect: AngularPConnectService,
@@ -119,6 +129,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
119
129
  this.testId = this.configProps$.testId;
120
130
  this.label$ = this.configProps$.label;
121
131
  this.displayMode$ = this.configProps$.displayMode;
132
+ this.inputMode = NgxCurrencyInputMode.Natural;
122
133
  let nValue: any = this.configProps$.value;
123
134
  if (nValue) {
124
135
  if (typeof nValue === 'string') {
@@ -128,6 +139,21 @@ export class DecimalComponent implements OnInit, OnDestroy {
128
139
  }
129
140
  this.helperText = this.configProps$.helperText;
130
141
  this.placeholder = this.configProps$.placeholder || '';
142
+ const showGroupSeparators = this.configProps$.showGroupSeparators;
143
+ const currencyISOCode: any = this.configProps$?.currencyISOCode;
144
+
145
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
146
+ this.currDec = theSymbols.theDecimalIndicator;
147
+ this.currSep = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
148
+
149
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
150
+ this.formatter = this.configProps$.formatter;
151
+
152
+ if (this.formatter === 'Currency') {
153
+ this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
154
+ } else {
155
+ this.formattedValue = format(this.value$, this.pConn$.getComponentName().toLowerCase(), theCurrencyOptions);
156
+ }
131
157
 
132
158
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
133
159
  setTimeout(() => {
@@ -156,6 +182,13 @@ export class DecimalComponent implements OnInit, OnDestroy {
156
182
  this.fieldControl.enable();
157
183
  }
158
184
 
185
+ if (this.bReadonly$ && this.formatter === 'Currency') {
186
+ this.currSym = theSymbols.theCurrencySymbol;
187
+ } else {
188
+ this.currSym = '';
189
+ }
190
+ this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
191
+
159
192
  this.componentReference = (this.pConn$.getStateProps() as any).value;
160
193
  }
161
194
 
@@ -163,8 +196,12 @@ export class DecimalComponent implements OnInit, OnDestroy {
163
196
  const actionsApi = this.pConn$?.getActionsApi();
164
197
  const propName = (this.pConn$?.getStateProps() as any).value;
165
198
  let value = event?.target?.value;
166
- value = value.replace(/,/g, '');
167
- value = value !== '' ? Number(value) : value;
199
+ if (this.currSep === ',') {
200
+ value = value.replace(/,/g, '');
201
+ } else {
202
+ value = value?.replace(/\./g, '');
203
+ value = value?.replace(/,/g, '.');
204
+ }
168
205
  handleEvent(actionsApi, 'changeNblur', propName, value);
169
206
  }
170
207
 
@@ -159,7 +159,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
159
159
 
160
160
  this.componentReference = (this.pConn$.getStateProps() as any).value;
161
161
 
162
- // @ts-ignore - parameter “contextName” for getDataObject method should be optional
163
162
  const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
164
163
  optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
165
164
  this.options$ = optionsList;
@@ -184,7 +183,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
184
183
  this.localizedValue = this.pConn$.getLocalizedValue(
185
184
  this.value$,
186
185
  this.localePath,
187
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'.
188
186
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
189
187
  );
190
188
  // trigger display of error message with field control
@@ -223,7 +221,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
223
221
  return this.pConn$.getLocalizedValue(
224
222
  opt.value,
225
223
  this.localePath,
226
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'.
227
224
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
228
225
  );
229
226
  }
@@ -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,33 @@
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
+ />
24
+ <mat-autocomplete #auto="matAutocomplete">
25
+ <mat-option *ngFor="let item of itemsTree" [value]="item.primary" (click)="optionClicked($event, item)">
26
+ <mat-checkbox [checked]="item.selected" (click)="optionClicked($event, item)">
27
+ <span>{{ item.primary }}</span>
28
+ </mat-checkbox>
29
+ </mat-option>
30
+ </mat-autocomplete>
31
+ <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
32
+ </mat-form-field>
33
+ </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
+ });