@pega/dx-component-builder-sdk 25.1.10 → 25.1.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.
Files changed (52) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.ts.mustache +18 -149
  3. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.html.mustache +1 -1
  4. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.ts.mustache +29 -150
  5. package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.ts.mustache +31 -149
  6. package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.ts.mustache +37 -163
  7. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.ts.mustache +34 -169
  8. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.ts.mustache +36 -154
  9. package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.ts.mustache +18 -157
  10. package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.ts.mustache +24 -148
  11. package/src/tasks/create/templates/SDK-Angular/field/Picklist-Autocomplete/demo.stories.tsx.mustache +7 -2
  12. package/src/tasks/create/templates/SDK-Angular/field/Picklist-Autocomplete/picklist-autocomplete.component.ts.mustache +28 -162
  13. package/src/tasks/create/templates/SDK-Angular/field/Picklist-RadioButtons/picklist-radio-buttons.component.ts.mustache +35 -161
  14. package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.ts.mustache +29 -144
  15. package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.ts.mustache +15 -155
  16. package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.ts.mustache +15 -155
  17. package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.ts.mustache +18 -152
  18. package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.ts.mustache +29 -142
  19. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.ts.mustache +16 -154
  20. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.ts.mustache +17 -151
  21. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.ts.mustache +0 -1
  22. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.ts.mustache +0 -1
  23. package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.ts.mustache +10 -3
  24. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.ts.mustache +0 -1
  25. package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.ts.mustache +0 -1
  26. package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.ts.mustache +0 -1
  27. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.ts.mustache +0 -1
  28. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.html.mustache +2 -2
  29. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.ts.mustache +4 -4
  30. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +96 -4
  31. package/src/tasks/create/templates/SDK-React/field/Picklist-RadioButtons/index.tsx.mustache +48 -1
  32. package/src/tasks/validator/index.js +3 -2
  33. package/src/util.js +3 -3
  34. package/tests/assets/sdk-r/components/create/override-sdk/infra/Assignment/Assignment.tsx +2 -2
  35. package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.tsx +13 -3
  36. package/tests/assets/sdk-r/components/create/override-sdk/infra/Stages/Stages.tsx +2 -3
  37. package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/CaseView.tsx +3 -2
  38. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +93 -4
  39. package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyRadiobuttons/index.tsx +45 -1
  40. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Assignment/Assignment.tsx +2 -2
  41. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.tsx +13 -3
  42. package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Stages/Stages.tsx +2 -3
  43. package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/CaseView.tsx +3 -2
  44. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/PConnProps.d.ts +0 -0
  45. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/create-nonce.ts +0 -0
  46. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/demo.stories.tsx +0 -0
  47. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/event-utils.ts +0 -0
  48. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/index.tsx +0 -0
  49. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/mock.ts +0 -0
  50. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/styles.ts +0 -0
  51. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/suggestions-handler.ts +0 -0
  52. /package/tests/assets/sdk-a/components/createAll/custom-constellation/field/{Pega_DXIL_MyRadioButtons → Pega_DXIL_MyRadiobuttons}/textformat-utils.tsx +0 -0
@@ -1,14 +1,13 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, forwardRef } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
- import { interval } from 'rxjs';
7
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
8
- import { Utils } from '@pega/angular-sdk-components';
6
+
7
+ import { FieldBase } from '@pega/angular-sdk-components';
9
8
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
- import { PConnFieldProps } from '@pega/angular-sdk-components';
11
9
  import { handleEvent } from '@pega/angular-sdk-components';
10
+ import { PConnFieldProps } from '@pega/angular-sdk-components';
12
11
 
13
12
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
14
13
  // If any, enter additional props that only exist on URL here
@@ -20,142 +19,22 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
20
19
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
21
20
  imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
22
21
  })
23
- export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
24
- @Input() pConn$: typeof PConnect;
25
- @Input() formGroup$: FormGroup;
26
-
27
- // Used with AngularPConnect
28
- angularPConnectData: AngularPConnectData = {};
22
+ export class {{COMPONENT_CLASS_NAME}}Component extends FieldBase {
29
23
  configProps$: {{COMPONENT_CLASS_NAME}}Props;
30
24
 
31
- label$ = '';
32
- value$ = '';
33
- bRequired$ = false;
34
- bReadonly$ = false;
35
- bDisabled$ = false;
36
- bVisible$ = true;
37
- displayMode$?: string = '';
38
- controlName$: string;
39
- testId = '';
40
- bHasForm$ = true;
41
- componentReference = '';
42
- helperText: string;
43
- placeholder: string;
44
-
45
- fieldControl = new FormControl('', null);
46
- actionsApi: object;
47
- propName: string;
48
-
49
- constructor(
50
- private angularPConnect: AngularPConnectService,
51
- private cdRef: ChangeDetectorRef,
52
- private utils: Utils
53
- ) {}
54
-
55
- ngOnInit(): void {
56
- // First thing in initialization is registering and subscribing to the AngularPConnect service
57
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
58
- this.controlName$ = this.angularPConnect.getComponentID(this);
59
-
60
- // Then, continue on with other initialization
61
-
62
- // call updateSelf when initializing
63
- // this.updateSelf();
64
- this.checkAndUpdate();
65
-
66
- if (this.formGroup$) {
67
- // add control to formGroup
68
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
69
- this.fieldControl.setValue(this.value$);
70
- this.bHasForm$ = true;
71
- } else {
72
- this.bReadonly$ = true;
73
- this.bHasForm$ = false;
74
- }
75
- }
76
-
77
- ngOnDestroy(): void {
78
- if (this.formGroup$) {
79
- this.formGroup$.removeControl(this.controlName$);
80
- }
81
-
82
- if (this.angularPConnectData.unsubscribeFn) {
83
- this.angularPConnectData.unsubscribeFn();
84
- }
85
- }
86
-
87
- // Callback passed when subscribing to store change
88
- onStateChange() {
89
- this.checkAndUpdate();
90
- }
91
-
92
- checkAndUpdate() {
93
- // Should always check the bridge to see if the component should
94
- // update itself (re-render)
95
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
96
-
97
- // ONLY call updateSelf when the component should update
98
- if (bUpdateSelf) {
99
- this.updateSelf();
100
- }
101
- }
102
-
103
- // updateSelf
104
- updateSelf(): void {
105
- // moved this from ngOnInit() and call this from there instead...
25
+ /**
26
+ * Updates the component when there are changes in the state.
27
+ */
28
+ override updateSelf(): void {
29
+ // Resolve config properties
106
30
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as {{COMPONENT_CLASS_NAME}}Props;
107
31
 
108
- if (this.configProps$.value != undefined) {
109
- this.value$ = this.configProps$.value;
110
- }
111
-
112
- this.testId = this.configProps$.testId;
113
- this.label$ = this.configProps$.label;
114
- this.displayMode$ = this.configProps$.displayMode;
115
- this.helperText = this.configProps$.helperText;
116
- this.placeholder = this.configProps$.placeholder || '';
117
-
118
- this.actionsApi = this.pConn$.getActionsApi();
119
- this.propName = this.pConn$.getStateProps().value;
120
-
121
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
122
- setTimeout(() => {
123
- if (this.configProps$.required != null) {
124
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
125
- }
126
- this.cdRef.detectChanges();
127
- });
128
-
129
- if (this.configProps$.visibility != null) {
130
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
131
- }
132
-
133
- // disabled
134
- if (this.configProps$.disabled != undefined) {
135
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
136
- }
32
+ // Update component common properties
33
+ this.updateComponentCommonProperties(this.configProps$);
137
34
 
138
- if (this.bDisabled$) {
139
- this.fieldControl.disable();
140
- } else {
141
- this.fieldControl.enable();
142
- }
143
-
144
- if (this.configProps$.readOnly != null) {
145
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
146
- }
147
-
148
- this.componentReference = this.pConn$.getStateProps().value;
149
-
150
- // trigger display of error message with field control
151
- if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
152
- const timer = interval(100).subscribe(() => {
153
- this.fieldControl.setErrors({ message: true });
154
- this.fieldControl.markAsTouched();
155
-
156
- timer.unsubscribe();
157
- });
158
- }
35
+ // Extract and normalize the value property
36
+ const { value } = this.configProps$;
37
+ this.value$ = value;
159
38
  }
160
39
 
161
40
  fieldOnChange(event: any) {
@@ -178,21 +57,4 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
178
57
  handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
179
58
  }
180
59
  }
181
-
182
- getErrorMessage() {
183
- let errMessage = '';
184
-
185
- // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
186
- if (this.fieldControl.hasError('message')) {
187
- errMessage = this.angularPConnectData.validateMessage ?? '';
188
- return errMessage;
189
- }
190
- if (this.fieldControl.hasError('required')) {
191
- errMessage = 'You must enter a value';
192
- } else if (this.fieldControl.errors) {
193
- errMessage = this.fieldControl.errors.toString();
194
- }
195
-
196
- return errMessage;
197
- }
198
60
  }
@@ -1,15 +1,14 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, forwardRef } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
- import { interval } from 'rxjs';
7
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
8
- import { Utils } from '@pega/angular-sdk-components';
6
+
7
+ import { FieldBase } from '@pega/angular-sdk-components';
9
8
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
10
- import { PConnFieldProps } from '@pega/angular-sdk-components';
11
9
  import { handleEvent } from '@pega/angular-sdk-components';
12
10
  import { format } from '@pega/angular-sdk-components';
11
+ import { PConnFieldProps } from '@pega/angular-sdk-components';
13
12
 
14
13
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
15
14
  // If any, enter additional props that only exist on Time here
@@ -21,147 +20,29 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
21
20
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
22
21
  imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
23
22
  })
24
- export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
25
- @Input() pConn$: typeof PConnect;
26
- @Input() formGroup$: FormGroup;
27
-
28
- // Used with AngularPConnect
29
- angularPConnectData: AngularPConnectData = {};
23
+ export class {{COMPONENT_CLASS_NAME}}Component extends FieldBase {
30
24
  configProps$: {{COMPONENT_CLASS_NAME}}Props;
31
-
32
- label$ = '';
33
- value$: string;
34
- bRequired$ = false;
35
- bReadonly$ = false;
36
- bDisabled$ = false;
37
- bVisible$ = true;
38
- displayMode$?: string = '';
39
- controlName$: string;
40
- testId = '';
41
- bHasForm$ = true;
42
- componentReference = '';
43
- helperText: string;
44
- placeholder: string;
45
-
46
- fieldControl = new FormControl('', null);
47
- actionsApi: object;
48
- propName: string;
49
25
  formattedValue$: any;
50
26
 
51
- constructor(
52
- private angularPConnect: AngularPConnectService,
53
- private cdRef: ChangeDetectorRef,
54
- private utils: Utils
55
- ) {}
56
-
57
- ngOnInit(): void {
58
- // First thing in initialization is registering and subscribing to the AngularPConnect service
59
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
60
- this.controlName$ = this.angularPConnect.getComponentID(this);
61
-
62
- // Then, continue on with other initialization
63
- // call updateSelf when initializing
64
- // this.updateSelf();
65
- this.checkAndUpdate();
66
-
67
- if (this.formGroup$) {
68
- // add control to formGroup
69
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
70
- this.fieldControl.setValue(this.value$);
71
- this.bHasForm$ = true;
72
- } else {
73
- this.bReadonly$ = true;
74
- this.bHasForm$ = false;
75
- }
76
- }
77
-
78
- ngOnDestroy(): void {
79
- if (this.formGroup$) {
80
- this.formGroup$.removeControl(this.controlName$);
81
- }
82
- if (this.angularPConnectData.unsubscribeFn) {
83
- this.angularPConnectData.unsubscribeFn();
84
- }
85
- }
86
-
87
- // Callback passed when subscribing to store change
88
- onStateChange() {
89
- this.checkAndUpdate();
90
- }
91
-
92
- checkAndUpdate() {
93
- // Should always check the bridge to see if the component should
94
- // update itself (re-render)
95
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
96
-
97
- // ONLY call updateSelf when the component should update
98
- if (bUpdateSelf) {
99
- this.updateSelf();
100
- }
101
- }
102
-
103
- // updateSelf
104
- updateSelf(): void {
105
- // moved this from ngOnInit() and call this from there instead...
27
+ /**
28
+ * Updates the component when there are changes in the state.
29
+ */
30
+ override updateSelf(): void {
31
+ // Resolve config properties
106
32
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as {{COMPONENT_CLASS_NAME}}Props;
107
33
 
108
- this.testId = this.configProps$.testId;
109
- this.label$ = this.configProps$.label;
110
- this.displayMode$ = this.configProps$.displayMode;
34
+ // Update component common properties
35
+ this.updateComponentCommonProperties(this.configProps$);
111
36
 
112
- if (this.configProps$.value != undefined) {
113
- this.value$ = this.configProps$.value;
114
- }
115
- this.helperText = this.configProps$.helperText;
116
- this.placeholder = this.configProps$.placeholder || '';
117
-
118
- this.actionsApi = this.pConn$.getActionsApi();
119
- this.propName = this.pConn$.getStateProps().value;
120
-
121
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
122
- setTimeout(() => {
123
- if (this.configProps$.required != null) {
124
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
125
- }
126
- this.cdRef.detectChanges();
127
- });
37
+ // Extract the value property
38
+ const { value } = this.configProps$;
39
+ this.value$ = value;
128
40
 
129
- if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
41
+ if (['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(this.displayMode$)) {
130
42
  this.formattedValue$ = format(this.value$, 'timeonly', {
131
43
  format: 'hh:mm A'
132
44
  });
133
45
  }
134
-
135
- if (this.configProps$.visibility != null) {
136
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
137
- }
138
-
139
- // disabled
140
- if (this.configProps$.disabled != undefined) {
141
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
142
- }
143
-
144
- if (this.bDisabled$) {
145
- this.fieldControl.disable();
146
- } else {
147
- this.fieldControl.enable();
148
- }
149
-
150
- if (this.configProps$.readOnly != null) {
151
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
152
- }
153
-
154
- this.componentReference = this.pConn$.getStateProps().value;
155
-
156
- // trigger display of error message with field control
157
- if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
158
- const timer = interval(100).subscribe(() => {
159
- this.fieldControl.setErrors({ message: true });
160
- this.fieldControl.markAsTouched();
161
-
162
- timer.unsubscribe();
163
- });
164
- }
165
46
  }
166
47
 
167
48
  fieldOnChange(event: any) {
@@ -189,19 +70,4 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
189
70
  handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
190
71
  }
191
72
  }
192
-
193
- getErrorMessage() {
194
- let errMessage = '';
195
- // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
196
- if (this.fieldControl.hasError('message')) {
197
- errMessage = this.angularPConnectData.validateMessage ?? '';
198
- return errMessage;
199
- }
200
- if (this.fieldControl.hasError('required')) {
201
- errMessage = 'You must enter a value';
202
- } else if (this.fieldControl.errors) {
203
- errMessage = this.fieldControl.errors.toString();
204
- }
205
- return errMessage;
206
- }
207
73
  }
@@ -5,7 +5,6 @@ import { ComponentMapperComponent, DetailsTemplateBase } from '@pega/angular-sdk
5
5
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
6
6
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
7
7
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
8
- standalone: true,
9
8
  imports: [forwardRef(() => ComponentMapperComponent)]
10
9
  })
11
10
  export class {{COMPONENT_CLASS_NAME}}Component extends DetailsTemplateBase {
@@ -5,7 +5,6 @@ import { ComponentMapperComponent, DetailsTemplateBase } from '@pega/angular-sdk
5
5
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
6
6
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
7
7
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
8
- standalone: true,
9
8
  imports: [forwardRef(() => ComponentMapperComponent)]
10
9
  })
11
10
  export class {{COMPONENT_CLASS_NAME}}Component extends DetailsTemplateBase {
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, forwardRef } from '@angular/core';
1
+ import { Component, OnInit, Input, forwardRef, OnChanges } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
@@ -28,10 +28,9 @@ interface {{COMPONENT_CLASS_NAME}}Props {
28
28
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
29
29
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
30
30
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
31
- standalone: true,
32
31
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
33
32
  })
34
- export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBase implements OnInit {
33
+ export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBase implements OnInit, OnChanges {
35
34
  @Input() override pConn$: typeof PConnect;
36
35
  @Input() formGroup$: FormGroup;
37
36
 
@@ -60,6 +59,14 @@ export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBase implemen
60
59
  this.updateSelf();
61
60
  }
62
61
 
62
+ ngOnChanges(changes) {
63
+ const { pConn$ } = changes;
64
+
65
+ if (pConn$.previousValue && !PCore.isDeepEqual(pConn$.previousValue.getConfigProps(), pConn$.currentValue.getConfigProps())) {
66
+ this.updateSelf();
67
+ }
68
+ }
69
+
63
70
  updateSelf() {
64
71
  const configProps = this.pConn$.getConfigProps() as {{COMPONENT_CLASS_NAME}}Props;
65
72
  const kids = this.pConn$.getChildren();
@@ -8,7 +8,6 @@ import { FormTemplateBase } from '@pega/angular-sdk-components';
8
8
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
9
9
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
10
10
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
11
- standalone: true,
12
11
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
13
12
  })
14
13
  export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBase implements OnInit, OnChanges {
@@ -14,7 +14,6 @@ interface {{COMPONENT_CLASS_NAME}}Props {
14
14
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
15
15
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
16
16
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
17
- standalone: true,
18
17
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
19
18
  })
20
19
  export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
@@ -11,7 +11,6 @@ interface {{COMPONENT_CLASS_NAME}}Props {
11
11
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
12
12
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
13
13
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
14
- standalone: true,
15
14
  imports: [CommonModule, MatTableModule]
16
15
  })
17
16
  export class {{COMPONENT_CLASS_NAME}}Component implements OnInit {
@@ -17,7 +17,6 @@ interface {{COMPONENT_CLASS_NAME}}Props {
17
17
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
18
18
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
19
19
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
20
- standalone: true,
21
20
  imports: [CommonModule, MatButtonModule, MatTableModule]
22
21
  })
23
22
  export class {{COMPONENT_CLASS_NAME}}Component implements OnInit {
@@ -1,6 +1,6 @@
1
1
  {{! pick new delimiters for mustache }}
2
2
  {{=<% %>=}}
3
- <div class="psdk-operator psdk-double">
3
+ <div class="psdk-operator psdk-double" [ngClass]="{ 'flex-row': displayLabel }">
4
4
  <div class="psdk-label">
5
5
  {{ label$ }}
6
6
  </div>
@@ -14,7 +14,7 @@
14
14
  <div *ngIf="bShowPopover$" class="psdk-operator-popover">
15
15
  <dl>
16
16
  <div *ngFor="let field of fields$; let i = index">
17
- <dt class="psdk-operator-name">{{ field.name }}</dt>
17
+ <dt>{{ field.name }}</dt>
18
18
  <dd class="psdk-operator-value">{{ field.value }}</dd>
19
19
  </div>
20
20
  </dl>
@@ -7,16 +7,16 @@ import { Utils } from '@pega/angular-sdk-components';
7
7
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
8
8
  templateUrl: './{{COMPONENT_CLASS_NAME_KEBAB}}.component.html',
9
9
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
10
- standalone: true,
11
10
  imports: [CommonModule, MatButtonModule]
12
11
  })
13
12
  export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnChanges, OnDestroy {
14
13
  @Input() pConn$: typeof PConnect;
15
14
  @Input() displayLabel;
15
+ @Input() name$?: string;
16
+
16
17
  fields$: any[] = [];
17
18
  bShowPopover$: boolean;
18
19
  date$: string;
19
- name$: string;
20
20
  label$: string;
21
21
  id$: string;
22
22
  constructor(
@@ -40,7 +40,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnChanges, OnD
40
40
 
41
41
  ngOnChanges(changes: SimpleChanges): void {
42
42
  const { pConn$ } = changes;
43
- if (pConn$.previousValue !== pConn$.currentValue) {
43
+ if (pConn$ && pConn$.previousValue !== pConn$.currentValue) {
44
44
  this.updateSelf();
45
45
  }
46
46
  }
@@ -68,7 +68,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnChanges, OnD
68
68
  this.id$ = configProps$.resolveOperator.userId;
69
69
  this.label$ = configProps$.resolveLabel;
70
70
  } else {
71
- this.name$ = configProps$?.value.userName;
71
+ this.name$ = this.name$ || configProps$?.value.userName;
72
72
  this.id$ = configProps$?.value.userId;
73
73
  this.label$ = configProps$.label;
74
74
  }