@pega/react-sdk-overrides 0.23.16 → 0.23.18

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 (47) hide show
  1. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +37 -3
  2. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -2
  3. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +38 -56
  4. package/lib/field/AutoComplete/AutoComplete.tsx +6 -4
  5. package/lib/field/Checkbox/Checkbox.tsx +7 -5
  6. package/lib/field/Currency/Currency.tsx +31 -6
  7. package/lib/field/Currency/currency-utils.ts +76 -0
  8. package/lib/field/Date/Date.tsx +25 -9
  9. package/lib/field/DateTime/DateTime.tsx +24 -10
  10. package/lib/field/Decimal/Decimal.tsx +8 -6
  11. package/lib/field/Dropdown/Dropdown.tsx +6 -4
  12. package/lib/field/Email/Email.tsx +8 -8
  13. package/lib/field/Integer/Integer.tsx +8 -6
  14. package/lib/field/Percentage/Percentage.tsx +8 -6
  15. package/lib/field/Phone/Phone.tsx +8 -7
  16. package/lib/field/RadioButtons/RadioButtons.tsx +7 -5
  17. package/lib/field/SemanticLink/SemanticLink.tsx +6 -0
  18. package/lib/field/TextArea/TextArea.tsx +8 -6
  19. package/lib/field/TextInput/TextInput.tsx +8 -6
  20. package/lib/field/Time/Time.tsx +7 -5
  21. package/lib/field/URL/URL.tsx +8 -6
  22. package/lib/helpers/date-format-utils.ts +66 -0
  23. package/lib/helpers/field-group-utils.js +1 -3
  24. package/lib/helpers/formatters/Currency.js +13 -5
  25. package/lib/helpers/formatters/common.js +5 -1
  26. package/lib/helpers/formatters/index.js +5 -0
  27. package/lib/helpers/template-utils.ts +80 -0
  28. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +66 -70
  29. package/lib/infra/MultiStep/MultiStep.css +4 -18
  30. package/lib/infra/NavBar/NavBar.tsx +129 -219
  31. package/lib/infra/View/View.tsx +27 -20
  32. package/lib/template/CaseView/CaseView.tsx +2 -5
  33. package/lib/template/DefaultForm/DefaultForm.tsx +4 -0
  34. package/lib/template/Details/Details/Details.tsx +52 -21
  35. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +63 -31
  36. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +64 -30
  37. package/lib/template/ListView/DefaultViewMeta.js +222 -0
  38. package/lib/template/ListView/ListView.tsx +152 -48
  39. package/lib/template/ListView/hooks.js +97 -0
  40. package/lib/template/ListView/utils.js +636 -0
  41. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +69 -42
  42. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +69 -43
  43. package/lib/widget/Attachment/Attachment.css +7 -0
  44. package/lib/widget/Attachment/Attachment.tsx +37 -3
  45. package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
  46. package/package.json +1 -1
  47. package/lib/template/utils.ts +0 -23
@@ -1,11 +1,9 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { makeStyles, useTheme } from '@material-ui/core/styles';
3
3
  import clsx from 'clsx';
4
- import PropTypes from "prop-types";
4
+ import PropTypes from 'prop-types';
5
5
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
6
-
7
6
  import './NavBar.css';
8
-
9
7
  import {
10
8
  Drawer,
11
9
  List,
@@ -34,145 +32,118 @@ import ClearOutlinedIcon from '@material-ui/icons/ClearOutlined';
34
32
  import ArrowBackIcon from '@material-ui/icons/ArrowBack';
35
33
  import useMediaQuery from '@material-ui/core/useMediaQuery';
36
34
 
37
- import { useNavBar } from "@pega/react-sdk-components/lib/components/helpers/reactContextHelpers";
35
+ import { useNavBar } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
38
36
  import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
39
37
 
40
38
  declare const PCore;
41
39
 
42
40
  const iconMap = {
43
- "pi pi-headline" : <HomeOutlinedIcon fontSize="large"/>,
44
- "pi pi-flag-solid": <FlagOutlinedIcon fontSize="large"/>
45
- }
41
+ 'pi pi-headline': <HomeOutlinedIcon fontSize='large' />,
42
+ 'pi pi-flag-solid': <FlagOutlinedIcon fontSize='large' />
43
+ };
46
44
 
47
45
  const drawerWidth = 300;
48
46
 
49
- const useStyles = makeStyles((theme) => ({
47
+ const useStyles = makeStyles(theme => ({
50
48
  drawerPaper: {
51
49
  position: 'relative',
52
50
  whiteSpace: 'nowrap',
53
51
  width: drawerWidth,
54
52
  transition: theme.transitions.create('width', {
55
53
  easing: theme.transitions.easing.sharp,
56
- duration: theme.transitions.duration.enteringScreen,
54
+ duration: theme.transitions.duration.enteringScreen
57
55
  }),
58
- height: "100vh"
56
+ height: '100vh'
59
57
  },
60
58
  drawerPaperClose: {
61
59
  overflowX: 'hidden',
62
60
  transition: theme.transitions.create('width', {
63
61
  easing: theme.transitions.easing.sharp,
64
- duration: theme.transitions.duration.leavingScreen,
62
+ duration: theme.transitions.duration.leavingScreen
65
63
  }),
66
64
  width: theme.spacing(7),
67
65
  [theme.breakpoints.up('md')]: {
68
- width: theme.spacing(9),
66
+ width: theme.spacing(9)
69
67
  },
70
- height: "100vh"
68
+ height: '100vh'
71
69
  },
72
70
  nested: {
73
- paddingLeft: theme.spacing(4),
71
+ paddingLeft: theme.spacing(4)
74
72
  },
75
73
  appListItem: {
76
74
  backgroundColor: theme.palette.primary.light,
77
- color: theme.palette.getContrastText(theme.palette.primary.light),
75
+ color: theme.palette.getContrastText(theme.palette.primary.light)
78
76
  },
79
77
  appListLogo: {
80
78
  marginRight: theme.spacing(2),
81
- width: "3.6rem",
79
+ width: '3.6rem'
82
80
  },
83
81
  appListIcon: {
84
- color: theme.palette.getContrastText(theme.palette.primary.light),
82
+ color: theme.palette.getContrastText(theme.palette.primary.light)
85
83
  },
86
84
  appListDiv: {
87
85
  backgroundColor: theme.palette.primary.light,
88
86
  color: theme.palette.getContrastText(theme.palette.primary.light),
89
87
  paddingTop: theme.spacing(2),
90
88
  paddingBottom: theme.spacing(2),
91
- display: "flex",
92
- alignItems: "center",
93
- justifyContent: "center"
89
+ display: 'flex',
90
+ alignItems: 'center',
91
+ justifyContent: 'center'
92
+ },
93
+ applicationLabel: {
94
+ whiteSpace: 'initial'
94
95
  }
95
96
  }));
96
97
 
97
98
  export default function NavBar(props) {
98
- const {
99
- pConn,
100
- pages,
101
- caseTypes
102
- } = props;
103
-
104
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
105
- const [navIcon, setNavIcon] = useState((PCore.getAssetLoader().getStaticServerUrl()).concat("pzpega-logo-mark.svg"));
106
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
107
- const [navExpandCollapse, setNavExpandCollapse] = useState(Utils.getImageSrc("plus", PCore.getAssetLoader().getStaticServerUrl()));
108
- const [navPages, setNavPages] = useState(JSON.parse(JSON.stringify(pages)));
109
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
110
- const [portalLogoImage, setPortalLogoImage] = useState(Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl()).concat("pzpega-logo-mark.svg"));
111
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
112
- const [portalOperator, setPortalOperator] = useState(PCore.getEnvironmentInfo().getOperatorName());
113
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
114
- const [portalOperatorInitials, setPortalOperatorInitials] = useState(Utils.getInitials(portalOperator));
115
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
116
- const [portalApp, setPortalApp] = useState(PCore.getEnvironmentInfo().getApplicationLabel());
117
- const [bShowCaseTypes, setBShowCaseTypes] = useState(true);
118
- const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false)
119
- const {open, setOpen} = useNavBar();
120
- const [anchorEl, setAnchorEl] = useState(null);
99
+ const { pConn, pages, caseTypes } = props;
121
100
 
122
101
  const classes = useStyles();
123
102
  const theme = useTheme();
124
103
  const isDesktop = useMediaQuery(theme.breakpoints.up('md'));
125
104
 
126
- useEffect( () => {
127
- setNavPages(JSON.parse(JSON.stringify(pages)));
128
- },
129
- [pages]);
105
+ const { open, setOpen } = useNavBar();
106
+ const [navPages, setNavPages] = useState(JSON.parse(JSON.stringify(pages)));
107
+ const [bShowCaseTypes, setBShowCaseTypes] = useState(true);
108
+ const [bShowOperatorButtons, setBShowOperatorButtons] = useState(false);
109
+ const [anchorEl, setAnchorEl] = useState(null);
130
110
 
131
- // const caseTypesMap = caseTypes.map((caseType, index) => {
132
- // const theKey = `caseType.${index}`;
133
- // return <li key={theKey}>{caseType.pyLabel}</li>;
134
- // });
111
+ const portalLogoImage = Utils.getIconPath(PCore.getAssetLoader().getStaticServerUrl()).concat(
112
+ 'pzpega-logo-mark.svg'
113
+ );
114
+ const portalOperator = PCore.getEnvironmentInfo().getOperatorName();
115
+ const portalApp = PCore.getEnvironmentInfo().getApplicationLabel();
135
116
 
136
- // const pagesMap = pages.map((page, index) => {
137
- // const theKey = `page.${index}`;
138
- // return <li key={theKey}>{page.pyLabel}</li>;
139
- // });
117
+ useEffect(() => {
118
+ setNavPages(JSON.parse(JSON.stringify(pages)));
119
+ }, [pages]);
140
120
 
141
121
  function navPanelButtonClick(oPageData: any) {
142
- const {
143
- pyClassName,
144
- pyRuleName
145
- } = oPageData;
146
-
147
- pConn.getActionsApi().showPage(pyRuleName, pyClassName).then(() => {
148
- // eslint-disable-next-line no-console
149
- console.log(`showPage completed`);
150
- });
122
+ const { pyClassName, pyRuleName } = oPageData;
123
+
124
+ pConn
125
+ .getActionsApi()
126
+ .showPage(pyRuleName, pyClassName)
127
+ .then(() => {
128
+ // eslint-disable-next-line no-console
129
+ console.log(`showPage completed`);
130
+ });
151
131
  }
152
132
 
153
- // function navPanelCreateButtonClick() {
154
- // if (navExpandCollapse.indexOf("plus") > 0) {
155
- // setNavExpandCollapse(Utils.getImageSrc("times", PCore.getAssetLoader().getStaticServerUrl()));
156
- // setBShowCaseTypes(true);
157
- // }
158
- // else {
159
- // setNavExpandCollapse(Utils.getImageSrc("plus", PCore.getAssetLoader().getStaticServerUrl()));
160
- // setBShowCaseTypes(false);
161
- // }
162
- // }
163
-
164
133
  function navPanelCreateCaseType(sCaseType: string, sFlowType: string) {
165
134
  setOpen(false);
166
135
  const actionInfo = {
167
- containerName: "primary",
168
- flowType: sFlowType || "pyStartCase"
136
+ containerName: 'primary',
137
+ flowType: sFlowType || 'pyStartCase'
169
138
  };
170
139
 
171
- pConn.getActionsApi().createWork(sCaseType, actionInfo).then(() => {
172
- // eslint-disable-next-line no-console
173
- console.log(`createWork completed`);
174
- });
175
-
140
+ pConn
141
+ .getActionsApi()
142
+ .createWork(sCaseType, actionInfo)
143
+ .then(() => {
144
+ // eslint-disable-next-line no-console
145
+ console.log(`createWork completed`);
146
+ });
176
147
  }
177
148
 
178
149
  // Toggle showing the Operator buttons
@@ -182,52 +153,6 @@ export default function NavBar(props) {
182
153
  else setAnchorEl(null);
183
154
  }
184
155
 
185
- function navPanelLogoutClick() {
186
-
187
- try {
188
- // eslint-disable-next-line no-console
189
- console.log(`--> navPanelLogoutClick clicked`);
190
- // Commenting out until revokeToken API is available
191
- // pConn.getActionsApi().logout().then(() => {
192
- // // eslint-disable-next-line no-console
193
- // console.log(`logout completed`);
194
- // },
195
- // error => {
196
- // // eslint-disable-next-line no-console
197
- // console.error(`onRejected function called: ${error.message}`);
198
- // })
199
- } catch (err) {
200
- // eslint-disable-next-line no-console
201
- console.log(`--> Attempt to call logout api failed: ${err}`);
202
- }
203
- finally {
204
- // authLogout();
205
- logout();
206
- }
207
- }
208
-
209
- // const theCaseTypeButtons = caseTypes.map((caseType) => <div style={{display: "flex"}}>
210
- // <button className="btn btn-link text-white"
211
- // onClick={() => { navPanelCreateCaseType(caseType.pyClassName, caseType.pyFlowType)}}>{caseType.pyLabel}</button></div>
212
- // );
213
-
214
- // const theOperatorButtons = <button className="btn btn-link text-white" style={{marginLeft: "-0.05rem"}} onClick={navPanelLogoutClick}>Logoff</button>;
215
-
216
-
217
- // return <div id="NavBar" style={{border: "solid 1px silver", margin: "1px"}} >
218
- // NavBar for <strong>{appName}</strong>
219
- // <br></br>
220
- // caseTypes:
221
- // <ul>
222
- // {caseTypesMap}
223
- // </ul>
224
- // Pages:
225
- // <ul>
226
- // {pagesMap}
227
- // </ul>
228
- // </div>;
229
-
230
-
231
156
  const handleDrawerOpen = () => {
232
157
  setOpen(!open);
233
158
  };
@@ -237,118 +162,103 @@ export default function NavBar(props) {
237
162
  setOpen(true);
238
163
  setBShowCaseTypes(true);
239
164
  } else setBShowCaseTypes(!bShowCaseTypes);
240
- }
241
-
242
- // const handlePopoverOpen = (event) => {
243
- // setAnchorEl(event.currentTarget);
244
- // };
245
-
246
- // const handlePopoverClose = () => {
247
- // setAnchorEl(null);
248
- // };
249
-
165
+ };
250
166
 
251
167
  useEffect(() => {
252
168
  if (!isDesktop) setOpen(false);
253
169
  else setOpen(true);
254
- }, [isDesktop])
255
-
170
+ }, [isDesktop]);
256
171
 
257
172
  return (
258
173
  <Drawer
259
- variant="permanent"
174
+ variant='permanent'
260
175
  classes={{
261
- paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose),
176
+ paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose)
262
177
  }}
263
178
  open={open && isDesktop}
264
179
  >
265
- {
266
- open ? (
267
- <List className={classes.appListItem}>
268
- <ListItem onClick={handleDrawerOpen}>
269
- <ListItemIcon>
270
- <img src={portalLogoImage} className={classes.appListLogo}/>
271
- </ListItemIcon>
272
- <ListItemText
273
- primary={<Typography variant="h6">{portalApp}</Typography>}
274
- />
275
- <ListItemSecondaryAction>
276
- <IconButton edge="end" onClick={handleDrawerOpen}>
277
- <ChevronLeftIcon className={classes.appListIcon} />
278
- </IconButton>
279
- </ListItemSecondaryAction>
280
- </ListItem>
281
- </List>
282
- ) : (
283
- <div className={classes.appListDiv} onClick={handleDrawerOpen} >
284
- <ChevronRightIcon className={classes.appListIcon} id="chevron-right-icon" fontSize="large" />
285
- </div>
286
- )
287
- }
180
+ {open ? (
181
+ <List className={classes.appListItem}>
182
+ <ListItem onClick={handleDrawerOpen}>
183
+ <ListItemIcon>
184
+ <img src={portalLogoImage} className={classes.appListLogo} />
185
+ </ListItemIcon>
186
+ <ListItemText
187
+ primary={
188
+ <Typography variant='h6' className={classes.applicationLabel}>
189
+ {portalApp}
190
+ </Typography>
191
+ }
192
+ />
193
+ <ListItemSecondaryAction>
194
+ <IconButton edge='end' onClick={handleDrawerOpen}>
195
+ <ChevronLeftIcon className={classes.appListIcon} />
196
+ </IconButton>
197
+ </ListItemSecondaryAction>
198
+ </ListItem>
199
+ </List>
200
+ ) : (
201
+ <div className={classes.appListDiv} onClick={handleDrawerOpen}>
202
+ <ChevronRightIcon
203
+ className={classes.appListIcon}
204
+ id='chevron-right-icon'
205
+ fontSize='large'
206
+ />
207
+ </div>
208
+ )}
288
209
  <List>
289
210
  <ListItem button onClick={handleCaseItemClick}>
290
211
  <ListItemIcon>
291
- {
292
- bShowCaseTypes && open ? <ClearOutlinedIcon fontSize="large" /> : <AddIcon fontSize="large" />
293
- }
212
+ {bShowCaseTypes && open ? (
213
+ <ClearOutlinedIcon fontSize='large' />
214
+ ) : (
215
+ <AddIcon fontSize='large' />
216
+ )}
294
217
  </ListItemIcon>
295
- <ListItemText primary="Create" />
218
+ <ListItemText primary='Create' />
296
219
  {bShowCaseTypes ? <ExpandLess /> : <ExpandMore />}
297
220
  </ListItem>
298
221
  </List>
299
- <Collapse in={bShowCaseTypes && open} timeout="auto" unmountOnExit className='scrollable'>
300
- <List component="div" disablePadding>
301
- {
302
- caseTypes.map(caseType => (
303
- <ListItem
304
- button
305
- className={classes.nested}
306
- onClick={() => navPanelCreateCaseType(caseType.pyClassName, caseType.pyFlowType)}
307
- key={caseType.pyLabel}
308
- >
309
- <ListItemIcon>
310
- <WorkOutlineIcon fontSize="large" />
311
- </ListItemIcon>
312
- <ListItemText primary={caseType.pyLabel} />
313
- </ListItem>
314
- ))
315
- }
222
+ <Collapse in={bShowCaseTypes && open} timeout='auto' unmountOnExit className='scrollable'>
223
+ <List component='div' disablePadding>
224
+ {caseTypes.map(caseType => (
225
+ <ListItem
226
+ button
227
+ className={classes.nested}
228
+ onClick={() => navPanelCreateCaseType(caseType.pyClassName, caseType.pyFlowType)}
229
+ key={caseType.pyLabel}
230
+ >
231
+ <ListItemIcon>
232
+ <WorkOutlineIcon fontSize='large' />
233
+ </ListItemIcon>
234
+ <ListItemText primary={caseType.pyLabel} />
235
+ </ListItem>
236
+ ))}
316
237
  </List>
317
238
  </Collapse>
318
239
  <List>
319
- {
320
- navPages.map(page => (
321
- <ListItem
322
- button
323
- onClick={() => navPanelButtonClick(page)}
324
- key={page.pyLabel}
325
- >
326
- <ListItemIcon>
327
- {iconMap[page.pxPageViewIcon]}
328
- </ListItemIcon>
329
- <ListItemText primary={page.pyLabel} />
330
- </ListItem>
331
- ))
332
- }
240
+ {navPages.map(page => (
241
+ <ListItem button onClick={() => navPanelButtonClick(page)} key={page.pyLabel}>
242
+ <ListItemIcon>{iconMap[page.pxPageViewIcon]}</ListItemIcon>
243
+ <ListItemText primary={page.pyLabel} />
244
+ </ListItem>
245
+ ))}
333
246
  </List>
334
247
  <Divider />
335
248
  <List className='marginTopAuto'>
336
249
  <>
337
250
  <ListItem onClick={navPanelOperatorButtonClick}>
338
251
  <ListItemIcon>
339
- <PersonOutlineIcon fontSize="large" />
252
+ <PersonOutlineIcon fontSize='large' />
340
253
  </ListItemIcon>
341
254
  <ListItemText primary={portalOperator} />
342
- {
343
- open && (
344
- <ListItemSecondaryAction>
345
- <IconButton edge="end" onClick={navPanelOperatorButtonClick}>
346
- <ChevronRightIcon/>
347
- </IconButton>
348
- </ListItemSecondaryAction>
349
- )
350
- }
351
-
255
+ {open && (
256
+ <ListItemSecondaryAction>
257
+ <IconButton edge='end' onClick={navPanelOperatorButtonClick}>
258
+ <ChevronRightIcon />
259
+ </IconButton>
260
+ </ListItemSecondaryAction>
261
+ )}
352
262
  </ListItem>
353
263
  <Menu
354
264
  anchorEl={anchorEl}
@@ -357,18 +267,18 @@ export default function NavBar(props) {
357
267
  onClick={navPanelOperatorButtonClick}
358
268
  anchorOrigin={{
359
269
  vertical: 'top',
360
- horizontal: 'right',
270
+ horizontal: 'right'
361
271
  }}
362
272
  transformOrigin={{
363
273
  vertical: 'top',
364
- horizontal: 'left',
274
+ horizontal: 'left'
365
275
  }}
366
276
  >
367
- <MenuItem onClick={navPanelLogoutClick}>
277
+ <MenuItem onClick={logout}>
368
278
  <ListItemIcon>
369
- <ArrowBackIcon fontSize="large" />
279
+ <ArrowBackIcon fontSize='large' />
370
280
  </ListItemIcon>
371
- <Typography variant="inherit">Logout</Typography>
281
+ <Typography variant='inherit'>Logout</Typography>
372
282
  </MenuItem>
373
283
  </Menu>
374
284
  </>
@@ -379,9 +289,9 @@ export default function NavBar(props) {
379
289
 
380
290
  NavBar.defaultProps = {
381
291
  pConn: null,
382
- appName: "",
292
+ appName: '',
383
293
  pages: [],
384
- caseTypes: [],
294
+ caseTypes: []
385
295
  };
386
296
 
387
297
  NavBar.propTypes = {
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { SdkComponentMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
7
  import ErrorBoundary from '@pega/react-sdk-components/lib/components/infra/ErrorBoundary';
8
8
 
9
- import { getAllFields } from '@pega/react-sdk-components/lib/components/template/utils';
9
+ import { getAllFields } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
10
10
 
11
11
  // Need to import any templates that we might render
12
12
 
@@ -18,6 +18,15 @@ import './View.css';
18
18
  //
19
19
 
20
20
  const FORMTEMPLATES = ['OneColumn', 'TwoColumn', 'DefaultForm', 'WideNarrow', 'NarrowWide'];
21
+ const NO_HEADER_TEMPLATES = [
22
+ 'SubTabs',
23
+ 'SimpleTable',
24
+ 'Details',
25
+ 'DetailsTwoColumn',
26
+ 'DetailsThreeColumn',
27
+ 'NarrowWideDetails',
28
+ 'WideNarrowDetails'
29
+ ];
21
30
 
22
31
  export default function View(props) {
23
32
  const { children, template, getPConnect, mode } = props;
@@ -45,35 +54,33 @@ export default function View(props) {
45
54
  if (SdkComponentMap) {
46
55
  // This is the node_modules version of react_pconnect!
47
56
  const theLocalComponent = SdkComponentMap.getLocalComponentMap()[template];
48
- if ( theLocalComponent !== undefined) {
49
- // eslint-disable-next-line no-console
50
- console.log(`View component found ${template}: Local`);
51
- ViewTemplate = theLocalComponent
57
+ if (theLocalComponent !== undefined) {
58
+ // eslint-disable-next-line no-console
59
+ console.log(`View component found ${template}: Local`);
60
+ ViewTemplate = theLocalComponent;
52
61
  } else {
53
- const thePegaProvidedComponent = SdkComponentMap.getPegaProvidedComponentMap()[template];
54
- if ( thePegaProvidedComponent !== undefined) {
55
- // console.log(`View component found ${template}: Pega-provided`);
56
- ViewTemplate = thePegaProvidedComponent;
57
- } else {
58
- // eslint-disable-next-line no-console
59
- console.error(`View component can't find template type ${template}`);
60
- ViewTemplate = ErrorBoundary;
61
- }
62
+ const thePegaProvidedComponent = SdkComponentMap.getPegaProvidedComponentMap()[template];
63
+ if (thePegaProvidedComponent !== undefined) {
64
+ // console.log(`View component found ${template}: Pega-provided`);
65
+ ViewTemplate = thePegaProvidedComponent;
66
+ } else {
67
+ // eslint-disable-next-line no-console
68
+ console.error(`View component can't find template type ${template}`);
69
+ ViewTemplate = ErrorBoundary;
70
+ }
62
71
  }
63
72
 
64
- if (template === "ListView") {
73
+ if (template === 'ListView') {
65
74
  // special case for ListView - add in a prop
66
75
  const bInForm = true;
67
- props = { ...props, bInForm};
76
+ props = { ...props, bInForm };
68
77
  }
69
78
  } else {
70
-
71
79
  // eslint-disable-next-line no-console
72
- console.warn(`View: SdkComponentMap expected but not found.`)
80
+ console.warn(`View: SdkComponentMap expected but not found.`);
73
81
 
74
82
  // eslint-disable-next-line no-console
75
83
  console.error(`View: Trying to render an unknown template: ${template}`);
76
-
77
84
  }
78
85
 
79
86
  // for debugging/investigation
@@ -104,7 +111,7 @@ export default function View(props) {
104
111
 
105
112
  return (
106
113
  <div className='grid-column'>
107
- {showLabel && template !== 'SubTabs' && template !== 'SimpleTable' && template !== 'Details' && (
114
+ {showLabel && !NO_HEADER_TEMPLATES.includes(template) && (
108
115
  <div className='template-title-container'>
109
116
  <span>{label}</span>
110
117
  </div>
@@ -62,6 +62,7 @@ export default function CaseView(props) {
62
62
 
63
63
  const classes = useStyles();
64
64
 
65
+ const editAction = availableActions.find((action) => action.ID === 'pyUpdateCaseDetails');
65
66
 
66
67
  /**
67
68
  *
@@ -163,9 +164,6 @@ export default function CaseView(props) {
163
164
 
164
165
  function _editClick() {
165
166
 
166
- const editAction = availableActions.find(
167
- (action) => action.ID === "pyUpdateCaseDetails"
168
- );
169
167
  const actionsAPI = thePConn.getActionsApi();
170
168
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
171
169
 
@@ -176,8 +174,7 @@ export default function CaseView(props) {
176
174
  function getActionButtonsHtml(): any {
177
175
 
178
176
  const aBHtml = <Box>
179
- <Button onClick={() => {_editClick()}}>Edit</Button>
180
- &nbsp;
177
+ {editAction && (<Button onClick={() => {_editClick()}}>Edit</Button>)}
181
178
  <CaseViewActionsMenu getPConnect={getPConnect} availableActions={availableActions} availableProcesses={availableProcesses} />
182
179
  </Box>;
183
180
 
@@ -1,12 +1,15 @@
1
1
  import React, { createElement } from "react";
2
2
  import PropTypes from "prop-types";
3
3
 
4
+ import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
4
5
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
5
6
 
6
7
  import './DefaultForm.css';
7
8
 
8
9
  export default function DefaultForm(props) {
9
10
  const { getPConnect, NumCols } = props;
11
+ const instructions = getInstructions(getPConnect(), props.instructions);
12
+ const instructionText = instructions?.replace(/<\/?[^>]+(>|$)/g, '');
10
13
 
11
14
  let divClass: string;
12
15
 
@@ -37,6 +40,7 @@ export default function DefaultForm(props) {
37
40
 
38
41
  return (
39
42
  <div className={divClass}>
43
+ <div>{instructionText}</div>
40
44
  {dfChildren}
41
45
  </div>
42
46
  )