@pega/angular-sdk-overrides 0.23.7 → 0.24.2

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 (39) 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/material-vertical-tabs/material-vertical-tabs.component.html +1 -1
  4. package/lib/designSystemExtension/operator/operator.component.ts +6 -4
  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/currency/currency.component.html +4 -4
  9. package/lib/field/currency/currency.component.ts +31 -19
  10. package/lib/field/date-time/date-time.component.html +5 -5
  11. package/lib/field/date-time/date-time.component.ts +8 -39
  12. package/lib/field/decimal/decimal.component.html +13 -4
  13. package/lib/field/decimal/decimal.component.ts +41 -5
  14. package/lib/field/multiselect/multiselect.component.html +34 -0
  15. package/lib/field/multiselect/multiselect.component.scss +7 -0
  16. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  17. package/lib/field/multiselect/multiselect.component.ts +363 -0
  18. package/lib/field/multiselect/utils.ts +209 -0
  19. package/lib/field/percentage/percentage.component.html +4 -3
  20. package/lib/field/percentage/percentage.component.ts +24 -5
  21. package/lib/field/user-reference/user-reference.component.html +50 -45
  22. package/lib/field/user-reference/user-reference.component.ts +33 -15
  23. package/lib/infra/Containers/flow-container/flow-container.component.ts +15 -9
  24. package/lib/infra/assignment/assignment.component.ts +30 -1
  25. package/lib/infra/multi-step/multi-step.component.html +1 -1
  26. package/lib/infra/navbar/navbar.component.html +4 -4
  27. package/lib/infra/navbar/navbar.component.ts +7 -3
  28. package/lib/template/case-summary/case-summary.component.ts +37 -3
  29. package/lib/template/case-view/case-view.component.html +1 -1
  30. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  31. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +2 -1
  32. package/lib/widget/attachment/attachment.component.html +9 -1
  33. package/lib/widget/attachment/attachment.component.ts +4 -1
  34. package/lib/widget/case-history/case-history.component.ts +1 -1
  35. package/lib/widget/file-utility/file-utility.component.html +2 -2
  36. package/lib/widget/file-utility/file-utility.component.ts +13 -13
  37. package/lib/widget/list-utility/list-utility.component.html +1 -1
  38. package/lib/widget/todo/todo.component.html +3 -3
  39. 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
 
@@ -1,5 +1,5 @@
1
1
  <div>
2
- <mat-button-toggle-group vertical (change)="onChange($event.value)" [value]="selectedTabId$" aria-label="Tabs">
2
+ <mat-button-toggle-group vertical hideSingleSelectionIndicator (change)="onChange($event.value)" [value]="selectedTabId$" aria-label="Tabs">
3
3
  <mat-button-toggle *ngFor="let tab of tabConfig$" [value]="tab.id" style="text-align: left">
4
4
  <div style="display: flex">
5
5
  <div style="flex-grow: 10">{{ tab.name }}</div>
@@ -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;
@@ -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() {
@@ -7,17 +7,17 @@
7
7
  <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
8
8
  <mat-label>{{ label$ }}</mat-label>
9
9
  <div class="psdk-currency-input">
10
- <span>{{ symbol }}</span>
11
10
  <input
12
11
  style="margin-left: 5px"
13
- type="float"
12
+ type="text"
14
13
  matInput
14
+ currencyMask
15
+ [options]="{ prefix: currSym, thousands: currSep, decimal: currDec, align: 'left', nullable: true }"
15
16
  [placeholder]="placeholder"
16
- [value]="value$ | number: '1.2-2'"
17
+ [formControlName]="controlName$"
17
18
  [required]="bRequired$"
18
19
  [formControl]="fieldControl"
19
20
  [attr.data-test-id]="testId"
20
- (change)="fieldOnChange($event)"
21
21
  (blur)="fieldOnBlur($event)"
22
22
  />
23
23
  </div>
@@ -4,9 +4,11 @@ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
6
  import { interval } from 'rxjs';
7
+ import { NgxCurrencyDirective } from 'ngx-currency';
7
8
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
8
9
  import { Utils } from '@pega/angular-sdk-components';
9
10
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
+ import { handleEvent } from '@pega/angular-sdk-components';
10
12
  import { getCurrencyCharacters } from '@pega/angular-sdk-components';
11
13
  import { PConnFieldProps } from '@pega/angular-sdk-components';
12
14
 
@@ -20,7 +22,7 @@ interface CurrrencyProps extends PConnFieldProps {
20
22
  templateUrl: './currency.component.html',
21
23
  styleUrls: ['./currency.component.scss'],
22
24
  standalone: true,
23
- imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
25
+ imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
24
26
  })
25
27
  export class CurrencyComponent implements OnInit, OnDestroy {
26
28
  @Input() pConn$: typeof PConnect;
@@ -31,7 +33,7 @@ export class CurrencyComponent implements OnInit, OnDestroy {
31
33
  configProps$: CurrrencyProps;
32
34
 
33
35
  label$ = '';
34
- value$: number | null;
36
+ value$: any;
35
37
  bRequired$ = false;
36
38
  bReadonly$ = false;
37
39
  bDisabled$ = false;
@@ -47,9 +49,9 @@ export class CurrencyComponent implements OnInit, OnDestroy {
47
49
  currencyOptions: Object = {};
48
50
 
49
51
  fieldControl = new FormControl<number | null>(null, { updateOn: 'blur' });
50
- symbol: string;
51
- thousandsSep: string;
52
- decimalSep: string;
52
+ currSym: string;
53
+ currSep: string;
54
+ currDec: string;
53
55
 
54
56
  constructor(
55
57
  private angularPConnect: AngularPConnectService,
@@ -114,10 +116,21 @@ export class CurrencyComponent implements OnInit, OnDestroy {
114
116
  this.testId = this.configProps$.testId;
115
117
  this.label$ = this.configProps$.label;
116
118
  this.displayMode$ = this.configProps$.displayMode;
117
- const nValue: any = this.configProps$.value;
118
- this.value$ = nValue && typeof nValue === 'string' ? parseFloat(nValue) : nValue;
119
+ let nValue: any = this.configProps$.value;
120
+ if (nValue) {
121
+ if (typeof nValue === 'string') {
122
+ nValue = parseFloat(nValue);
123
+ }
124
+ this.value$ = nValue;
125
+ }
119
126
  this.helperText = this.configProps$.helperText;
120
127
  this.placeholder = this.configProps$.placeholder || '';
128
+ const currencyISOCode: any = this.configProps$?.currencyISOCode;
129
+
130
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
131
+ this.currSym = theSymbols.theCurrencySymbol;
132
+ this.currSep = theSymbols.theDigitGroupSeparator;
133
+ this.currDec = theSymbols.theDecimalIndicator;
121
134
 
122
135
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
123
136
  setTimeout(() => {
@@ -150,11 +163,6 @@ export class CurrencyComponent implements OnInit, OnDestroy {
150
163
  this.currencyISOCode = this.configProps$.currencyISOCode;
151
164
  }
152
165
 
153
- const theSymbols = getCurrencyCharacters(this.currencyISOCode);
154
- this.symbol = theSymbols.theCurrencySymbol;
155
- this.thousandsSep = theSymbols.theDigitGroupSeparator;
156
- this.decimalSep = theSymbols.theDecimalIndicator;
157
-
158
166
  this.componentReference = (this.pConn$.getStateProps() as any).value;
159
167
 
160
168
  // trigger display of error message with field control
@@ -168,14 +176,18 @@ export class CurrencyComponent implements OnInit, OnDestroy {
168
176
  }
169
177
  }
170
178
 
171
- fieldOnChange(event: any) {
172
- this.angularPConnectData.actions?.onChange(this, event);
173
- }
174
-
175
179
  fieldOnBlur(event: any) {
176
- // PConnect wants to use eventHandler for onBlur
177
-
178
- this.angularPConnectData.actions?.onBlur(this, event);
180
+ const actionsApi = this.pConn$?.getActionsApi();
181
+ const propName = (this.pConn$?.getStateProps() as any).value;
182
+ let value = event?.target?.value;
183
+ value = value?.substring(1);
184
+ if (this.currSep === ',') {
185
+ value = value.replace(/,/g, '');
186
+ } else {
187
+ value = value?.replace(/\./g, '');
188
+ value = value?.replace(/,/g, '.');
189
+ }
190
+ handleEvent(actionsApi, 'changeNblur', propName, value);
179
191
  }
180
192
 
181
193
  getErrorMessage() {
@@ -8,18 +8,18 @@
8
8
  <mat-label>{{ label$ }}</mat-label>
9
9
  <input
10
10
  matInput
11
+ [owlDateTime]="dtPicker"
11
12
  [attr.data-test-id]="testId"
12
- [ngxMatDatetimePicker]="picker"
13
13
  [placeholder]="placeholder"
14
14
  [formControl]="fieldControl"
15
- (dateChange)="fieldOnChange($event)"
16
15
  (blur)="fieldOnBlur($event)"
16
+ (dateTimeChange)="fieldOnBlur($event)"
17
17
  [value]="value$"
18
18
  [required]="bRequired$"
19
19
  />
20
- <mat-datepicker-toggle matSuffix [for]="$any(picker)"></mat-datepicker-toggle>
21
- <ngx-mat-datetime-picker #picker [stepHour]="stepHour" [stepMinute]="stepMinute" [stepSecond]="stepSecond"> </ngx-mat-datetime-picker>
22
- <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
20
+ <mat-datepicker-toggle matSuffix [for]="$any(dtPicker)" [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
21
+ <owl-date-time #dtPicker></owl-date-time>
22
+ <mat-error *ngIf="fieldControl?.invalid">{{ getErrorMessage() }}</mat-error>
23
23
  </mat-form-field>
24
24
  </div>
25
25
  </div>
@@ -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,11 @@ 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());
202
- }
203
-
204
171
  fieldOnBlur(event: any) {
205
- // PConnect wants to use eventHandler for onBlur
206
- if (event.target.value) event.value = event.target.value;
172
+ if (typeof event.value === 'object') {
173
+ // convert date to pega "date" format
174
+ event.value = event.value?.toISOString();
175
+ }
207
176
 
208
177
  this.angularPConnectData.actions?.onBlur(this, event);
209
178
  }
@@ -1,22 +1,31 @@
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
+ inputMode: inputMode
20
+ }"
13
21
  [placeholder]="placeholder"
14
22
  step="0.01"
15
- [value]="value$"
23
+ [formControlName]="controlName$"
16
24
  [required]="bRequired$"
17
25
  [formControl]="fieldControl"
18
26
  [attr.data-test-id]="testId"
19
27
  (blur)="fieldOnBlur($event)"
28
+ [readonly]="bReadonly$"
20
29
  />
21
30
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
22
31
  </mat-form-field>