@pega/react-sdk-overrides 0.23.6 → 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.
Files changed (29) hide show
  1. package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +15 -21
  2. package/lib/helpers/formatters/index.js +1 -1
  3. package/lib/helpers/versionHelpers.ts +0 -31
  4. package/lib/infra/Attachment/Attachment.tsx +38 -3
  5. package/lib/infra/VerticalTabs/{LeftAlignVerticalTab.tsx → LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx} +2 -2
  6. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/index.tsx +1 -0
  7. package/lib/infra/VerticalTabs/{VerticalTabs.tsx → VerticalTabs/VerticalTabs.tsx} +1 -1
  8. package/lib/infra/VerticalTabs/{index.tsx → VerticalTabs/index.tsx} +0 -0
  9. package/lib/templates/CaseView/CaseView.tsx +2 -2
  10. package/lib/templates/{CaseView → CaseViewActionsMenu}/CaseViewActionsMenu.tsx +0 -0
  11. package/lib/templates/CaseViewActionsMenu/index.tsx +1 -0
  12. package/lib/templates/ListView/ListView.tsx +1 -1
  13. package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +1 -1
  14. package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  15. package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +1 -1
  16. package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +4 -2
  17. package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +1 -1
  18. package/lib/templates/SimpleTable/{helpers.ts → simpleTableHelpers.ts} +0 -0
  19. package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -2
  20. package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +1 -1
  21. package/lib/widgets/FileUtility/{ActionButtonsForFileUtil.css → ActionButtonsForFileUtil/ActionButtonsForFileUtil.css} +0 -0
  22. package/lib/widgets/FileUtility/{ActionButtonsForFileUtil.tsx → ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx} +0 -0
  23. package/lib/widgets/FileUtility/ActionButtonsForFileUtil/index.tsx +1 -0
  24. package/lib/widgets/FileUtility/{FileUtility.css → FileUtility/FileUtility.css} +0 -0
  25. package/lib/widgets/FileUtility/{FileUtility.tsx → FileUtility/FileUtility.tsx} +1 -1
  26. package/lib/widgets/FileUtility/FileUtility/index.tsx +1 -0
  27. package/lib/widgets/SummaryItem/SummaryItem.tsx +1 -1
  28. package/package.json +1 -1
  29. package/lib/widgets/FileUtility/index.tsx +0 -0
@@ -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}>
@@ -58,7 +58,7 @@ function parseDateInISO(value) {
58
58
  return value ? getDateObject(value).toISOString() : value;
59
59
  }
60
60
 
61
- export function format(value, type, options) {
61
+ export function format(value, type, options = {}) {
62
62
  let formattedValue;
63
63
 
64
64
  switch (type?.toLowerCase()) {
@@ -16,35 +16,4 @@ export function compareSdkPCoreVersions() {
16
16
  // eslint-disable-next-line no-console
17
17
  console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
18
18
 
19
- // JA Testing
20
- // debugger;
21
-
22
- // const svcParams = [
23
- // {
24
- // "field" : "type",
25
- // "value" : "Field"
26
- // },
27
- // {
28
- // "field" : "subtype",
29
- // "value" : "Text",
30
- // }
31
- // ];
32
-
33
- // const options = {};
34
-
35
- // const AssetLoader = PCore.getAssetLoader();
36
-
37
- // AssetLoader
38
- // .getSvcComponentsConfig(svcParams, options)
39
- // .then((response) => {
40
- // if (response?.data?.components?.[0]) {
41
- // console.log(response.data.components[0]);
42
- // }
43
- // throw new Error('bad response');
44
- // })
45
- // .catch(() => {
46
- // throw new Error('no response:');
47
- // });
48
-
49
-
50
19
  }
@@ -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';
@@ -35,7 +35,7 @@ import IconButton from '@material-ui/core/IconButton';
35
35
  import CloseIcon from '@material-ui/icons/Close';
36
36
  import { Radio } from '@material-ui/core';
37
37
  import Checkbox from '@material-ui/core/Checkbox';
38
- import { filterData } from '@pega/react-sdk-components/lib/components/templates/SimpleTable/helpers';
38
+ import { filterData } from '@pega/react-sdk-components/lib/components/templates/SimpleTable/simpleTableHelpers';
39
39
  import './ListView.css';
40
40
 
41
41
  const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
@@ -2,7 +2,7 @@ import React, { Children } from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
4
  // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
- import NarrowWide from '@pega/react-sdk-components/lib/components/templates/NarrowWide';
5
+ import NarrowWide from '@pega/react-sdk-components/lib/components/templates/NarrowWide/NarrowWide';
6
6
 
7
7
  /*
8
8
  * The wrapper handles knowing how to take in just children and mapping
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
- import OneColumn from '@pega/react-sdk-components/lib/components/templates/OneColumn';
4
+ import OneColumn from '@pega/react-sdk-components/lib/components/templates/OneColumn/OneColumn';
5
5
 
6
6
  /*
7
7
  * The wrapper handles knowing how to take in just children
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import FieldGroupTemplate from '@pega/react-sdk-components/lib/components/templates/FieldGroupTemplate/';
3
- import SimpleTableManual from '@pega/react-sdk-components/lib/components/templates/SimpleTableManual';
3
+ import SimpleTableManual from '@pega/react-sdk-components/lib/components/templates/SimpleTable/SimpleTableManual';
4
4
 
5
5
  declare const PCore: any;
6
6
 
@@ -8,7 +8,7 @@ import TableHead from '@material-ui/core/TableHead';
8
8
  import TableRow from '@material-ui/core/TableRow';
9
9
  import Paper from '@material-ui/core/Paper';
10
10
  import { makeStyles } from '@material-ui/core/styles';
11
- import { buildFieldsForTable, filterData } from '@pega/react-sdk-components/lib/components/helpers';
11
+ import { buildFieldsForTable, filterData } from '@pega/react-sdk-components/lib/components/templates/SimpleTable/simpleTableHelpers';
12
12
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
13
13
  import Link from '@material-ui/core/Link';
14
14
  import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
@@ -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}>
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from "react";
3
3
  import ListView from '@pega/react-sdk-components/lib/components/templates/ListView';
4
- import SimpleTable from '@pega/react-sdk-components/lib/components/templates/SimpleTable';
4
+ import SimpleTable from '@pega/react-sdk-components/lib/components/templates/SimpleTable/SimpleTable';
5
5
 
6
6
  import PromotedFilters from '@pega/react-sdk-components/lib/components/templates/PromotedFilters';
7
7
 
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
- // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
- import TwoColumn from '@pega/react-sdk-components/lib/components/templates/TwoColumn';
4
+ import TwoColumn from '@pega/react-sdk-components/lib/components/templates/TwoColumn/TwoColumn';
6
5
 
7
6
  /*
8
7
  * The wrapper handles knowing how to take in just children
@@ -2,7 +2,7 @@ import React, { Children } from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
4
  // import { TwoColumnPage as TwoColumn } from "@pega/cosmos-react-core";
5
- import WideNarrow from '@pega/react-sdk-components/lib/components/templates/WideNarrow';
5
+ import WideNarrow from '@pega/react-sdk-components/lib/components/templates/WideNarrow/WideNarrow';
6
6
 
7
7
  /*
8
8
  * The wrapper handles knowing how to take in just children and mapping
@@ -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.6",
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