@pega/react-sdk-overrides 0.23.24 → 0.23.26

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.
@@ -33,3 +33,7 @@
33
33
  font-size: 1rem;
34
34
  font-weight: 400;
35
35
  }
36
+
37
+ .banner-layout {
38
+ padding: 1rem;
39
+ }
@@ -3,8 +3,13 @@ import Grid from '@material-ui/core/Grid';
3
3
  import './Banner.css';
4
4
 
5
5
  export default function Banner(props) {
6
- const { a, b, banner } = props;
6
+ const { a, b, banner, variant} = props;
7
7
  const { title, message, backgroundImage } = banner;
8
+ const variantMap = {
9
+ 'two-column': [6, 6],
10
+ 'narrow-wide': [4, 8],
11
+ 'wide-narrow': [8, 4]
12
+ };
8
13
  return (
9
14
  <div style={{ marginBottom: '2rem' }}>
10
15
  <div
@@ -18,16 +23,14 @@ export default function Banner(props) {
18
23
  </div>
19
24
  </div>
20
25
  </div>
21
- <div style={{ padding: '1rem' }}>
22
- <Grid container item xs={12} spacing={1}>
23
- <Grid item xs={8} style={{ padding: '1em' }}>
24
- {a}
25
- </Grid>
26
- <Grid item xs={4} style={{ padding: '1em' }}>
27
- {b}
28
- </Grid>
26
+ <Grid container item xs={12} className='banner-layout' spacing={1}>
27
+ <Grid item xs={variantMap[variant][0]} style={{ padding: '1em' }}>
28
+ {a}
29
29
  </Grid>
30
- </div>
30
+ <Grid item xs={variantMap[variant][1]} style={{ padding: '1em' }}>
31
+ {b}
32
+ </Grid>
33
+ </Grid>
31
34
  </div>
32
35
  );
33
36
  }
@@ -1,7 +1,7 @@
1
1
  .quick-link-ul-list {
2
2
  list-style: none;
3
3
  padding: 0;
4
- grid-template-columns: repeat(3, 1fr);
4
+ grid-template-columns: repeat(auto-fill, minmax(min(40ch, 100%), 1fr));
5
5
  display: grid;
6
6
  gap: calc(1rem);
7
7
  }
@@ -33,4 +33,8 @@
33
33
  display: flex;
34
34
  align-items: center;
35
35
  gap: 0.5rem;
36
- }
36
+ }
37
+
38
+ .quick-link-heading {
39
+ margin-top: 8px;
40
+ }
@@ -7,7 +7,7 @@ export default function WssQuickCreate(props) {
7
7
 
8
8
  return (
9
9
  <div>
10
- <h1>{heading}</h1>
10
+ <h1 className='quick-link-heading'>{heading}</h1>
11
11
  <ul className='quick-link-ul-list'>
12
12
  {actions &&
13
13
  actions.map(element => {
@@ -30,7 +30,7 @@ const NO_HEADER_TEMPLATES = [
30
30
  ];
31
31
 
32
32
  export default function View(props) {
33
- const { children, template, getPConnect, mode } = props;
33
+ const { children, template, getPConnect, mode, visibility, name: pageName } = props;
34
34
  let { label, showLabel = false } = props;
35
35
 
36
36
  // Get the inherited props from the parent to determine label settings. For 8.6, this is only for embedded data form views
@@ -45,6 +45,13 @@ export default function View(props) {
45
45
  showLabel = true;
46
46
  }
47
47
 
48
+ const key = `${getPConnect().getContextName()}_${getPConnect().getPageReference()}_${pageName}`;
49
+ // As long as the template is defined in the dependencies of the view
50
+ // it will be loaded, otherwise fall back to single column
51
+ if (visibility === false) {
52
+ return '';
53
+ }
54
+
48
55
  // As long as the template is defined in the dependencies of the view
49
56
  // it will be loaded, otherwise fall back to single column
50
57
  // JA - React SDK not using LazyComponentMap yet
@@ -88,7 +95,7 @@ export default function View(props) {
88
95
  // console.log(`View rendering template: ${template}`);
89
96
 
90
97
  // spreading because all props should go to the template
91
- let RenderedTemplate = <ViewTemplate {...props}>{children}</ViewTemplate>;
98
+ let RenderedTemplate = <ViewTemplate key={key} {...props}>{children}</ViewTemplate>;
92
99
 
93
100
  if (FORMTEMPLATES.includes(template) && showLabel) {
94
101
  // Original:
@@ -127,9 +134,9 @@ export default function View(props) {
127
134
 
128
135
  if (children) {
129
136
  return <>{children}</>;
130
- } else {
131
- return <div id='View'>View has no children.</div>;
132
137
  }
138
+
139
+ return null;
133
140
  }
134
141
 
135
142
  View.defaultProps = {
@@ -79,14 +79,17 @@ export default function FieldGroupTemplate(props) {
79
79
 
80
80
  pConn.setInheritedProp('displayMode', 'LABELS_LEFT');
81
81
  const memoisedReadOnlyList = useMemo(() => {
82
- return referenceList.map((item, index) => (
83
- <FieldGroup
84
- key={item[heading]}
85
- name={fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`}
86
- >
87
- {buildView(pConn, index, lookForChildInConfig)}
88
- </FieldGroup>
89
- ));
82
+ return referenceList.map((item, index) => {
83
+ const key = item[heading] || `field-group-row-${index}`;
84
+ return (
85
+ <FieldGroup
86
+ key={key}
87
+ name={fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`}
88
+ >
89
+ {buildView(pConn, index, lookForChildInConfig)}
90
+ </FieldGroup>
91
+ );
92
+ });
90
93
  }, []);
91
94
 
92
95
  return <div>{memoisedReadOnlyList}</div>;
@@ -34,7 +34,7 @@ const useStyles = makeStyles(theme => ({
34
34
 
35
35
  export default function WssNavBar(props) {
36
36
  const { appInfo, navLinks, operator, navDisplayOptions } = props;
37
- const { alignment } = navDisplayOptions;
37
+ const { alignment, position } = navDisplayOptions;
38
38
  const classes = useStyles();
39
39
 
40
40
  const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null);
@@ -55,11 +55,24 @@ export default function WssNavBar(props) {
55
55
  setAnchorElUser(null);
56
56
  };
57
57
 
58
+ const navLinksContent = (
59
+ <Box
60
+ sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
61
+ style={{ justifyContent: alignment }}
62
+ >
63
+ {navLinks.map(link => (
64
+ <Button className='link-style' key={link.text} onClick={link.onClick}>
65
+ {link.text}
66
+ </Button>
67
+ ))}
68
+ </Box>
69
+ );
70
+
58
71
  return (
59
72
  <div id='NavBar' className='nav-bar'>
60
73
  <AppBar position='static' color='primary'>
61
74
  <Container maxWidth='xl'>
62
- <Toolbar disableGutters>
75
+ <Toolbar disableGutters style={{ justifyContent: 'space-between' }}>
63
76
  <Button style={{ textTransform: 'capitalize' }} onClick={appInfo.onClick}>
64
77
  <img src={appInfo.imageSrc} className={classes.appListLogo} />
65
78
  <span className={classes.appName}>{appInfo.appName}</span>
@@ -98,16 +111,7 @@ export default function WssNavBar(props) {
98
111
  </Menu>
99
112
  </Box>
100
113
 
101
- <Box
102
- sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}
103
- style={{ justifyContent: alignment }}
104
- >
105
- {navLinks.map(link => (
106
- <Button className='link-style' key={link.text} onClick={link.onClick}>
107
- {link.text}
108
- </Button>
109
- ))}
110
- </Box>
114
+ {position === 'inline' && <>{navLinksContent}</>}
111
115
 
112
116
  <Box sx={{ flexGrow: 0 }}>
113
117
  <IconButton onClick={handleOpenUserMenu}>
@@ -134,6 +138,7 @@ export default function WssNavBar(props) {
134
138
  </Menu>
135
139
  </Box>
136
140
  </Toolbar>
141
+ {position === 'below' && <>{navLinksContent}</>}
137
142
  </Container>
138
143
  </AppBar>
139
144
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.24",
3
+ "version": "0.23.26",
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": [