@pega/react-sdk-overrides 23.1.10 → 23.1.12

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 (232) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +17 -0
  3. package/SECURITY.md +10 -0
  4. package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +6 -14
  5. package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
  13. package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
  16. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
  17. package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
  18. package/lib/field/AutoComplete/config-ext.json +2 -3
  19. package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
  20. package/lib/field/CancelAlert/index.tsx +1 -1
  21. package/lib/field/Checkbox/Checkbox.tsx +120 -63
  22. package/lib/field/Checkbox/config-ext.json +2 -3
  23. package/lib/field/Currency/Currency.tsx +25 -50
  24. package/lib/field/Currency/config-ext.json +2 -3
  25. package/lib/field/Currency/currency-utils.ts +9 -16
  26. package/lib/field/Date/Date.tsx +15 -11
  27. package/lib/field/Date/config-ext.json +2 -3
  28. package/lib/field/DateTime/DateTime.tsx +9 -9
  29. package/lib/field/DateTime/config-ext.json +1 -2
  30. package/lib/field/Decimal/Decimal.tsx +33 -44
  31. package/lib/field/Decimal/config-ext.json +1 -2
  32. package/lib/field/Decimal/index.tsx +1 -1
  33. package/lib/field/Dropdown/Dropdown.tsx +122 -31
  34. package/lib/field/Dropdown/config-ext.json +1 -2
  35. package/lib/field/Email/Email.tsx +11 -10
  36. package/lib/field/Email/config-ext.json +1 -2
  37. package/lib/field/Email/index.tsx +1 -1
  38. package/lib/field/Group/Group.tsx +39 -0
  39. package/lib/field/Group/config-ext.json +7 -0
  40. package/lib/field/Group/index.tsx +1 -0
  41. package/lib/field/Integer/Integer.tsx +8 -7
  42. package/lib/field/Integer/config-ext.json +1 -2
  43. package/lib/field/MultiSelect/Multiselect.tsx +244 -0
  44. package/lib/field/MultiSelect/index.tsx +1 -0
  45. package/lib/field/MultiSelect/utils.ts +230 -0
  46. package/lib/field/Percentage/Percentage.tsx +46 -41
  47. package/lib/field/Percentage/config-ext.json +1 -2
  48. package/lib/field/Phone/Phone.tsx +13 -12
  49. package/lib/field/Phone/index.tsx +1 -1
  50. package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
  51. package/lib/field/RadioButtons/config-ext.json +1 -2
  52. package/lib/field/RichText/RichText.tsx +8 -7
  53. package/lib/field/ScalarList/ScalarList.tsx +3 -13
  54. package/lib/field/ScalarList/config-ext.json +1 -2
  55. package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
  56. package/lib/field/SemanticLink/config-ext.json +1 -2
  57. package/lib/field/SemanticLink/utils.ts +8 -11
  58. package/lib/field/TextArea/TextArea.tsx +7 -6
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +4 -6
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +9 -7
  63. package/lib/field/TextInput/config-ext.json +1 -2
  64. package/lib/field/TextInput/index.tsx +1 -1
  65. package/lib/field/Time/Time.tsx +11 -11
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +9 -8
  68. package/lib/field/URL/config-ext.json +1 -2
  69. package/lib/field/URL/index.tsx +1 -1
  70. package/lib/field/UserReference/UserReference.tsx +18 -16
  71. package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
  72. package/lib/field/UserReference/config-ext.json +1 -2
  73. package/lib/helpers/attachmentHelpers.ts +13 -8
  74. package/lib/helpers/case-utils.tsx +4 -8
  75. package/lib/helpers/common-utils.ts +5 -1
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +3 -3
  78. package/lib/helpers/event-utils.ts +3 -3
  79. package/lib/helpers/field-group-utils.ts +1 -1
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +15 -21
  82. package/lib/helpers/formatters/CurrencyMap.ts +505 -501
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +1 -2
  85. package/lib/helpers/formatters/index.ts +26 -19
  86. package/lib/helpers/instructions-utils.ts +38 -0
  87. package/lib/helpers/reactContextHelpers.ts +2 -2
  88. package/lib/helpers/simpleTableHelpers.ts +59 -83
  89. package/lib/helpers/state-utils.tsx +5 -9
  90. package/lib/helpers/template-utils.ts +3 -6
  91. package/lib/helpers/utils.ts +5 -5
  92. package/lib/helpers/versionHelpers.ts +1 -4
  93. package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
  94. package/lib/infra/ActionButtons/index.tsx +1 -1
  95. package/lib/infra/Assignment/Assignment.tsx +99 -79
  96. package/lib/infra/Assignment/index.tsx +1 -1
  97. package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
  98. package/lib/infra/AssignmentCard/index.tsx +1 -1
  99. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
  100. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
  101. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  103. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  104. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +227 -218
  105. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  106. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  107. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  108. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  109. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +36 -46
  110. package/lib/infra/Containers/helpers.ts +6 -0
  111. package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
  112. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
  113. package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
  114. package/lib/infra/DeferLoad/index.tsx +1 -1
  115. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
  116. package/lib/infra/MultiStep/MultiStep.css +11 -15
  117. package/lib/infra/MultiStep/MultiStep.tsx +176 -212
  118. package/lib/infra/MultiStep/index.tsx +1 -1
  119. package/lib/infra/NavBar/NavBar.css +103 -105
  120. package/lib/infra/NavBar/NavBar.tsx +19 -31
  121. package/lib/infra/Reference/Reference.tsx +16 -18
  122. package/lib/infra/Region/Region.tsx +4 -6
  123. package/lib/infra/RootContainer/RootContainer.tsx +75 -111
  124. package/lib/infra/RootContainer/index.tsx +1 -1
  125. package/lib/infra/Stages/Stages.tsx +32 -39
  126. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
  127. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
  128. package/lib/infra/View/View.tsx +17 -21
  129. package/lib/template/AppShell/AppShell.css +22 -23
  130. package/lib/template/AppShell/AppShell.tsx +39 -74
  131. package/lib/template/BannerPage/BannerPage.tsx +12 -14
  132. package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
  133. package/lib/template/CaseSummary/config-ext.json +1 -2
  134. package/lib/template/CaseView/CaseView.tsx +34 -63
  135. package/lib/template/CaseView/config-ext.json +1 -2
  136. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
  137. package/lib/template/Confirmation/Confirmation.tsx +12 -17
  138. package/lib/template/Confirmation/config-ext.json +1 -2
  139. package/lib/template/DataReference/DataReference.tsx +95 -121
  140. package/lib/template/DataReference/config-ext.json +1 -2
  141. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  142. package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
  143. package/lib/template/DefaultForm/config-ext.json +1 -2
  144. package/lib/template/Details/Details/Details.tsx +19 -22
  145. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
  146. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  147. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
  148. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  149. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
  150. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  151. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  152. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +15 -14
  153. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
  154. package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
  155. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
  156. package/lib/template/ListPage/ListPage.tsx +5 -10
  157. package/lib/template/ListPage/config-ext.json +1 -2
  158. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  159. package/lib/template/ListView/ListView.tsx +185 -175
  160. package/lib/template/ListView/config-ext.json +1 -2
  161. package/lib/template/ListView/hooks.ts +24 -26
  162. package/lib/template/ListView/utils.ts +51 -87
  163. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
  164. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
  166. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
  167. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  168. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +14 -24
  170. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  171. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
  172. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  173. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
  174. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  175. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
  176. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  177. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
  178. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  179. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  180. package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
  181. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
  182. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  183. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
  184. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
  185. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
  186. package/lib/template/SubTabs/SubTabs.tsx +22 -40
  187. package/lib/template/SubTabs/config-ext.json +1 -2
  188. package/lib/template/SubTabs/tabUtils.ts +2 -5
  189. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
  191. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  192. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
  193. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  194. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
  195. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  196. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +22 -34
  198. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
  199. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  200. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +13 -21
  202. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  203. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
  204. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  205. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  206. package/lib/template/WssNavBar/WssNavBar.tsx +18 -21
  207. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
  208. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  209. package/lib/widget/Attachment/Attachment.css +60 -1
  210. package/lib/widget/Attachment/Attachment.tsx +378 -405
  211. package/lib/widget/Attachment/index.tsx +1 -1
  212. package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
  213. package/lib/widget/CaseHistory/config-ext.json +1 -2
  214. package/lib/widget/CaseHistory/index.tsx +1 -1
  215. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
  216. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
  218. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  219. package/lib/widget/Followers/Followers.tsx +23 -20
  220. package/lib/widget/Followers/config-ext.json +1 -2
  221. package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
  222. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  223. package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
  224. package/lib/widget/SummaryItem/index.tsx +1 -1
  225. package/lib/widget/SummaryList/SummaryList.tsx +7 -10
  226. package/lib/widget/ToDo/ToDo.css +4 -4
  227. package/lib/widget/ToDo/ToDo.tsx +52 -53
  228. package/lib/widget/ToDo/config-ext.json +1 -2
  229. package/package.json +5 -2
  230. package/lib/helpers/auth.js +0 -834
  231. package/lib/helpers/authManager.ts +0 -933
  232. package/lib/helpers/config_access.js +0 -186
@@ -1,12 +1,11 @@
1
- import React, { useMemo, useState, useEffect } from 'react';
2
- import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
1
+ import { PropsWithChildren, ReactElement, useEffect, useMemo, useState } from 'react';
3
2
 
4
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
3
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  // ReferenceProps can't be used until getComponentConfig() is NOT private
7
7
  interface DataReferenceProps extends PConnProps {
8
8
  // If any, enter additional props that only exist on this component
9
- children: Array<any>;
10
9
  label: string;
11
10
  showLabel: any;
12
11
  displayMode: string;
@@ -15,18 +14,13 @@ interface DataReferenceProps extends PConnProps {
15
14
  selectionMode: string;
16
15
  displayAs: string;
17
16
  ruleClass: string;
18
- parameters: Array<string>; // need to fix
17
+ parameters: string[]; // need to fix
19
18
  hideLabel: boolean;
20
19
  }
21
20
 
22
-
23
21
  const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
24
22
 
25
- // Remove this and use "real" PCore type once .d.ts is fixed (currently shows ~7 errors)
26
- declare const PCore: any;
27
-
28
-
29
- export default function DataReference(props: DataReferenceProps) {
23
+ export default function DataReference(props: PropsWithChildren<DataReferenceProps>) {
30
24
  // Get emitted components from map (so we can get any override that may exist)
31
25
  const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');
32
26
  const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');
@@ -45,17 +39,17 @@ export default function DataReference(props: DataReferenceProps) {
45
39
  parameters,
46
40
  hideLabel
47
41
  } = props;
48
- let childrenToRender = children;
42
+ let childrenToRender = children as ReactElement[];
49
43
  const pConn = getPConnect();
50
44
  const [dropDownDataSource, setDropDownDataSource] = useState(null);
51
45
  const propsToUse: any = { label, showLabel, ...pConn.getInheritedProps() };
52
46
  if (propsToUse.showLabel === false) {
53
47
  propsToUse.label = '';
54
48
  }
55
- const rawViewMetadata = pConn.getRawMetadata();
56
- const viewName = rawViewMetadata["name"];
57
- const [firstChildMeta] = rawViewMetadata["children"];
58
- const refList = rawViewMetadata["config"].referenceList;
49
+ const rawViewMetadata: any = pConn.getRawMetadata();
50
+ const viewName = rawViewMetadata.name;
51
+ const [firstChildMeta] = rawViewMetadata.children;
52
+ const refList = rawViewMetadata.config.referenceList;
59
53
  const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');
60
54
  let propName;
61
55
  const isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode);
@@ -63,32 +57,34 @@ export default function DataReference(props: DataReferenceProps) {
63
57
 
64
58
  /* Only for dropdown when it has param use data api to get the data back and add it to datasource */
65
59
  useEffect(() => {
66
- if (
67
- firstChildMeta?.type === "Dropdown" &&
68
- rawViewMetadata["config"]?.parameters
69
- ) {
60
+ if (firstChildMeta?.type === 'Dropdown' && rawViewMetadata.config?.parameters) {
70
61
  const { value, key, text } = firstChildMeta.config.datasource.fields;
71
- PCore.getDataApiUtils()
72
- .getData(refList, {
73
- dataViewParameters: parameters
74
- })
75
- .then((res) => {
62
+ (
63
+ PCore.getDataApiUtils().getData(
64
+ refList,
65
+ {
66
+ dataViewParameters: parameters
67
+ } as any,
68
+ ''
69
+ ) as Promise<any>
70
+ )
71
+ .then(res => {
76
72
  if (res.data.data !== null) {
77
73
  const ddDataSource = res.data.data
78
- .map((listItem) => ({
79
- key: listItem[key.split(" .", 2)[1]],
80
- text: listItem[text.split(" .", 2)[1]],
81
- value: listItem[value.split(" .", 2)[1]]
74
+ .map(listItem => ({
75
+ key: listItem[key.split(' .', 2)[1]],
76
+ text: listItem[text.split(' .', 2)[1]],
77
+ value: listItem[value.split(' .', 2)[1]]
82
78
  }))
83
- .filter((item) => item.key);
79
+ .filter(item => item.key);
84
80
  // Filtering out undefined entries that will break preview
85
81
  setDropDownDataSource(ddDataSource);
86
82
  } else {
87
- const ddDataSource: any = []
83
+ const ddDataSource: any = [];
88
84
  setDropDownDataSource(ddDataSource);
89
85
  }
90
86
  })
91
- .catch((err) => {
87
+ .catch(err => {
92
88
  // eslint-disable-next-line no-console
93
89
  console.error(err?.stack);
94
90
  return Promise.resolve({
@@ -105,14 +101,14 @@ export default function DataReference(props: DataReferenceProps) {
105
101
  delete firstChildMeta.config.readOnly;
106
102
  }
107
103
  if (firstChildMeta?.type === 'Dropdown') {
108
- firstChildMeta.config.datasource.source = rawViewMetadata["config"]?.parameters
104
+ firstChildMeta.config.datasource.source = rawViewMetadata.config?.parameters
109
105
  ? dropDownDataSource
110
106
  : '@DATASOURCE '.concat(refList).concat('.pxResults');
111
107
  } else if (firstChildMeta?.type === 'AutoComplete') {
112
108
  firstChildMeta.config.datasource = refList;
113
109
 
114
110
  /* Insert the parameters to the component only if present */
115
- if (rawViewMetadata["config"]?.parameters) {
111
+ if (rawViewMetadata.config?.parameters) {
116
112
  firstChildMeta.config.parameters = parameters;
117
113
  }
118
114
  }
@@ -130,10 +126,9 @@ export default function DataReference(props: DataReferenceProps) {
130
126
  const handleSelection = event => {
131
127
  const caseKey = pConn.getCaseInfo().getKey();
132
128
  const refreshOptions = { autoDetectRefresh: true };
133
- if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName', '')) { // 2nd arg empty string until typedef marked correctly
134
- getPConnect()
135
- .getActionsApi()
136
- .refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName', ''), null, refreshOptions); // 2nd arg empty string until typedef marked correctly
129
+ if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName', '')) {
130
+ // 2nd arg empty string until typedef marked correctly
131
+ getPConnect().getActionsApi().refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName', ''), null, refreshOptions); // 2nd arg empty string until typedef marked correctly
137
132
  PCore.getDeferLoadManager().refreshActiveComponents(pConn.getContextName());
138
133
  } else {
139
134
  const pgRef = pConn.getPageReference().replace('caseInfo.content', '');
@@ -143,45 +138,41 @@ export default function DataReference(props: DataReferenceProps) {
143
138
  // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value
144
139
  const propValue = event?.id || event?.target.value;
145
140
  if (propValue && canBeChangedInReviewMode && isDisplayModeEnabled) {
146
- PCore.getDataApiUtils()
147
- .getCaseEditLock(caseKey)
148
- .then(caseResponse => {
149
- const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
150
- let curr = {};
151
- const commitData = curr;
141
+ (PCore.getDataApiUtils().getCaseEditLock(caseKey, '') as Promise<any>).then(caseResponse => {
142
+ const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
143
+ let curr = {};
144
+ const commitData = curr;
152
145
 
153
- pageTokens.forEach(el => {
154
- if (el !== '') {
155
- curr[el] = {};
156
- curr = curr[el];
157
- }
158
- });
146
+ pageTokens.forEach(el => {
147
+ if (el !== '') {
148
+ curr[el] = {};
149
+ curr = curr[el];
150
+ }
151
+ });
159
152
 
160
- // expecting format like {Customer: {pyID:"C-100"}}
161
- const propArr = propName.split('.');
162
- propArr.forEach((element, idx) => {
163
- if (idx + 1 === propArr.length) {
164
- curr[element] = propValue;
165
- } else {
166
- curr[element] = {};
167
- curr = curr[element];
168
- }
169
- });
153
+ // expecting format like {Customer: {pyID:"C-100"}}
154
+ const propArr = propName.split('.');
155
+ propArr.forEach((element, idx) => {
156
+ if (idx + 1 === propArr.length) {
157
+ curr[element] = propValue;
158
+ } else {
159
+ curr[element] = {};
160
+ curr = curr[element];
161
+ }
162
+ });
170
163
 
171
- PCore.getDataApiUtils()
172
- .updateCaseEditFieldsData(
173
- caseKey,
174
- { [caseKey]: commitData },
175
- caseResponse.headers.etag,
176
- pConn.getContextName()
177
- )
178
- .then(response => {
179
- PCore.getContainerUtils().updateChildContainersEtag(
180
- pConn.getContextName(),
181
- response.headers.etag
182
- );
183
- });
164
+ (
165
+ PCore.getDataApiUtils().updateCaseEditFieldsData(
166
+ caseKey,
167
+ { [caseKey]: commitData },
168
+ caseResponse.headers.etag,
169
+ pConn.getContextName()
170
+ ) as Promise<any>
171
+ ).then(response => {
172
+ PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), response.data.data.caseInfo.lastUpdateTime);
173
+ PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);
184
174
  });
175
+ });
185
176
  }
186
177
  };
187
178
 
@@ -191,7 +182,8 @@ export default function DataReference(props: DataReferenceProps) {
191
182
  const recreatedFirstChild = useMemo(() => {
192
183
  const { type, config } = firstChildMeta;
193
184
  if (firstChildMeta?.type !== 'Region') {
194
- pConn.clearErrorMessages({ // Need to add empty string for category and context to match typdef
185
+ pConn.clearErrorMessages({
186
+ // Need to add empty string for category and context to match typdef
195
187
  property: propName,
196
188
  category: '',
197
189
  context: ''
@@ -208,69 +200,51 @@ export default function DataReference(props: DataReferenceProps) {
208
200
  ruleClass={ruleClass}
209
201
  referenceType={referenceType}
210
202
  hideLabel={hideLabel}
211
- dataRelationshipContext={
212
- rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name ? rawViewMetadata["config"].name : null
213
- }
203
+ dataRelationshipContext={rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null}
214
204
  />
215
205
  );
216
206
  }
217
207
 
218
208
  if (isDisplayModeEnabled && selectionMode === SELECTION_MODE.MULTI) {
219
- return (
220
- <MultiReferenceReadonly
221
- config={config}
222
- getPConnect={firstChildPConnect}
223
- label={propsToUse.label}
224
- hideLabel={hideLabel}
225
- />
226
- );
209
+ return <MultiReferenceReadonly config={config} getPConnect={firstChildPConnect} label={propsToUse.label} hideLabel={hideLabel} />;
227
210
  }
228
211
 
229
212
  // In the case of a datasource with parameters you cannot load the dropdown before the parameters
230
- if (
231
- type === 'Dropdown' &&
232
- rawViewMetadata["config"]?.parameters &&
233
- dropDownDataSource === null
234
- ) {
213
+ if (type === 'Dropdown' && rawViewMetadata.config?.parameters && dropDownDataSource === null) {
235
214
  return null;
236
215
  }
237
216
 
238
- return firstChildPConnect().createComponent({
239
- type,
240
- config: {
241
- ...config,
242
- required: propsToUse.required,
243
- visibility: propsToUse.visibility,
244
- disabled: propsToUse.disabled,
245
- label: propsToUse.label,
246
- viewName: getPConnect().getCurrentView(),
247
- parameters: rawViewMetadata["config"].parameters,
248
- readOnly: false,
249
- localeReference: rawViewMetadata["config"].localeReference,
250
- ...(selectionMode === SELECTION_MODE.SINGLE ? { referenceType } : ''),
251
- dataRelationshipContext:
252
- rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name
253
- ? rawViewMetadata["config"].name
254
- : null,
255
- hideLabel,
256
- onRecordChange: handleSelection
217
+ return firstChildPConnect().createComponent(
218
+ {
219
+ type,
220
+ config: {
221
+ ...config,
222
+ required: propsToUse.required,
223
+ visibility: propsToUse.visibility,
224
+ disabled: propsToUse.disabled,
225
+ label: propsToUse.label,
226
+ viewName: getPConnect().getCurrentView(),
227
+ parameters: rawViewMetadata.config.parameters,
228
+ readOnly: false,
229
+ localeReference: rawViewMetadata.config.localeReference,
230
+ ...(selectionMode === SELECTION_MODE.SINGLE ? { referenceType } : ''),
231
+ dataRelationshipContext: rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null,
232
+ hideLabel,
233
+ onRecordChange: handleSelection
234
+ }
257
235
  },
258
- },
259
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
236
+ '',
237
+ '',
238
+ {}
239
+ ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
260
240
  }
261
- }, [
262
- firstChildMeta.config?.datasource?.source,
263
- parameters,
264
- dropDownDataSource,
265
- propsToUse.required,
266
- propsToUse.disabled
267
- ]);
241
+ }, [firstChildMeta.config?.datasource?.source, parameters, dropDownDataSource, propsToUse.required, propsToUse.disabled]);
268
242
 
269
243
  // Only include the views region for rendering when it has content
270
244
  if (firstChildMeta?.type !== 'Region') {
271
- const viewsRegion = rawViewMetadata["children"][1];
245
+ const viewsRegion = rawViewMetadata.children[1];
272
246
  if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {
273
- childrenToRender = [recreatedFirstChild, ...children.slice(1)];
247
+ childrenToRender = [recreatedFirstChild, ...(children as ReactElement[]).slice(1)];
274
248
  } else {
275
249
  childrenToRender = [recreatedFirstChild];
276
250
  }
@@ -281,7 +255,7 @@ export default function DataReference(props: DataReferenceProps) {
281
255
  ) : (
282
256
  <div>
283
257
  {childrenToRender.map(child => (
284
- <React.Fragment>{child}</React.Fragment>
258
+ <>{child}</>
285
259
  ))}
286
260
  </div>
287
261
  );
@@ -4,6 +4,5 @@
4
4
  "type": "Template",
5
5
  "icon": "DataReference.svg",
6
6
  "subtype": "DATAVIEW",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -16,15 +16,19 @@
16
16
  gap: calc(1rem);
17
17
  }
18
18
 
19
+ .psdk-default-form-three-column .grid-column {
20
+ grid-column: 1 / span 3;
21
+ }
22
+
19
23
  .psdk-default-form-two-column .grid-column {
20
24
  grid-column: 1 / span 2;
21
25
  }
22
26
 
23
- .psdk-default-form-three-column .grid-column {
24
- grid-column: 1 / span 3;
27
+ .psdk-default-form-one-column .grid-column {
28
+ grid-column: 1;
25
29
  }
26
30
 
27
- .psdk-default-form-instruction-text{
31
+ .psdk-default-form-instruction-text {
28
32
  padding-top: 0.625rem;
29
33
  padding-bottom: 0.625rem;
30
34
  }
@@ -1,22 +1,19 @@
1
- import React, { createElement } from 'react';
1
+ import { createElement, PropsWithChildren } from 'react';
2
+
2
3
  import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
3
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
5
  import connectToState from '@pega/react-sdk-components/lib/components/helpers/state-utils';
5
- import { getKeyForMappedField, mapStateToProps } from './utils';
6
- // import type { PConnProps } from '../../../types/PConnProps';
7
6
 
7
+ import { getKeyForMappedField, mapStateToProps } from './utils';
8
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
9
 
9
10
  import './DefaultForm.css';
10
11
 
11
-
12
- // Can't use PConn props until proper props for getPConnect().getChildren()[0].getPConnect;
13
- // interface DefaultFormProps extends PConnProps {
14
- // // If any, enter additional props that only exist on this component
15
- // children: Array<any>,
16
- // NumCols: string
17
-
18
- // }
19
-
12
+ interface DefaultFormProps extends PConnProps {
13
+ // If any, enter additional props that only exist on this component
14
+ NumCols: string;
15
+ instructions: string;
16
+ }
20
17
 
21
18
  const Child = connectToState(mapStateToProps)(props => {
22
19
  const { key, visibility, ...rest } = props;
@@ -24,7 +21,7 @@ const Child = connectToState(mapStateToProps)(props => {
24
21
  return createElement(createPConnectComponent(), { ...rest, key, visibility });
25
22
  });
26
23
 
27
- export default function DefaultForm(props /* : DefaultFormProps */) {
24
+ export default function DefaultForm(props: PropsWithChildren<DefaultFormProps>) {
28
25
  const { getPConnect, NumCols = '1' } = props;
29
26
  const instructions = getInstructions(getPConnect(), props.instructions);
30
27
 
@@ -52,15 +49,15 @@ export default function DefaultForm(props /* : DefaultFormProps */) {
52
49
  // to take the children and create components for them, put in an array and pass as the
53
50
  // defaultForm kids
54
51
  const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
55
- const dfChildren = arChildren.map(kid => <Child key={getKeyForMappedField(kid)} {...kid} />);
52
+ const dfChildren = arChildren?.map(kid => <Child key={getKeyForMappedField(kid)} {...kid} />);
56
53
 
57
54
  return (
58
55
  <>
59
56
  {instructions && (
60
57
  <div className='psdk-default-form-instruction-text'>
61
58
  {/* server performs sanitization method for instructions html content */}
62
- { /* eslint-disable react/no-danger */ }
63
- <div key="instructions" id="instruction-text" dangerouslySetInnerHTML={{ __html: instructions }} />
59
+ {/* eslint-disable react/no-danger */}
60
+ <div key='instructions' id='instruction-text' dangerouslySetInnerHTML={{ __html: instructions }} />
64
61
  </div>
65
62
  )}
66
63
  <div className={divClass}>{dfChildren}</div>
@@ -4,6 +4,5 @@
4
4
  "description": "DefaultForm Template",
5
5
  "type": "Template",
6
6
  "subtype": "FORM",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,18 +1,18 @@
1
- import React, { createElement } from 'react';
1
+ import { createElement } from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
+
3
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
7
 
6
- // import type { PConnProps } from '../../../../types/PConnProps';
7
-
8
-
9
- // Can't use PConnProps until getPConnect().getChildren() type is ok
10
- // interface DetailsProps extends PConnProps {
11
- // // If any, enter additional props that only exist on this component
12
- // }
13
-
8
+ interface DetailsProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ label: string;
11
+ showLabel: boolean;
12
+ showHighlightedData: boolean;
13
+ }
14
14
 
15
- export default function Details(props /* : DetailsProps */) {
15
+ export default function Details(props: DetailsProps) {
16
16
  // Get emitted components from map (so we can get any override that may exist)
17
17
  const FieldGroup = getComponentFromMap('FieldGroup');
18
18
 
@@ -25,20 +25,18 @@ export default function Details(props /* : DetailsProps */) {
25
25
  // in a readonly (display) mode instead of a editable
26
26
  getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
27
27
  getPConnect().setInheritedProp('readOnly', true);
28
- const children = getPConnect()
29
- .getChildren()
30
- .map((configObject, index) =>
31
- createElement(createPConnectComponent(), {
32
- ...configObject,
33
- // eslint-disable-next-line react/no-array-index-key
34
- key: index.toString()
35
- })
36
- );
28
+ const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
+ createElement(createPConnectComponent(), {
30
+ ...configObject,
31
+ // eslint-disable-next-line react/no-array-index-key
32
+ key: index.toString()
33
+ })
34
+ );
37
35
 
38
36
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
39
37
  let highlightedDataArr = [];
40
38
  if (showHighlightedData) {
41
- const { highlightedData = [] } = getPConnect().getRawMetadata().config;
39
+ const { highlightedData = [] } = (getPConnect().getRawMetadata() as any).config;
42
40
  highlightedDataArr = highlightedData.map(field => {
43
41
  field.config.displayMode = 'STACKED_LARGE_VAL';
44
42
 
@@ -48,8 +46,7 @@ export default function Details(props /* : DetailsProps */) {
48
46
  field.config.displayAsStatus = true;
49
47
  }
50
48
 
51
- return getPConnect().createComponent(field,
52
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
49
+ return getPConnect().createComponent(field, '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
53
50
  });
54
51
  }
55
52
 
@@ -1,27 +1,23 @@
1
- import { useState, useEffect, Fragment } from 'react';
2
- import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/react-sdk-components/lib/components/template/SubTabs/tabUtils';
3
- import React from 'react';
1
+ import { Children, PropsWithChildren, useEffect, useState } from 'react';
4
2
  import { Tab, Tabs, TextField } from '@material-ui/core';
5
3
  import { TabContext, TabPanel } from '@material-ui/lab';
6
- import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
4
 
5
+ import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/react-sdk-components/lib/components/template/SubTabs/tabUtils';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
7
 
9
8
  interface DetailsSubTabsProps extends PConnProps {
10
9
  // If any, enter additional props that only exist on this component
11
- children: Array<any>,
12
- showLabel: boolean,
13
- label: string
14
-
10
+ showLabel: boolean;
11
+ label: string;
15
12
  }
16
13
 
17
-
18
- export default function DetailsSubTabs(props: DetailsSubTabsProps) {
14
+ export default function DetailsSubTabs(props: PropsWithChildren<DetailsSubTabsProps>) {
19
15
  const { children = [], label, showLabel = true, getPConnect } = props;
20
16
  // Get the inherited props from the parent to determine label settings
21
17
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
22
18
 
23
19
  const defaultTabIndex = 0;
24
- const deferLoadedTabs = children[0];
20
+ const deferLoadedTabs = Children.toArray(children)[0];
25
21
  let availableTabs = [];
26
22
 
27
23
  useEffect(() => {
@@ -42,7 +38,7 @@ export default function DetailsSubTabs(props: DetailsSubTabsProps) {
42
38
  };
43
39
 
44
40
  return (
45
- <Fragment>
41
+ <>
46
42
  {propsToUse.showLabel && <TextField>{propsToUse.label}</TextField>}
47
43
  <TabContext value={currentTabId.toString()}>
48
44
  <Tabs onChange={handleTabClick} value={currentTabId}>
@@ -57,6 +53,6 @@ export default function DetailsSubTabs(props: DetailsSubTabsProps) {
57
53
  </TabPanel>
58
54
  ))}
59
55
  </TabContext>
60
- </Fragment>
56
+ </>
61
57
  );
62
58
  }
@@ -4,6 +4,5 @@
4
4
  "description": "Details (Sub tabs)",
5
5
  "type": "Template",
6
6
  "subtype": "DETAILS",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,20 +1,18 @@
1
- import React, { createElement } from 'react';
1
+ import { createElement } from 'react';
2
2
  import Grid from '@material-ui/core/Grid';
3
+
3
4
  import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
4
5
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
+ import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
7
 
6
- // import type { PConnProps } from '../../../../types/PConnProps';
7
-
8
- // Can't use PConnProps until getPConnect().getChildren() type is ok
9
- // interface DetailsThreeColumnProps extends PConnProps {
10
- // // If any, enter additional props that only exist on this component
11
- // showLabel: boolean,
12
- // label: string,
13
- // showHighlightedData: boolean
14
- // }
15
-
8
+ interface DetailsThreeColumnProps extends PConnProps {
9
+ // If any, enter additional props that only exist on this component
10
+ showLabel: boolean;
11
+ label: string;
12
+ showHighlightedData: boolean;
13
+ }
16
14
 
17
- export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */) {
15
+ export default function DetailsThreeColumn(props: DetailsThreeColumnProps) {
18
16
  // Get emitted components from map (so we can get any override that may exist)
19
17
  const FieldGroup = getComponentFromMap('FieldGroup');
20
18
 
@@ -27,20 +25,18 @@ export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */
27
25
  // in a readonly (display) mode instead of a editable
28
26
  getPConnect().setInheritedProp('displayMode', 'LABELS_LEFT');
29
27
  getPConnect().setInheritedProp('readOnly', true);
30
- const children = getPConnect()
31
- .getChildren()
32
- .map((configObject, index) =>
33
- createElement(createPConnectComponent(), {
34
- ...configObject,
35
- // eslint-disable-next-line react/no-array-index-key
36
- key: index.toString()
37
- })
38
- );
28
+ const children = (getPConnect().getChildren() as any[]).map((configObject, index) =>
29
+ createElement(createPConnectComponent(), {
30
+ ...configObject,
31
+ // eslint-disable-next-line react/no-array-index-key
32
+ key: index.toString()
33
+ })
34
+ );
39
35
 
40
36
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
41
37
  let highlightedDataArr = [];
42
38
  if (showHighlightedData) {
43
- const { highlightedData = [] } = getPConnect().getRawMetadata().config;
39
+ const { highlightedData = [] } = (getPConnect().getRawMetadata() as any).config;
44
40
  highlightedDataArr = highlightedData.map(field => {
45
41
  field.config.displayMode = 'STACKED_LARGE_VAL';
46
42
 
@@ -50,8 +46,7 @@ export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */
50
46
  field.config.displayAsStatus = true;
51
47
  }
52
48
 
53
- return getPConnect().createComponent(field,
54
- '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
49
+ return getPConnect().createComponent(field, '', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
55
50
  });
56
51
  }
57
52
 
@@ -4,6 +4,5 @@
4
4
  "description": "Details (Three column)",
5
5
  "type": "Template",
6
6
  "subtype": "DETAILS",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }