@pega/react-sdk-overrides 0.23.7 → 0.23.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.
@@ -40,26 +40,21 @@ export default function DetailsFields(props) {
40
40
  fields?.forEach((field, index) => {
41
41
  const thePConn = field.getPConnect();
42
42
  const theCompType = thePConn.getComponentName().toLowerCase();
43
- const { label, value } = thePConn.getConfigProps();
44
- // If value is "" then also we would have to get viewMetadata using getReferencedView.
45
- if (theCompType === 'reference' || value === '') {
46
- const configObj = thePConn?.getReferencedView();
47
- configObj.config.readOnly = theCompType === 'reference';
48
- configObj.config.displayMode = 'LABELS_LEFT';
49
- const propToUse = { ...thePConn.getInheritedProps() };
50
- configObj.config.label = theCompType === 'reference' ? propToUse?.label : label;
51
- fieldComponents.push({
52
- type: theCompType,
53
- label,
54
- value: (
55
- <React.Fragment key={index}>
56
- {createElement(createPConnectComponent(), thePConn.getReferencedViewPConnect())}
57
- </React.Fragment>
58
- )
59
- });
60
- } else {
61
- fieldComponents.push({ type: theCompType, value, label });
62
- }
43
+ const { label } = thePConn.getConfigProps();
44
+ const configObj = thePConn?.getReferencedView();
45
+ configObj.config.readOnly = theCompType === 'reference';
46
+ configObj.config.displayMode = 'LABELS_LEFT';
47
+ const propToUse = { ...thePConn.getInheritedProps() };
48
+ configObj.config.label = theCompType === 'reference' ? propToUse?.label : label;
49
+ fieldComponents.push({
50
+ type: theCompType,
51
+ label,
52
+ value: (
53
+ <React.Fragment key={index}>
54
+ {createElement(createPConnectComponent(), thePConn.getReferencedViewPConnect())}
55
+ </React.Fragment>
56
+ )
57
+ });
63
58
  });
64
59
 
65
60
  function getGridItemLabel(field: any, keyVal: string) {
@@ -110,7 +105,6 @@ export default function DetailsFields(props) {
110
105
  }
111
106
 
112
107
  function getGridItem(field: any, keyVal: string) {
113
-
114
108
  return (
115
109
  <Grid item xs={12} key={keyVal}>
116
110
  <Typography variant='body2' component='span' className={classes.fieldValue}>
@@ -133,12 +133,13 @@ export default function Attachment(props) {
133
133
  },
134
134
  primary: {
135
135
  type: att.type,
136
- name: att.name,
136
+ name: att.error ? att.fileName : att.name,
137
137
  icon: "trash",
138
138
  click: removeFile,
139
139
  },
140
140
  secondary: {
141
- text: att.meta
141
+ text: att.meta,
142
+ error: att.error
142
143
  },
143
144
  actions
144
145
  };
@@ -158,7 +159,41 @@ export default function Attachment(props) {
158
159
 
159
160
  const onUploadProgress = () => {};
160
161
 
161
- const errorHandler = () => {};
162
+ const errorHandler = (isFetchCanceled) => {
163
+ return (error) => {
164
+ if (!isFetchCanceled(error)) {
165
+ let uploadFailMsg = pConn.getLocalizedValue('Something went wrong');
166
+ if (error.response && error.response.data && error.response.data.errorDetails) {
167
+ uploadFailMsg = pConn.getLocalizedValue(error.response.data.errorDetails[0].localizedValue);
168
+ }
169
+ myFiles[0].meta = uploadFailMsg;
170
+ myFiles[0].error = true;
171
+ myFiles[0].fileName = pConn.getLocalizedValue('Unable to upload file');
172
+ arFileList$ = myFiles.map((att) => {
173
+ return getNewListUtilityItemProps({
174
+ att,
175
+ downloadFile: null,
176
+ cancelFile: null,
177
+ deleteFile: null,
178
+ removeFile: null
179
+ });
180
+ });
181
+ setFile((current) => {
182
+ return {
183
+ ...current,
184
+ props: {
185
+ ...current.props,
186
+ arFileList$
187
+ },
188
+ inProgress: false,
189
+ attachmentUploaded: true,
190
+ showMenuIcon: false
191
+ };
192
+ });
193
+ }
194
+ throw error;
195
+ };
196
+ };
162
197
 
163
198
  PCore.getAttachmentUtils()
164
199
  .uploadAttachment(
@@ -13,7 +13,7 @@ import {
13
13
 
14
14
  // In this styling, "root" is the top-level "Tab" object (which is the button)
15
15
  // and the button contains spans that will match on the '> span'
16
- const LeftAlignVerticalTab: any = withStyles((/* theme */) => ({
16
+ const LeftAlignVerticalTabs: any = withStyles((/* theme */) => ({
17
17
  root: {
18
18
  width: '100%',
19
19
  maxWidth: '100%',
@@ -24,4 +24,4 @@ const LeftAlignVerticalTab: any = withStyles((/* theme */) => ({
24
24
  },
25
25
  }))((props) => <div><Tab {...props} /><Divider /></div>);
26
26
 
27
- export default LeftAlignVerticalTab;
27
+ export default LeftAlignVerticalTabs;
@@ -0,0 +1 @@
1
+ export { default } from './LeftAlignVerticalTabs';
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
3
3
  import { makeStyles } from '@material-ui/core/styles'
4
4
 
5
5
  import Tabs from '@material-ui/core/Tabs';
6
- import LeftAlignVerticalTab from './LeftAlignVerticalTab';
6
+ import LeftAlignVerticalTab from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs';
7
7
 
8
8
 
9
9
  // The MuiTabs-indicator class is in a span whose parent is div (under the Tabs root component)
@@ -10,8 +10,8 @@ import Button from '@material-ui/core/Button';
10
10
  import Grid from '@material-ui/core/Grid';
11
11
 
12
12
  import StoreContext from "@pega/react-sdk-components/lib/bridge/Context/StoreContext";
13
- import CaseViewActionsMenu from "./CaseViewActionsMenu";
14
- import VerticalTabs from '@pega/react-sdk-components/lib/components/infra/VerticalTabs';
13
+ import CaseViewActionsMenu from "@pega/react-sdk-components/lib/components/templates/CaseViewActionsMenu";
14
+ import VerticalTabs from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/VerticalTabs';
15
15
  import DeferLoad from '@pega/react-sdk-components/lib/components/infra/DeferLoad';
16
16
 
17
17
 
@@ -0,0 +1 @@
1
+ export { default } from './CaseViewActionsMenu';
@@ -189,6 +189,8 @@ export default function SimpleTableManual(props) {
189
189
  }
190
190
 
191
191
  const formatRowsData = data => {
192
+ if(!data) return {};
193
+
192
194
  return data.map(item => {
193
195
  return displayedColumns.reduce((dataForRow, colKey) => {
194
196
  dataForRow[colKey] = getRowValue(item, colKey);
@@ -585,7 +587,7 @@ export default function SimpleTableManual(props) {
585
587
  .slice(0)
586
588
  .map(row => {
587
589
  return (
588
- <TableRow key={row[1]}>
590
+ <TableRow key={row[displayedColumns[0]]}>
589
591
  {displayedColumns.map(colKey => {
590
592
  return (
591
593
  <TableCell key={colKey} className={classes.tableCell}>
@@ -0,0 +1 @@
1
+ export { default } from './ActionButtonsForFileUtil';
@@ -3,7 +3,7 @@ import TextField from '@material-ui/core/TextField';
3
3
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
4
  import download from "downloadjs";
5
5
  import SummaryList from '@pega/react-sdk-components/lib/components/widgets/SummaryList';
6
- import ActionButtonsForFileUtil from './ActionButtonsForFileUtil';
6
+ import ActionButtonsForFileUtil from '@pega/react-sdk-components/lib/components/widgets/FileUtility/ActionButtonsForFileUtil';
7
7
  import './FileUtility.css';
8
8
  import { IconButton, Menu, MenuItem } from '@material-ui/core';
9
9
  import MoreVertIcon from '@material-ui/icons/MoreVert';
@@ -0,0 +1 @@
1
+ export { default } from './FileUtility';
@@ -44,7 +44,7 @@ export default function SummaryItem(props) {
44
44
  <img className="psdk-utility-card-actions-svg-icon" src={`${imagePath$}${item.primary.icon}.svg`}></img>
45
45
  </button>
46
46
  </div>)}
47
- {item.secondary.text && (<div>{item.secondary.text}</div>)}
47
+ {item.secondary.text && (<div style={{ color: item.secondary.error ? 'red' : undefined }}>{item.secondary.text}</div>)}
48
48
  </div>
49
49
  <div className="psdk-utility-action">
50
50
  {menuIconOverride$ && (<button type="button" className="psdk-utility-button" onClick={removeAttachment}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.7",
3
+ "version": "0.23.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": [
File without changes