@pega/dx-component-builder-sdk 0.242.16 → 0.242.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.
- package/package.json +1 -1
- package/src/tasks/create/templates/Constellation/template/PAGE/demo.stories.tsx.mustache +1 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.spec.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Date/demo.stories.tsx.mustache +1 -11
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/demo.stories.tsx.mustache +1 -12
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.spec.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/demo.stories.tsx.mustache +1 -15
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.spec.ts.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/demo.stories.tsx.mustache +10 -21
- package/src/tasks/create/templates/SDK-Angular/field/Integer/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Picklist-Autocomplete/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Picklist-RadioButtons/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-Angular/template/FORM/demo.stories.tsx.mustache +9 -17
- package/src/tasks/create/templates/SDK-Angular/template/FORM/mock.ts.mustache +19 -1
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/demo.stories.tsx.mustache +7 -16
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/mock.ts.mustache +19 -1
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/demo.stories.tsx.mustache +35 -47
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/demo.stories.tsx.mustache +7 -17
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/demo.stories.tsx.mustache +7 -10
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/demo.stories.tsx.mustache +9 -17
- package/tests/assets/sdk-a/components/create/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/create/custom-sdk/field/pega-dxil-my-test-text/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/create/override-sdk/field/user-reference/user-reference.component.html +2 -10
- package/tests/assets/sdk-a/components/create/override-sdk/field/user-reference/user-reference.component.ts +34 -12
- package/tests/assets/sdk-a/components/create/override-sdk/infra/view/view.component.ts +15 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyCurrency/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyDate/demo.stories.tsx +0 -16
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyDateTime/demo.stories.tsx +0 -17
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyDecimal/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyEmail/mock.ts +1 -0
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +9 -20
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyParagraph/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyPercentage/mock.ts +1 -0
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyPhone/demo.stories.tsx +1 -2
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyPicklist/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyRadioButtons/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MySearchbox/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyText/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/field/Pega_DXIL_MyURL/demo.stories.tsx +0 -1
- package/tests/assets/sdk-a/components/createAll/custom-constellation/template/Pega_DXIL_MyDetails/demo.stories.tsx +10 -0
- package/tests/assets/sdk-a/components/createAll/custom-constellation/template/Pega_DXIL_MyPage/demo.stories.tsx +1 -13
- package/tests/assets/sdk-a/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/demo.stories.tsx +10 -32
- package/tests/assets/sdk-a/components/createAll/custom-constellation/widget/Pega_DXIL_MyCaseWidget/index.tsx +2 -2
- package/tests/assets/sdk-a/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +10 -22
- package/tests/assets/sdk-a/components/createAll/custom-constellation/widget/Pega_DXIL_MyPageWidget/demo.stories.tsx +10 -21
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-boolean/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-currency/demo.stories.tsx +1 -15
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date/demo.stories.tsx +1 -11
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date/pega-dxil-my-date.component.spec.ts +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-date-time/demo.stories.tsx +1 -12
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-decimal/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.spec.ts +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-email/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-icon-button-url/demo.stories.tsx +10 -21
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-integer/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-paragraph/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-percentage/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.spec.ts +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-phone/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-picklist/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-radiobuttons/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-searchbox/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-text/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-text-input/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-time-of-day/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-url/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-details/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-form/demo.stories.tsx +9 -17
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-form/mock.ts +19 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-page/demo.stories.tsx +35 -47
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-two-column-details/demo.stories.tsx +1 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/demo.stories.tsx +7 -16
- package/tests/assets/sdk-a/components/createAll/custom-sdk/template/pega-dxil-my-two-column-form/mock.ts +19 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/widget/pega-dxil-my-case-widget/demo.stories.tsx +7 -17
- package/tests/assets/sdk-a/components/createAll/custom-sdk/widget/pega-dxil-my-page-case-widget/demo.stories.tsx +9 -17
- package/tests/assets/sdk-a/components/createAll/custom-sdk/widget/pega-dxil-my-page-widget/demo.stories.tsx +7 -10
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/user-reference/user-reference.component.html +2 -10
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/user-reference/user-reference.component.ts +34 -12
- package/tests/assets/sdk-a/components/createAll/override-sdk/infra/view/view.component.ts +15 -1
|
@@ -44,6 +44,9 @@ export const child1 = [
|
|
|
44
44
|
label: 'First Name',
|
|
45
45
|
hasSuggestions: false
|
|
46
46
|
};
|
|
47
|
+
},
|
|
48
|
+
clearErrorMessages: () => {
|
|
49
|
+
/* nothing */
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
}
|
|
@@ -93,6 +96,9 @@ export const child1 = [
|
|
|
93
96
|
label: 'Middle Name',
|
|
94
97
|
hasSuggestions: false
|
|
95
98
|
};
|
|
99
|
+
},
|
|
100
|
+
clearErrorMessages: () => {
|
|
101
|
+
/* nothing */
|
|
96
102
|
}
|
|
97
103
|
};
|
|
98
104
|
}
|
|
@@ -142,6 +148,9 @@ export const child1 = [
|
|
|
142
148
|
label: 'Last Name',
|
|
143
149
|
hasSuggestions: false
|
|
144
150
|
};
|
|
151
|
+
},
|
|
152
|
+
clearErrorMessages: () => {
|
|
153
|
+
/* nothing */
|
|
145
154
|
}
|
|
146
155
|
};
|
|
147
156
|
}
|
|
@@ -194,6 +203,9 @@ export const child2 = [
|
|
|
194
203
|
label: 'Email',
|
|
195
204
|
hasSuggestions: false
|
|
196
205
|
};
|
|
206
|
+
},
|
|
207
|
+
clearErrorMessages: () => {
|
|
208
|
+
/* nothing */
|
|
197
209
|
}
|
|
198
210
|
};
|
|
199
211
|
}
|
|
@@ -243,6 +255,9 @@ export const child2 = [
|
|
|
243
255
|
label: 'Phone Number',
|
|
244
256
|
hasSuggestions: false
|
|
245
257
|
};
|
|
258
|
+
},
|
|
259
|
+
clearErrorMessages: () => {
|
|
260
|
+
/* nothing */
|
|
246
261
|
}
|
|
247
262
|
};
|
|
248
263
|
}
|
|
@@ -349,7 +364,10 @@ export const child2 = [
|
|
|
349
364
|
getContextName: () => {
|
|
350
365
|
return 'app/primary_1/workarea_9';
|
|
351
366
|
},
|
|
352
|
-
getDataObject: () => {}
|
|
367
|
+
getDataObject: () => {},
|
|
368
|
+
clearErrorMessages: () => {
|
|
369
|
+
/* nothing */
|
|
370
|
+
}
|
|
353
371
|
};
|
|
354
372
|
}
|
|
355
373
|
}
|
|
@@ -8,23 +8,13 @@ const meta: Meta<PegaDxilMyCaseWidgetComponent> = {
|
|
|
8
8
|
title: 'PegaDxilMyCaseWidget',
|
|
9
9
|
component: PegaDxilMyCaseWidgetComponent,
|
|
10
10
|
excludeStories: /.*Data$/,
|
|
11
|
-
render: (args
|
|
12
|
-
window.PCore = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
} as any;
|
|
20
|
-
},
|
|
21
|
-
getDataApiUtils: () => {
|
|
22
|
-
return {
|
|
23
|
-
getData: () => {
|
|
24
|
-
return Promise.resolve(historyData);
|
|
25
|
-
}
|
|
26
|
-
} as any;
|
|
27
|
-
}
|
|
11
|
+
render: (args) => {
|
|
12
|
+
window.PCore.getDataApiUtils = (): any => {
|
|
13
|
+
return {
|
|
14
|
+
getData: () => {
|
|
15
|
+
return Promise.resolve(historyData);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
28
18
|
};
|
|
29
19
|
return {
|
|
30
20
|
props: {
|
|
@@ -4,29 +4,21 @@ import { configProps, operatorDetails } from './mock';
|
|
|
4
4
|
|
|
5
5
|
import { PegaDxilMyPageCaseWidgetComponent } from './pega-dxil-my-page-case-widget.component';
|
|
6
6
|
|
|
7
|
-
window.PCore = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
getLocaleUtils: () => {
|
|
17
|
-
return {
|
|
18
|
-
getLocaleValue: val => {
|
|
19
|
-
return val;
|
|
20
|
-
}
|
|
21
|
-
} as any;
|
|
22
|
-
}
|
|
7
|
+
window.PCore.getUserApi = (): any => {
|
|
8
|
+
return {
|
|
9
|
+
getOperatorDetails: () => {
|
|
10
|
+
return new Promise(resolve => {
|
|
11
|
+
resolve(operatorDetails);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
23
15
|
};
|
|
24
16
|
|
|
25
17
|
const meta: Meta<PegaDxilMyPageCaseWidgetComponent> = {
|
|
26
18
|
title: 'PegaDxilMyPageCaseWidget',
|
|
27
19
|
component: PegaDxilMyPageCaseWidgetComponent,
|
|
28
20
|
excludeStories: /.*Data$/,
|
|
29
|
-
render: (args
|
|
21
|
+
render: (args) => ({
|
|
30
22
|
props: {
|
|
31
23
|
...args,
|
|
32
24
|
pConn$: {
|
|
@@ -8,16 +8,13 @@ const meta: Meta<PegaDxilMyPageWidgetComponent> = {
|
|
|
8
8
|
title: 'PegaDxilMyPageWidget',
|
|
9
9
|
component: PegaDxilMyPageWidgetComponent,
|
|
10
10
|
excludeStories: /.*Data$/,
|
|
11
|
-
render: (args
|
|
12
|
-
window.PCore = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
} as any;
|
|
20
|
-
}
|
|
11
|
+
render: (args) => {
|
|
12
|
+
window.PCore.getDataApiUtils = (): any => {
|
|
13
|
+
return {
|
|
14
|
+
getData: () => {
|
|
15
|
+
return Promise.resolve(worklistData);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
21
18
|
};
|
|
22
19
|
return {
|
|
23
20
|
props: {
|
|
@@ -8,13 +8,7 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
<div [formGroup]="formGroup$" *ngIf="type === 'dropdown'">
|
|
10
10
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
11
|
-
<mat-select
|
|
12
|
-
[value]="value$"
|
|
13
|
-
[required]="bRequired$"
|
|
14
|
-
[formControl]="fieldControl"
|
|
15
|
-
[attr.data-test-id]="testId"
|
|
16
|
-
(selectionChange)="fieldOnChange($event)"
|
|
17
|
-
>
|
|
11
|
+
<mat-select [required]="bRequired$" [formControl]="fieldControl" [attr.data-test-id]="testId" (selectionChange)="fieldOnChange($event)">
|
|
18
12
|
<mat-option *ngFor="let opt of options$" [value]="opt.key">
|
|
19
13
|
{{ opt.value }}
|
|
20
14
|
</mat-option>
|
|
@@ -32,14 +26,12 @@
|
|
|
32
26
|
matInput
|
|
33
27
|
[placeholder]="placeholder"
|
|
34
28
|
[formControl]="fieldControl"
|
|
35
|
-
[value]="value$"
|
|
36
29
|
[required]="bRequired$"
|
|
37
30
|
[matAutocomplete]="auto"
|
|
38
31
|
[attr.data-test-id]="testId"
|
|
39
|
-
(change)="fieldOnChange($event)"
|
|
40
32
|
(blur)="fieldOnBlur($event)"
|
|
41
33
|
/>
|
|
42
|
-
<mat-autocomplete #auto="matAutocomplete">
|
|
34
|
+
<mat-autocomplete #auto="matAutocomplete" autoActiveFirstOption (optionSelected)="optionChanged($event)">
|
|
43
35
|
<mat-option *ngFor="let opt of filteredOptions | async" [value]="opt.value">
|
|
44
36
|
<span>{{ opt.value }}</span>
|
|
45
37
|
</mat-option>
|
|
@@ -23,6 +23,7 @@ interface UserReferenceProps extends Omit<PConnFieldProps, 'value'> {
|
|
|
23
23
|
value?: any;
|
|
24
24
|
showAsFormattedText?: boolean;
|
|
25
25
|
additionalProps?: object;
|
|
26
|
+
onRecordChange?: any;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
@Component({
|
|
@@ -66,6 +67,7 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
66
67
|
fieldControl = new FormControl('', null);
|
|
67
68
|
actionsApi: Object;
|
|
68
69
|
propName: string;
|
|
70
|
+
onRecordChange: any;
|
|
69
71
|
|
|
70
72
|
constructor(
|
|
71
73
|
private angularPConnect: AngularPConnectService,
|
|
@@ -83,11 +85,11 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
83
85
|
if (this.formGroup$) {
|
|
84
86
|
// add control to formGroup
|
|
85
87
|
this.formGroup$.addControl(this.controlName$, this.fieldControl);
|
|
86
|
-
this.fieldControl.setValue(this.value$);
|
|
88
|
+
this.fieldControl.setValue(this.getValue(this.value$));
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
this.filteredOptions = this.fieldControl.valueChanges.pipe(
|
|
90
|
-
startWith(''),
|
|
92
|
+
startWith(this.getValue(this.value$) || ''),
|
|
91
93
|
map(value => this._filter(value || ''))
|
|
92
94
|
);
|
|
93
95
|
}
|
|
@@ -126,6 +128,21 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
126
128
|
return this.options$?.filter(option => option.value?.toLowerCase().includes(filterVal));
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
isUserNameAvailable = user => {
|
|
132
|
+
return typeof user === 'object' && user !== null && user.userName;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
getUserName = user => {
|
|
136
|
+
return user.userName;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
getValue = user => {
|
|
140
|
+
if (this.displayAs$ === DROPDOWN_LIST) {
|
|
141
|
+
return this.utils.getUserId(user) || this.getUserName(user);
|
|
142
|
+
}
|
|
143
|
+
return this.isUserNameAvailable(user) ? this.getUserName(user) : this.utils.getUserId(user);
|
|
144
|
+
};
|
|
145
|
+
|
|
129
146
|
async checkAndUpdate() {
|
|
130
147
|
// Should always check the bridge to see if the component should
|
|
131
148
|
// update itself (re-render)
|
|
@@ -140,6 +157,7 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
140
157
|
async updateSelf() {
|
|
141
158
|
const props = this.pConn$.getConfigProps() as UserReferenceProps;
|
|
142
159
|
this.testId = props.testId;
|
|
160
|
+
this.onRecordChange = props?.onRecordChange;
|
|
143
161
|
|
|
144
162
|
const { label, displayAs, value, showAsFormattedText, helperText, placeholder, displayMode } = props;
|
|
145
163
|
|
|
@@ -150,20 +168,18 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
150
168
|
this.placeholder = placeholder || '';
|
|
151
169
|
this.displayMode$ = displayMode;
|
|
152
170
|
|
|
171
|
+
this.value$ = this.pConn$.getConfigProps()?.value;
|
|
172
|
+
|
|
153
173
|
const { readOnly, required } = props;
|
|
154
174
|
[this.bReadonly$, this.bRequired$] = [readOnly, required].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
|
|
155
175
|
|
|
156
176
|
this.actionsApi = this.pConn$.getActionsApi();
|
|
157
177
|
this.propName = this.pConn$.getStateProps().value;
|
|
158
178
|
|
|
159
|
-
const isUserNameAvailable = user => {
|
|
160
|
-
return typeof user === 'object' && user !== null && user.userName;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
179
|
this.userID$ = this.utils.getUserId(value);
|
|
164
180
|
|
|
165
181
|
if (this.userID$ && this.bReadonly$ && this.showAsFormattedText$) {
|
|
166
|
-
if (isUserNameAvailable(value)) {
|
|
182
|
+
if (this.isUserNameAvailable(value)) {
|
|
167
183
|
this.userName$ = value.userName;
|
|
168
184
|
} else {
|
|
169
185
|
// if same user ref field is referred in view as editable & readonly formatted text
|
|
@@ -201,7 +217,12 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
201
217
|
if (event?.target) {
|
|
202
218
|
this.filterValue = (event.target as HTMLInputElement).value;
|
|
203
219
|
}
|
|
204
|
-
const value = event?.
|
|
220
|
+
const value = event?.value;
|
|
221
|
+
handleEvent(this.actionsApi, 'change', this.propName, value);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
optionChanged(event: any) {
|
|
225
|
+
const value = event?.option?.value;
|
|
205
226
|
handleEvent(this.actionsApi, 'change', this.propName, value);
|
|
206
227
|
}
|
|
207
228
|
|
|
@@ -211,11 +232,12 @@ export class UserReferenceComponent implements OnInit, OnDestroy {
|
|
|
211
232
|
const index = this.options$?.findIndex(element => element.value === event.target.value);
|
|
212
233
|
key = index > -1 ? (key = this.options$[index].key) : event.target.value;
|
|
213
234
|
}
|
|
214
|
-
|
|
215
|
-
const value = {
|
|
216
|
-
value: key
|
|
217
|
-
};
|
|
235
|
+
const value = key;
|
|
218
236
|
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
237
|
+
if (this.onRecordChange) {
|
|
238
|
+
event.target.value = value;
|
|
239
|
+
this.onRecordChange(event);
|
|
240
|
+
}
|
|
219
241
|
}
|
|
220
242
|
|
|
221
243
|
getErrorMessage() {
|
|
@@ -8,6 +8,20 @@ import { ReferenceComponent } from '@pega/angular-sdk-components';
|
|
|
8
8
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
9
9
|
|
|
10
10
|
const NO_HEADER_TEMPLATES = ['SubTabs', 'SimpleTable', 'Confirmation', 'DynamicTabs', 'DetailsSubTabs'];
|
|
11
|
+
const DETAILS_TEMPLATES = [
|
|
12
|
+
'Details',
|
|
13
|
+
'DetailsFields',
|
|
14
|
+
'DetailsOneColumn',
|
|
15
|
+
'DetailsSubTabs',
|
|
16
|
+
'DetailsThreeColumn',
|
|
17
|
+
'DetailsTwoColumn',
|
|
18
|
+
'NarrowWideDetails',
|
|
19
|
+
'WideNarrowDetails'
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function isDetailsTemplate(template) {
|
|
23
|
+
return DETAILS_TEMPLATES.includes(template);
|
|
24
|
+
}
|
|
11
25
|
|
|
12
26
|
/**
|
|
13
27
|
* WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
@@ -146,7 +160,7 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
146
160
|
this.templateName$ = this.configProps$.template || '';
|
|
147
161
|
this.title$ = this.configProps$.title || '';
|
|
148
162
|
this.label$ = this.configProps$.label || '';
|
|
149
|
-
this.showLabel$ = this.configProps$.showLabel || this.showLabel$;
|
|
163
|
+
this.showLabel$ = this.configProps$.showLabel || isDetailsTemplate(this.templateName$) || this.showLabel$;
|
|
150
164
|
// label & showLabel within inheritedProps takes precedence over configProps
|
|
151
165
|
this.label$ = this.inheritedProps$.label || this.label$;
|
|
152
166
|
this.showLabel$ = this.inheritedProps$.showLabel || this.showLabel$;
|