@pega/dx-component-builder-sdk 0.242.12 → 0.242.14

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.12",
3
+ "version": "0.242.14",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -279,25 +279,39 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
279
279
 
280
280
  columns = preProcessColumns(columns) || [];
281
281
  if (!this.displayMode$ && listType !== 'associated' && typeof datasource === 'string') {
282
- this.getData(datasource, parameters, columns, context);
282
+ this.getData(datasource, parameters, columns, context, listType);
283
283
  }
284
284
  }
285
285
 
286
- getData(datasource, parameters, columns, context) {
287
- this.dataPageService.getDataPageData(datasource, parameters, context).then((results: any) => {
288
- const optionsData: any[] = [];
289
- const displayColumn = getDisplayFieldsMetaData(columns);
290
- results?.forEach(element => {
291
- const val = element[displayColumn.primary]?.toString();
292
- const obj = {
293
- key: element[displayColumn.key] || element.pyGUID,
294
- value: val
295
- };
296
- optionsData.push(obj);
286
+ getData(dataSource, parameters, columns, context, listType) {
287
+ const dataConfig: any = {
288
+ columns,
289
+ dataSource,
290
+ deferDatasource: true,
291
+ listType,
292
+ parameters,
293
+ matchPosition: 'contains',
294
+ maxResultsDisplay: '5000',
295
+ cacheLifeSpan: 'form'
296
+ };
297
+ PCore.getDataApi()
298
+ .init(dataConfig, context)
299
+ .then((dataApiObj: any) => {
300
+ const optionsData: any[] = [];
301
+ const displayColumn = getDisplayFieldsMetaData(columns);
302
+ dataApiObj?.fetchData('').then(response => {
303
+ response.data?.forEach(element => {
304
+ const val = element[displayColumn.primary]?.toString();
305
+ const obj = {
306
+ key: element[displayColumn.key] || element.pyGUID,
307
+ value: val
308
+ };
309
+ optionsData.push(obj);
310
+ });
311
+ optionsData?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
312
+ this.options$ = optionsData;
313
+ });
297
314
  });
298
- optionsData?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
299
- this.options$ = optionsData;
300
- });
301
315
  }
302
316
 
303
317
  isSelected(buttonValue: string): boolean {
@@ -1,5 +1,5 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
- import { AngularPConnectData, AngularPConnectService, ComponentMapperComponent } from '@pega/angular-sdk-components';
1
+ import { Component, forwardRef } from '@angular/core';
2
+ import { ComponentMapperComponent, DetailsTemplateBase } from '@pega/angular-sdk-components';
3
3
 
4
4
  @Component({
5
5
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
@@ -8,48 +8,14 @@ import { AngularPConnectData, AngularPConnectService, ComponentMapperComponent }
8
8
  standalone: true,
9
9
  imports: [forwardRef(() => ComponentMapperComponent)]
10
10
  })
11
- export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
12
- constructor(private angularPConnect: AngularPConnectService) {}
13
-
14
- @Input() pConn$: typeof PConnect;
11
+ export class {{COMPONENT_CLASS_NAME}}Component extends DetailsTemplateBase {
12
+ override pConn$: typeof PConnect;
15
13
 
16
14
  highlightedDataArr: any[] = [];
17
15
  showHighlightedData: boolean;
18
16
  arFields$: any[] = [];
19
17
 
20
- // Used with AngularPConnect
21
- angularPConnectData: AngularPConnectData = {};
22
-
23
- ngOnInit(): void {
24
- // First thing in initialization is registering and subscribing to the AngularPConnect service
25
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
26
-
27
- // this.updateSelf();
28
- this.checkAndUpdate();
29
- }
30
-
31
- ngOnDestroy() {
32
- if (this.angularPConnectData.unsubscribeFn) {
33
- this.angularPConnectData.unsubscribeFn();
34
- }
35
- }
36
-
37
- onStateChange() {
38
- this.checkAndUpdate();
39
- }
40
-
41
- checkAndUpdate() {
42
- // Should always check the bridge to see if the component should
43
- // update itself (re-render)
44
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
45
-
46
- // ONLY call updateSelf when the component should update
47
- if (bUpdateSelf) {
48
- this.updateSelf();
49
- }
50
- }
51
-
52
- updateSelf() {
18
+ override updateSelf() {
53
19
  const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
54
20
  this.showHighlightedData = rawMetaData?.showHighlightedData;
55
21
 
@@ -1,6 +1,5 @@
1
- import { Component, OnInit, Input, forwardRef, OnDestroy } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { AngularPConnectData, AngularPConnectService, ComponentMapperComponent } from '@pega/angular-sdk-components';
1
+ import { Component, forwardRef } from '@angular/core';
2
+ import { ComponentMapperComponent, DetailsTemplateBase } from '@pega/angular-sdk-components';
4
3
 
5
4
  @Component({
6
5
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
@@ -9,11 +8,8 @@ import { AngularPConnectData, AngularPConnectService, ComponentMapperComponent }
9
8
  standalone: true,
10
9
  imports: [forwardRef(() => ComponentMapperComponent)]
11
10
  })
12
- export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
13
- constructor(private angularPConnect: AngularPConnectService) {}
14
-
15
- @Input() pConn$: typeof PConnect;
16
- @Input() formGroup$: FormGroup;
11
+ export class {{COMPONENT_CLASS_NAME}}Component extends DetailsTemplateBase {
12
+ override pConn$: typeof PConnect;
17
13
 
18
14
  showHighlightedData: boolean;
19
15
  highlightedDataArr: any;
@@ -24,45 +20,13 @@ export class {{COMPONENT_CLASS_NAME}}Component implements OnInit, OnDestroy {
24
20
 
25
21
  propsToUse: any = {};
26
22
 
27
- // Used with AngularPConnect
28
- angularPConnectData: AngularPConnectData = {};
29
-
30
- ngOnInit(): void {
31
- // First thing in initialization is registering and subscribing to the AngularPConnect service
32
- this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
33
-
34
- // this.updateSelf();
35
- this.checkAndUpdate();
36
- }
37
-
38
- ngOnDestroy() {
39
- if (this.angularPConnectData.unsubscribeFn) {
40
- this.angularPConnectData.unsubscribeFn();
41
- }
42
- }
43
-
44
- onStateChange() {
45
- this.checkAndUpdate();
46
- }
47
-
48
- checkAndUpdate() {
49
- // Should always check the bridge to see if the component should
50
- // update itself (re-render)
51
- const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
52
-
53
- // ONLY call updateSelf when the component should update
54
- if (bUpdateSelf) {
55
- this.updateSelf();
56
- }
57
- }
58
-
59
- updateSelf() {
23
+ override updateSelf() {
60
24
  const rawMetaData: any = this.pConn$.resolveConfigProps(this.pConn$.getRawMetadata()?.config);
61
25
  this.showHighlightedData = rawMetaData?.showHighlightedData;
62
26
 
63
27
  if (this.showHighlightedData) {
64
28
  const highlightedData = rawMetaData?.highlightedData;
65
- this.highlightedDataArr = highlightedData.map(field => {
29
+ this.highlightedDataArr = highlightedData?.map(field => {
66
30
  field.config.displayMode = 'STACKED_LARGE_VAL';
67
31
 
68
32
  if (field.config.value === '@P .pyStatusWork') {
@@ -94,8 +94,5 @@ export default meta;
94
94
  type Story = StoryObj<{{COMPONENT_CLASS_NAME}}Component>;
95
95
 
96
96
  export const {{COMPONENT_CLASS_NAME}}: Story = {
97
- args: {
98
- label: 'Form',
99
- showLabel: false
100
- }
97
+ args: {}
101
98
  };
@@ -4,7 +4,7 @@ import { FormGroup } from '@angular/forms';
4
4
  import { ReferenceComponent } from '@pega/angular-sdk-components';
5
5
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
6
6
  import { TemplateUtils } from '@pega/angular-sdk-components';
7
- import { FormTemplateBaseComponent } from '@pega/angular-sdk-components';
7
+ import { FormTemplateBase } from '@pega/angular-sdk-components';
8
8
 
9
9
  interface {{COMPONENT_CLASS_NAME}}Props {
10
10
  // If any, enter additional props that only exist on this component
@@ -19,7 +19,7 @@ interface {{COMPONENT_CLASS_NAME}}Props {
19
19
  standalone: true,
20
20
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
21
21
  })
22
- export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBaseComponent implements OnInit {
22
+ export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBase implements OnInit {
23
23
  @Input() override pConn$: typeof PConnect;
24
24
  @Input() formGroup$: FormGroup;
25
25
 
@@ -2,7 +2,7 @@ import { Component, OnInit, Input, forwardRef, SimpleChanges, OnChanges } from '
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { FormGroup } from '@angular/forms';
4
4
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
5
- import { FormTemplateBaseComponent } from '@pega/angular-sdk-components';
5
+ import { FormTemplateBase } from '@pega/angular-sdk-components';
6
6
 
7
7
  @Component({
8
8
  selector: 'app-{{COMPONENT_CLASS_NAME_KEBAB}}',
@@ -11,7 +11,7 @@ import { FormTemplateBaseComponent } from '@pega/angular-sdk-components';
11
11
  standalone: true,
12
12
  imports: [CommonModule, forwardRef(() => ComponentMapperComponent)]
13
13
  })
14
- export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBaseComponent implements OnInit, OnChanges {
14
+ export class {{COMPONENT_CLASS_NAME}}Component extends FormTemplateBase implements OnInit, OnChanges {
15
15
  @Input() override pConn$: typeof PConnect;
16
16
  @Input() formGroup$: FormGroup;
17
17