@pega/react-sdk-overrides 8.23.11 → 23.1.11

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 (233) 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 +12 -16
  5. package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
  6. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  7. package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
  8. package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
  9. package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
  10. package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
  11. package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +14 -11
  12. package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
  13. package/lib/designSystemExtension/Operator/Operator.tsx +100 -84
  14. package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
  15. package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
  16. package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
  17. package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
  18. package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
  19. package/lib/field/AutoComplete/config-ext.json +2 -3
  20. package/lib/field/CancelAlert/CancelAlert.tsx +100 -81
  21. package/lib/field/CancelAlert/index.tsx +1 -1
  22. package/lib/field/Checkbox/Checkbox.tsx +27 -16
  23. package/lib/field/Checkbox/config-ext.json +2 -3
  24. package/lib/field/Currency/Currency.tsx +30 -47
  25. package/lib/field/Currency/config-ext.json +2 -3
  26. package/lib/field/Currency/currency-utils.ts +10 -21
  27. package/lib/field/Date/Date.tsx +24 -13
  28. package/lib/field/Date/config-ext.json +2 -3
  29. package/lib/field/DateTime/DateTime.tsx +21 -10
  30. package/lib/field/DateTime/config-ext.json +1 -2
  31. package/lib/field/Decimal/Decimal.tsx +31 -40
  32. package/lib/field/Decimal/config-ext.json +1 -2
  33. package/lib/field/Decimal/index.tsx +1 -1
  34. package/lib/field/Dropdown/Dropdown.tsx +128 -31
  35. package/lib/field/Dropdown/config-ext.json +1 -2
  36. package/lib/field/Email/Email.tsx +16 -7
  37. package/lib/field/Email/config-ext.json +1 -2
  38. package/lib/field/Email/index.tsx +1 -1
  39. package/lib/field/Group/Group.tsx +39 -0
  40. package/lib/field/Group/config-ext.json +7 -0
  41. package/lib/field/Group/index.tsx +1 -0
  42. package/lib/field/Integer/Integer.tsx +15 -6
  43. package/lib/field/Integer/config-ext.json +1 -2
  44. package/lib/field/Percentage/Percentage.tsx +52 -39
  45. package/lib/field/Percentage/config-ext.json +1 -2
  46. package/lib/field/Phone/Phone.tsx +15 -6
  47. package/lib/field/Phone/index.tsx +1 -1
  48. package/lib/field/RadioButtons/RadioButtons.tsx +26 -34
  49. package/lib/field/RadioButtons/config-ext.json +1 -2
  50. package/lib/field/RichText/RichText.tsx +96 -0
  51. package/lib/field/RichText/index.tsx +1 -0
  52. package/lib/field/ScalarList/ScalarList.tsx +63 -0
  53. package/lib/field/ScalarList/config-ext.json +7 -0
  54. package/lib/field/ScalarList/index.tsx +1 -0
  55. package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
  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 +15 -5
  59. package/lib/field/TextArea/config-ext.json +1 -2
  60. package/lib/field/TextContent/TextContent.tsx +9 -2
  61. package/lib/field/TextContent/config-ext.json +1 -2
  62. package/lib/field/TextInput/TextInput.tsx +18 -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 +14 -19
  66. package/lib/field/Time/config-ext.json +1 -2
  67. package/lib/field/URL/URL.tsx +15 -6
  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 +52 -60
  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 +15 -10
  74. package/lib/helpers/case-utils.tsx +5 -10
  75. package/lib/helpers/common-utils.ts +6 -2
  76. package/lib/helpers/data_page.ts +3 -7
  77. package/lib/helpers/date-format-utils.ts +4 -4
  78. package/lib/helpers/event-utils.ts +4 -4
  79. package/lib/helpers/field-group-utils.ts +6 -8
  80. package/lib/helpers/formatters/Boolean.ts +9 -26
  81. package/lib/helpers/formatters/Currency.ts +22 -28
  82. package/lib/helpers/formatters/CurrencyMap.ts +512 -505
  83. package/lib/helpers/formatters/Date.ts +20 -26
  84. package/lib/helpers/formatters/common.ts +2 -7
  85. package/lib/helpers/formatters/index.ts +29 -22
  86. package/lib/helpers/reactContextHelpers.ts +2 -2
  87. package/lib/helpers/simpleTableHelpers.ts +63 -87
  88. package/lib/helpers/state-utils.tsx +5 -12
  89. package/lib/helpers/template-utils.ts +4 -10
  90. package/lib/helpers/utils.ts +5 -5
  91. package/lib/helpers/versionHelpers.ts +1 -7
  92. package/lib/infra/ActionButtons/ActionButtons.tsx +44 -45
  93. package/lib/infra/ActionButtons/index.tsx +1 -1
  94. package/lib/infra/Assignment/Assignment.tsx +102 -86
  95. package/lib/infra/Assignment/index.tsx +1 -1
  96. package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
  97. package/lib/infra/AssignmentCard/index.tsx +1 -1
  98. package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +93 -240
  99. package/lib/infra/Containers/FlowContainer/helpers.ts +34 -48
  100. package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
  101. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
  102. package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
  103. package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +229 -223
  104. package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
  105. package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
  106. package/lib/infra/Containers/SimpleView/helper.ts +125 -0
  107. package/lib/infra/Containers/SimpleView/index.tsx +1 -0
  108. package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +47 -64
  109. package/lib/infra/Containers/helpers.ts +6 -0
  110. package/lib/infra/DashboardFilter/DashboardFilter.tsx +25 -54
  111. package/lib/infra/DashboardFilter/filterUtils.tsx +12 -42
  112. package/lib/infra/DeferLoad/DeferLoad.tsx +21 -33
  113. package/lib/infra/DeferLoad/index.tsx +1 -1
  114. package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -39
  115. package/lib/infra/MultiStep/MultiStep.css +11 -15
  116. package/lib/infra/MultiStep/MultiStep.tsx +180 -216
  117. package/lib/infra/MultiStep/index.tsx +1 -1
  118. package/lib/infra/NavBar/NavBar.css +103 -105
  119. package/lib/infra/NavBar/NavBar.tsx +26 -45
  120. package/lib/infra/Reference/Reference.tsx +16 -22
  121. package/lib/infra/Region/Region.tsx +9 -9
  122. package/lib/infra/RootContainer/RootContainer.tsx +75 -120
  123. package/lib/infra/RootContainer/index.tsx +1 -1
  124. package/lib/infra/Stages/Stages.tsx +36 -41
  125. package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
  126. package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
  127. package/lib/infra/View/View.tsx +25 -29
  128. package/lib/template/AppShell/AppShell.css +22 -23
  129. package/lib/template/AppShell/AppShell.tsx +47 -71
  130. package/lib/template/BannerPage/BannerPage.tsx +26 -33
  131. package/lib/template/CaseSummary/CaseSummary.tsx +66 -19
  132. package/lib/template/CaseSummary/config-ext.json +1 -2
  133. package/lib/template/CaseView/CaseView.tsx +44 -74
  134. package/lib/template/CaseView/config-ext.json +1 -2
  135. package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +66 -31
  136. package/lib/template/Confirmation/Confirmation.tsx +24 -55
  137. package/lib/template/Confirmation/config-ext.json +1 -2
  138. package/lib/template/DataReference/DataReference.tsx +112 -142
  139. package/lib/template/DataReference/config-ext.json +1 -2
  140. package/lib/template/DefaultForm/DefaultForm.css +7 -3
  141. package/lib/template/DefaultForm/DefaultForm.tsx +15 -16
  142. package/lib/template/DefaultForm/config-ext.json +1 -2
  143. package/lib/template/Details/Details/Details.tsx +24 -28
  144. package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
  145. package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
  146. package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
  147. package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
  148. package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
  149. package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
  150. package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
  151. package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  152. package/lib/template/Details/DynamicTabs/config.json +36 -0
  153. package/lib/template/Details/DynamicTabs/index.tsx +1 -0
  154. package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +22 -35
  155. package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
  156. package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
  157. package/lib/template/ListPage/ListPage.tsx +12 -16
  158. package/lib/template/ListPage/config-ext.json +1 -2
  159. package/lib/template/ListView/DefaultViewMeta.ts +1 -3
  160. package/lib/template/ListView/ListView.tsx +247 -309
  161. package/lib/template/ListView/config-ext.json +1 -2
  162. package/lib/template/ListView/hooks.ts +24 -26
  163. package/lib/template/ListView/utils.ts +205 -94
  164. package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -34
  165. package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
  166. package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
  167. package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
  168. package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
  169. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
  170. package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
  171. package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
  172. package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
  173. package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
  174. package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
  175. package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
  176. package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
  177. package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
  178. package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
  179. package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
  180. package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
  181. package/lib/template/PromotedFilters/PromotedFilters.tsx +39 -33
  182. package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +113 -15
  183. package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
  184. package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -104
  185. package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -44
  186. package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
  187. package/lib/template/SubTabs/SubTabs.tsx +26 -45
  188. package/lib/template/SubTabs/config-ext.json +1 -2
  189. package/lib/template/SubTabs/tabUtils.ts +2 -9
  190. package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
  191. package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
  192. package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
  193. package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
  194. package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
  195. package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
  196. package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
  197. package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
  198. package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
  199. package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
  200. package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
  201. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
  202. package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
  203. package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
  204. package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
  205. package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
  206. package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
  207. package/lib/template/WssNavBar/WssNavBar.tsx +24 -10
  208. package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
  209. package/lib/widget/AppAnnouncement/config-ext.json +1 -2
  210. package/lib/widget/Attachment/Attachment.css +60 -1
  211. package/lib/widget/Attachment/Attachment.tsx +379 -394
  212. package/lib/widget/Attachment/index.tsx +1 -1
  213. package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
  214. package/lib/widget/CaseHistory/config-ext.json +1 -2
  215. package/lib/widget/CaseHistory/index.tsx +1 -1
  216. package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
  217. package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
  218. package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +322 -245
  219. package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
  220. package/lib/widget/Followers/Followers.tsx +27 -25
  221. package/lib/widget/Followers/config-ext.json +1 -2
  222. package/lib/widget/QuickCreate/QuickCreate.tsx +71 -39
  223. package/lib/widget/SummaryItem/SummaryItem.css +9 -9
  224. package/lib/widget/SummaryItem/SummaryItem.tsx +62 -52
  225. package/lib/widget/SummaryItem/index.tsx +1 -1
  226. package/lib/widget/SummaryList/SummaryList.tsx +15 -4
  227. package/lib/widget/ToDo/ToDo.css +4 -4
  228. package/lib/widget/ToDo/ToDo.tsx +72 -116
  229. package/lib/widget/ToDo/config-ext.json +1 -2
  230. package/package.json +5 -2
  231. package/lib/helpers/auth.js +0 -483
  232. package/lib/helpers/authManager.js +0 -634
  233. package/lib/helpers/config_access.js +0 -259
@@ -1,21 +1,18 @@
1
- import dayjs from "dayjs";
2
- import relativeTime from "dayjs/plugin/relativeTime";
3
- import localizedFormat from "dayjs/plugin/localizedFormat";
4
- import utc from "dayjs/plugin/utc";
5
- import tzone from "dayjs/plugin/timezone";
1
+ import dayjs from 'dayjs';
2
+ import relativeTime from 'dayjs/plugin/relativeTime';
3
+ import localizedFormat from 'dayjs/plugin/localizedFormat';
4
+ import utc from 'dayjs/plugin/utc';
5
+ import tzone from 'dayjs/plugin/timezone';
6
6
 
7
7
  dayjs.extend(relativeTime);
8
8
  dayjs.extend(localizedFormat);
9
9
  dayjs.extend(utc);
10
10
  dayjs.extend(tzone);
11
11
 
12
- const types = ["fromNow", "customFormat"];
12
+ const types = ['fromNow', 'customFormat'];
13
13
 
14
14
  // value should be in ISO 8601 format.
15
- function DateFormatter(
16
- value,
17
- { type = types[1], format = "DD/MM/YYYY", timezone = "America/New_York" } = {}
18
- ) {
15
+ function DateFormatter(value: string, { type = types[1], format = 'DD/MM/YYYY', timezone = 'America/New_York' } = {}) {
19
16
  if (!value) return value;
20
17
  switch (type) {
21
18
  case types[1]:
@@ -30,7 +27,7 @@ function DateFormatter(
30
27
  // value should be in hh:mm:ss format (00:00:00 - 23:59:59).
31
28
  function TimeFormatter(value, options) {
32
29
  if (!value) return value;
33
- const { locale = "en-US" } = options;
30
+ const { locale = 'en-US' } = options;
34
31
  const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/;
35
32
  if (value.length === 8 && timeOnlyRegex.test(value)) {
36
33
  const tempDate = new Date();
@@ -46,32 +43,29 @@ function TimeFormatter(value, options) {
46
43
  }
47
44
 
48
45
  export default {
49
- "DateTime-Long": (value, options) =>
50
- DateFormatter(value, { ...options, type: "customFormat", format: "LLL" }),
51
- "DateTime-Short": (value, options) =>
46
+ 'DateTime-Long': (value, options) => DateFormatter(value, { ...options, type: 'customFormat', format: 'LLL' }),
47
+ 'DateTime-Short': (value, options) =>
52
48
  DateFormatter(value, {
53
49
  ...options,
54
- type: "customFormat",
55
- format: "MMM DD, YYYY"
50
+ type: 'customFormat',
51
+ format: 'MMM DD, YYYY'
56
52
  }),
57
- "DateTime-Since": (value) => DateFormatter(value, { type: "fromNow" }),
58
- "Time-Only": (value, options) =>
53
+ 'DateTime-Since': value => DateFormatter(value, { type: 'fromNow' }),
54
+ 'Time-Only': (value, options) =>
59
55
  TimeFormatter(value, {
60
56
  ...options,
61
- type: "customFormat",
62
- format: "hh:mm:ss A"
57
+ type: 'customFormat',
58
+ format: 'hh:mm:ss A'
63
59
  }),
64
60
  convertToTimezone: (value, options) => {
65
61
  return value && options && options.timezone
66
62
  ? DateFormatter(value, {
67
63
  ...options,
68
- type: "customFormat",
69
- format: "YYYY-MM-DDTHH:mm:ss"
64
+ type: 'customFormat',
65
+ format: 'YYYY-MM-DDTHH:mm:ss'
70
66
  })
71
67
  : value;
72
68
  },
73
- convertFromTimezone: (value, timezone) =>
74
- value && timezone ? dayjs.tz(value, timezone).utc().format() : value,
75
- Date: (value, options) =>
76
- DateFormatter(value, { type: "customFormat", ...options })
69
+ convertFromTimezone: (value, timezone) => (value && timezone ? dayjs.tz(value, timezone).utc().format() : value),
70
+ Date: (value, options) => DateFormatter(value, { type: 'customFormat', ...options })
77
71
  };
@@ -1,9 +1,4 @@
1
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
2
-
3
- declare const PCore: typeof PCoreType;
4
-
5
-
6
- export function getLocale(locale='') {
1
+ export function getLocale(locale: string = '') {
7
2
  // use locale if specified
8
3
  if (locale) return locale;
9
4
  // otherwise, use operator locale if it's defined
@@ -12,7 +7,7 @@ export function getLocale(locale='') {
12
7
  return Intl.DateTimeFormat().resolvedOptions().locale;
13
8
  }
14
9
 
15
- export function getCurrentTimezone(timezone="America/New_York") {
10
+ export function getCurrentTimezone(timezone: string = 'America/New_York') {
16
11
  if (timezone) return timezone;
17
12
  return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
18
13
  }
@@ -1,7 +1,7 @@
1
- import Boolean from "./Boolean";
2
- import Currency from "./Currency";
3
- import DateFormatter from "./Date";
4
- import { getCurrentTimezone, getLocale } from "./common";
1
+ import Boolean from './Boolean';
2
+ import Currency from './Currency';
3
+ import DateFormatter from './Date';
4
+ import { getCurrentTimezone, getLocale } from './common';
5
5
 
6
6
  export default {
7
7
  ...Boolean,
@@ -9,10 +9,10 @@ export default {
9
9
  ...DateFormatter
10
10
  };
11
11
 
12
- function getDateObject(text) {
12
+ function getDateObject(text): Date {
13
13
  // TODO - cleanup formatters util functions as DX APIs are returning values per ISO std now.
14
- const timeStamp = text.replace(/-/g, "");
15
- const isDateTime = timeStamp.indexOf("GMT") !== -1;
14
+ const timeStamp = text.replace(/-/g, '');
15
+ const isDateTime = timeStamp.indexOf('GMT') !== -1;
16
16
  const year = parseInt(timeStamp.substr(0, 4), 10);
17
17
  const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
18
18
  const day = parseInt(timeStamp.substr(6, 2), 10);
@@ -44,7 +44,7 @@ function isIsoDate(str) {
44
44
  }
45
45
 
46
46
  function parseDateInISO(value) {
47
- const isMilliSeconds = new RegExp("^[0-9]+$").exec(value);
47
+ const isMilliSeconds = /^[0-9]+$/.exec(value);
48
48
  if (isMilliSeconds) {
49
49
  const date = new Date(parseInt(value, 10));
50
50
  return date.toISOString();
@@ -58,14 +58,14 @@ function parseDateInISO(value) {
58
58
  return value ? getDateObject(value).toISOString() : value;
59
59
  }
60
60
 
61
- export function format(value, type, options = {}) {
62
- let formattedValue;
61
+ export function format(value, type, options = {}): string {
62
+ let formattedValue: string;
63
63
 
64
64
  switch (type?.toLowerCase()) {
65
- case "currency": {
65
+ case 'currency': {
66
66
  const defaultOptions = {
67
67
  locale: getLocale(),
68
- position: "before",
68
+ position: 'before',
69
69
  decPlaces: 2
70
70
  };
71
71
  const params = { ...defaultOptions, ...options };
@@ -73,23 +73,30 @@ export function format(value, type, options = {}) {
73
73
  break;
74
74
  }
75
75
 
76
- case "decimal": {
76
+ case 'decimal': {
77
77
  const defaultOptions = { locale: getLocale(), decPlaces: 2 };
78
78
  const params = { ...defaultOptions, ...options };
79
79
  formattedValue = Currency.Decimal(value, params);
80
80
  break;
81
81
  }
82
82
 
83
- case "integer": {
83
+ case 'percentage': {
84
+ const defaultOptions = { locale: getLocale(), decPlaces: 2 };
85
+ const params = { ...defaultOptions, ...options };
86
+ formattedValue = Currency.Percentage(value, params);
87
+ break;
88
+ }
89
+
90
+ case 'integer': {
84
91
  const defaultOptions = { locale: getLocale() };
85
92
  const params = { ...defaultOptions, ...options };
86
93
  formattedValue = Currency.Integer(value, params);
87
94
  break;
88
95
  }
89
96
 
90
- case "date": {
97
+ case 'date': {
91
98
  const defaultOptions = {
92
- format: "MMM DD, YYYY",
99
+ format: 'MMM DD, YYYY',
93
100
  timezone: getCurrentTimezone()
94
101
  };
95
102
  const params = { ...defaultOptions, ...options };
@@ -97,9 +104,9 @@ export function format(value, type, options = {}) {
97
104
  break;
98
105
  }
99
106
 
100
- case "datetime": {
107
+ case 'datetime': {
101
108
  const defaultOptions = {
102
- format: "MMM DD, YYYY h:mm A",
109
+ format: 'MMM DD, YYYY h:mm A',
103
110
  timezone: getCurrentTimezone()
104
111
  };
105
112
  const params = { ...defaultOptions, ...options };
@@ -107,13 +114,13 @@ export function format(value, type, options = {}) {
107
114
  break;
108
115
  }
109
116
 
110
- case "boolean":
111
- case "checkbox": {
112
- formattedValue = Boolean.TrueFalse(value, { allowEmpty: false });
117
+ case 'boolean':
118
+ case 'checkbox': {
119
+ formattedValue = Boolean.TrueFalse(value, { allowEmpty: false, ...options });
113
120
  break;
114
121
  }
115
122
 
116
- case "userreference": {
123
+ case 'userreference': {
117
124
  formattedValue = value.userName;
118
125
  break;
119
126
  }
@@ -1,4 +1,4 @@
1
- import { createContext, useContext } from "react";
1
+ import { createContext, useContext } from 'react';
2
2
 
3
3
  // This file contains a shared access point for any React contexts that may need to be
4
4
  // defined/used across various components.
@@ -6,5 +6,5 @@ import { createContext, useContext } from "react";
6
6
  // For example, the AppShell wants to use a NavContext that interacts with
7
7
  // that context's consumption in the NavBar to handle clicks for opening/closing
8
8
  // aspects of the NavBar
9
- export const NavContext = createContext({open: false, setOpen: f => f});
9
+ export const NavContext = createContext({ open: false, setOpen: f => f });
10
10
  export const useNavBar = () => useContext(NavContext);
@@ -1,40 +1,36 @@
1
1
  import { Utils } from './utils';
2
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
3
2
 
4
- declare const PCore: typeof PCoreType;
5
-
6
-
7
- export const TABLE_CELL = "SdkRenderer";
8
- export const DELETE_ICON = "DeleteIcon";
3
+ export const TABLE_CELL = 'SdkRenderer';
4
+ export const DELETE_ICON = 'DeleteIcon';
9
5
 
10
6
  // BUG-615253: Workaround for autosize in table with lazy loading components
11
7
  /* istanbul ignore next */
12
8
  function getFieldWidth(field, label) {
13
- let width;
9
+ let width: number;
14
10
  switch (field.type) {
15
- case "Time":
11
+ case 'Time':
16
12
  width = 150;
17
13
  break;
18
- case "Date":
14
+ case 'Date':
19
15
  width = 160;
20
16
  break;
21
- case "DateTime":
17
+ case 'DateTime':
22
18
  width = 205;
23
19
  break;
24
- case "AutoComplete":
25
- case "TextArea":
20
+ case 'AutoComplete':
21
+ case 'TextArea':
26
22
  width = 190;
27
23
  break;
28
- case "Currency":
29
- case "TextInput":
24
+ case 'Currency':
25
+ case 'TextInput':
30
26
  width = 182;
31
27
  break;
32
- case "Checkbox":
28
+ case 'Checkbox':
33
29
  // eslint-disable-next-line no-case-declarations
34
- const text = document.createElement("span");
30
+ const text = document.createElement('span');
35
31
  document.body.appendChild(text);
36
- text.style.fontSize = "13px";
37
- text.style.position = "absolute";
32
+ text.style.fontSize = '13px';
33
+ text.style.position = 'absolute';
38
34
  text.innerHTML = label;
39
35
  width = Math.ceil(text.clientWidth) + 30;
40
36
  document.body.removeChild(text);
@@ -45,19 +41,18 @@ function getFieldWidth(field, label) {
45
41
  return width;
46
42
  }
47
43
 
48
- export const getContext = (thePConn) => {
44
+ export const getContext = thePConn => {
49
45
  const contextName = thePConn.getContextName();
50
46
  const pageReference = thePConn.getPageReference();
51
- let { referenceList } = thePConn.getStateProps().config;
52
- const pageReferenceForRows = referenceList.startsWith(".")
53
- ? `${pageReference}.${referenceList.substring(1)}`
54
- : referenceList;
47
+ const { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
48
+ const pageReferenceForRows = referenceList.startsWith('.') ? `${pageReference}.${referenceList.substring(1)}` : referenceList;
55
49
 
56
50
  // removing "caseInfo.content" prefix to avoid setting it as a target while preparing pageInstructions
57
- referenceList = pageReferenceForRows.replace(
58
- PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT,
59
- ""
60
- );
51
+ // skipping the removal as StateMachine itself is removing this case info prefix while preparing pageInstructions
52
+ // referenceList = pageReferenceForRows.replace(
53
+ // PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT,
54
+ // ""
55
+ // );
61
56
 
62
57
  return {
63
58
  contextName,
@@ -66,8 +61,8 @@ export const getContext = (thePConn) => {
66
61
  };
67
62
  };
68
63
 
69
- export const populateRowKey = (rawData) => {
70
- return rawData.map((row, index) => {
64
+ export const populateRowKey = rawData => {
65
+ return rawData.map((row: any, index: number) => {
71
66
  return { ...row, index };
72
67
  });
73
68
  };
@@ -75,7 +70,7 @@ export const populateRowKey = (rawData) => {
75
70
  export const getApiContext = (processedData, pConnect, reorderCB) => {
76
71
  return {
77
72
  fetchData: () => {
78
- return new Promise((resolve) => {
73
+ return new Promise(resolve => {
79
74
  resolve({
80
75
  data: processedData,
81
76
  filteredRecordCount: processedData.length,
@@ -89,24 +84,12 @@ export const getApiContext = (processedData, pConnect, reorderCB) => {
89
84
  applyRowReorder: (sourceKey, destinationKey) => {
90
85
  // indexes are keys for simple table so, it should work.
91
86
  reorderCB();
92
- return Promise.resolve(
93
- pConnect
94
- .getListActions()
95
- .reorder(parseInt(sourceKey, 10), parseInt(destinationKey, 10))
96
- );
87
+ return Promise.resolve(pConnect.getListActions().reorder(parseInt(sourceKey, 10), parseInt(destinationKey, 10)));
97
88
  }
98
89
  };
99
90
  };
100
91
 
101
- export const buildMetaForListView = (
102
- fieldMetadata,
103
- fields,
104
- type,
105
- ruleClass,
106
- name,
107
- propertyLabel,
108
- parameters
109
- ) => {
92
+ export const buildMetaForListView = (fieldMetadata, fields, type, ruleClass, name, propertyLabel, isDataObject, parameters) => {
110
93
  return {
111
94
  name,
112
95
  config: {
@@ -114,26 +97,28 @@ export const buildMetaForListView = (
114
97
  referenceList: fieldMetadata.datasource.name,
115
98
  parameters: parameters ?? fieldMetadata.datasource.parameters,
116
99
  personalization: false,
100
+ isDataObject,
117
101
  grouping: true,
118
102
  globalSearch: true,
119
103
  reorderFields: true,
120
104
  toggleFieldVisibility: true,
121
- personalizationId: "" /* TODO */,
122
- template: "ListView",
105
+ title: propertyLabel,
106
+ personalizationId: '' /* TODO */,
107
+ template: 'ListView',
123
108
  presets: [
124
109
  {
125
- name: "presets",
126
- template: "Table",
110
+ name: 'presets',
111
+ template: 'Table',
127
112
  config: {},
128
113
  children: [
129
114
  {
130
- name: "Columns",
131
- type: "Region",
115
+ name: 'Columns',
116
+ type: 'Region',
132
117
  children: fields
133
118
  }
134
119
  ],
135
120
  label: propertyLabel,
136
- id: "P_" /* TODO */
121
+ id: 'P_' /* TODO */
137
122
  }
138
123
  ],
139
124
  ruleClass
@@ -144,10 +129,10 @@ export const buildMetaForListView = (
144
129
  export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
145
130
  const fieldDefs = configFields.map((field, index) => {
146
131
  return {
147
- type: "text",
132
+ type: 'text',
148
133
  label: fields[index].config.label || fields[index].config.caption,
149
134
  fillAvailableSpace: !!field.config.fillAvailableSpace,
150
- id: index,
135
+ id: `${index}`,
151
136
  name: field.config.value.substr(4),
152
137
  cellRenderer: TABLE_CELL,
153
138
  sort: false,
@@ -164,7 +149,7 @@ export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
164
149
  // ONLY add DELETE_ICON to fields when the table is requested as EDITABLE
165
150
  if (showDeleteButton) {
166
151
  fieldDefs.push({
167
- type: "text",
152
+ type: 'text',
168
153
  id: fieldDefs.length,
169
154
  cellRenderer: DELETE_ICON,
170
155
  sort: false,
@@ -181,17 +166,17 @@ export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
181
166
  export const createMetaForTable = (fields, renderMode) => {
182
167
  return {
183
168
  height: {
184
- minHeight: "auto",
185
- fitHeightToElement: "fitHeightToElement",
186
- deltaAdjustment: "deltaAdjustment",
169
+ minHeight: 'auto',
170
+ fitHeightToElement: 'fitHeightToElement',
171
+ deltaAdjustment: 'deltaAdjustment',
187
172
  autoSize: true
188
173
  },
189
174
  fieldDefs: fields,
190
- itemKey: "index",
175
+ itemKey: 'index',
191
176
  grouping: false,
192
177
  reorderFields: false,
193
- reorderItems: renderMode === "Editable",
194
- dragHandle: renderMode === "Editable",
178
+ reorderItems: renderMode === 'Editable',
179
+ dragHandle: renderMode === 'Editable',
195
180
  globalSearch: false,
196
181
  personalization: false,
197
182
  toggleFieldVisibility: false,
@@ -209,7 +194,7 @@ export const createMetaForTable = (fields, renderMode) => {
209
194
  * @param {number} index - index of the page list to add
210
195
  */
211
196
  export const getAddRowCallback = (pConnect, index) => {
212
- return () => pConnect.getListActions().insert({}, index);
197
+ return () => pConnect.getListActions().insert({}, index, ''); // 3rd arg null until typedef marked correctly as optional
213
198
  };
214
199
 
215
200
  /**
@@ -232,17 +217,13 @@ export function createPConnect(contextName, referenceList, pageReference): any {
232
217
  const { getPConnect } = PCore.createPConnect(config);
233
218
 
234
219
  return getPConnect();
235
- };
220
+ }
236
221
 
237
- export const filterData = (filterByColumns) => {
222
+ export const filterData = filterByColumns => {
238
223
  return function filteringData(item) {
239
224
  let bKeep = true;
240
225
  for (const filterObj of filterByColumns) {
241
- if (
242
- filterObj.containsFilterValue !== '' ||
243
- filterObj.containsFilter === 'null' ||
244
- filterObj.containsFilter === 'notnull'
245
- ) {
226
+ if (filterObj.containsFilterValue !== '' || filterObj.containsFilter === 'null' || filterObj.containsFilter === 'notnull') {
246
227
  let value: any;
247
228
  let filterValue: any;
248
229
 
@@ -250,14 +231,9 @@ export const filterData = (filterByColumns) => {
250
231
  case 'Date':
251
232
  case 'DateTime':
252
233
  case 'Time':
253
- value =
254
- item[filterObj.ref] !== null ?? item[filterObj.ref] !== ''
255
- ? Utils.getSeconds(item[filterObj.ref])
256
- : null;
234
+ value = item[filterObj.ref] !== null ?? item[filterObj.ref] !== '' ? Utils.getSeconds(item[filterObj.ref]) : null;
257
235
  filterValue =
258
- filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== ''
259
- ? Utils.getSeconds(filterObj.containsFilterValue)
260
- : null;
236
+ filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== '' ? Utils.getSeconds(filterObj.containsFilterValue) : null;
261
237
 
262
238
  // eslint-disable-next-line sonarjs/no-nested-switch
263
239
  switch (filterObj.containsFilter) {
@@ -278,20 +254,20 @@ export const filterData = (filterByColumns) => {
278
254
  break;
279
255
 
280
256
  case 'equal':
281
- // becasue filterValue is in minutes, need to have a range of less than 60 secons
257
+ // becasue filterValue is in minutes, need to have a range of less than 60 secons
282
258
 
283
- if (value !== null && filterValue !== null) {
284
- // get rid of milliseconds
285
- value /= 1000;
286
- filterValue /= 1000;
259
+ if (value !== null && filterValue !== null) {
260
+ // get rid of milliseconds
261
+ value /= 1000;
262
+ filterValue /= 1000;
287
263
 
288
- const diff = value - filterValue;
289
- if (diff !== 0) {
290
- bKeep = false;
291
- }
264
+ const diff = value - filterValue;
265
+ if (diff !== 0) {
266
+ bKeep = false;
292
267
  }
268
+ }
293
269
 
294
- break;
270
+ break;
295
271
 
296
272
  case 'after':
297
273
  if (value < filterValue) {
@@ -360,5 +336,5 @@ export const filterData = (filterByColumns) => {
360
336
  }
361
337
  }
362
338
  return bKeep;
363
- }
364
- }
339
+ };
340
+ };
@@ -1,10 +1,7 @@
1
- import React, { useContext } from 'react';
1
+ import { useContext } from 'react';
2
2
  import { connect, Provider, shallowEqual } from 'react-redux';
3
- import ReactReduxContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
4
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
5
-
6
- declare const PCore: typeof PCoreType;
7
3
 
4
+ import ReactReduxContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
8
5
 
9
6
  const connectToState = (mapStateToProps = () => {}) => {
10
7
  return (Component: any) => {
@@ -18,19 +15,15 @@ const connectToState = (mapStateToProps = () => {}) => {
18
15
  // Compare start props
19
16
  const c11nEnv = next.getPConnect();
20
17
  const allStateProps = c11nEnv.getStateProps();
21
- for (const key in allStateProps) {
22
- if (
23
- !shallowEqual(next[key], prev[key]) ||
24
- (next.routingInfo && !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
25
- ) {
18
+ for (const key of Object.keys(allStateProps)) {
19
+ if (!shallowEqual(next[key], prev[key]) || (next.routingInfo && !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))) {
26
20
  return false;
27
21
  }
28
22
  }
29
23
  /* TODO For some rawConfig we are not getting routingInfo under allStateProps */
30
24
  return !(
31
25
  'routingInfo' in next &&
32
- (!shallowEqual(next.routingInfo, prev.routingInfo) ||
33
- !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
26
+ (!shallowEqual(next.routingInfo, prev.routingInfo) || !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
34
27
  );
35
28
  }
36
29
  })(Component);
@@ -1,12 +1,8 @@
1
1
  // This file is adapted from React DX components/template/utils.js
2
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
3
-
4
- declare const PCore: typeof PCoreType;
5
-
6
2
 
7
3
  export function getAllFields(pConnect: any) {
8
4
  const metadata = pConnect.getRawMetadata();
9
- let allFields = [];
5
+ let allFields: any[] = [];
10
6
  if (metadata.children && metadata.children.map) {
11
7
  allFields = metadata.children.map(fields => {
12
8
  const children = fields.children instanceof Array ? fields.children : [];
@@ -16,7 +12,7 @@ export function getAllFields(pConnect: any) {
16
12
  return allFields;
17
13
  }
18
14
 
19
- export function filterForFieldValueList(fields: any) {
15
+ export function filterForFieldValueList(fields: any[]) {
20
16
  return fields
21
17
  .filter(({ visibility }) => visibility !== false)
22
18
  .map(({ value, label }) => ({
@@ -49,10 +45,8 @@ export function getIsAssignmentView(pConnect) {
49
45
  * @param {Function} pConnect PConnect object for the component
50
46
  * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
51
47
  */
52
- export function getInstructions(pConnect, instructions = 'casestep') {
53
- const caseStepInstructions =
54
- PCore.getConstants().CASE_INFO.INSTRUCTIONS &&
55
- pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
48
+ export function getInstructions(pConnect, instructions: string = 'casestep'): string | undefined {
49
+ const caseStepInstructions = PCore.getConstants().CASE_INFO.INSTRUCTIONS && pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
56
50
 
57
51
  // Determine if this view is the current assignment/step view
58
52
  const isCurrentAssignmentView = getIsAssignmentView(pConnect);
@@ -2,14 +2,14 @@ import dayjs from 'dayjs';
2
2
  import customParseFormat from 'dayjs/plugin/customParseFormat';
3
3
  import localizedFormat from 'dayjs/plugin/localizedFormat';
4
4
  import relativeTime from 'dayjs/plugin/relativeTime';
5
- import { SdkConfigAccess } from './config_access';
5
+ import { SdkConfigAccess } from '@pega/auth/lib/sdk-auth-manager';
6
6
 
7
7
  dayjs.extend(customParseFormat);
8
8
  dayjs.extend(localizedFormat);
9
9
  dayjs.extend(relativeTime);
10
10
 
11
11
  export class Utils {
12
- static lastControlID: number = 0;
12
+ static lastControlID = 0;
13
13
 
14
14
  static getSDKStaticConentUrl() {
15
15
  const sdkConfigServer = SdkConfigAccess.getSdkConfigServer();
@@ -30,9 +30,9 @@ export class Utils {
30
30
  return sPrefix + this.lastControlID.toString();
31
31
  }
32
32
 
33
- static getOptionList(configProps: any, dataObject: any): Array<any> {
33
+ static getOptionList(configProps: any, dataObject: any): any[] {
34
34
  const listType = configProps.listType;
35
- let arReturn: Array<any> = [];
35
+ let arReturn: any[] = [];
36
36
 
37
37
  if (listType) {
38
38
  switch (listType.toLowerCase()) {
@@ -47,7 +47,7 @@ export class Utils {
47
47
  // get data page
48
48
  // eslint-disable-next-line no-case-declarations
49
49
  const dataPage = configProps.datasource;
50
- if (dataObject[dataPage]) {
50
+ if (typeof dataPage === 'string' && dataObject[dataPage]) {
51
51
  // eslint-disable-next-line no-alert
52
52
  alert('need to handle data page');
53
53
  } else {
@@ -4,18 +4,12 @@
4
4
  * Container helper functions that can identify which version of
5
5
  * PCore/PConnect is being run
6
6
  */
7
- import PCoreType from '@pega/pcore-pconnect-typedefs/types/pcore';
8
7
 
9
- declare const PCore: typeof PCoreType;
10
-
11
-
12
- export const sdkVersion = "8.7";
8
+ export const sdkVersion = '8.7';
13
9
 
14
10
  export function compareSdkPCoreVersions() {
15
-
16
11
  // const theConstellationVersion = PCore.getPCoreVersion();
17
12
 
18
13
  // eslint-disable-next-line no-console
19
14
  console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
20
-
21
15
  }