@pega/dx-component-builder-sdk 0.242.19 → 0.242.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/dx-component-builder-sdk",
3
- "version": "0.242.19",
3
+ "version": "0.242.20",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -121,7 +121,6 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
121
121
  // call updateSelf when initializing
122
122
  this.checkAndUpdate();
123
123
  // this should get called afer checkAndUpdate
124
- this.getDatapageData();
125
124
 
126
125
  if (this.formGroup$) {
127
126
  // add control to formGroup
@@ -253,7 +252,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
253
252
  );
254
253
 
255
254
  this.localizedValue = this.options$?.find(opt => opt.key === this.value$)?.value || this.localizedValue;
256
-
255
+ this.getDatapageData();
257
256
  // trigger display of error message with field control
258
257
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
259
258
  const timer = interval(100).subscribe(() => {
@@ -13,7 +13,6 @@
13
13
  [placeholder]="placeholder"
14
14
  [formControl]="fieldControl"
15
15
  [attr.data-test-id]="testId"
16
- [value]="value$"
17
16
  [required]="bRequired$"
18
17
  [matAutocomplete]="auto"
19
18
  (input)="fieldOnChange($event)"
@@ -14,6 +14,10 @@ import { DatapageService } from '@pega/angular-sdk-components';
14
14
  import { handleEvent } from '@pega/angular-sdk-components';
15
15
  import { PConnFieldProps } from '@pega/angular-sdk-components';
16
16
 
17
+ interface IOption {
18
+ key: string;
19
+ value: string;
20
+ }
17
21
  interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
18
22
  // If any, enter additional props that only exist on AutoComplete here
19
23
  deferDatasource?: boolean;
@@ -108,6 +112,13 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
108
112
  );
109
113
  }
110
114
 
115
+ setOptions(options: IOption[]) {
116
+ this.options$ = options;
117
+ const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
118
+ this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
119
+ this.fieldControl.setValue(this.value$);
120
+ }
121
+
111
122
  ngOnDestroy(): void {
112
123
  if (this.formGroup$) {
113
124
  this.formGroup$.removeControl(this.controlName$);
@@ -149,6 +160,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
149
160
  if (this.configProps$.value != undefined) {
150
161
  const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
151
162
  this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
163
+ this.fieldControl.setValue(this.value$);
152
164
  }
153
165
 
154
166
  this.setPropertyValuesFromProps();
@@ -191,7 +203,8 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
191
203
 
192
204
  this.componentReference = this.pConn$.getStateProps().value;
193
205
  if (this.listType === 'associated') {
194
- this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
206
+ const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
207
+ this.setOptions(optionsList);
195
208
  }
196
209
 
197
210
  if (!this.displayMode$ && this.listType !== 'associated') {
@@ -263,7 +276,7 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
263
276
  };
264
277
  optionsData.push(obj);
265
278
  });
266
- this.options$ = optionsData;
279
+ this.setOptions(optionsData);
267
280
  }
268
281
 
269
282
  flattenParameters(params = {}) {
@@ -199,7 +199,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
199
199
  if (typeof event.value === 'object') {
200
200
  // convert date to pega "date" format
201
201
  const dateTime = dayjs(event.value?.toISOString());
202
- const timeZoneDateTime = dayjs.tz(dateTime.format('YYYY-MM-DDTHH:mm:ss'), this.timezone);
202
+ const timeZoneDateTime = (dayjs as any).tz(dateTime.format('YYYY-MM-DDTHH:mm:ss'), this.timezone);
203
203
  event.value = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
204
204
  }
205
205
  handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
@@ -121,7 +121,6 @@ export class PegaDxilMyPicklistComponent implements OnInit, OnDestroy {
121
121
  // call updateSelf when initializing
122
122
  this.checkAndUpdate();
123
123
  // this should get called afer checkAndUpdate
124
- this.getDatapageData();
125
124
 
126
125
  if (this.formGroup$) {
127
126
  // add control to formGroup
@@ -253,7 +252,7 @@ export class PegaDxilMyPicklistComponent implements OnInit, OnDestroy {
253
252
  );
254
253
 
255
254
  this.localizedValue = this.options$?.find(opt => opt.key === this.value$)?.value || this.localizedValue;
256
-
255
+ this.getDatapageData();
257
256
  // trigger display of error message with field control
258
257
  if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
259
258
  const timer = interval(100).subscribe(() => {
@@ -11,7 +11,6 @@
11
11
  [placeholder]="placeholder"
12
12
  [formControl]="fieldControl"
13
13
  [attr.data-test-id]="testId"
14
- [value]="value$"
15
14
  [required]="bRequired$"
16
15
  [matAutocomplete]="auto"
17
16
  (input)="fieldOnChange($event)"
@@ -14,6 +14,10 @@ import { DatapageService } from '@pega/angular-sdk-components';
14
14
  import { handleEvent } from '@pega/angular-sdk-components';
15
15
  import { PConnFieldProps } from '@pega/angular-sdk-components';
16
16
 
17
+ interface IOption {
18
+ key: string;
19
+ value: string;
20
+ }
17
21
  interface PegaDxilMySearchboxProps extends PConnFieldProps {
18
22
  // If any, enter additional props that only exist on AutoComplete here
19
23
  deferDatasource?: boolean;
@@ -108,6 +112,13 @@ export class PegaDxilMySearchboxComponent implements OnInit, OnDestroy {
108
112
  );
109
113
  }
110
114
 
115
+ setOptions(options: IOption[]) {
116
+ this.options$ = options;
117
+ const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
118
+ this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
119
+ this.fieldControl.setValue(this.value$);
120
+ }
121
+
111
122
  ngOnDestroy(): void {
112
123
  if (this.formGroup$) {
113
124
  this.formGroup$.removeControl(this.controlName$);
@@ -149,6 +160,7 @@ export class PegaDxilMySearchboxComponent implements OnInit, OnDestroy {
149
160
  if (this.configProps$.value != undefined) {
150
161
  const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
151
162
  this.value$ = index > -1 ? this.options$[index].value : this.configProps$.value;
163
+ this.fieldControl.setValue(this.value$);
152
164
  }
153
165
 
154
166
  this.setPropertyValuesFromProps();
@@ -191,7 +203,8 @@ export class PegaDxilMySearchboxComponent implements OnInit, OnDestroy {
191
203
 
192
204
  this.componentReference = this.pConn$.getStateProps().value;
193
205
  if (this.listType === 'associated') {
194
- this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
206
+ const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
207
+ this.setOptions(optionsList);
195
208
  }
196
209
 
197
210
  if (!this.displayMode$ && this.listType !== 'associated') {
@@ -263,7 +276,7 @@ export class PegaDxilMySearchboxComponent implements OnInit, OnDestroy {
263
276
  };
264
277
  optionsData.push(obj);
265
278
  });
266
- this.options$ = optionsData;
279
+ this.setOptions(optionsData);
267
280
  }
268
281
 
269
282
  flattenParameters(params = {}) {
@@ -199,7 +199,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
199
199
  if (typeof event.value === 'object') {
200
200
  // convert date to pega "date" format
201
201
  const dateTime = dayjs(event.value?.toISOString());
202
- const timeZoneDateTime = dayjs.tz(dateTime.format('YYYY-MM-DDTHH:mm:ss'), this.timezone);
202
+ const timeZoneDateTime = (dayjs as any).tz(dateTime.format('YYYY-MM-DDTHH:mm:ss'), this.timezone);
203
203
  event.value = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
204
204
  }
205
205
  handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);