@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/dx-component-builder-sdk",
3
- "version": "25.1.10",
3
+ "version": "25.1.12",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -1,12 +1,10 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, forwardRef, OnDestroy } 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 { MatCheckboxModule } from '@angular/material/checkbox';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
6
  import { MatOptionModule } from '@angular/material/core';
7
- import { interval } from 'rxjs';
8
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
9
- import { Utils } from '@pega/angular-sdk-components';
7
+ import { FieldBase } from '@pega/angular-sdk-components';
10
8
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
11
9
  import { PConnFieldProps } from '@pega/angular-sdk-components';
12
10
  import { deleteInstruction, insertInstruction, updateNewInstructions } from '@pega/angular-sdk-components';
@@ -36,29 +34,12 @@ interface {{COMPONENT_CLASS_NAME}}Props extends Omit<PConnFieldProps, 'value'> {
36
34
  styleUrls: ['./{{COMPONENT_CLASS_NAME_KEBAB}}.component.scss'],
37
35
  imports: [CommonModule, ReactiveFormsModule, MatCheckboxModule, MatFormFieldModule, MatOptionModule, forwardRef(() => ComponentMapperComponent)]
38
36
  })
39
- export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
40
- @Input() pConn$: typeof PConnect;
41
- @Input() formGroup$: FormGroup;
42
-
43
- // Used with AngularPConnect
44
- angularPConnectData: AngularPConnectData = {};
37
+ export class {{COMPONENT_CLASS_NAME}}Component extends FieldBase implements OnInit, OnDestroy {
45
38
  configProps$: {{COMPONENT_CLASS_NAME}}Props;
46
39
 
47
- label$ = '';
48
- value$: any = '';
49
40
  caption$?: string = '';
50
- testId = '';
51
41
  showLabel$ = false;
52
42
  isChecked$ = false;
53
- bRequired$ = false;
54
- bReadonly$ = false;
55
- bDisabled$ = false;
56
- bVisible$ = true;
57
- displayMode$?: string = '';
58
- controlName$: string;
59
- bHasForm$ = true;
60
- componentReference = '';
61
- helperText: string;
62
43
  trueLabel$?: string;
63
44
  falseLabel$?: string;
64
45
 
@@ -70,85 +51,32 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
70
51
  selectedvalues: any;
71
52
  referenceList: string;
72
53
  listOfCheckboxes: any[] = [];
73
- actionsApi: object;
74
- propName: string;
75
54
  variant?: string;
76
55
 
77
- fieldControl = new FormControl('', null);
78
-
79
- constructor(
80
- private angularPConnect: AngularPConnectService,
81
- private cdRef: ChangeDetectorRef,
82
- private utils: Utils
83
- ) {}
84
-
85
- ngOnInit(): void {
86
- // First thing in initialization is registering and subscribing to the AngularPConnect service
87
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
88
- this.controlName$ = this.angularPConnect.getComponentID(this);
56
+ // Override ngOnInit method
57
+ override ngOnInit(): void {
58
+ super.ngOnInit();
89
59
 
90
- // Then, continue on with other initialization
91
-
92
- // call updateSelf when initializing
93
- // this.updateSelf();
94
- this.checkAndUpdate();
95
-
96
- if (this.selectionMode === 'multi' && this.referenceList?.length > 0) {
60
+ if (this.selectionMode === 'multi' && this.referenceList?.length > 0 && !this.bReadonly$) {
97
61
  this.pConn$.setReferenceList(this.selectionList);
98
62
  updateNewInstructions(this.pConn$, this.selectionList);
99
63
  }
100
-
101
- if (this.formGroup$) {
102
- // add control to formGroup
103
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
104
- this.fieldControl.setValue(this.value$);
105
- this.bHasForm$ = true;
106
- } else {
107
- this.bReadonly$ = true;
108
- this.bHasForm$ = false;
109
- }
110
64
  }
111
65
 
112
- ngOnDestroy(): void {
113
- if (this.formGroup$) {
114
- this.formGroup$.removeControl(this.controlName$);
115
- }
116
-
117
- if (this.angularPConnectData.unsubscribeFn) {
118
- this.angularPConnectData.unsubscribeFn();
119
- }
120
- }
121
-
122
- // Callback passed when subscribing to store change
123
- onStateChange() {
124
- this.checkAndUpdate();
125
- }
126
-
127
- checkAndUpdate() {
128
- // Should always check the bridge to see if the component should
129
- // update itself (re-render)
130
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
131
-
132
- // ONLY call updateSelf when the component should update
133
- if (bUpdateSelf) {
134
- this.updateSelf();
135
- }
136
- }
137
-
138
- // updateSelf
139
- updateSelf(): void {
66
+ /**
67
+ * Updates the component when there are changes in the state.
68
+ */
69
+ override updateSelf(): void {
140
70
  // moved this from ngOnInit() and call this from there instead...
141
71
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as {{COMPONENT_CLASS_NAME}}Props;
142
72
 
143
- this.testId = this.configProps$.testId;
144
- this.displayMode$ = this.configProps$.displayMode;
145
- this.label$ = this.configProps$.label;
73
+ // Update component common properties
74
+ this.updateComponentCommonProperties(this.configProps$);
75
+
146
76
  if (this.label$ != '') {
147
77
  this.showLabel$ = true;
148
78
  }
149
-
150
- this.actionsApi = this.pConn$.getActionsApi();
151
- this.propName = this.pConn$.getStateProps().value;
79
+ this.variant = this.configProps$.variant;
152
80
 
153
81
  // multi case
154
82
  this.selectionMode = this.configProps$.selectionMode;
@@ -157,6 +85,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
157
85
  this.selectionList = this.configProps$.selectionList;
158
86
  this.selectedvalues = this.configProps$.readonlyContextList;
159
87
  this.primaryField = this.configProps$.primaryField;
88
+ this.bReadonly$ = this.configProps$.renderMode === 'ReadOnly' || this.displayMode$ === 'DISPLAY_ONLY' || this.configProps$.readOnly;
160
89
 
161
90
  this.datasource = this.configProps$.datasource;
162
91
  this.selectionKey = this.configProps$.selectionKey;
@@ -174,53 +103,10 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
174
103
  }
175
104
 
176
105
  this.caption$ = this.configProps$.caption;
177
- this.helperText = this.configProps$.helperText;
178
106
  this.trueLabel$ = this.configProps$.trueLabel || 'Yes';
179
107
  this.falseLabel$ = this.configProps$.falseLabel || 'No';
180
108
 
181
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
182
- setTimeout(() => {
183
- if (this.configProps$.required != null) {
184
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
185
- }
186
- this.cdRef.detectChanges();
187
- });
188
-
189
- if (this.configProps$.visibility != null) {
190
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
191
- }
192
-
193
- // disabled
194
- if (this.configProps$.disabled != undefined) {
195
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
196
- }
197
-
198
- if (this.configProps$.readOnly != null) {
199
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
200
- }
201
-
202
- if (this.bDisabled$ || this.bReadonly$) {
203
- this.fieldControl.disable();
204
- } else {
205
- this.fieldControl.enable();
206
- }
207
-
208
- this.componentReference = this.pConn$.getStateProps().value;
209
-
210
- if (this.value$ === 'true' || this.value$ == true) {
211
- this.isChecked$ = true;
212
- } else {
213
- this.isChecked$ = false;
214
- }
215
- // trigger display of error message with field control
216
- if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
217
- const timer = interval(100).subscribe(() => {
218
- this.fieldControl.setErrors({ message: true });
219
- this.fieldControl.markAsTouched();
220
-
221
- timer.unsubscribe();
222
- });
223
- }
109
+ this.isChecked$ = this.value$ === 'true' || this.value$ == true;
224
110
  }
225
111
  }
226
112
 
@@ -258,21 +144,4 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
258
144
  context: ''
259
145
  });
260
146
  }
261
-
262
- getErrorMessage() {
263
- let errMessage = '';
264
-
265
- // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
266
- if (this.fieldControl.hasError('message')) {
267
- errMessage = this.angularPConnectData.validateMessage ?? '';
268
- return errMessage;
269
- }
270
- if (this.fieldControl.hasError('required')) {
271
- errMessage = 'You must enter a value';
272
- } else if (this.fieldControl.errors) {
273
- errMessage = this.fieldControl.errors.toString();
274
- }
275
-
276
- return errMessage;
277
- }
278
147
  }
@@ -13,7 +13,7 @@
13
13
  #dateInput
14
14
  [attr.data-test-id]="testId"
15
15
  [matDatepicker]="pegadate"
16
- [placeholder]="dateFormatInfo.dateFormatStringLC"
16
+ [placeholder]="theDateFormat.dateFormatStringLC"
17
17
  type="text"
18
18
  [value]="value$"
19
19
  [required]="bRequired$"
@@ -1,20 +1,18 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, Inject, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, forwardRef, OnDestroy } 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 { MatDatepickerModule } from '@angular/material/datepicker';
5
5
  import { MatNativeDateModule } from '@angular/material/core';
6
6
  import { MatInputModule } from '@angular/material/input';
7
7
  import { MatFormFieldModule } from '@angular/material/form-field';
8
8
  import { MAT_DATE_FORMATS } from '@angular/material/core';
9
9
  import { MomentDateModule } from '@angular/material-moment-adapter';
10
- import { interval } from 'rxjs';
11
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
12
- import { Utils } from '@pega/angular-sdk-components';
10
+ import { FieldBase } from '@pega/angular-sdk-components';
13
11
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
14
- import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
15
- import { PConnFieldProps } from '@pega/angular-sdk-components';
12
+ import { getDateFormatInfo } from '@pega/angular-sdk-components';
16
13
  import { format } from '@pega/angular-sdk-components';
17
14
  import { handleEvent } from '@pega/angular-sdk-components';
15
+ import { PConnFieldProps } from '@pega/angular-sdk-components';
18
16
 
19
17
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
20
18
  // If any, enter additional props that only exist on Date here
@@ -55,153 +53,32 @@ class MyFormat {
55
53
  ],
56
54
  providers: [{ provide: MAT_DATE_FORMATS, useClass: MyFormat }]
57
55
  })
58
- export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
59
- @Input() pConn$: typeof PConnect;
60
- @Input() formGroup$: FormGroup;
61
-
62
- // Used with AngularPConnect
63
- angularPConnectData: AngularPConnectData = {};
56
+ export class {{COMPONENT_CLASS_NAME}}Component extends FieldBase implements OnInit, OnDestroy {
64
57
  configProps$: {{COMPONENT_CLASS_NAME}}Props;
65
58
 
66
- label$ = '';
67
- value$: any;
68
- bRequired$ = false;
69
- bReadonly$ = false;
70
- bDisabled$ = false;
71
- bVisible$ = true;
72
- displayMode$?: string = '';
73
- controlName$: string;
74
- bHasForm$ = true;
75
- componentReference = '';
76
- testId = '';
77
- helperText: string;
78
- placeholder: string;
79
-
80
- fieldControl = new FormControl('', null);
81
-
82
- // Start with default dateFormatInfo
83
- dateFormatInfo = dateFormatInfoDefault;
84
- // and then update, as needed, based on locale, etc.
85
59
  theDateFormat = getDateFormatInfo();
86
- actionsApi: object;
87
- propName: string;
88
60
  formattedValue$: any;
89
61
 
90
- constructor(
91
- private angularPConnect: AngularPConnectService,
92
- private cdRef: ChangeDetectorRef,
93
- private utils: Utils,
94
- @Inject(MAT_DATE_FORMATS) private config: MyFormat
95
- ) {}
96
-
97
- ngOnInit(): void {
98
- this.dateFormatInfo = this.theDateFormat;
99
- // First thing in initialization is registering and subscribing to the AngularPConnect service
100
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
101
- this.controlName$ = this.angularPConnect.getComponentID(this);
102
-
103
- // Then, continue on with other initialization
104
- // call updateSelf when initializing
105
- // this.updateSelf();
106
- this.checkAndUpdate();
107
-
108
- if (this.formGroup$) {
109
- // add control to formGroup
110
- this.formGroup$.addControl(this.controlName$, this.fieldControl);
111
- this.fieldControl.setValue(this.value$);
112
- this.bHasForm$ = true;
113
- } else {
114
- this.bReadonly$ = true;
115
- this.bHasForm$ = false;
116
- }
117
- }
118
-
119
- ngOnDestroy(): void {
120
- if (this.formGroup$) {
121
- this.formGroup$.removeControl(this.controlName$);
122
- }
123
-
124
- if (this.angularPConnectData.unsubscribeFn) {
125
- this.angularPConnectData.unsubscribeFn();
126
- }
127
- }
128
-
129
- // Callback passed when subscribing to store change
130
- onStateChange() {
131
- this.checkAndUpdate();
132
- }
133
-
134
- checkAndUpdate() {
135
- // Should always check the bridge to see if the component should
136
- // update itself (re-render)
137
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
138
-
139
- // ONLY call updateSelf when the component should update
140
- if (bUpdateSelf) {
141
- this.updateSelf();
142
- }
143
- }
144
-
145
- // updateSelf
146
- updateSelf(): void {
147
- // starting very simple...
148
- // moved this from ngOnInit() and call this from there instead...
62
+ /**
63
+ * Updates the component when there are changes in the state.
64
+ */
65
+ override updateSelf(): void {
66
+ // Resolve config properties
149
67
  this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as {{COMPONENT_CLASS_NAME}}Props;
150
68
 
151
- this.value$ = this.configProps$.value;
152
- this.testId = this.configProps$.testId;
153
- this.label$ = this.configProps$.label;
154
- this.displayMode$ = this.configProps$.displayMode;
155
- this.helperText = this.configProps$.helperText;
156
- this.placeholder = this.configProps$.placeholder || '';
157
-
158
- this.actionsApi = this.pConn$.getActionsApi();
159
- this.propName = this.pConn$.getStateProps().value;
160
-
161
- // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
162
- setTimeout(() => {
163
- if (this.configProps$.required != null) {
164
- this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
165
- }
166
- this.cdRef.detectChanges();
167
- });
69
+ // Update component common properties
70
+ this.updateComponentCommonProperties(this.configProps$);
168
71
 
169
- if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
72
+ // Extract and normalize the value property
73
+ const { value } = this.configProps$;
74
+ this.value$ = value;
75
+
76
+ // Format value for display modes
77
+ if (['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(this.displayMode$)) {
170
78
  this.formattedValue$ = format(this.value$, 'date', {
171
79
  format: this.theDateFormat.dateFormatString
172
80
  });
173
81
  }
174
-
175
- if (this.configProps$.visibility != null) {
176
- this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
177
- }
178
-
179
- // disabled
180
- if (this.configProps$.disabled != undefined) {
181
- this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
182
- }
183
-
184
- if (this.bDisabled$) {
185
- this.fieldControl.disable();
186
- } else {
187
- this.fieldControl.enable();
188
- }
189
-
190
- if (this.configProps$.readOnly != null) {
191
- this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
192
- }
193
-
194
- this.componentReference = this.pConn$.getStateProps().value;
195
-
196
- // trigger display of error message with field control
197
- if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
198
- const timer = interval(100).subscribe(() => {
199
- this.fieldControl.setErrors({ message: true });
200
- this.fieldControl.markAsTouched();
201
-
202
- timer.unsubscribe();
203
- });
204
- }
205
82
  }
206
83
 
207
84
  fieldOnDateChange(event: any) {
@@ -217,18 +94,20 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
217
94
  return this.fieldControl.status === 'INVALID';
218
95
  }
219
96
 
220
- getErrorMessage() {
221
- let errMessage = '';
97
+ override getErrorMessage() {
222
98
  // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
223
99
  if (this.fieldControl.hasError('message')) {
224
- errMessage = this.angularPConnectData.validateMessage ?? '';
225
- return errMessage;
100
+ return this.angularPConnectData.validateMessage ?? '';
226
101
  }
102
+
227
103
  if (this.fieldControl.hasError('required')) {
228
- errMessage = 'You must enter a value';
229
- } else if (this.fieldControl.errors) {
230
- errMessage = `${this.fieldControl.errors['matDatepickerParse'].text} is not a valid date value`;
104
+ return 'You must enter a value';
105
+ }
106
+
107
+ if (this.fieldControl.errors) {
108
+ return `${this.fieldControl.errors['matDatepickerParse'].text} is not a valid date value`;
231
109
  }
232
- return errMessage;
110
+
111
+ return '';
233
112
  }
234
113
  }