@pega/react-sdk-overrides 24.2.10 → 25.1.10

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 (169) hide show
  1. package/lib/designSystemExtension/Banner/Banner.css +1 -1
  2. package/lib/designSystemExtension/Banner/Banner.tsx +10 -7
  3. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  4. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +53 -37
  5. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
  6. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
  7. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
  8. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +8 -9
  9. package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
  10. package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
  11. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +32 -4
  12. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +7 -14
  13. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +13 -2
  14. package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
  15. package/lib/field/CancelAlert/CancelAlert.css +4 -4
  16. package/lib/field/CancelAlert/CancelAlert.tsx +7 -10
  17. package/lib/field/Checkbox/Checkbox.tsx +97 -4
  18. package/lib/field/Currency/Currency.tsx +10 -7
  19. package/lib/field/Currency/currency-utils.ts +1 -2
  20. package/lib/field/Date/Date.tsx +8 -8
  21. package/lib/field/DateTime/DateTime.tsx +16 -13
  22. package/lib/field/Decimal/Decimal.tsx +10 -7
  23. package/lib/field/Dropdown/Dropdown.tsx +30 -25
  24. package/lib/field/Email/Email.tsx +11 -13
  25. package/lib/field/Group/Group.tsx +10 -8
  26. package/lib/field/Integer/Integer.tsx +5 -7
  27. package/lib/field/Location/Location.css +4 -0
  28. package/lib/field/Location/Location.tsx +258 -0
  29. package/lib/field/Location/config-ext.json +8 -0
  30. package/lib/field/Location/index.tsx +1 -0
  31. package/lib/field/Multiselect/utils.ts +1 -1
  32. package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
  33. package/lib/field/ObjectReference/index.tsx +1 -0
  34. package/lib/field/ObjectReference/utils.ts +111 -0
  35. package/lib/field/Percentage/Percentage.tsx +9 -9
  36. package/lib/field/Phone/Phone.tsx +7 -5
  37. package/lib/field/RadioButtons/RadioButtons.tsx +47 -5
  38. package/lib/field/RichText/RichText.css +79 -0
  39. package/lib/field/RichText/RichText.tsx +3 -1
  40. package/lib/field/ScalarList/ScalarList.tsx +2 -4
  41. package/lib/field/SelectableCard/SelectableCard.tsx +175 -0
  42. package/lib/field/SelectableCard/index.tsx +1 -0
  43. package/lib/field/SelectableCard/utils.tsx +223 -0
  44. package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
  45. package/lib/field/SemanticLink/utils.ts +1 -1
  46. package/lib/field/TextArea/TextArea.tsx +5 -7
  47. package/lib/field/TextContent/TextContent.tsx +1 -2
  48. package/lib/field/TextInput/TextInput.tsx +5 -7
  49. package/lib/field/Time/Time.tsx +4 -8
  50. package/lib/field/URL/URL.tsx +5 -7
  51. package/lib/field/UserReference/UserReference.tsx +3 -6
  52. package/lib/helpers/attachmentShared.ts +6 -0
  53. package/lib/helpers/common-utils.ts +24 -2
  54. package/lib/helpers/data_page.ts +0 -1
  55. package/lib/helpers/field-group-utils.ts +1 -1
  56. package/lib/helpers/formatters/Currency.ts +20 -20
  57. package/lib/helpers/formatters/CurrencyMap.ts +0 -2
  58. package/lib/helpers/formatters/common.ts +2 -1
  59. package/lib/helpers/formatters/index.ts +2 -4
  60. package/lib/helpers/object-utils.ts +10 -0
  61. package/lib/helpers/simpleTableHelpers.ts +118 -6
  62. package/lib/helpers/utils.ts +8 -1
  63. package/lib/helpers/versionHelpers.ts +0 -1
  64. package/lib/infra/ActionButtons/ActionButtons.tsx +28 -21
  65. package/lib/infra/Assignment/Assignment.tsx +39 -36
  66. package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
  67. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +21 -113
  68. package/lib/infra/Containers/FlowContainer/helpers.ts +1 -5
  69. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +4 -3
  70. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +7 -6
  71. package/lib/infra/Containers/SimpleView/helper.ts +1 -1
  72. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +4 -5
  73. package/lib/infra/Containers/container-helpers.ts +52 -0
  74. package/lib/infra/DashboardFilter/DashboardFilter.tsx +5 -9
  75. package/lib/infra/DashboardFilter/filterUtils.tsx +3 -6
  76. package/lib/infra/DeferLoad/DeferLoad.tsx +7 -9
  77. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
  78. package/lib/infra/MultiStep/MultiStep.css +48 -70
  79. package/lib/infra/MultiStep/MultiStep.tsx +27 -58
  80. package/lib/infra/NavBar/NavBar.css +1 -1
  81. package/lib/infra/NavBar/NavBar.tsx +43 -32
  82. package/lib/infra/Reference/Reference.tsx +3 -4
  83. package/lib/infra/Region/Region.tsx +1 -1
  84. package/lib/infra/RootContainer/RootContainer.tsx +3 -4
  85. package/lib/infra/Stages/Stages.tsx +3 -4
  86. package/lib/infra/View/View.tsx +4 -3
  87. package/lib/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
  88. package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
  89. package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +244 -0
  90. package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  91. package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  92. package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  93. package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
  94. package/lib/template/AdvancedSearch/config-ext.json +9 -0
  95. package/lib/template/AdvancedSearch/index.tsx +1 -0
  96. package/lib/template/AppShell/AppShell.css +1 -1
  97. package/lib/template/AppShell/AppShell.tsx +22 -23
  98. package/lib/template/BannerPage/BannerPage.tsx +2 -2
  99. package/lib/template/CaseSummary/CaseSummary.tsx +28 -41
  100. package/lib/template/CaseView/CaseView.tsx +32 -38
  101. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
  102. package/lib/template/Confirmation/Confirmation.tsx +3 -4
  103. package/lib/template/DataReference/DataReference.tsx +312 -106
  104. package/lib/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
  105. package/lib/template/DataReference/SearchForm.tsx +149 -0
  106. package/lib/template/DataReference/utils.ts +90 -0
  107. package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
  108. package/lib/template/DefaultForm/utils/index.ts +1 -3
  109. package/lib/template/DefaultPage/DefaultPage.tsx +108 -0
  110. package/lib/template/DefaultPage/index.tsx +1 -0
  111. package/lib/template/Details/Details/Details.tsx +11 -11
  112. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
  113. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
  114. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
  115. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -2
  116. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +2 -5
  117. package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
  118. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
  119. package/lib/template/ListPage/ListPage.tsx +1 -1
  120. package/lib/template/ListView/ListView.tsx +285 -204
  121. package/lib/template/ListView/hooks.ts +1 -5
  122. package/lib/template/ListView/utils.ts +38 -6
  123. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +1 -1
  124. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
  125. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
  126. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
  127. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
  128. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
  129. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
  130. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
  131. package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -3
  132. package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +145 -0
  133. package/lib/template/SelfServiceCaseView/index.tsx +1 -0
  134. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -5
  135. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +99 -84
  136. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +3 -5
  137. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +10 -2
  138. package/lib/template/SubTabs/SubTabs.tsx +2 -2
  139. package/lib/template/SubTabs/tabUtils.ts +118 -1
  140. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
  141. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
  142. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
  143. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
  144. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
  145. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
  146. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
  147. package/lib/template/WssNavBar/WssNavBar.css +1 -1
  148. package/lib/template/WssNavBar/WssNavBar.tsx +6 -6
  149. package/lib/template/utils.tsx +58 -0
  150. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
  151. package/lib/widget/Attachment/Attachment.css +7 -8
  152. package/lib/widget/Attachment/Attachment.tsx +304 -231
  153. package/lib/widget/Attachment/Attachment.types.ts +96 -0
  154. package/lib/widget/Attachment/AttachmentUtils.ts +316 -0
  155. package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
  156. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
  157. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
  158. package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
  159. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +30 -23
  160. package/lib/widget/Followers/Followers.tsx +2 -4
  161. package/lib/widget/QuickCreate/QuickCreate.tsx +1 -3
  162. package/lib/widget/SummaryItem/SummaryItem.css +9 -11
  163. package/lib/widget/SummaryItem/SummaryItem.tsx +3 -3
  164. package/lib/widget/SummaryList/SummaryList.tsx +1 -1
  165. package/lib/widget/ToDo/ToDo.css +1 -13
  166. package/lib/widget/ToDo/ToDo.tsx +38 -37
  167. package/package.json +1 -1
  168. package/lib/helpers/attachmentHelpers.ts +0 -76
  169. package/lib/infra/Containers/helpers.ts +0 -6
@@ -1,4 +1,5 @@
1
1
  import { Button } from '@mui/material';
2
+ import { makeStyles } from '@mui/styles';
2
3
  import './WssQuickCreate.css';
3
4
 
4
5
  // WssQuickCreate is one of the few components that does NOT have getPConnect.
@@ -9,19 +10,29 @@ interface WssQuickCreateProps {
9
10
  actions?: any[];
10
11
  }
11
12
 
13
+ const useStyles = makeStyles(theme => ({
14
+ quickLinkList: {
15
+ backgroundColor: theme.palette.mode === 'dark' ? 'var(--app-background-color)' : 'var(--link-button-color)',
16
+ color: 'var(--app-text-color)',
17
+ borderRadius: '16px',
18
+ border: '1px solid var(--app-primary-color)'
19
+ }
20
+ }));
21
+
12
22
  export default function WssQuickCreate(props: WssQuickCreateProps) {
13
23
  const { heading, actions } = props;
24
+ const classes = useStyles();
14
25
 
15
26
  return (
16
27
  <div>
17
- <h1 id='quick-links-heading' className='quick-link-heading'>
28
+ <h1 id='quick-links-heading' className='quick-links-heading'>
18
29
  {heading}
19
30
  </h1>
20
31
  <ul id='quick-links' className='quick-link-ul-list'>
21
32
  {actions &&
22
33
  actions.map(element => {
23
34
  return (
24
- <li className='quick-link-list' key={element.label}>
35
+ <li className={classes.quickLinkList} key={element.label}>
25
36
  <Button className='quick-link-button' onClick={element.onClick}>
26
37
  <span className='quick-link-button-span'>
27
38
  {element.icon && <img className='quick-link-icon' src={element.icon} />}
@@ -7,7 +7,7 @@ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
7
7
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
8
8
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
9
9
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
10
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
11
11
 
12
12
  interface IOption {
13
13
  key: string;
@@ -5,7 +5,7 @@
5
5
  align-items: center;
6
6
  height: 100%;
7
7
  width: 100%;
8
- background-color: rgba(100, 100, 100, 0.4);
8
+ background-color: var(--modal-background-color);
9
9
  position: fixed;
10
10
  z-index: 9999;
11
11
  top: 0px;
@@ -16,9 +16,9 @@
16
16
  display: table;
17
17
  margin: auto;
18
18
  min-width: 550px;
19
- background-color: white;
20
- border: 1px solid black;
19
+ background-color: var(--modal-top-color);
20
+ border: 1px solid var(--modal-border-color);
21
21
  border-radius: 10px;
22
22
  padding: 20px;
23
- box-shadow: 0 0 10px 3px #777;
23
+ box-shadow: 0 0 10px 3px var(--modal-box-shadow-color);
24
24
  }
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from 'react';
2
- import { Button, Grid, IconButton, Snackbar } from '@mui/material';
2
+ import { Button, Grid2, IconButton, Snackbar } from '@mui/material';
3
3
  import CloseIcon from '@mui/icons-material/Close';
4
4
 
5
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
6
  import './CancelAlert.css';
7
7
 
8
8
  interface CancelAlertProps extends PConnFieldProps {
@@ -58,14 +58,12 @@ export default function CancelAlert(props: CancelAlertProps) {
58
58
  function cancelHandler() {
59
59
  if (isReverseCoexistence) {
60
60
  dismiss(true);
61
- // @ts-ignore - An argument for 'payload' was not provided.
62
61
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
63
62
  } else if (!isDataObject && !isLocalAction && !isBulkAction) {
64
63
  disableButton(btnIds.DELETE);
65
64
  actionsAPI
66
65
  .deleteCaseInCreateStage(containerItemID, hideDelete)
67
66
  .then(() => {
68
- // @ts-ignore - An argument for 'payload' was not provided.
69
67
  PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
70
68
  })
71
69
  .catch(() => {
@@ -78,13 +76,12 @@ export default function CancelAlert(props: CancelAlertProps) {
78
76
  });
79
77
  } else if (isLocalAction) {
80
78
  dismiss(true);
81
- actionsAPI.cancelAssignment(containerItemID);
79
+ actionsAPI.cancelAssignment(containerItemID, false);
82
80
  } else if (isBulkAction) {
83
81
  dismiss(true);
84
82
  actionsAPI.cancelBulkAction(containerItemID);
85
83
  } else {
86
84
  dismiss(true);
87
- // @ts-ignore - Argument of type '{ containerItemID: string; skipReleaseLockRequest: any; }' is not assignable to parameter of type 'ContainerInfo'.
88
85
  containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
89
86
  }
90
87
  }
@@ -128,10 +125,10 @@ export default function CancelAlert(props: CancelAlertProps) {
128
125
  <p>{localizedVal(content, localeCategory)}</p>
129
126
  </div>
130
127
  <div className='action-controls'>
131
- <Grid container spacing={4} justifyContent='space-between'>
132
- <Grid item>{leftButton}</Grid>
133
- <Grid item>{rightButton}</Grid>
134
- </Grid>
128
+ <Grid2 container spacing={4} justifyContent='space-between'>
129
+ <Grid2>{leftButton}</Grid2>
130
+ <Grid2>{rightButton}</Grid2>
131
+ </Grid2>
135
132
  </div>
136
133
  </div>
137
134
  </div>
@@ -1,4 +1,3 @@
1
- /* eslint-disable react/no-array-index-key */
2
1
  import { useState, useEffect } from 'react';
3
2
  import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@mui/material';
4
3
  import makeStyles from '@mui/styles/makeStyles';
@@ -6,7 +5,7 @@ import makeStyles from '@mui/styles/makeStyles';
6
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
7
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
7
  import { insertInstruction, deleteInstruction, updateNewInstuctions } from '@pega/react-sdk-components/lib/components/helpers/instructions-utils';
9
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
9
 
11
10
  interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
12
11
  // If any, enter additional props that only exist on Checkbox here
@@ -21,18 +20,33 @@ interface CheckboxProps extends Omit<PConnFieldProps, 'value'> {
21
20
  primaryField: string;
22
21
  readonlyContextList: any;
23
22
  referenceList: string;
23
+ variant?: string;
24
+ hideFieldLabels: boolean;
25
+ additionalProps: any;
26
+ imagePosition: string;
27
+ imageSize: string;
28
+ showImageDescription: string;
29
+ renderMode: string;
30
+ image: string;
24
31
  }
25
32
 
26
33
  const useStyles = makeStyles(() => ({
27
34
  checkbox: {
28
35
  display: 'flex',
29
36
  flexDirection: 'column'
37
+ },
38
+ selectableCard: {
39
+ display: 'grid',
40
+ gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, 40ch), 1fr))',
41
+ gridAutoRows: '1fr',
42
+ gap: '0.5rem'
30
43
  }
31
44
  }));
32
45
 
33
46
  export default function CheckboxComponent(props: CheckboxProps) {
34
47
  // Get emitted components from map (so we can get any override that may exist)
35
48
  const FieldValueList = getComponentFromMap('FieldValueList');
49
+ const SelectableCard = getComponentFromMap('SelectableCard');
36
50
 
37
51
  const {
38
52
  getPConnect,
@@ -56,8 +70,20 @@ export default function CheckboxComponent(props: CheckboxProps) {
56
70
  selectionList,
57
71
  primaryField,
58
72
  referenceList,
59
- readonlyContextList: selectedvalues
73
+ readonlyContextList: selectedvalues,
74
+ variant,
75
+ hideFieldLabels,
76
+ additionalProps,
77
+ imagePosition,
78
+ imageSize,
79
+ showImageDescription,
80
+ renderMode,
81
+ image
60
82
  } = props;
83
+ const readOnlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY' || readOnly;
84
+
85
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
+ const [theSelectedButton, setSelectedButton] = useState(value);
61
87
  const classes = useStyles();
62
88
  const helperTextToDisplay = validatemessage || helperText;
63
89
  const thePConn = getPConnect();
@@ -71,12 +97,17 @@ export default function CheckboxComponent(props: CheckboxProps) {
71
97
  }, [value]);
72
98
 
73
99
  useEffect(() => {
74
- if (referenceList?.length > 0) {
100
+ if (referenceList?.length > 0 && !readOnlyMode) {
75
101
  thePConn.setReferenceList(selectionList);
76
102
  updateNewInstuctions(thePConn, selectionList);
77
103
  }
78
104
  }, [thePConn]);
79
105
 
106
+ useEffect(() => {
107
+ // This update theSelectedButton which will update the UI to show the selected button correctly
108
+ setSelectedButton(value);
109
+ }, [value]);
110
+
80
111
  if (displayMode === 'DISPLAY_ONLY') {
81
112
  return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;
82
113
  }
@@ -93,6 +124,68 @@ export default function CheckboxComponent(props: CheckboxProps) {
93
124
  thePConn.getValidationApi().validate(event.target.checked);
94
125
  };
95
126
 
127
+ const handleCheckboxChange = (event, item) => {
128
+ if (event.target.checked) {
129
+ insertInstruction(thePConn, selectionList, selectionKey, primaryField, item);
130
+ } else {
131
+ deleteInstruction(thePConn, selectionList, selectionKey, item);
132
+ }
133
+ thePConn.clearErrorMessages({ property: selectionList });
134
+ };
135
+
136
+ const actions = thePConn.getActionsApi();
137
+
138
+ const commonProps = {
139
+ ...additionalProps,
140
+ className: 'standard',
141
+ disabled,
142
+ readOnly,
143
+ onClick: (actions as any).onClick
144
+ };
145
+
146
+ if (variant === 'card') {
147
+ return (
148
+ <div>
149
+ <h4 style={{ marginTop: 0, marginBottom: 0 }}>{label}</h4>
150
+ <div className={classes.selectableCard}>
151
+ <SelectableCard
152
+ {...commonProps}
153
+ testId={testId}
154
+ displayMode={displayMode}
155
+ dataSource={datasource}
156
+ getPConnect={getPConnect}
157
+ readOnly={renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY' || readOnly}
158
+ onChange={e => {
159
+ e.stopPropagation();
160
+ const recordKey = selectionKey?.split('.').pop();
161
+ const selectedItem = datasource?.source?.find(item => item[recordKey as any] === e.target.id) ?? {};
162
+ handleCheckboxChange(e, {
163
+ id: selectedItem[recordKey as any],
164
+ primary: selectedItem[recordKey as any]
165
+ });
166
+ }}
167
+ onBlur={() => {
168
+ thePConn.getValidationApi().validate(selectedvalues, selectionList);
169
+ }}
170
+ hideFieldLabels={hideFieldLabels}
171
+ recordKey={selectionKey?.split('.').pop()}
172
+ cardLabel={primaryField.split('.').pop()}
173
+ image={{
174
+ imagePosition,
175
+ imageSize,
176
+ showImageDescription,
177
+ imageField: image?.split('.').pop(),
178
+ imageDescription: (thePConn?.getRawMetadata()?.config as any).imageDescription?.split('.').pop()
179
+ }}
180
+ readOnlyList={selectedvalues}
181
+ type='checkbox'
182
+ showNoValue={(renderMode === 'ReadOnly' || readOnly || displayMode === 'DISPLAY_ONLY') && selectedvalues.length === 0}
183
+ />
184
+ </div>
185
+ </div>
186
+ );
187
+ }
188
+
96
189
  const handleChangeMultiMode = (event, element) => {
97
190
  if (event.target.checked) {
98
191
  insertInstruction(thePConn, selectionList, selectionKey, primaryField, {
@@ -1,8 +1,8 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { NumericFormat } from 'react-number-format';
3
3
  import { TextField } from '@mui/material';
4
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
5
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
6
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
7
7
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
8
8
  import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
@@ -45,9 +45,11 @@ export default function Currency(props: CurrrencyProps) {
45
45
  const helperTextToDisplay = validatemessage || helperText;
46
46
  const [values, setValues] = useState(value.toString());
47
47
 
48
- const testProp = {
49
- 'data-test-id': testId
50
- };
48
+ const testProps: any = { 'data-test-id': testId };
49
+
50
+ useEffect(() => {
51
+ setValues(value.toString());
52
+ }, [value]);
51
53
 
52
54
  // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
53
55
  const theSymbols = getCurrencyCharacters(currencyISOCode);
@@ -56,7 +58,7 @@ export default function Currency(props: CurrrencyProps) {
56
58
  const theCurrSep = theSymbols.theDigitGroupSeparator;
57
59
 
58
60
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
59
- const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
61
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
60
62
 
61
63
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
64
 
@@ -86,6 +88,7 @@ export default function Currency(props: CurrrencyProps) {
86
88
  return (
87
89
  <NumericFormat
88
90
  valueIsNumericString
91
+ variant={readOnly ? 'standard' : 'outlined'}
89
92
  label={label}
90
93
  helperText={helperTextToDisplay}
91
94
  placeholder={placeholder ?? ''}
@@ -101,7 +104,7 @@ export default function Currency(props: CurrrencyProps) {
101
104
  {...currencyProp}
102
105
  decimalScale={allowDecimals !== false ? 2 : 0}
103
106
  fixedDecimalScale={allowDecimals}
104
- InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}
107
+ slotProps={{ input: { ...readOnlyProp, inputProps: { ...testProps } } }}
105
108
  customInput={TextField}
106
109
  />
107
110
  );
@@ -1,6 +1,5 @@
1
- // eslint-disable-next-line import/no-named-default
2
1
  import { default as CurrencyAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/Currency';
3
- // eslint-disable-next-line import/no-named-default
2
+
4
3
  import { default as CurrencyMapAlias } from '@pega/react-sdk-components/lib/components/helpers/formatters/CurrencyMap';
5
4
 
6
5
  export const getCurrencyOptions = (inISOCode: string) => {
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
3
3
  import dayjs, { Dayjs } from 'dayjs';
4
4
 
@@ -6,7 +6,7 @@ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event
6
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
7
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
8
8
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
9
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
10
 
11
11
  // Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
12
12
  function getFormattedDate(date) {
@@ -39,6 +39,10 @@ export default function Date(props: DateProps) {
39
39
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
40
40
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
41
41
 
42
+ useEffect(() => {
43
+ setDateValue(dayjs(value));
44
+ }, [value]);
45
+
42
46
  if (displayMode === 'DISPLAY_ONLY') {
43
47
  const formattedDate = format(props.value, 'date', {
44
48
  format: dateFormatInfo.dateFormatString
@@ -58,11 +62,7 @@ export default function Date(props: DateProps) {
58
62
  return <TextInput {...props} />;
59
63
  }
60
64
 
61
- let testProp = {};
62
-
63
- testProp = {
64
- 'data-test-id': testId
65
- };
65
+ const testProps: any = { 'data-test-id': testId };
66
66
 
67
67
  const handleChange = date => {
68
68
  if (date && date.isValid()) {
@@ -85,7 +85,7 @@ export default function Date(props: DateProps) {
85
85
  error: status === 'error',
86
86
  helperText: helperTextToDisplay,
87
87
  size: 'small',
88
- InputProps: { ...testProp }
88
+ InputProps: { ...testProps }
89
89
  }
90
90
  }}
91
91
  onChange={handleChange}
@@ -1,12 +1,12 @@
1
- import { useState } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
3
3
  import dayjs, { Dayjs } from 'dayjs';
4
-
4
+ import DateFormatter from '@pega/react-sdk-components/lib/components/helpers/formatters/Date';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
7
  import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
8
8
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
9
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
10
 
11
11
  interface DateTimeProps extends PConnFieldProps {
12
12
  // If any, enter additional props that only exist on DateTime here
@@ -19,7 +19,10 @@ export default function DateTime(props: DateTimeProps) {
19
19
 
20
20
  const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
21
21
 
22
- const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(value) : null);
22
+ const environmentInfo = PCore.getEnvironmentInfo();
23
+ const timezone = environmentInfo && environmentInfo.getTimeZone();
24
+
25
+ const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null);
23
26
 
24
27
  const pConn = getPConnect();
25
28
  const actions = pConn.getActionsApi();
@@ -34,6 +37,10 @@ export default function DateTime(props: DateTimeProps) {
34
37
  dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
35
38
  dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
36
39
 
40
+ useEffect(() => {
41
+ setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));
42
+ }, [value]);
43
+
37
44
  if (displayMode === 'DISPLAY_ONLY') {
38
45
  const formattedDateTime = format(props.value, 'datetime', {
39
46
  format: `${dateFormatInfo.dateFormatString} hh:mm a`
@@ -53,15 +60,12 @@ export default function DateTime(props: DateTimeProps) {
53
60
  return <TextInput {...props} value={formattedDateTime} />;
54
61
  }
55
62
 
56
- let testProp = {};
57
-
58
- testProp = {
59
- 'data-test-id': testId
60
- };
63
+ const testProps: any = { 'data-test-id': testId };
61
64
 
62
65
  const handleChange = date => {
63
- setDateValue(date);
64
- const changeValue = date && date.isValid() ? date.toISOString() : null;
66
+ const timeZoneDateTime = (dayjs as any).tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone);
67
+ const changeValue = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
68
+ setDateValue(timeZoneDateTime);
65
69
  handleEvent(actions, 'changeNblur', propName, changeValue);
66
70
  };
67
71
 
@@ -81,7 +85,6 @@ export default function DateTime(props: DateTimeProps) {
81
85
  label={label}
82
86
  value={dateValue}
83
87
  onChange={handleChange}
84
- data-test-id={testId}
85
88
  slotProps={{
86
89
  textField: {
87
90
  variant: 'outlined',
@@ -90,7 +93,7 @@ export default function DateTime(props: DateTimeProps) {
90
93
  error: status === 'error',
91
94
  helperText: helperTextToDisplay,
92
95
  size: 'small',
93
- InputProps: { ...testProp }
96
+ InputProps: { ...testProps }
94
97
  }
95
98
  }}
96
99
  />
@@ -1,11 +1,11 @@
1
1
  import { NumericFormat } from 'react-number-format';
2
2
  import { TextField } from '@mui/material';
3
- import { useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
4
  import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
7
7
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
8
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
9
 
10
10
  /* Using react-number-format component here, since it allows formatting decimal values,
11
11
  as per the locale.
@@ -58,6 +58,10 @@ export default function Decimal(props: DecimalProps) {
58
58
 
59
59
  const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
60
60
 
61
+ useEffect(() => {
62
+ setValues(value.toString());
63
+ }, [value]);
64
+
61
65
  let readOnlyProp = {}; // Note: empty if NOT ReadOnly
62
66
 
63
67
  if (readOnly) {
@@ -68,7 +72,7 @@ export default function Decimal(props: DecimalProps) {
68
72
  if (formatter === 'Currency') {
69
73
  formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
70
74
  } else {
71
- formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
75
+ formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
72
76
  }
73
77
 
74
78
  if (displayMode === 'DISPLAY_ONLY') {
@@ -79,9 +83,7 @@ export default function Decimal(props: DecimalProps) {
79
83
  return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
80
84
  }
81
85
 
82
- const testProp = {
83
- 'data-test-id': testId
84
- };
86
+ const testProps: any = { 'data-test-id': testId };
85
87
 
86
88
  function decimalOnBlur() {
87
89
  handleEvent(actions, 'changeNblur', propName, values);
@@ -109,10 +111,11 @@ export default function Decimal(props: DecimalProps) {
109
111
  }}
110
112
  onBlur={!readOnly ? decimalOnBlur : undefined}
111
113
  prefix={readOnly && formatter === 'Currency' ? theCurrSym : ''}
114
+ suffix={readOnly && formatter === 'Percentage' ? '%' : ''}
112
115
  decimalSeparator={theCurrDec}
113
116
  thousandSeparator={showGroupSeparators ? theCurrSep : ''}
114
117
  decimalScale={readOnly && formatter === 'Currency' ? undefined : decimalPrecision}
115
- InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}
118
+ slotProps={{ input: { ...readOnlyProp, inputProps: { ...testProps } } }}
116
119
  customInput={TextField}
117
120
  />
118
121
  );
@@ -6,7 +6,7 @@ import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
6
6
  import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
7
7
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
8
8
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
9
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
9
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
10
10
 
11
11
  interface IOption {
12
12
  key: string;
@@ -137,7 +137,7 @@ export default function Dropdown(props: DropdownProps) {
137
137
  }, [theDatasource]);
138
138
 
139
139
  useEffect(() => {
140
- if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {
140
+ if (listType !== 'associated' && typeof datasource === 'string') {
141
141
  getDataPage(datasource, parameters, context).then((results: any) => {
142
142
  const optionsData: any[] = [];
143
143
  const displayColumn = getDisplayFieldsMetaData(columns);
@@ -165,34 +165,38 @@ export default function Dropdown(props: DropdownProps) {
165
165
 
166
166
  let readOnlyProp = {};
167
167
 
168
- if (displayMode === 'DISPLAY_ONLY') {
169
- return (
170
- <FieldValueList
171
- name={hideLabel ? '' : label}
172
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
173
- value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
174
- />
175
- );
176
- }
168
+ const displayFn = (displayM, val) => {
169
+ if (displayM === 'DISPLAY_ONLY') {
170
+ return (
171
+ <FieldValueList
172
+ name={hideLabel ? '' : label}
173
+ value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
174
+ />
175
+ );
176
+ }
177
+
178
+ if (displayM === 'STACKED_LARGE_VAL') {
179
+ return (
180
+ <FieldValueList
181
+ name={hideLabel ? '' : label}
182
+ value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
183
+ variant='stacked'
184
+ />
185
+ );
186
+ }
177
187
 
178
- if (displayMode === 'STACKED_LARGE_VAL') {
179
- return (
180
- <FieldValueList
181
- name={hideLabel ? '' : label}
182
- // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
183
- value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
184
- variant='stacked'
185
- />
186
- );
188
+ return null;
189
+ };
190
+
191
+ if (displayMode) {
192
+ return displayFn(displayMode, options.find(option => option.key === value)?.value || value);
187
193
  }
188
194
 
189
195
  if (readOnly) {
190
196
  readOnlyProp = { readOnly: true };
191
197
  }
192
198
 
193
- let testProp = {};
194
-
195
- testProp = {
199
+ const testProps: any = {
196
200
  'data-test-id': testId
197
201
  };
198
202
 
@@ -220,11 +224,12 @@ export default function Dropdown(props: DropdownProps) {
220
224
  label={label}
221
225
  value={value === '' && !readOnly ? placeholder : value}
222
226
  select
223
- InputProps={{ ...readOnlyProp, ...testProp }}
227
+ slotProps={{
228
+ input: { ...readOnlyProp, ...testProps }
229
+ }}
224
230
  >
225
231
  {options.map((option: any) => (
226
232
  <MenuItem key={option.key} value={option.key}>
227
- {/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
228
233
  {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
229
234
  </MenuItem>
230
235
  ))}
@@ -3,7 +3,7 @@ import { InputAdornment, TextField } from '@mui/material';
3
3
  import MailOutlineIcon from '@mui/icons-material/MailOutline';
4
4
 
5
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
6
+ import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
7
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
8
8
 
9
9
  interface EmailProps extends PConnFieldProps {
@@ -55,11 +55,7 @@ export default function Email(props: EmailProps) {
55
55
  return <TextInput {...props} />;
56
56
  }
57
57
 
58
- let testProp = {};
59
-
60
- testProp = {
61
- 'data-test-id': testId
62
- };
58
+ const testProps: any = { 'data-test-id': testId };
63
59
 
64
60
  function handleChange(event) {
65
61
  // update internal value
@@ -85,13 +81,15 @@ export default function Email(props: EmailProps) {
85
81
  label={label}
86
82
  value={inputValue}
87
83
  type='email'
88
- InputProps={{
89
- startAdornment: (
90
- <InputAdornment position='start'>
91
- <MailOutlineIcon />
92
- </InputAdornment>
93
- ),
94
- inputProps: { ...testProp }
84
+ slotProps={{
85
+ input: {
86
+ startAdornment: (
87
+ <InputAdornment position='start'>
88
+ <MailOutlineIcon />
89
+ </InputAdornment>
90
+ ),
91
+ inputProps: { ...testProps }
92
+ }
95
93
  }}
96
94
  />
97
95
  );