@pega/angular-sdk-overrides 0.242.7 → 0.242.8

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 (49) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -1
  2. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
  3. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +6 -0
  4. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  5. package/lib/designSystemExtension/operator/operator.component.scss +10 -2
  6. package/lib/designSystemExtension/operator/operator.component.ts +4 -3
  7. package/lib/field/currency/currency.component.ts +19 -13
  8. package/lib/field/date-time/date-time.component.html +0 -1
  9. package/lib/field/date-time/date-time.component.ts +17 -3
  10. package/lib/field/decimal/decimal.component.html +1 -0
  11. package/lib/field/decimal/decimal.component.ts +38 -15
  12. package/lib/field/dropdown/dropdown.component.ts +18 -3
  13. package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
  14. package/lib/field/percentage/percentage.component.html +1 -1
  15. package/lib/field/percentage/percentage.component.ts +27 -17
  16. package/lib/field/phone/phone.component.ts +6 -13
  17. package/lib/field/rich-text/rich-text.component.ts +12 -3
  18. package/lib/field/text/text.component.ts +2 -2
  19. package/lib/field/text-input/text-input.component.ts +1 -1
  20. package/lib/field/time/time.component.html +1 -1
  21. package/lib/field/time/time.component.ts +21 -6
  22. package/lib/field/user-reference/user-reference.component.html +40 -38
  23. package/lib/field/user-reference/user-reference.component.ts +66 -7
  24. package/lib/infra/Containers/flow-container/flow-container.component.ts +7 -2
  25. package/lib/infra/Containers/flow-container/helpers.ts +1 -1
  26. package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
  27. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +0 -1
  28. package/lib/infra/action-buttons/action-buttons.component.html +1 -1
  29. package/lib/infra/assignment/assignment.component.ts +2 -4
  30. package/lib/infra/assignment-card/assignment-card.component.ts +4 -32
  31. package/lib/infra/defer-load/defer-load.component.ts +4 -1
  32. package/lib/infra/reference/reference.component.ts +70 -86
  33. package/lib/infra/root-container/root-container.component.ts +24 -17
  34. package/lib/template/default-form/default-form.component.ts +5 -7
  35. package/lib/template/field-group-template/field-group-template.component.html +7 -7
  36. package/lib/template/field-group-template/field-group-template.component.scss +8 -0
  37. package/lib/template/field-group-template/field-group-template.component.ts +64 -41
  38. package/lib/template/field-group-template/utils.ts +9 -0
  39. package/lib/template/field-value-list/field-value-list.component.html +2 -2
  40. package/lib/template/field-value-list/field-value-list.component.scss +4 -0
  41. package/lib/template/list-view/list-view.component.html +3 -1
  42. package/lib/template/list-view/list-view.component.ts +1 -1
  43. package/lib/template/simple-table-manual/helpers.ts +18 -2
  44. package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
  45. package/lib/template/simple-table-manual/simple-table-manual.component.scss +7 -3
  46. package/lib/template/simple-table-manual/simple-table-manual.component.ts +62 -22
  47. package/lib/widget/todo/todo.component.html +0 -1
  48. package/lib/widget/todo/todo.component.scss +2 -0
  49. package/package.json +1 -1
@@ -27,7 +27,6 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
27
27
  this.updateLabelAndDate(this.secondaryFields$);
28
28
  }
29
29
 
30
- // eslint-disable-next-line sonarjs/no-identical-functions
31
30
  ngOnChanges() {
32
31
  this.updatePrimaryWithStatus();
33
32
  this.updateLabelAndDate(this.primaryFieldsWithStatus$);
@@ -10,7 +10,7 @@
10
10
  </ng-template>
11
11
 
12
12
  <ng-template #showDetails>
13
- <div class="psdk-grid-filter" *ngIf="field.config.label">
13
+ <div class="psdk-grid-filter" *ngIf="field.config.label && getVisibility(field.config)">
14
14
  <div class="psdk-details-fields-label">
15
15
  {{ field.config.label }}
16
16
  </div>
@@ -29,4 +29,10 @@ export class MaterialDetailsFieldsComponent {
29
29
  _formatDate(dateValue: string, dateFormat: string): string {
30
30
  return this.utils.generateDate(dateValue, dateFormat);
31
31
  }
32
+
33
+ getVisibility(config): boolean {
34
+ const { visibility = true } = config;
35
+
36
+ return this.utils.getBooleanValue(visibility);
37
+ }
32
38
  }
@@ -1,4 +1,4 @@
1
- <div class="psdk-operator psdk-double">
1
+ <div class="psdk-operator psdk-double" [ngClass]="{ 'flex-row': displayLabel }">
2
2
  <div class="psdk-label">
3
3
  {{ label$ }}
4
4
  </div>
@@ -1,9 +1,18 @@
1
1
  .psdk-operator {
2
2
  display: flex;
3
- flex-direction: row;
3
+ flex-direction: column;
4
4
  font-size: 0.8rem;
5
5
  color: var(--app-neutral-color);
6
+ padding-left: 0.625rem;
7
+ margin: 16px 0 8px 0;
8
+ }
9
+
10
+ .psdk-operator.flex-row {
11
+ flex-direction: row;
6
12
  align-items: center;
13
+ text-align: center;
14
+ padding-left: 0;
15
+ margin: 0;
7
16
  }
8
17
 
9
18
  .psdk-operator-popover {
@@ -35,7 +44,6 @@
35
44
 
36
45
  .psdk-double {
37
46
  column-gap: 1rem;
38
- text-align: center;
39
47
  }
40
48
 
41
49
  .psdk-top-pad {
@@ -13,10 +13,11 @@ import { Utils } from '@pega/angular-sdk-components';
13
13
  export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
14
14
  @Input() pConn$: typeof PConnect;
15
15
  @Input() displayLabel;
16
+ @Input() name$?: string;
17
+
16
18
  fields$: any[] = [];
17
19
  bShowPopover$: boolean;
18
20
  date$: string;
19
- name$: string;
20
21
  label$: string;
21
22
  id$: string;
22
23
  constructor(
@@ -40,7 +41,7 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
40
41
 
41
42
  ngOnChanges(changes: SimpleChanges): void {
42
43
  const { pConn$ } = changes;
43
- if (pConn$.previousValue !== pConn$.currentValue) {
44
+ if (pConn$ && pConn$.previousValue !== pConn$.currentValue) {
44
45
  this.updateSelf();
45
46
  }
46
47
  }
@@ -69,7 +70,7 @@ export class OperatorComponent implements OnInit, OnChanges, OnDestroy {
69
70
  this.id$ = configProps$.resolveOperator.userId;
70
71
  this.label$ = configProps$.resolveLabel;
71
72
  } else {
72
- this.name$ = configProps$?.value.userName;
73
+ this.name$ = this.name$ || configProps$?.value.userName;
73
74
  this.id$ = configProps$?.value.userId;
74
75
  this.label$ = configProps$.label;
75
76
  }
@@ -130,6 +130,7 @@ export class CurrencyComponent implements OnInit, OnDestroy {
130
130
  nValue = parseFloat(nValue);
131
131
  }
132
132
  this.value$ = nValue;
133
+ this.fieldControl.setValue(this.value$);
133
134
  }
134
135
  this.helperText = this.configProps$.helperText;
135
136
  this.placeholder = this.configProps$.placeholder || '';
@@ -197,20 +198,25 @@ export class CurrencyComponent implements OnInit, OnDestroy {
197
198
  }
198
199
 
199
200
  fieldOnBlur(event: any) {
200
- const actionsApi = this.pConn$?.getActionsApi();
201
- const propName = this.pConn$?.getStateProps().value;
202
- let value = event?.target?.value;
203
- value = value?.substring(1);
204
- // replacing thousand separator with empty string as not required in api call
205
- const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
206
- let regExp = new RegExp(String.raw`${thousandSep}`, 'g');
207
- value = value?.replace(regExp, '');
208
- // replacing decimal separator with '.'
209
- if (this.decimalSeparator !== '.') {
210
- regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
211
- value = value.replace(regExp, '.');
201
+ const oldVal = this.value$ ?? '';
202
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
203
+
204
+ if (isValueChanged) {
205
+ const actionsApi = this.pConn$?.getActionsApi();
206
+ const propName = this.pConn$?.getStateProps().value;
207
+ let value = event?.target?.value;
208
+ value = value?.substring(1);
209
+ // replacing thousand separator with empty string as not required in api call
210
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
211
+ let regExp = new RegExp(String.raw`${thousandSep}`, 'g');
212
+ value = value?.replace(regExp, '');
213
+ // replacing decimal separator with '.'
214
+ if (this.decimalSeparator !== '.') {
215
+ regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
216
+ value = value.replace(regExp, '.');
217
+ }
218
+ handleEvent(actionsApi, 'changeNblur', propName, value);
212
219
  }
213
- handleEvent(actionsApi, 'changeNblur', propName, value);
214
220
  }
215
221
 
216
222
  getErrorMessage() {
@@ -13,7 +13,6 @@
13
13
  [placeholder]="placeholder"
14
14
  [formControl]="fieldControl"
15
15
  (dateTimeChange)="fieldOnDateChange($event)"
16
- [value]="value$"
17
16
  [required]="bRequired$"
18
17
  />
19
18
  <mat-datepicker-toggle matSuffix [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
@@ -6,6 +6,7 @@ import { MatInputModule } from '@angular/material/input';
6
6
  import { MatFormFieldModule } from '@angular/material/form-field';
7
7
  import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
8
8
  import { interval } from 'rxjs';
9
+ import dayjs from 'dayjs';
9
10
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
10
11
  import { Utils } from '@pega/angular-sdk-components';
11
12
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
@@ -13,6 +14,7 @@ import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-comp
13
14
  import { PConnFieldProps } from '@pega/angular-sdk-components';
14
15
  import { handleEvent } from '@pega/angular-sdk-components';
15
16
  import { format } from '@pega/angular-sdk-components';
17
+ import { DateFormatters } from '@pega/angular-sdk-components';
16
18
 
17
19
  interface DateTimeProps extends PConnFieldProps {
18
20
  // If any, enter additional props that only exist on DateTime here
@@ -68,6 +70,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
68
70
  actionsApi: Object;
69
71
  propName: string;
70
72
  formattedValue$: any;
73
+ timezone = PCore.getEnvironmentInfo()?.getTimeZone();
71
74
 
72
75
  constructor(
73
76
  private angularPConnect: AngularPConnectService,
@@ -88,7 +91,12 @@ export class DateTimeComponent implements OnInit, OnDestroy {
88
91
  if (this.formGroup$) {
89
92
  // add control to formGroup
90
93
  this.formGroup$.addControl(this.controlName$, this.fieldControl);
91
- this.fieldControl.setValue(this.value$);
94
+ let dateTimeValue = this.value$ ?? '';
95
+
96
+ if (this.value$) {
97
+ dateTimeValue = dayjs(DateFormatters?.convertToTimezone(this.value$, { timezone: this.timezone }))?.toISOString();
98
+ }
99
+ this.fieldControl.setValue(dateTimeValue);
92
100
  this.bHasForm$ = true;
93
101
  } else {
94
102
  this.bReadonly$ = true;
@@ -132,7 +140,11 @@ export class DateTimeComponent implements OnInit, OnDestroy {
132
140
  this.testId = this.configProps$.testId;
133
141
  this.helperText = this.configProps$.helperText;
134
142
  this.value$ = this.configProps$?.value;
135
- this.fieldControl.setValue(this.value$);
143
+ let dateTimeValue = this.configProps$?.value ?? '';
144
+ if (this.value$) {
145
+ dateTimeValue = dayjs(DateFormatters?.convertToTimezone(this.value$, { timezone: this.timezone }))?.toISOString();
146
+ }
147
+ this.fieldControl.setValue(dateTimeValue);
136
148
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
137
149
  setTimeout(() => {
138
150
  if (this.configProps$.required != null) {
@@ -186,7 +198,9 @@ export class DateTimeComponent implements OnInit, OnDestroy {
186
198
  // this comes from the date pop up
187
199
  if (typeof event.value === 'object') {
188
200
  // convert date to pega "date" format
189
- event.value = event.value?.toISOString();
201
+ const dateTime = dayjs(event.value?.toISOString());
202
+ const timeZoneDateTime = (dayjs as any).tz(dateTime.format('YYYY-MM-DDTHH:mm:ss'), this.timezone);
203
+ event.value = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
190
204
  }
191
205
  handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
192
206
  }
@@ -12,6 +12,7 @@
12
12
  currencyMask
13
13
  [options]="{
14
14
  prefix: currencySymbol,
15
+ suffix: suffix,
15
16
  thousands: thousandSeparator,
16
17
  decimal: decimalSeparator,
17
18
  align: 'left',
@@ -4,6 +4,7 @@ import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angul
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
6
  import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
7
+ import { interval } from 'rxjs';
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';
@@ -65,6 +66,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
65
66
  formatter;
66
67
  formattedValue: any;
67
68
  inputMode: any;
69
+ suffix = '';
68
70
 
69
71
  constructor(
70
72
  private angularPConnect: AngularPConnectService,
@@ -136,6 +138,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
136
138
  nValue = parseFloat(nValue);
137
139
  }
138
140
  this.value$ = nValue;
141
+ this.fieldControl.setValue(this.value$);
139
142
  }
140
143
  this.helperText = this.configProps$.helperText;
141
144
  this.placeholder = this.configProps$.placeholder || '';
@@ -185,27 +188,47 @@ export class DecimalComponent implements OnInit, OnDestroy {
185
188
  if (this.bReadonly$ && this.formatter === 'Currency') {
186
189
  this.currencySymbol = theSymbols.theCurrencySymbol;
187
190
  }
191
+
192
+ if (this.bReadonly$ && this.formatter === 'Percentage') {
193
+ this.suffix = '%';
194
+ }
195
+
188
196
  this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
189
197
 
190
198
  this.componentReference = this.pConn$.getStateProps().value;
199
+
200
+ // trigger display of error message with field control
201
+ if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
202
+ const timer = interval(100).subscribe(() => {
203
+ this.fieldControl.setErrors({ message: true });
204
+ this.fieldControl.markAsTouched();
205
+
206
+ timer.unsubscribe();
207
+ });
208
+ }
191
209
  }
192
210
 
193
211
  fieldOnBlur(event: any) {
194
- const actionsApi = this.pConn$?.getActionsApi();
195
- const propName = this.pConn$?.getStateProps().value;
196
- let value = event?.target?.value;
197
- // replacing thousand separator with empty string as not required in api call
198
- if (this.configProps$.showGroupSeparators) {
199
- const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
200
- const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
201
- value = value?.replace(regExp, '');
202
- }
203
- // replacing decimal separator with '.'
204
- if (this.decimalSeparator !== '.') {
205
- const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
206
- value = value.replace(regExp, '.');
207
- }
208
- handleEvent(actionsApi, 'changeNblur', propName, value);
212
+ const oldVal = this.value$ ?? '';
213
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
214
+
215
+ if (isValueChanged) {
216
+ const actionsApi = this.pConn$?.getActionsApi();
217
+ const propName = this.pConn$?.getStateProps().value;
218
+ let value = event?.target?.value;
219
+ // replacing thousand separator with empty string as not required in api call
220
+ if (this.configProps$.showGroupSeparators) {
221
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
222
+ const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
223
+ value = value?.replace(regExp, '');
224
+ }
225
+ // replacing decimal separator with '.'
226
+ if (this.decimalSeparator !== '.') {
227
+ const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
228
+ value = value.replace(regExp, '.');
229
+ }
230
+ handleEvent(actionsApi, 'changeNblur', propName, value);
231
+ }
209
232
  }
210
233
 
211
234
  getErrorMessage() {
@@ -134,6 +134,18 @@ export class DropdownComponent implements OnInit, OnDestroy {
134
134
  }
135
135
  }
136
136
 
137
+ set options(options: IOption[]) {
138
+ this.options$ = options;
139
+ if (this.displayMode$) {
140
+ this.value$ = this.options$?.find(option => option.key === this.value$)?.value || this.value$;
141
+ this.localizedValue = this.pConn$.getLocalizedValue(
142
+ this.value$ === 'Select...' ? '' : this.value$,
143
+ this.localePath,
144
+ this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
145
+ );
146
+ }
147
+ }
148
+
137
149
  ngOnDestroy(): void {
138
150
  if (this.formGroup$) {
139
151
  this.formGroup$.removeControl(this.controlName$);
@@ -215,7 +227,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
215
227
  if (this.theDatasource) {
216
228
  const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
217
229
  optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
218
- this.options$ = optionsList;
230
+ this.options = optionsList;
219
231
  }
220
232
 
221
233
  this.actionsApi = this.pConn$.getActionsApi();
@@ -239,6 +251,9 @@ export class DropdownComponent implements OnInit, OnDestroy {
239
251
  this.localePath,
240
252
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
241
253
  );
254
+
255
+ this.localizedValue = this.options$?.find(opt => opt.key === this.value$)?.value || this.localizedValue;
256
+
242
257
  // trigger display of error message with field control
243
258
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
244
259
  const timer = interval(100).subscribe(() => {
@@ -278,7 +293,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
278
293
  }
279
294
 
280
295
  columns = preProcessColumns(columns) || [];
281
- if (!this.displayMode$ && listType !== 'associated' && typeof datasource === 'string') {
296
+ if (listType !== 'associated' && typeof datasource === 'string') {
282
297
  this.getData(datasource, parameters, columns, context, listType);
283
298
  }
284
299
  }
@@ -309,7 +324,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
309
324
  optionsData.push(obj);
310
325
  });
311
326
  optionsData?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
312
- this.options$ = optionsData;
327
+ this.options = optionsData;
313
328
  });
314
329
  });
315
330
  }
@@ -1,4 +1,4 @@
1
- <mat-grid-list cols="2" rowHeight="6.25rem">
1
+ <mat-grid-list cols="2" rowHeight="4.25rem">
2
2
  <mat-grid-tile>
3
3
  <button mat-raised-button variant="contained" color="secondary" (click)="onCancel()">
4
4
  {{ localizedVal('Cancel', localeCategory) }}
@@ -26,7 +26,7 @@
26
26
  [required]="bRequired$"
27
27
  [formControl]="fieldControl"
28
28
  [attr.data-test-id]="testId"
29
- (change)="fieldOnChange()"
29
+ (change)="fieldOnChange($event)"
30
30
  (blur)="fieldOnBlur($event)"
31
31
  [readonly]="bReadonly$"
32
32
  />
@@ -179,27 +179,37 @@ export class PercentageComponent implements OnInit, OnDestroy {
179
179
  }
180
180
  }
181
181
 
182
- fieldOnChange() {
183
- this.pConn$.clearErrorMessages({
184
- property: this.propName
185
- });
182
+ fieldOnChange(event: any) {
183
+ const oldVal = this.value$ ?? '';
184
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
185
+
186
+ if (isValueChanged) {
187
+ this.pConn$.clearErrorMessages({
188
+ property: this.propName
189
+ });
190
+ }
186
191
  }
187
192
 
188
193
  fieldOnBlur(event: any) {
189
- let value = event?.target?.value;
190
- value = value ? value.replace(/%/g, '') : '';
191
- // replacing thousand separator with empty string as not required in api call
192
- if (this.configProps$.showGroupSeparators) {
193
- const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
194
- const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
195
- value = value?.replace(regExp, '');
196
- }
197
- // replacing decimal separator with '.'
198
- if (this.decimalSeparator !== '.') {
199
- const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
200
- value = value.replace(regExp, '.');
194
+ const oldVal = this.value$ ?? '';
195
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
196
+
197
+ if (isValueChanged) {
198
+ let value = event?.target?.value;
199
+ value = value ? value.replace(/%/g, '') : '';
200
+ // replacing thousand separator with empty string as not required in api call
201
+ if (this.configProps$.showGroupSeparators) {
202
+ const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
203
+ const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
204
+ value = value?.replace(regExp, '');
205
+ }
206
+ // replacing decimal separator with '.'
207
+ if (this.decimalSeparator !== '.') {
208
+ const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
209
+ value = value.replace(regExp, '.');
210
+ }
211
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
201
212
  }
202
- handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
203
213
  }
204
214
 
205
215
  getErrorMessage() {
@@ -38,18 +38,11 @@ export class PhoneComponent implements OnInit, OnDestroy {
38
38
  displayMode$?: string = '';
39
39
  controlName$: string;
40
40
  bHasForm$ = true;
41
- componentReference = '';
42
41
  testId: string;
43
- separateDialCode = false;
44
- afterBlur: boolean;
45
42
  helperText: string;
46
43
 
47
44
  fieldControl = new FormControl('', null);
48
45
 
49
- phoneForm = new FormGroup({
50
- phone: new FormControl<string | null>(null)
51
- });
52
-
53
46
  actionsApi: Object;
54
47
  propName: string;
55
48
 
@@ -117,6 +110,7 @@ export class PhoneComponent implements OnInit, OnDestroy {
117
110
  this.testId = this.configProps$.testId;
118
111
  if (this.configProps$.value != undefined) {
119
112
  this.value$ = this.configProps$.value;
113
+ this.fieldControl.setValue(this.value$);
120
114
  }
121
115
  this.helperText = this.configProps$.helperText;
122
116
 
@@ -150,10 +144,6 @@ export class PhoneComponent implements OnInit, OnDestroy {
150
144
  this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
151
145
  }
152
146
 
153
- if (this.bReadonly$) {
154
- this.phoneForm.setValue({ phone: this.value$ });
155
- }
156
-
157
147
  // trigger display of error message with field control
158
148
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
159
149
  const timer = interval(100).subscribe(() => {
@@ -170,9 +160,12 @@ export class PhoneComponent implements OnInit, OnDestroy {
170
160
  }
171
161
 
172
162
  fieldOnChange() {
173
- if (this.formGroup$.controls[this.controlName$].value) {
163
+ const oldVal = this.value$ ?? '';
164
+ const newVal = this.formGroup$.controls[this.controlName$].value;
165
+ const isValueChanged = newVal?.toString() !== oldVal.toString();
166
+
167
+ if (isValueChanged && newVal) {
174
168
  const value = this.formGroup$.controls[this.controlName$].value;
175
- this.afterBlur = true;
176
169
  handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
177
170
  }
178
171
  }
@@ -116,8 +116,12 @@ export class RichTextComponent implements OnInit, OnDestroy {
116
116
  }
117
117
  }
118
118
 
119
- fieldOnChange() {
120
- if (this.status === 'error') {
119
+ fieldOnChange(editorValue: any) {
120
+ const oldVal = this.value$ ?? '';
121
+ const newVal = editorValue?.editor?.getBody()?.innerHTML ?? '';
122
+ const isValueChanged = newVal.toString() !== oldVal.toString();
123
+
124
+ if (isValueChanged || this.status === 'error') {
121
125
  const property = this.propName;
122
126
  this.pConn$.clearErrorMessages({
123
127
  property,
@@ -128,6 +132,11 @@ export class RichTextComponent implements OnInit, OnDestroy {
128
132
  }
129
133
 
130
134
  fieldOnBlur(editorValue: any) {
131
- handleEvent(this.actionsApi, 'changeNblur', this.propName, editorValue);
135
+ const oldVal = this.value$ ?? '';
136
+ const isValueChanged = editorValue.toString() !== oldVal.toString();
137
+
138
+ if (isValueChanged) {
139
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, editorValue);
140
+ }
132
141
  }
133
142
  }
@@ -144,7 +144,7 @@ export class TextComponent implements OnInit, OnDestroy {
144
144
  generateDateTime(sVal): string {
145
145
  if (!sVal) return '';
146
146
  if (sVal.length === 10) return this.generateDate(sVal);
147
- const value = sVal.substring(0, sVal.length - 1);
147
+ // const value = sVal.substring(0, sVal.length - 1);
148
148
  // value = new Intl.DateTimeFormat('default', {
149
149
  // year: 'numeric',
150
150
  // month: 'numeric',
@@ -155,6 +155,6 @@ export class TextComponent implements OnInit, OnDestroy {
155
155
  // hour12: true,
156
156
  // }).format(new Date(value))
157
157
 
158
- return this.utils.generateDateTime(value, 'DateTime-Long-YYYY-Custom');
158
+ return this.utils.generateDateTime(sVal, 'DateTime-Long-YYYY-Custom');
159
159
  }
160
160
  }
@@ -161,7 +161,7 @@ export class TextInputComponent implements OnInit, OnDestroy {
161
161
  }
162
162
  }
163
163
 
164
- fieldOnChange(event) {
164
+ fieldOnChange(event: any) {
165
165
  const oldVal = this.value$ ?? '';
166
166
  const isValueChanged = event.target.value.toString() !== oldVal.toString();
167
167
 
@@ -14,7 +14,7 @@
14
14
  [required]="bRequired$"
15
15
  [attr.data-test-id]="testId"
16
16
  [formControl]="fieldControl"
17
- (change)="fieldOnChange()"
17
+ (change)="fieldOnChange($event)"
18
18
  (blur)="fieldOnBlur($event)"
19
19
  />
20
20
  <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
@@ -165,15 +165,30 @@ export class TimeComponent implements OnInit, OnDestroy {
165
165
  }
166
166
  }
167
167
 
168
- fieldOnChange() {
169
- this.pConn$.clearErrorMessages({
170
- property: this.propName
171
- });
168
+ fieldOnChange(event: any) {
169
+ const oldVal = this.value$ ?? '';
170
+ const isValueChanged = event.target.value.toString() !== oldVal.toString();
171
+
172
+ if (isValueChanged) {
173
+ this.pConn$.clearErrorMessages({
174
+ property: this.propName
175
+ });
176
+ }
172
177
  }
173
178
 
174
179
  fieldOnBlur(event: any) {
175
- const value = event?.target?.value;
176
- handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
180
+ const oldVal = this.value$ ?? '';
181
+ const isValueChanged = event?.target?.value.toString() !== oldVal.toString();
182
+
183
+ if (isValueChanged) {
184
+ let value = event?.target?.value;
185
+ const hhmmPattern = /^\d{2}:\d{2}$/;
186
+ if (hhmmPattern.test(value)) {
187
+ value = `${value}:00`; // append ":00"
188
+ }
189
+
190
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
191
+ }
177
192
  }
178
193
 
179
194
  getErrorMessage() {