@pega/react-sdk-overrides 0.23.8 → 0.23.9

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.
@@ -24,26 +24,30 @@ const FieldGroupList = props => {
24
24
  {props.items.map(item => (
25
25
  <Grid item style={{ width: '100%' }}>
26
26
  <b>{item.name}</b>
27
- <button
28
- type='button'
29
- style={{ float: 'right' }}
30
- className='psdk-utility-button'
31
- id={`delete-row-${Utils.getLastChar(item.name)}`}
32
- onClick={() => {
33
- props.onDelete(item.id);
34
- }}
35
- >
36
- <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$}></img>
37
- </button>
27
+ {props.onDelete && (
28
+ <button
29
+ type='button'
30
+ style={{ float: 'right' }}
31
+ className='psdk-utility-button'
32
+ id={`delete-row-${Utils.getLastChar(item.name)}`}
33
+ onClick={() => {
34
+ props.onDelete(item.id);
35
+ }}
36
+ >
37
+ <img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$}></img>
38
+ </button>
39
+ )}
38
40
  {item.children}
39
41
  <br />
40
- <Divider />
42
+ {props.onAdd && <Divider />}
41
43
  <br />
42
44
  </Grid>
43
45
  ))}
44
- <Link onClick={props.onAdd} style={{ cursor: 'pointer' }}>
45
- +Add
46
- </Link>
46
+ {props.onAdd && (
47
+ <Link onClick={props.onAdd} style={{ cursor: 'pointer' }}>
48
+ +Add
49
+ </Link>
50
+ )}
47
51
  </Grid>
48
52
  </Grid>
49
53
  </Grid>
@@ -5,6 +5,7 @@ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
5
  import TextInput from '@pega/react-sdk-components/lib/components/forms/TextInput';
6
6
  import isDeepEqual from 'fast-deep-equal/react';
7
7
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
8
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
8
9
 
9
10
  interface IOption {
10
11
  key: string;
@@ -42,7 +43,6 @@ export default function AutoComplete(props) {
42
43
  placeholder,
43
44
  value = '',
44
45
  validatemessage,
45
- onChange,
46
46
  readOnly,
47
47
  testId,
48
48
  displayMode,
@@ -60,6 +60,11 @@ export default function AutoComplete(props) {
60
60
  let selectedValue: any = '';
61
61
  const helperTextToDisplay = validatemessage || helperText;
62
62
 
63
+ const thePConn = getPConnect();
64
+ const actionsApi = thePConn.getActionsApi();
65
+ const propName = thePConn.getStateProps().value;
66
+
67
+
63
68
  if (!isDeepEqual(datasource, theDatasource)) {
64
69
  // inbound datasource is different, so update theDatasource (to trigger useEffect)
65
70
  setDatasource(datasource);
@@ -137,7 +142,8 @@ export default function AutoComplete(props) {
137
142
  }
138
143
 
139
144
  const handleChange = (event: object, newValue) => {
140
- onChange({ value: newValue ? newValue.key : '' });
145
+ const val = newValue ? newValue.key : '' ;
146
+ handleEvent(actionsApi, 'changeNblur', propName, val);
141
147
  };
142
148
 
143
149
  const handleInputValue = (event, newInputValue) => {
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "AutoComplete",
3
+ "label": "Search box",
4
+ "description": "Picklist",
5
+ "type": "Field",
6
+ "subtype": "Picklist",
7
+ "componentKey" : "AutoComplete",
8
+ "icon": "",
9
+ "properties": [
10
+ ]
11
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "Checkbox",
3
+ "label": "Checkbox",
4
+ "description": "Boolean",
5
+ "type": "Field",
6
+ "subtype": "Boolean",
7
+ "componentKey" : "Checkbox",
8
+ "properties": [
9
+ ]
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "Currency",
3
+ "label": "Currency",
4
+ "description": "Currency",
5
+ "type": "Field",
6
+ "subtype": "Decimal-Currency",
7
+ "componentKey" : "Currency",
8
+ "properties": [
9
+ ]
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "Date",
3
+ "label": "Date only",
4
+ "description": "Date only",
5
+ "type": "Field",
6
+ "subtype": "Date",
7
+ "componentKey" : "Date",
8
+ "properties": [
9
+ ]
10
+ }
@@ -0,0 +1,10 @@
1
+ import { createContext, useContext } from "react";
2
+
3
+ // This file contains a shared access point for any React contexts that may need to be
4
+ // defined/used across various components.
5
+
6
+ // For example, the AppShell wants to use a NavContext that interacts with
7
+ // that context's consumption in the NavBar to handle clicks for opening/closing
8
+ // aspects of the NavBar
9
+ export const NavContext = createContext({open: false, setOpen: f => f});
10
+ export const useNavBar = () => useContext(NavContext);
@@ -10,7 +10,7 @@ import CloseIcon from '@material-ui/icons/Close';
10
10
  declare const PCore: any;
11
11
 
12
12
  export default function Assignment(props) {
13
- const { getPConnect, children, itemKey, isCreateStage } = props;
13
+ const { getPConnect, children, itemKey, isInModal } = props;
14
14
  const thePConn = getPConnect();
15
15
 
16
16
  const [bHasNavigation, setHasNavigation] = useState(false);
@@ -164,7 +164,9 @@ export default function Assignment(props) {
164
164
  // check if create stage (modal)
165
165
  const { PUB_SUB_EVENTS } = PCore.getConstants();
166
166
  const { publish } = PCore.getPubSubUtils();
167
- if (isCreateStage) {
167
+ const isAssignmentInCreateStage = thePConn.getCaseInfo().isAssignmentInCreateStage();
168
+ const isLocalAction = thePConn.getCaseInfo().isLocalAction() || getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION);
169
+ if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
168
170
  const cancelPromise = cancelCreateStageAssignment(itemKey);
169
171
 
170
172
  cancelPromise
@@ -289,13 +291,13 @@ Assignment.propTypes = {
289
291
  children: PropTypes.node.isRequired,
290
292
  getPConnect: PropTypes.func.isRequired,
291
293
  itemKey: PropTypes.string,
292
- isCreateStage: PropTypes.bool
294
+ isInModal: PropTypes.bool
293
295
  // actionButtons: PropTypes.object
294
296
  // buildName: PropTypes.string
295
297
  };
296
298
 
297
299
  Assignment.defaultProps = {
298
300
  itemKey: null,
299
- isCreateStage: false
301
+ isInModal: false
300
302
  // buildName: null
301
303
  };
@@ -286,7 +286,7 @@ const ModalViewContainer = props => {
286
286
  </DialogTitle>
287
287
  <DialogContent className={classes.dlgContent}>
288
288
  {bShowModal ? (
289
- <Assignment getPConnect={createdView.getPConnect} itemKey={itemKey} isCreateStage>
289
+ <Assignment getPConnect={createdView.getPConnect} itemKey={itemKey} isInModal>
290
290
  {arNewChildrenAsReact}
291
291
  </Assignment>
292
292
  ) : (
@@ -34,7 +34,7 @@ import ClearOutlinedIcon from '@material-ui/icons/ClearOutlined';
34
34
  import ArrowBackIcon from '@material-ui/icons/ArrowBack';
35
35
  import useMediaQuery from '@material-ui/core/useMediaQuery';
36
36
 
37
- import { useNavBar } from "@pega/react-sdk-components/lib/components/templates/AppShell/AppShell";
37
+ import { useNavBar } from "@pega/react-sdk-components/lib/components/helpers/reactContextHelpers";
38
38
  import { logout } from '@pega/react-sdk-components/lib/components/helpers/authManager';
39
39
 
40
40
  declare const PCore;
@@ -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 '@pega/react-sdk-components/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs';
6
+ import LeftAlignVerticalTab from '@pega/react-sdk-components/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs';
7
7
 
8
8
 
9
9
  // The MuiTabs-indicator class is in a span whose parent is div (under the Tabs root component)
@@ -1,7 +1,9 @@
1
- import React, { useEffect, useState, createContext, useContext } from "react";
1
+ import React, { useEffect, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { makeStyles } from '@material-ui/core/styles';
4
4
 
5
+ import { NavContext } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
6
+
5
7
  // import {
6
8
  // Avatar,
7
9
  // Toaster,
@@ -33,9 +35,6 @@ const useStyles = makeStyles((theme) => ({
33
35
  declare const PCore;
34
36
 
35
37
 
36
- const NavContext = createContext({open: false, setOpen: f => f});
37
- export const useNavBar = () => useContext(NavContext);
38
-
39
38
  /*
40
39
  * The wrapper handles knowing how to take in just children and mapping
41
40
  * to the Cosmos template. This could be a combination of things but it knows...
@@ -1 +1 @@
1
- export { default } from './AppShell';
1
+ export { default } from './AppShell';
@@ -27,7 +27,7 @@ export default function CaseViewActionsMenu(props) {
27
27
  const actionsAPI = thePConn.getActionsApi();
28
28
  const openLocalAction = actionsAPI.openLocalAction.bind(actionsAPI);
29
29
 
30
- openLocalAction( data.ID, { ...data});
30
+ openLocalAction( data.ID, { ...data, containerName: 'modal', type: 'express'});
31
31
  // after doing the action, close the menu...
32
32
  handleClose();
33
33
 
@@ -16,7 +16,8 @@ export default function FieldGroupTemplate(props) {
16
16
  getPConnect,
17
17
  lookForChildInConfig,
18
18
  heading,
19
- displayMode
19
+ displayMode,
20
+ allowTableEdit: allowAddEdit
20
21
  } = props;
21
22
  const pConn = getPConnect();
22
23
  const resolvedList = getReferenceList(pConn);
@@ -44,7 +45,7 @@ export default function FieldGroupTemplate(props) {
44
45
  pConn.getListActions().deleteEntry(index);
45
46
  }
46
47
  };
47
- if (referenceList.length === 0) {
48
+ if (referenceList.length === 0 && allowAddEdit !== false) {
48
49
  addFieldGroupItem();
49
50
  }
50
51
 
@@ -59,8 +60,8 @@ export default function FieldGroupTemplate(props) {
59
60
  return (
60
61
  <FieldGroupList
61
62
  items={MemoisedChildren}
62
- onAdd={addFieldGroupItem}
63
- onDelete={deleteFieldGroupItem}
63
+ onAdd={allowAddEdit !== false ? addFieldGroupItem : undefined}
64
+ onDelete={allowAddEdit !== false ? deleteFieldGroupItem : undefined}
64
65
  />
65
66
  );
66
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.8",
3
+ "version": "0.23.9",
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": [