@pega/react-sdk-overrides 0.23.31 → 0.23.33

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.
@@ -132,7 +132,7 @@ export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
132
132
  type: 'text',
133
133
  label: fields[index].config.label || fields[index].config.caption,
134
134
  fillAvailableSpace: !!field.config.fillAvailableSpace,
135
- id: index,
135
+ id: `${index}`,
136
136
  name: field.config.value.substr(4),
137
137
  cellRenderer: TABLE_CELL,
138
138
  sort: false,
@@ -680,7 +680,9 @@ export const readContextResponse = async (context, params) => {
680
680
  if (compositeKeys.length) {
681
681
  otherContext.setCompositeKeys(compositeKeys);
682
682
  }
683
- otherContext.fetchRowActionDetails = null;
683
+ if (otherContext) {
684
+ otherContext.fetchRowActionDetails = null;
685
+ }
684
686
  }
685
687
 
686
688
  const presetArray = [];
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-nested-ternary */
2
- import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';
2
+ import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
3
  import Table from '@material-ui/core/Table';
4
4
  import TableBody from '@material-ui/core/TableBody';
5
5
  import TableCell from '@material-ui/core/TableCell';
@@ -197,6 +197,20 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
197
197
  // Constellation DX Components.
198
198
  const fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
199
199
 
200
+ useLayoutEffect(() => {
201
+ if (allowEditingInModal) {
202
+ getPConnect()
203
+ .getListActions()
204
+ .initDefaultPageInstructions(
205
+ getPConnect().getReferenceList(),
206
+ fieldDefs.filter(item => item.name).map(item => item.name)
207
+ );
208
+ } else {
209
+ // @ts-ignore - An argument for 'fields' was not provided
210
+ getPConnect().getListActions().initDefaultPageInstructions(getPConnect().getReferenceList());
211
+ }
212
+ }, []);
213
+
200
214
  const displayedColumns = fieldDefs.map(field => {
201
215
  return field.name ? field.name : field.cellRenderer;
202
216
  });
@@ -290,6 +304,10 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
290
304
  } else {
291
305
  pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
292
306
  }
307
+
308
+ getPConnect().clearErrorMessages({
309
+ property: (getPConnect().getStateProps() as any)?.referenceList?.substring(1)
310
+ } as any);
293
311
  };
294
312
 
295
313
  const editRecord = () => {
@@ -1,3 +1,4 @@
1
+ import { useEffect, useState } from 'react';
1
2
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
2
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
4
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
@@ -25,38 +26,64 @@ export default function QuickCreate(props: QuickCreateProps) {
25
26
  });
26
27
  };
27
28
 
28
- const cases: any = [];
29
- const envInfo = PCore.getEnvironmentInfo();
30
- if (
31
- classFilter &&
32
- envInfo.environmentInfoObject &&
33
- envInfo.environmentInfoObject.pyCaseTypeList &&
34
- envInfo.environmentInfoObject.pyCaseTypeList.length > 0
35
- ) {
36
- classFilter.forEach(item => {
37
- let icon = Utils.getImageSrc('polaris-solid', Utils.getSDKStaticConentUrl());
38
- let label = '';
29
+ const [quickCreatecases, setCases] = useState([]);
30
+
31
+ /* If the classFilter is empty and has no entries - we will default to the default set of case types
32
+ It will usually come from the envInfo but for Launchpad, this is not populated - instead get the list of cases from the store */
33
+ useEffect(() => {
34
+ const cases: any = [];
35
+ const defaultCases: any = [];
36
+ const envInfo = PCore.getEnvironmentInfo();
37
+ if (envInfo?.environmentInfoObject?.pyCaseTypeList) {
39
38
  envInfo.environmentInfoObject.pyCaseTypeList.forEach(casetype => {
40
- if (casetype.pyWorkTypeImplementationClassName === item) {
41
- icon = casetype.pxIcon && Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl());
42
- label = casetype.pyWorkTypeName ?? '';
39
+ if (casetype.pyWorkTypeName && casetype.pyWorkTypeImplementationClassName) {
40
+ defaultCases.push({
41
+ classname: casetype.pyWorkTypeImplementationClassName,
42
+ onClick: () => {
43
+ createCase(casetype.pyWorkTypeImplementationClassName);
44
+ },
45
+ ...(showCaseIcons && { icon: Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl()) }),
46
+ label: casetype.pyWorkTypeName
47
+ });
48
+ }
49
+ });
50
+ } else {
51
+ const pConnectInAppContext = PCore.createPConnect({
52
+ options: { context: PCore.getConstants().APP.APP }
53
+ }).getPConnect();
54
+ const pyPortalInAppContext = pConnectInAppContext.getValue('pyPortal') as any;
55
+ pyPortalInAppContext?.pyCaseTypesAvailableToCreate?.forEach(casetype => {
56
+ if (casetype.pyClassName && casetype.pyLabel) {
57
+ defaultCases.push({
58
+ classname: casetype.pyClassName,
59
+ onClick: () => {
60
+ createCase(casetype.pyClassName);
61
+ },
62
+ ...(showCaseIcons && { icon: Utils.getImageSrc(casetype?.pxIcon, Utils.getSDKStaticConentUrl()) }),
63
+ label: casetype.pyLabel
64
+ });
43
65
  }
44
66
  });
45
- if (label !== '') {
46
- cases.push({
47
- label,
48
- onClick: () => {
49
- createCase(item);
50
- },
51
- ...(showCaseIcons && { icon })
67
+ }
68
+
69
+ /* If classFilter is not empty - filter from the list of defaultCases */
70
+ if (classFilter?.length > 0) {
71
+ classFilter.forEach(item => {
72
+ defaultCases.forEach(casetype => {
73
+ if (casetype.classname === item) {
74
+ cases.push(casetype);
75
+ }
52
76
  });
53
- }
54
- });
55
- }
77
+ });
78
+ setCases(cases);
79
+ } else {
80
+ setCases(defaultCases);
81
+ }
82
+ }, []);
56
83
 
57
84
  return (
58
85
  <div>
59
- <WssQuickCreate heading={heading} actions={cases} />
86
+ <WssQuickCreate heading={heading} actions={quickCreatecases} />
60
87
  </div>
61
88
  );
62
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.31",
3
+ "version": "0.23.33",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [