@pega/react-sdk-overrides 0.242.7 → 0.242.8

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.
@@ -78,7 +78,7 @@ export default function CancelAlert(props: CancelAlertProps) {
78
78
  });
79
79
  } else if (isLocalAction) {
80
80
  dismiss(true);
81
- actionsAPI.cancelAssignment(containerItemID);
81
+ actionsAPI.cancelAssignment(containerItemID, false);
82
82
  } else if (isBulkAction) {
83
83
  dismiss(true);
84
84
  actionsAPI.cancelBulkAction(containerItemID);
@@ -56,7 +56,7 @@ export default function Currency(props: CurrrencyProps) {
56
56
  const theCurrSep = theSymbols.theDigitGroupSeparator;
57
57
 
58
58
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
59
- const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
59
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
60
60
 
61
61
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
62
 
@@ -68,7 +68,7 @@ export default function Decimal(props: DecimalProps) {
68
68
  if (formatter === 'Currency') {
69
69
  formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
70
70
  } else {
71
- formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
71
+ formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
72
72
  }
73
73
 
74
74
  if (displayMode === 'DISPLAY_ONLY') {
@@ -50,7 +50,7 @@ export default function Percentage(props: PercentageProps) {
50
50
  const helperTextToDisplay = validatemessage || helperText;
51
51
 
52
52
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
53
- const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
53
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
54
54
 
55
55
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
56
56
 
@@ -46,6 +46,7 @@ export default function ScalarList(props: ScalarListProps) {
46
46
  }
47
47
  },
48
48
  '',
49
+ // @ts-ignore
49
50
  '',
50
51
  {}
51
52
  ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
@@ -147,7 +147,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
147
147
  }
148
148
 
149
149
  function onSaveActionSuccess(data) {
150
- actionsAPI.cancelAssignment(itemKey).then(() => {
150
+ actionsAPI.cancelAssignment(itemKey, false).then(() => {
151
151
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
152
152
  });
153
153
  }
@@ -206,7 +206,7 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
206
206
  showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
207
207
  });
208
208
  } else {
209
- const cancelPromise = cancelAssignment(itemKey);
209
+ const cancelPromise = cancelAssignment(itemKey, false);
210
210
 
211
211
  cancelPromise
212
212
  .then(data => {
@@ -290,7 +290,7 @@ export const FlowContainer = (props: FlowContainerProps) => {
290
290
 
291
291
  const caseId = thePConn.getCaseSummary().content.pyID;
292
292
  const urgency = getPConnect().getCaseSummary().assignments ? getPConnect().getCaseSummary().assignments?.[0].urgency : '';
293
- const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName());
293
+ const operatorInitials = Utils.getInitials(PCore.getEnvironmentInfo().getOperatorName() || '');
294
294
 
295
295
  const bShowBanner = showBanner(getPConnect);
296
296
 
@@ -49,10 +49,15 @@ function ListViewActionButtons(props: ListViewActionButtonsProps) {
49
49
  getPConnect()
50
50
  .getActionsApi()
51
51
  .submitEmbeddedDataModal(context)
52
- .then(() => {})
52
+ .then(() => {
53
+ closeActionsDialog();
54
+ })
55
+ .catch(err => {
56
+ // eslint-disable-next-line no-console
57
+ console.log(err);
58
+ })
53
59
  .finally(() => {
54
60
  setIsDisabled(false);
55
- closeActionsDialog();
56
61
  });
57
62
  }}
58
63
  >
@@ -69,8 +69,8 @@ export default function DeferLoad(props: DeferLoadProps) {
69
69
  const getViewOptions = () => ({
70
70
  viewContext: resourceType,
71
71
  pageClass: loadViewCaseID ? '' : (pConnect.getDataObject('') as any).pyPortal.classID, // 2nd arg empty string until typedef allows optional
72
- container: isContainerPreview ? 'preview' : null,
73
- containerName: isContainerPreview ? 'preview' : null,
72
+ container: isContainerPreview ? 'preview' : undefined,
73
+ containerName: isContainerPreview ? 'preview' : undefined,
74
74
  updateData: isContainerPreview
75
75
  });
76
76
 
@@ -179,7 +179,7 @@ export default function RootContainer(props: PropsWithChildren<RootContainerProp
179
179
  }
180
180
  };
181
181
 
182
- if (!PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
182
+ if (prevRootConfig && !PCore.isDeepEqual(currentRootConfig, prevRootConfig)) {
183
183
  rootView.current = createElement(createPConnectComponent(), PCore.createPConnect(currentRootConfig)) as any;
184
184
  }
185
185
 
@@ -73,7 +73,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
73
73
  const pConn = getPConnect();
74
74
  const envInfo = PCore.getEnvironmentInfo();
75
75
  const imageKey = envInfo.getOperatorImageInsKey();
76
- const userName = envInfo.getOperatorName();
76
+ const userName = envInfo.getOperatorName() || '';
77
77
  const currentUserInitials = Utils.getInitials(userName);
78
78
  const appNameToDisplay = showAppName ? envInfo.getApplicationLabel() : '';
79
79
  const portalClass = pConn.getValue('.classID', ''); // 2nd arg empty string until typedef marked correctly
@@ -101,7 +101,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
101
101
  );
102
102
  // Initial setting of appName and mapChildren
103
103
  useEffect(() => {
104
- setAppName(PCore.getEnvironmentInfo().getApplicationName());
104
+ setAppName(PCore.getEnvironmentInfo().getApplicationName() || '');
105
105
 
106
106
  const tempMap: any = (pConn.getChildren() as any)?.map((child: any, index) => {
107
107
  const theChildComp = child.getPConnect().getComponentName();
@@ -125,7 +125,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
125
125
  .getPageDataAsync(caseTypesAvailableToCreateDP, pConn.getContextName(), {
126
126
  PortalName: portalID
127
127
  })
128
- .then(response => {
128
+ .then((response: { pyCaseTypesAvailableToCreate?: any }) => {
129
129
  if (response?.pyCaseTypesAvailableToCreate) {
130
130
  pConn.replaceState('.pyCaseTypesAvailableToCreate', response.pyCaseTypesAvailableToCreate, {
131
131
  skipDirtyValidation: true
@@ -218,10 +218,10 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
218
218
  portalName={portalName}
219
219
  imageSrc={iconURL}
220
220
  fullImageSrc={fullIconURL}
221
- appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
221
+ appName={localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
222
222
  appInfo={{
223
223
  imageSrc: iconURL,
224
- appName: localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
224
+ appName: localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase()),
225
225
  onClick: links[0] && /* links[0].onClick ? */ links[0].onClick /* : undefined */
226
226
  }}
227
227
  navLinks={links.filter((link, index) => {
@@ -245,7 +245,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
245
245
  <NavBar
246
246
  getPConnect={getPConnect}
247
247
  pConn={getPConnect()}
248
- appName={localizedVal(appNameToDisplay, '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
248
+ appName={localizedVal(appNameToDisplay || '', '', `${portalClass}!PORTAL!${envPortalName}`.toUpperCase())}
249
249
  pages={pages}
250
250
  caseTypes={caseTypes}
251
251
  />
@@ -41,7 +41,7 @@ export default function Confirmation(props: PropsWithChildren<ConfirmationProps>
41
41
  // Not using whatsNext at the moment, need to figure out the use of it
42
42
  // const whatsNext = datasource?.source;
43
43
  // const items = whatsNext.length > 0 ? whatsNext.map(item => item.label) : '';
44
- const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget());
44
+ const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(getPConnect().getTarget() || '');
45
45
  const rootInfo = PCore.getContainerUtils().getContainerItemData(getPConnect().getTarget(), activeContainerItemID);
46
46
  const onConfirmViewClose = () => {
47
47
  setShowConfirmView(false);
@@ -52,12 +52,27 @@ interface SimpleTableManualProps extends PConnProps {
52
52
  displayMode?: string;
53
53
  useSeparateViewForEdit: any;
54
54
  viewForEditModal: any;
55
+ validatemessage?: string;
56
+ required?: boolean;
55
57
  }
56
58
 
57
59
  const useStyles = makeStyles((/* theme */) => ({
58
60
  label: {
59
61
  margin: '8px'
60
62
  },
63
+ tableLabel: {
64
+ '&::after': {
65
+ display: 'inline',
66
+ content: '" *"',
67
+ verticalAlign: 'top',
68
+ color: 'var(--app-error-color)'
69
+ }
70
+ },
71
+ message: {
72
+ margin: '8px',
73
+ color: 'var(--app-error-color)',
74
+ fontSize: '14px'
75
+ },
61
76
  header: {
62
77
  background: '#f5f5f5'
63
78
  },
@@ -110,7 +125,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
110
125
  editModeConfig,
111
126
  displayMode,
112
127
  useSeparateViewForEdit,
113
- viewForEditModal
128
+ viewForEditModal,
129
+ required,
130
+ validatemessage
114
131
  } = props;
115
132
  const pConn = getPConnect();
116
133
  const [rowData, setRowData] = useState([]);
@@ -306,6 +323,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
306
323
  if (allowEditingInModal && defaultView) {
307
324
  pConn
308
325
  .getActionsApi()
326
+ // @ts-ignore
309
327
  .openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
310
328
  } else {
311
329
  // @ts-ignore - An argument for 'pageRef' was not provided.
@@ -322,6 +340,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
322
340
  if (typeof selectedRowIndex.current === 'number') {
323
341
  pConn
324
342
  .getActionsApi()
343
+ // @ts-ignore
325
344
  .openEmbeddedDataModal(
326
345
  bUseSeparateViewForEdit ? editView : defaultView,
327
346
  pConn,
@@ -383,6 +402,9 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
383
402
  };
384
403
 
385
404
  function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
405
+ if (!orderedBy || (!a[orderedBy] && !b[orderedBy])) {
406
+ return 0;
407
+ }
386
408
  if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
387
409
  return -1;
388
410
  }
@@ -580,10 +602,11 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
580
602
  <>
581
603
  <TableContainer component={Paper} style={{ margin: '4px 0px' }} id='simple-table-manual'>
582
604
  {propsToUse.label && (
583
- <h3 className={classes.label}>
605
+ <h3 className={`${classes.label} ${required ? classes.tableLabel : ''}`}>
584
606
  {propsToUse.label} {results()}
585
607
  </h3>
586
608
  )}
609
+ {validatemessage && <div className={classes.message}>{validatemessage}</div>}
587
610
  <Table>
588
611
  <TableHead className={classes.header}>
589
612
  <TableRow>
@@ -34,6 +34,7 @@
34
34
 
35
35
  .file-error {
36
36
  color: var(--app-error-color);
37
+ font-size: 14px;
37
38
  }
38
39
 
39
40
  .psdk-utility-card {
@@ -33,7 +33,7 @@ const updateAttachmentState = (pConn, key, attachments) => {
33
33
  };
34
34
 
35
35
  export default function Attachment(props: AttachmentProps) {
36
- const { value, getPConnect, label, validatemessage, allowMultiple, extensions, displayMode } = props;
36
+ const { value, getPConnect, label, validatemessage, allowMultiple, extensions, displayMode, helperText } = props;
37
37
  /* this is a temporary fix because required is supposed to be passed as a boolean and NOT as a string */
38
38
  let { required, disabled } = props;
39
39
  [required, disabled] = [required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
@@ -461,7 +461,7 @@ export default function Attachment(props: AttachmentProps) {
461
461
  <div className='file-upload-container'>
462
462
  <span className={`label ${required ? 'file-label' : ''}`}>{label}</span>
463
463
  {((files.length === 0 && allowMultiple !== 'true') || allowMultiple === 'true') && <section>{content}</section>}
464
- {validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : ''}
464
+ {validatemessage !== '' ? <span className='file-error'>{validatemessage}</span> : <span style={{ fontSize: '14px' }}>{helperText}</span>}
465
465
  {files && files.length > 0 && <section>{fileDisplay}</section>}
466
466
  </div>
467
467
  );
@@ -129,7 +129,7 @@ export default function ToDo(props: ToDoProps) {
129
129
  const CONSTS = PCore.getConstants();
130
130
 
131
131
  const bLogging = true;
132
- const currentUser = PCore.getEnvironmentInfo().getOperatorName();
132
+ const currentUser = PCore.getEnvironmentInfo().getOperatorName() ?? '';
133
133
  const currentUserInitials = Utils.getInitials(currentUser);
134
134
  const assignmentsSource = datasource?.source || myWorkList?.source;
135
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.242.7",
3
+ "version": "0.242.8",
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": [