@pega/angular-sdk-overrides 24.2.10 → 24.2.12
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.
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -1
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +6 -0
- package/lib/designSystemExtension/operator/operator.component.html +1 -1
- package/lib/designSystemExtension/operator/operator.component.scss +10 -2
- package/lib/designSystemExtension/operator/operator.component.ts +4 -3
- package/lib/field/auto-complete/auto-complete.component.html +0 -1
- package/lib/field/auto-complete/auto-complete.component.ts +15 -2
- package/lib/field/check-box/check-box.component.html +4 -0
- package/lib/field/currency/currency.component.ts +19 -13
- package/lib/field/date/date.component.html +2 -1
- package/lib/field/date-time/date-time.component.html +2 -2
- package/lib/field/date-time/date-time.component.ts +17 -3
- package/lib/field/decimal/decimal.component.html +1 -0
- package/lib/field/decimal/decimal.component.ts +38 -15
- package/lib/field/dropdown/dropdown.component.html +1 -0
- package/lib/field/dropdown/dropdown.component.ts +18 -4
- package/lib/field/email/email.component.ts +17 -7
- package/lib/field/integer/integer.component.html +1 -1
- package/lib/field/integer/integer.component.ts +16 -6
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -2
- package/lib/field/percentage/percentage.component.html +1 -1
- package/lib/field/percentage/percentage.component.ts +27 -17
- package/lib/field/phone/config-ext.json +1 -1
- package/lib/field/phone/phone.component.html +3 -1
- package/lib/field/phone/phone.component.ts +6 -13
- package/lib/field/radio-buttons/radio-buttons.component.html +3 -6
- package/lib/field/rich-text/rich-text.component.ts +12 -3
- package/lib/field/text/text.component.ts +6 -4
- package/lib/field/text-area/text-area.component.html +4 -2
- package/lib/field/text-area/text-area.component.ts +16 -6
- package/lib/field/text-input/text-input.component.html +1 -1
- package/lib/field/text-input/text-input.component.ts +16 -6
- package/lib/field/time/time.component.html +2 -2
- package/lib/field/time/time.component.ts +21 -6
- package/lib/field/url/url.component.html +1 -1
- package/lib/field/url/url.component.ts +16 -6
- package/lib/field/user-reference/user-reference.component.html +40 -38
- package/lib/field/user-reference/user-reference.component.ts +70 -7
- package/lib/infra/Containers/flow-container/flow-container.component.ts +17 -43
- package/lib/infra/Containers/flow-container/helpers.ts +2 -2
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +0 -7
- package/lib/infra/action-buttons/action-buttons.component.html +1 -1
- package/lib/infra/assignment/assignment.component.html +1 -1
- package/lib/infra/assignment/assignment.component.ts +82 -39
- package/lib/infra/assignment-card/assignment-card.component.html +1 -0
- package/lib/infra/defer-load/defer-load.component.ts +4 -1
- package/lib/infra/navbar/navbar.component.ts +0 -2
- package/lib/infra/reference/reference.component.ts +77 -90
- package/lib/infra/root-container/root-container.component.html +2 -15
- package/lib/infra/root-container/root-container.component.ts +24 -27
- package/lib/template/base/form-template-base.ts +6 -0
- package/lib/template/confirmation/confirmation.component.html +1 -1
- package/lib/template/default-form/default-form.component.ts +35 -2
- package/lib/template/field-group-template/field-group-template.component.html +7 -7
- package/lib/template/field-group-template/field-group-template.component.scss +8 -0
- package/lib/template/field-group-template/field-group-template.component.ts +64 -41
- package/lib/template/field-value-list/field-value-list.component.html +2 -2
- package/lib/template/field-value-list/field-value-list.component.scss +4 -0
- package/lib/template/list-view/list-view.component.html +3 -1
- package/lib/template/list-view/list-view.component.ts +1 -3
- package/lib/template/list-view/listViewHelpers.ts +2 -5
- package/lib/template/list-view/utils.ts +2 -5
- package/lib/template/simple-table-manual/helpers.ts +9 -7
- package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +11 -3
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +62 -24
- package/lib/template/utils.ts +16 -0
- package/lib/widget/feed-container/feed-container.component.ts +0 -2
- package/lib/widget/todo/todo.component.html +4 -5
- package/lib/widget/todo/todo.component.scss +9 -0
- package/lib/widget/todo/todo.component.ts +4 -3
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
|
|
3
3
|
</div>
|
|
4
4
|
<ng-template #noDisplayMode>
|
|
5
|
-
<div *ngIf="
|
|
5
|
+
<div *ngIf="bHasForm$; else noEdit">
|
|
6
6
|
<div #f="ngForm" [formGroup]="formGroup$" *ngIf="bVisible$">
|
|
7
7
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
8
8
|
<ngx-mat-intl-tel-input
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
[preferredCountries]="['us']"
|
|
12
12
|
[enablePlaceholder]="true"
|
|
13
13
|
[enableSearch]="true"
|
|
14
|
+
[required]="bRequired$"
|
|
15
|
+
[disabled]="bDisabled$ || bReadonly$"
|
|
14
16
|
(change)="fieldOnChange()"
|
|
15
17
|
(blur)="fieldOnBlur()"
|
|
16
18
|
>
|
|
@@ -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
|
-
|
|
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
|
}
|
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
<ng-template #noDisplayMode>
|
|
9
9
|
<div [formGroup]="formGroup$" *ngIf="bVisible$">
|
|
10
10
|
<mat-form-field class="psdk-radio-form" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
</span>
|
|
14
|
-
<!-- <mat-label>{{label$}}</mat-label> -->
|
|
15
|
-
<input matInput [placeholder]="placeholder" style="display: none" />
|
|
11
|
+
<mat-label>{{ label$ }}</mat-label>
|
|
12
|
+
<input matInput [placeholder]="placeholder" style="display: none" [required]="bRequired$" />
|
|
16
13
|
<mat-radio-group
|
|
17
14
|
[value]="value$"
|
|
18
15
|
[required]="bRequired$"
|
|
@@ -24,7 +21,7 @@
|
|
|
24
21
|
<mat-radio-button
|
|
25
22
|
*ngFor="let opt of options$"
|
|
26
23
|
[checked]="isSelected(opt.key)"
|
|
27
|
-
[disabled]="bReadonly$"
|
|
24
|
+
[disabled]="bDisabled$ || bReadonly$"
|
|
28
25
|
[value]="opt.key"
|
|
29
26
|
class="psdk-radio-button"
|
|
30
27
|
>
|
|
@@ -116,8 +116,12 @@ export class RichTextComponent implements OnInit, OnDestroy {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
fieldOnChange() {
|
|
120
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -5,6 +5,7 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
|
|
|
5
5
|
import { Utils } from '@pega/angular-sdk-components';
|
|
6
6
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
7
7
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
8
|
+
import { format } from '@pega/angular-sdk-components';
|
|
8
9
|
|
|
9
10
|
interface TextProps extends PConnFieldProps {
|
|
10
11
|
// If any, enter additional props that only exist on Text here
|
|
@@ -99,8 +100,9 @@ export class TextComponent implements OnInit, OnDestroy {
|
|
|
99
100
|
break;
|
|
100
101
|
case 'time':
|
|
101
102
|
if (this.value$) {
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
this.formattedValue$ = format(this.value$, 'timeonly', {
|
|
104
|
+
format: 'hh:mm A'
|
|
105
|
+
});
|
|
104
106
|
} else {
|
|
105
107
|
this.formattedValue$ = '';
|
|
106
108
|
}
|
|
@@ -144,7 +146,7 @@ export class TextComponent implements OnInit, OnDestroy {
|
|
|
144
146
|
generateDateTime(sVal): string {
|
|
145
147
|
if (!sVal) return '';
|
|
146
148
|
if (sVal.length === 10) return this.generateDate(sVal);
|
|
147
|
-
const value = sVal.substring(0, sVal.length - 1);
|
|
149
|
+
// const value = sVal.substring(0, sVal.length - 1);
|
|
148
150
|
// value = new Intl.DateTimeFormat('default', {
|
|
149
151
|
// year: 'numeric',
|
|
150
152
|
// month: 'numeric',
|
|
@@ -155,6 +157,6 @@ export class TextComponent implements OnInit, OnDestroy {
|
|
|
155
157
|
// hour12: true,
|
|
156
158
|
// }).format(new Date(value))
|
|
157
159
|
|
|
158
|
-
return this.utils.generateDateTime(
|
|
160
|
+
return this.utils.generateDateTime(sVal, 'DateTime-Long-YYYY-Custom');
|
|
159
161
|
}
|
|
160
162
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
|
|
3
3
|
</div>
|
|
4
4
|
<ng-template #noDisplayMode>
|
|
5
|
-
<div *ngIf="
|
|
5
|
+
<div *ngIf="bHasForm$; else noEdit">
|
|
6
6
|
<div [formGroup]="formGroup$">
|
|
7
7
|
<div *ngIf="bVisible$">
|
|
8
8
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
9
|
+
<mat-label>{{ label$ }}</mat-label>
|
|
9
10
|
<textarea
|
|
10
11
|
matInput
|
|
11
12
|
rows="5"
|
|
@@ -15,8 +16,9 @@
|
|
|
15
16
|
[value]="value$"
|
|
16
17
|
[required]="bRequired$"
|
|
17
18
|
[disabled]="bDisabled$"
|
|
19
|
+
[readonly]="bReadonly$"
|
|
18
20
|
[formControl]="fieldControl"
|
|
19
|
-
(change)="fieldOnChange()"
|
|
21
|
+
(change)="fieldOnChange($event)"
|
|
20
22
|
(blur)="fieldOnBlur($event)"
|
|
21
23
|
></textarea>
|
|
22
24
|
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
@@ -159,15 +159,25 @@ export class TextAreaComponent implements OnInit, OnDestroy {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
fieldOnChange() {
|
|
163
|
-
this.
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
fieldOnChange(event: any) {
|
|
163
|
+
const oldVal = this.value$ ?? '';
|
|
164
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
165
|
+
|
|
166
|
+
if (isValueChanged) {
|
|
167
|
+
this.pConn$.clearErrorMessages({
|
|
168
|
+
property: this.propName
|
|
169
|
+
});
|
|
170
|
+
}
|
|
166
171
|
}
|
|
167
172
|
|
|
168
173
|
fieldOnBlur(event: any) {
|
|
169
|
-
const
|
|
170
|
-
|
|
174
|
+
const oldVal = this.value$ ?? '';
|
|
175
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
176
|
+
|
|
177
|
+
if (isValueChanged) {
|
|
178
|
+
const value = event?.target?.value;
|
|
179
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
180
|
+
}
|
|
171
181
|
}
|
|
172
182
|
|
|
173
183
|
getErrorMessage() {
|
|
@@ -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>
|
|
@@ -161,15 +161,25 @@ export class TextInputComponent implements OnInit, OnDestroy {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
fieldOnChange() {
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
fieldOnChange(event: any) {
|
|
165
|
+
const oldVal = this.value$ ?? '';
|
|
166
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
167
|
+
|
|
168
|
+
if (isValueChanged) {
|
|
169
|
+
this.pConn$.clearErrorMessages({
|
|
170
|
+
property: this.propName
|
|
171
|
+
});
|
|
172
|
+
}
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
fieldOnBlur(event: any) {
|
|
171
|
-
const
|
|
172
|
-
|
|
176
|
+
const oldVal = this.value$ ?? '';
|
|
177
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
178
|
+
|
|
179
|
+
if (isValueChanged) {
|
|
180
|
+
const value = event?.target?.value;
|
|
181
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
182
|
+
}
|
|
173
183
|
}
|
|
174
184
|
|
|
175
185
|
getErrorMessage() {
|
|
@@ -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>
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
</div>
|
|
24
24
|
</ng-template>
|
|
25
25
|
<ng-template #noEdit>
|
|
26
|
-
<component-mapper *ngIf="bVisible$ !== false" name="Text" [props]="{ pConn$, formatAs$: '
|
|
26
|
+
<component-mapper *ngIf="bVisible$ !== false" name="Text" [props]="{ pConn$, formatAs$: 'time' }"></component-mapper>
|
|
27
27
|
</ng-template>
|
|
@@ -165,15 +165,30 @@ export class TimeComponent implements OnInit, OnDestroy {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
fieldOnChange() {
|
|
169
|
-
this.
|
|
170
|
-
|
|
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
|
|
176
|
-
|
|
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() {
|
|
@@ -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>
|
|
@@ -159,15 +159,25 @@ export class UrlComponent implements OnInit, OnDestroy {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
fieldOnChange() {
|
|
163
|
-
this.
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
fieldOnChange(event: any) {
|
|
163
|
+
const oldVal = this.value$ ?? '';
|
|
164
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
165
|
+
|
|
166
|
+
if (isValueChanged) {
|
|
167
|
+
this.pConn$.clearErrorMessages({
|
|
168
|
+
property: this.propName
|
|
169
|
+
});
|
|
170
|
+
}
|
|
166
171
|
}
|
|
167
172
|
|
|
168
173
|
fieldOnBlur(event: any) {
|
|
169
|
-
const
|
|
170
|
-
|
|
174
|
+
const oldVal = this.value$ ?? '';
|
|
175
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
176
|
+
|
|
177
|
+
if (isValueChanged) {
|
|
178
|
+
const value = event?.target?.value;
|
|
179
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
180
|
+
}
|
|
171
181
|
}
|
|
172
182
|
|
|
173
183
|
getErrorMessage() {
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
<div
|
|
1
|
+
<div>
|
|
2
2
|
<div *ngIf="displayMode$; else noDisplayMode">
|
|
3
3
|
<component-mapper name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
|
|
4
4
|
</div>
|
|
5
5
|
<ng-template #noDisplayMode>
|
|
6
|
-
<div
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
<mat-
|
|
12
|
-
<mat-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
<mat-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<mat-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
6
|
+
<div class="psdk-user-reference">
|
|
7
|
+
<div *ngIf="this.userID$ && type === 'operator'">
|
|
8
|
+
<component-mapper name="Operator" [props]="{ pConn$, name$: userName$ }"></component-mapper>
|
|
9
|
+
</div>
|
|
10
|
+
<div [formGroup]="formGroup$" *ngIf="type === 'dropdown'">
|
|
11
|
+
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
12
|
+
<mat-select [required]="bRequired$" [formControl]="fieldControl" [attr.data-test-id]="testId" (selectionChange)="fieldOnChange($event)">
|
|
13
|
+
<mat-option *ngFor="let opt of options$" [value]="opt.key">
|
|
14
|
+
{{ opt.value }}
|
|
15
|
+
</mat-option>
|
|
16
|
+
</mat-select>
|
|
17
|
+
<mat-label>{{ label$ }}</mat-label>
|
|
18
|
+
<mat-error *ngIf="fieldControl.invalid">
|
|
19
|
+
{{ getErrorMessage() }}
|
|
20
|
+
</mat-error>
|
|
21
|
+
</mat-form-field>
|
|
22
|
+
</div>
|
|
23
|
+
<div [formGroup]="formGroup$" *ngIf="type === 'searchbox'">
|
|
24
|
+
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
25
|
+
<mat-label>{{ label$ }}</mat-label>
|
|
26
|
+
<input
|
|
27
|
+
matInput
|
|
28
|
+
[placeholder]="placeholder"
|
|
29
|
+
[formControl]="fieldControl"
|
|
30
|
+
[required]="bRequired$"
|
|
31
|
+
[matAutocomplete]="auto"
|
|
32
|
+
[attr.data-test-id]="testId"
|
|
33
|
+
(blur)="fieldOnBlur($event)"
|
|
34
|
+
/>
|
|
35
|
+
<mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption (optionSelected)="optionChanged($event)">
|
|
36
|
+
<mat-option *ngFor="let opt of filteredOptions | async" [value]="opt.value">
|
|
37
|
+
<span>{{ opt.value }}</span>
|
|
38
|
+
</mat-option>
|
|
39
|
+
</mat-autocomplete>
|
|
40
|
+
<mat-error *ngIf="fieldControl.invalid">
|
|
41
|
+
{{ getErrorMessage() }}
|
|
42
|
+
</mat-error>
|
|
43
|
+
</mat-form-field>
|
|
44
|
+
</div>
|
|
43
45
|
</div>
|
|
44
46
|
</ng-template>
|
|
45
47
|
</div>
|
|
@@ -168,7 +168,11 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
168
168
|
this.placeholder = placeholder || '';
|
|
169
169
|
this.displayMode$ = displayMode;
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
if (value && typeof value === 'object') {
|
|
172
|
+
this.value$ = value.userName ? value.userName : '';
|
|
173
|
+
} else {
|
|
174
|
+
this.value$ = value || '';
|
|
175
|
+
}
|
|
172
176
|
|
|
173
177
|
const { readOnly, required } = props;
|
|
174
178
|
[this.bReadonly$, this.bRequired$] = [readOnly, required].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
|
|
@@ -184,12 +188,8 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
184
188
|
} else {
|
|
185
189
|
// if same user ref field is referred in view as editable & readonly formatted text
|
|
186
190
|
// referenced users won't be available, so get user details from dx api
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (resp.data && resp.data.pyOperatorInfo && resp.data.pyOperatorInfo.pyUserName) {
|
|
190
|
-
this.userName$ = resp.data.pyOperatorInfo.pyUserName;
|
|
191
|
-
}
|
|
192
|
-
});
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
192
|
+
this.userName$ = await getUserName(this.pConn$, this.userID$);
|
|
193
193
|
}
|
|
194
194
|
} else if (displayAs === DROPDOWN_LIST || displayAs === SEARCH_BOX) {
|
|
195
195
|
const queryPayload = {
|
|
@@ -257,3 +257,66 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
257
257
|
return errMessage;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
+
|
|
261
|
+
const buildColumnForDisplayValue = dataObj => {
|
|
262
|
+
if (dataObj.columns) {
|
|
263
|
+
dataObj.columns = dataObj.columns.map(column => {
|
|
264
|
+
const tempColObj = { ...column };
|
|
265
|
+
if (tempColObj.key === 'true') {
|
|
266
|
+
tempColObj.useForSearch = true;
|
|
267
|
+
} else {
|
|
268
|
+
tempColObj.useForSearch = false;
|
|
269
|
+
}
|
|
270
|
+
return tempColObj;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
function getUserName(pConn, userId = ''): Promise<string> {
|
|
276
|
+
return new Promise(resolve => {
|
|
277
|
+
const { parameters = {}, referenceList } = pConn.getConfigProps();
|
|
278
|
+
const contextName = pConn.getContextName();
|
|
279
|
+
|
|
280
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
281
|
+
const OPERATORS_DP = referenceList || PCore.getEnvironmentInfo().getDefaultOperatorDP() || '';
|
|
282
|
+
|
|
283
|
+
const columns = [
|
|
284
|
+
{
|
|
285
|
+
value: 'pyUserName',
|
|
286
|
+
display: 'true',
|
|
287
|
+
useForSearch: true,
|
|
288
|
+
primary: 'true'
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
value: 'pyUserIdentifier',
|
|
292
|
+
setProperty: 'Associated property',
|
|
293
|
+
key: 'true',
|
|
294
|
+
display: 'true',
|
|
295
|
+
secondary: 'true',
|
|
296
|
+
useForSearch: true
|
|
297
|
+
}
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
const dataConfig: any = {
|
|
301
|
+
dataSource: OPERATORS_DP,
|
|
302
|
+
parameters,
|
|
303
|
+
matchPosition: 'equals',
|
|
304
|
+
listType: 'datapage',
|
|
305
|
+
columns,
|
|
306
|
+
cacheLifeSpan: 'form',
|
|
307
|
+
deferDatasource: false,
|
|
308
|
+
maxResultsDisplay: '1',
|
|
309
|
+
ignoreCase: true
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
PCore.getDataApi()
|
|
313
|
+
.init(dataConfig, contextName)
|
|
314
|
+
.then(dataApiObj => {
|
|
315
|
+
buildColumnForDisplayValue(dataApiObj);
|
|
316
|
+
dataApiObj.registerForBufferedCall({ waitTime: 50 });
|
|
317
|
+
dataApiObj.fetchData(userId).then((response: any) => {
|
|
318
|
+
resolve(response.data?.[0]?.pyUserName || userId);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
}
|