@pega/angular-sdk-overrides 0.25.17 → 0.25.18

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.
@@ -20,61 +20,67 @@
20
20
  width: auto;
21
21
  }
22
22
 
23
- .mat-datepicker-content,
24
- .time-container {
25
- box-shadow:
26
- 0px 2px 4px -1px rgba(0, 0, 0, 0.2),
27
- 0px 4px 5px 0px rgba(0, 0, 0, 0.14),
28
- 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
29
- display: block;
30
- border-radius: 4px;
31
- background-color: var(--mat-datepicker-calendar-container-background-color);
32
- color: var(--mat-datepicker-calendar-container-text-color);
23
+ .owl-dt-container {
24
+ background-color: var(--mat-sys-surface-container);
25
+ color: var(--mat-sys-on-surface);
33
26
  }
34
27
 
35
- .mat-calendar-body-cell-content {
36
- color: var(--mat-datepicker-calendar-date-text-color);
37
- border-color: var(--mat-datepicker-calendar-date-outline-color);
28
+ .owl-dt-container-row,
29
+ .owl-dt-container-info .owl-dt-container-range:last-child {
30
+ border-color: var(--mat-sys-outline-variant);
38
31
  }
39
32
 
40
- .mat-calendar-body-selected {
41
- background-color: var(--mat-datepicker-calendar-date-selected-state-background-color);
42
- color: var(--mat-datepicker-calendar-date-selected-state-text-color);
33
+ .owl-dt-calendar-control,
34
+ .owl-dt-calendar-table .owl-dt-calendar-cell {
35
+ color: var(--mat-sys-on-surface);
43
36
  }
44
37
 
45
- .mat-calendar-body-cell-content {
46
- border: none !important;
38
+ .owl-dt-calendar-table .owl-dt-calendar-header,
39
+ .owl-dt-calendar-table .owl-dt-calendar-cell-disabled > .owl-dt-calendar-cell-content:not(.owl-dt-calendar-cell-selected) {
40
+ color: var(--mat-sys-on-surface-variant);
47
41
  }
48
42
 
49
- .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover
50
- > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
51
- background-color: var(--mat-datepicker-calendar-date-hover-state-background-color);
43
+ .owl-dt-calendar-table .owl-dt-calendar-header .owl-dt-calendar-table-divider::after {
44
+ background-color: var(--mat-sys-outline-variant);
52
45
  }
53
46
 
54
- .mat-calendar-arrow {
55
- fill: var(--mat-datepicker-calendar-period-button-icon-color);
47
+ .owl-dt-calendar-table .owl-dt-calendar-cell-today:not(.owl-dt-calendar-cell-selected) {
48
+ border-color: var(--mat-sys-outline);
56
49
  }
57
50
 
58
- .mat-calendar-table-header th {
59
- text-align: center;
60
- padding: 0 0 8px 0;
61
- color: var(--mat-datepicker-calendar-header-text-color);
62
- font-size: var(--mat-datepicker-calendar-header-text-size);
63
- font-weight: var(--mat-datepicker-calendar-header-text-weight);
51
+ .owl-dt-calendar-table .owl-dt-calendar-cell-selected {
52
+ background-color: var(--mat-sys-primary);
53
+ color: var(--mat-sys-on-primary);
64
54
  }
65
55
 
66
- .mat-datepicker-content .mat-calendar-previous-button,
67
- .mat-datepicker-content .mat-calendar-next-button {
68
- color: var(--mat-datepicker-calendar-navigation-button-icon-color);
56
+ .owl-dt-calendar-table .owl-dt-calendar-cell-active:focus > .owl-dt-calendar-cell-content:not(.owl-dt-calendar-cell-selected),
57
+ .owl-dt-calendar-table :not(.owl-dt-calendar-cell-disabled):hover > .owl-dt-calendar-cell-content:not(.owl-dt-calendar-cell-selected),
58
+ .owl-dt-calendar-control .owl-dt-calendar-control-content .owl-dt-calendar-control-button:hover,
59
+ .owl-dt-control-period-button:hover > .owl-dt-control-button-content,
60
+ .owl-dt-container-control-button:hover .owl-dt-control-button-content,
61
+ .owl-dt-control:focus > .owl-dt-control-content {
62
+ background-color: var(--mat-sys-surface-container-high);
69
63
  }
70
64
 
71
- .mat-calendar-table-header-divider::after {
72
- content: '';
73
- position: absolute;
74
- top: 0;
75
- left: -8px;
76
- right: -8px;
77
- height: 1px;
78
- background: var(--mat-datepicker-calendar-header-divider-color);
65
+ .owl-dt-timer-content .owl-dt-timer-input {
66
+ border-color: var(--mat-sys-outline);
67
+ background-color: var(--mat-sys-surface-container-highest);
68
+ color: var(--mat-sys-on-surface);
69
+ }
70
+
71
+ .owl-dt-container-buttons,
72
+ .owl-dt-container-info .owl-dt-container-info-active,
73
+ .owl-dt-timer-hour12 {
74
+ color: var(--mat-sys-primary);
75
+ }
76
+
77
+ .owl-dt-control-arrow-button[disabled] {
78
+ color: var(--mat-sys-on-surface-variant);
79
+ }
80
+
81
+ .owl-dt-timer-hour12 .owl-dt-timer-hour12-box:focus .owl-dt-control-button-content,
82
+ .owl-dt-timer-hour12 .owl-dt-timer-hour12-box:hover .owl-dt-control-button-content {
83
+ background-color: var(--mat-sys-primary);
84
+ color: var(--mat-sys-on-primary);
79
85
  }
80
86
  }
@@ -95,6 +95,12 @@ export class DateTimeComponent extends FieldBase implements OnInit, OnDestroy {
95
95
  }
96
96
 
97
97
  fieldOnDateChange(event: any) {
98
+ // owl picker emits null when the typed text can't be parsed; clear the input instead of defaulting to now
99
+ if (!event.value) {
100
+ this.fieldControl.setValue('');
101
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, '');
102
+ return;
103
+ }
98
104
  // this comes from the date pop up
99
105
  if (typeof event.value === 'object') {
100
106
  // convert date to pega "date" format
@@ -104,4 +110,25 @@ export class DateTimeComponent extends FieldBase implements OnInit, OnDestroy {
104
110
  }
105
111
  handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
106
112
  }
113
+
114
+ override getErrorMessage() {
115
+ // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
116
+ if (this.fieldControl.hasError('message')) {
117
+ return this.angularPConnectData.validateMessage ?? '';
118
+ }
119
+
120
+ if (this.fieldControl.hasError('required')) {
121
+ return 'You must enter a value';
122
+ }
123
+
124
+ if (this.fieldControl.hasError('owlDateTimeParse')) {
125
+ return `${this.fieldControl.errors?.['owlDateTimeParse'].text} is not a valid date time value`;
126
+ }
127
+
128
+ if (this.fieldControl.errors) {
129
+ return 'Invalid date time value';
130
+ }
131
+
132
+ return '';
133
+ }
107
134
  }
@@ -11,12 +11,14 @@
11
11
  <mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
12
12
  <mat-select
13
13
  [value]="value$"
14
+ [placeholder]="placeholderText"
14
15
  [required]="bRequired$"
15
16
  [disabled]="bDisabled$"
16
17
  [attr.data-test-id]="testId"
17
18
  (selectionChange)="fieldOnChange($event)"
18
19
  [formControl]="fieldControl"
19
20
  >
21
+ <mat-option>{{ placeholderText }}</mat-option>
20
22
  <mat-option *ngFor="let opt of options$" [value]="opt.key">
21
23
  {{ getLocalizedOptionValue(opt) }}
22
24
  </mat-option>
@@ -80,16 +80,19 @@ export class DropdownComponent extends FieldBase implements OnInit, OnDestroy {
80
80
  localeName = '';
81
81
  localePath = '';
82
82
  localizedValue = '';
83
+ placeholderText = '';
83
84
 
84
85
  set options(options: IOption[]) {
85
86
  this.options$ = options;
86
87
  if (this.displayMode$) {
87
88
  this.value$ = this.options$?.find(option => option.key === this.value$)?.value || this.value$;
88
89
  this.localizedValue = this.pConn$.getLocalizedValue(
89
- this.value$ === 'Select...' ? '' : this.value$,
90
+ this.value$,
90
91
  this.localePath,
91
92
  this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
92
93
  );
94
+
95
+ this.cdRef.markForCheck();
93
96
  }
94
97
  }
95
98
 
@@ -115,20 +118,15 @@ export class DropdownComponent extends FieldBase implements OnInit, OnDestroy {
115
118
  const { value, fieldMetadata, datasource } = configProps;
116
119
 
117
120
  this.value$ = value;
121
+ this.placeholderText = this.pConn$.getLocalizedValue(this.placeholder || 'Select...', '', '');
118
122
 
119
123
  if (!isEqual(datasource, this.theDatasource)) {
120
124
  // inbound datasource is different, so update theDatasource
121
125
  this.theDatasource = datasource || null;
122
126
  }
123
127
 
124
- if (this.value$ === '' && !this.bReadonly$) {
125
- this.value$ = 'Select';
126
- }
127
-
128
128
  if (this.theDatasource) {
129
- const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
130
- optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
131
- this.options = optionsList;
129
+ this.options = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject());
132
130
  }
133
131
 
134
132
  this.actionsApi = this.pConn$.getActionsApi();
@@ -215,27 +213,21 @@ export class DropdownComponent extends FieldBase implements OnInit, OnDestroy {
215
213
  };
216
214
  optionsData.push(obj);
217
215
  });
218
- optionsData?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
219
216
  this.options = optionsData;
220
217
  });
221
218
  });
222
219
  }
223
220
 
224
- isSelected(buttonValue: string): boolean {
225
- return this.value$ === buttonValue;
226
- }
227
-
228
221
  fieldOnChange(event: any) {
229
- if (event?.value === 'Select') {
230
- event.value = '';
231
- }
232
- handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
222
+ // The reset option has no value; Pega expects '' for a cleared field
223
+ const value = event.value ?? '';
224
+ handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
233
225
 
234
226
  this.pConn$.clearErrorMessages({
235
227
  property: this.propName
236
228
  });
237
229
  if (this.onRecordChange) {
238
- this.onRecordChange.emit(event.value);
230
+ this.onRecordChange.emit(value);
239
231
  }
240
232
  }
241
233
 
@@ -1,4 +1,4 @@
1
- import { Directive, inject, Input, OnDestroy, OnInit } from '@angular/core';
1
+ import { Directive, inject, Input, OnDestroy, OnInit, ChangeDetectorRef } from '@angular/core';
2
2
  import { FormControl, FormGroup } from '@angular/forms';
3
3
 
4
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
@@ -11,6 +11,7 @@ export class FieldBase implements OnInit, OnDestroy {
11
11
 
12
12
  protected angularPConnect = inject(AngularPConnectService);
13
13
  protected utils = inject(Utils);
14
+ protected cdRef = inject(ChangeDetectorRef);
14
15
 
15
16
  protected angularPConnectData: AngularPConnectData = {};
16
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/angular-sdk-overrides",
3
- "version": "0.25.17",
3
+ "version": "0.25.18",
4
4
  "description": "Angular SDK - Code for overriding components",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"