@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
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
.
|
|
36
|
-
|
|
37
|
-
border-color: var(--mat-
|
|
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
|
-
.
|
|
41
|
-
|
|
42
|
-
color: var(--mat-
|
|
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
|
-
.
|
|
46
|
-
|
|
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
|
-
.
|
|
50
|
-
|
|
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
|
-
.
|
|
55
|
-
|
|
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
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
.
|
|
67
|
-
.
|
|
68
|
-
|
|
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
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
230
|
-
|
|
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(
|
|
230
|
+
this.onRecordChange.emit(value);
|
|
239
231
|
}
|
|
240
232
|
}
|
|
241
233
|
|
package/lib/field/field.base.ts
CHANGED
|
@@ -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
|
|