@pega/react-sdk-overrides 0.23.23 → 0.23.25

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.
@@ -6,7 +6,7 @@ export default function Banner(props) {
6
6
  const { a, b, banner } = props;
7
7
  const { title, message, backgroundImage } = banner;
8
8
  return (
9
- <div>
9
+ <div style={{ marginBottom: '2rem' }}>
10
10
  <div
11
11
  className='background-image-style'
12
12
  style={{ backgroundImage: `url(${backgroundImage})` }}
@@ -0,0 +1,36 @@
1
+ .quick-link-ul-list {
2
+ list-style: none;
3
+ padding: 0;
4
+ grid-template-columns: repeat(3, 1fr);
5
+ display: grid;
6
+ gap: calc(1rem);
7
+ }
8
+
9
+ .quick-link-list {
10
+ background-color: #3f51b5;
11
+ color: white;
12
+ border-radius: 8px;
13
+ }
14
+
15
+ .quick-link-button {
16
+ text-transform: capitalize !important;
17
+ font-size: 16px !important;
18
+ color: white !important;
19
+ padding: calc(0.5rem * 2) !important;
20
+ height: 6rem;
21
+ width: 100%;
22
+ justify-content: start !important;
23
+ }
24
+
25
+ .quick-link-icon {
26
+ width: 1em;
27
+ height: 1em;
28
+ flex-shrink: 0;
29
+ filter: invert(100%);
30
+ }
31
+
32
+ .quick-link-button-span {
33
+ display: flex;
34
+ align-items: center;
35
+ gap: 0.5rem;
36
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { Button } from '@material-ui/core';
3
+ import './WssQuickCreate.css';
4
+
5
+ export default function WssQuickCreate(props) {
6
+ const { heading, actions } = props;
7
+
8
+ return (
9
+ <div>
10
+ <h1>{heading}</h1>
11
+ <ul className='quick-link-ul-list'>
12
+ {actions &&
13
+ actions.map(element => {
14
+ return (
15
+ <li className='quick-link-list' key={element.label}>
16
+ <Button className='quick-link-button' onClick={element.onClick}>
17
+ <span className='quick-link-button-span'>
18
+ {element.icon && <img className='quick-link-icon' src={element.icon}/>}
19
+ <span>{element.label}</span>
20
+ </span>
21
+ </Button>
22
+ </li>
23
+ );
24
+ })}
25
+ </ul>
26
+ </div>
27
+ );
28
+ }
@@ -0,0 +1 @@
1
+ export { default } from './WssQuickCreate';
@@ -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:
@@ -24,7 +24,6 @@ const useStyles = makeStyles(theme => ({
24
24
  wsscontent: {
25
25
  flexGrow: 1,
26
26
  height: '100vh',
27
- overflow: 'auto',
28
27
  marginLeft: theme.spacing(1),
29
28
  marginRight: theme.spacing(1)
30
29
  }
@@ -23,3 +23,8 @@
23
23
  .psdk-default-form-three-column .grid-column {
24
24
  grid-column: 1 / span 3;
25
25
  }
26
+
27
+ .psdk-default-form-instruction-text{
28
+ padding-top: 0.625rem;
29
+ padding-bottom: 0.625rem;
30
+ }
@@ -1,5 +1,5 @@
1
- import React, { createElement } from "react";
2
- import PropTypes from "prop-types";
1
+ import React, { createElement } from 'react';
2
+ import PropTypes from 'prop-types';
3
3
 
4
4
  import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
5
5
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
@@ -13,19 +13,19 @@ export default function DefaultForm(props) {
13
13
 
14
14
  let divClass: string;
15
15
 
16
- const numCols = NumCols || "1";
16
+ const numCols = NumCols || '1';
17
17
  switch (numCols) {
18
- case "1" :
19
- divClass = "psdk-default-form-one-column";
18
+ case '1':
19
+ divClass = 'psdk-default-form-one-column';
20
20
  break;
21
- case "2" :
22
- divClass = "psdk-default-form-two-column";
21
+ case '2':
22
+ divClass = 'psdk-default-form-two-column';
23
23
  break;
24
- case "3" :
25
- divClass = "psdk-default-form-three-column";
24
+ case '3':
25
+ divClass = 'psdk-default-form-three-column';
26
26
  break;
27
- default :
28
- divClass = "psdk-default-form-one-column";
27
+ default:
28
+ divClass = 'psdk-default-form-one-column';
29
29
  break;
30
30
  }
31
31
 
@@ -35,15 +35,19 @@ export default function DefaultForm(props) {
35
35
  // to take the children and create components for them, put in an array and pass as the
36
36
  // defaultForm kids
37
37
  const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
38
- // eslint-disable-next-line react/no-array-index-key
39
- const dfChildren = arChildren.map((kid, idx) => createElement(createPConnectComponent(), {...kid, key: idx}));
38
+ const dfChildren = arChildren.map((kid, idx) =>
39
+ // eslint-disable-next-line react/no-array-index-key
40
+ createElement(createPConnectComponent(), { ...kid, key: idx })
41
+ );
40
42
 
41
43
  return (
42
- <div className={divClass}>
43
- <div>{instructionText}</div>
44
- {dfChildren}
45
- </div>
46
- )
44
+ <>
45
+ {instructionText && (
46
+ <div className='psdk-default-form-instruction-text'>{instructionText}</div>
47
+ )}
48
+ <div className={divClass}>{dfChildren}</div>
49
+ </>
50
+ );
47
51
  }
48
52
 
49
53
  DefaultForm.propTypes = {
@@ -52,5 +56,5 @@ DefaultForm.propTypes = {
52
56
  };
53
57
 
54
58
  DefaultForm.defaultProps = {
55
- NumCols: "1"
59
+ NumCols: '1'
56
60
  };
@@ -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>;
@@ -3,3 +3,9 @@
3
3
  text-transform: capitalize !important;
4
4
  font-size: 1rem !important;
5
5
  }
6
+
7
+ .nav-bar {
8
+ position: sticky;
9
+ inset-block-start: 0;
10
+ z-index: 100;
11
+ }
@@ -56,7 +56,7 @@ export default function WssNavBar(props) {
56
56
  };
57
57
 
58
58
  return (
59
- <div id='NavBar'>
59
+ <div id='NavBar' className='nav-bar'>
60
60
  <AppBar position='static' color='primary'>
61
61
  <Container maxWidth='xl'>
62
62
  <Toolbar disableGutters>
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import WssQuickCreate from '@pega/react-sdk-components/lib/components/designSystemExtension/WssQuickCreate';
3
+ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
4
+
5
+ declare const PCore: any;
6
+
7
+ export default function QuickCreate(props) {
8
+ const { getPConnect, heading, showCaseIcons, classFilter } = props;
9
+ const pConn = getPConnect();
10
+ const createCase = (className) => {
11
+ pConn
12
+ .getActionsApi()
13
+ .createWork(className, {})
14
+ .catch((error) => {
15
+ // eslint-disable-next-line no-console
16
+ console.log('Error in case creation: ', error?.message)
17
+ });
18
+ };
19
+
20
+ const cases: any = [];
21
+ const envInfo = PCore.getEnvironmentInfo();
22
+ if (
23
+ classFilter &&
24
+ envInfo.environmentInfoObject &&
25
+ envInfo.environmentInfoObject.pyCaseTypeList &&
26
+ envInfo.environmentInfoObject.pyCaseTypeList.length > 0
27
+ ) {
28
+ classFilter.forEach((item) => {
29
+ let icon = Utils.getImageSrc('polaris-solid', PCore.getAssetLoader().getStaticServerUrl());
30
+ let label = '';
31
+ envInfo.environmentInfoObject.pyCaseTypeList.forEach((casetype) => {
32
+ if (casetype.pyWorkTypeImplementationClassName === item) {
33
+ icon = casetype.pxIcon && Utils.getImageSrc(casetype?.pxIcon, PCore.getAssetLoader().getStaticServerUrl());
34
+ label = casetype.pyWorkTypeName ?? '';
35
+ }
36
+ });
37
+ if (label !== '') {
38
+ cases.push({
39
+ label,
40
+ onClick: () => {
41
+ createCase(item);
42
+ },
43
+ ...(showCaseIcons && { icon })
44
+ });
45
+ }
46
+ });
47
+ }
48
+
49
+ return (
50
+ <div>
51
+ <WssQuickCreate heading={heading} actions={cases}></WssQuickCreate>
52
+ </div>
53
+ );
54
+ }
@@ -0,0 +1 @@
1
+ export { default } from './QuickCreate';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.23",
3
+ "version": "0.23.25",
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": [