@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,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: string,
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,4 +1,3 @@
1
-
2
1
  export function getLocale(locale: string = '') {
3
2
  // use locale if specified
4
3
  if (locale) return locale;
@@ -8,7 +7,7 @@ export function getLocale(locale: string = '') {
8
7
  return Intl.DateTimeFormat().resolvedOptions().locale;
9
8
  }
10
9
 
11
- export function getCurrentTimezone(timezone: string = "America/New_York" ) {
10
+ export function getCurrentTimezone(timezone: string = 'America/New_York') {
12
11
  if (timezone) return timezone;
13
12
  return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
14
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,
@@ -11,8 +11,8 @@ export default {
11
11
 
12
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();
@@ -62,10 +62,10 @@ export function format(value, type, options = {}): string {
62
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 = {}): string {
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 = {}): string {
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 = {}): string {
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
  }
@@ -0,0 +1,38 @@
1
+ const isSelfReferencedProperty = (param, referenceProp) => {
2
+ const [, parentPropName] = param.split('.');
3
+ const referencePropParent = referenceProp?.split('.').pop();
4
+ return parentPropName === referencePropParent;
5
+ };
6
+
7
+ const updateNewInstuctions = (c11nEnv, selectionList) => {
8
+ const { datasource: { parameters = {} } = {} } = c11nEnv.getFieldMetadata(selectionList) || {};
9
+ const compositeKeys: any = [];
10
+ Object.values(parameters).forEach((param: any) => {
11
+ if (isSelfReferencedProperty(param, selectionList)) compositeKeys.push(param.substring(param.lastIndexOf('.') + 1));
12
+ });
13
+ c11nEnv.getListActions().initDefaultPageInstructions(selectionList, compositeKeys);
14
+ };
15
+
16
+ const insertInstruction = (c11nEnv, selectionList, selectionKey, primaryField, item) => {
17
+ const { id, primary } = item;
18
+ const actualProperty = selectionKey.startsWith('.') ? selectionKey.substring(1) : selectionKey;
19
+ const displayProperty = primaryField.startsWith('.') ? primaryField.substring(1) : primaryField;
20
+ const rows = c11nEnv.getValue(`${c11nEnv.getPageReference()}${selectionList}`) || [];
21
+ const startIndex = rows.length;
22
+ const content = {
23
+ [actualProperty]: id,
24
+ [displayProperty]: primary,
25
+ nonFormProperties: actualProperty !== displayProperty ? [displayProperty] : []
26
+ };
27
+ c11nEnv.getListActions().insert(content, startIndex);
28
+ };
29
+
30
+ const deleteInstruction = (c11nEnv, selectionList, selectionKey, item) => {
31
+ const { id } = item;
32
+ const actualProperty = selectionKey.startsWith('.') ? selectionKey.substring(1) : selectionKey;
33
+ const rows = c11nEnv.getValue(`${c11nEnv.getPageReference()}${selectionList}`) || [];
34
+ const index = rows.findIndex(row => row[actualProperty] === id);
35
+ c11nEnv.getListActions().deleteEntry(index);
36
+ };
37
+
38
+ export { updateNewInstuctions, insertInstruction, deleteInstruction };
@@ -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,37 +1,36 @@
1
1
  import { Utils } from './utils';
2
2
 
3
-
4
- export const TABLE_CELL = "SdkRenderer";
5
- export const DELETE_ICON = "DeleteIcon";
3
+ export const TABLE_CELL = 'SdkRenderer';
4
+ export const DELETE_ICON = 'DeleteIcon';
6
5
 
7
6
  // BUG-615253: Workaround for autosize in table with lazy loading components
8
7
  /* istanbul ignore next */
9
8
  function getFieldWidth(field, label) {
10
9
  let width: number;
11
10
  switch (field.type) {
12
- case "Time":
11
+ case 'Time':
13
12
  width = 150;
14
13
  break;
15
- case "Date":
14
+ case 'Date':
16
15
  width = 160;
17
16
  break;
18
- case "DateTime":
17
+ case 'DateTime':
19
18
  width = 205;
20
19
  break;
21
- case "AutoComplete":
22
- case "TextArea":
20
+ case 'AutoComplete':
21
+ case 'TextArea':
23
22
  width = 190;
24
23
  break;
25
- case "Currency":
26
- case "TextInput":
24
+ case 'Currency':
25
+ case 'TextInput':
27
26
  width = 182;
28
27
  break;
29
- case "Checkbox":
28
+ case 'Checkbox':
30
29
  // eslint-disable-next-line no-case-declarations
31
- const text = document.createElement("span");
30
+ const text = document.createElement('span');
32
31
  document.body.appendChild(text);
33
- text.style.fontSize = "13px";
34
- text.style.position = "absolute";
32
+ text.style.fontSize = '13px';
33
+ text.style.position = 'absolute';
35
34
  text.innerHTML = label;
36
35
  width = Math.ceil(text.clientWidth) + 30;
37
36
  document.body.removeChild(text);
@@ -42,19 +41,18 @@ function getFieldWidth(field, label) {
42
41
  return width;
43
42
  }
44
43
 
45
- export const getContext = (thePConn) => {
44
+ export const getContext = thePConn => {
46
45
  const contextName = thePConn.getContextName();
47
46
  const pageReference = thePConn.getPageReference();
48
- let { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
49
- const pageReferenceForRows = referenceList.startsWith(".")
50
- ? `${pageReference}.${referenceList.substring(1)}`
51
- : referenceList;
47
+ const { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
48
+ const pageReferenceForRows = referenceList.startsWith('.') ? `${pageReference}.${referenceList.substring(1)}` : referenceList;
52
49
 
53
50
  // removing "caseInfo.content" prefix to avoid setting it as a target while preparing pageInstructions
54
- referenceList = pageReferenceForRows.replace(
55
- PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT,
56
- ""
57
- );
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
+ // );
58
56
 
59
57
  return {
60
58
  contextName,
@@ -63,7 +61,7 @@ export const getContext = (thePConn) => {
63
61
  };
64
62
  };
65
63
 
66
- export const populateRowKey = (rawData) => {
64
+ export const populateRowKey = rawData => {
67
65
  return rawData.map((row: any, index: number) => {
68
66
  return { ...row, index };
69
67
  });
@@ -72,7 +70,7 @@ export const populateRowKey = (rawData) => {
72
70
  export const getApiContext = (processedData, pConnect, reorderCB) => {
73
71
  return {
74
72
  fetchData: () => {
75
- return new Promise((resolve) => {
73
+ return new Promise(resolve => {
76
74
  resolve({
77
75
  data: processedData,
78
76
  filteredRecordCount: processedData.length,
@@ -86,25 +84,12 @@ export const getApiContext = (processedData, pConnect, reorderCB) => {
86
84
  applyRowReorder: (sourceKey, destinationKey) => {
87
85
  // indexes are keys for simple table so, it should work.
88
86
  reorderCB();
89
- return Promise.resolve(
90
- pConnect
91
- .getListActions()
92
- .reorder(parseInt(sourceKey, 10), parseInt(destinationKey, 10))
93
- );
87
+ return Promise.resolve(pConnect.getListActions().reorder(parseInt(sourceKey, 10), parseInt(destinationKey, 10)));
94
88
  }
95
89
  };
96
90
  };
97
91
 
98
- export const buildMetaForListView = (
99
- fieldMetadata,
100
- fields,
101
- type,
102
- ruleClass,
103
- name,
104
- propertyLabel,
105
- isDataObject,
106
- parameters
107
- ) => {
92
+ export const buildMetaForListView = (fieldMetadata, fields, type, ruleClass, name, propertyLabel, isDataObject, parameters) => {
108
93
  return {
109
94
  name,
110
95
  config: {
@@ -118,22 +103,22 @@ export const buildMetaForListView = (
118
103
  reorderFields: true,
119
104
  toggleFieldVisibility: true,
120
105
  title: propertyLabel,
121
- personalizationId: "" /* TODO */,
122
- template: "ListView",
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, ''); // 3rd arg null until typedef marked correctly as optional
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,7 +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
3
 
4
+ import ReactReduxContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
5
5
 
6
6
  const connectToState = (mapStateToProps = () => {}) => {
7
7
  return (Component: any) => {
@@ -15,19 +15,15 @@ const connectToState = (mapStateToProps = () => {}) => {
15
15
  // Compare start props
16
16
  const c11nEnv = next.getPConnect();
17
17
  const allStateProps = c11nEnv.getStateProps();
18
- for (const key in allStateProps) {
19
- if (
20
- !shallowEqual(next[key], prev[key]) ||
21
- (next.routingInfo && !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
22
- ) {
18
+ for (const key of Object.keys(allStateProps)) {
19
+ if (!shallowEqual(next[key], prev[key]) || (next.routingInfo && !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))) {
23
20
  return false;
24
21
  }
25
22
  }
26
23
  /* TODO For some rawConfig we are not getting routingInfo under allStateProps */
27
24
  return !(
28
25
  'routingInfo' in next &&
29
- (!shallowEqual(next.routingInfo, prev.routingInfo) ||
30
- !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
26
+ (!shallowEqual(next.routingInfo, prev.routingInfo) || !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
31
27
  );
32
28
  }
33
29
  })(Component);
@@ -1,9 +1,8 @@
1
1
  // This file is adapted from React DX components/template/utils.js
2
2
 
3
-
4
3
  export function getAllFields(pConnect: any) {
5
4
  const metadata = pConnect.getRawMetadata();
6
- let allFields: Array<any> = [];
5
+ let allFields: any[] = [];
7
6
  if (metadata.children && metadata.children.map) {
8
7
  allFields = metadata.children.map(fields => {
9
8
  const children = fields.children instanceof Array ? fields.children : [];
@@ -13,7 +12,7 @@ export function getAllFields(pConnect: any) {
13
12
  return allFields;
14
13
  }
15
14
 
16
- export function filterForFieldValueList(fields: Array<any>) {
15
+ export function filterForFieldValueList(fields: any[]) {
17
16
  return fields
18
17
  .filter(({ visibility }) => visibility !== false)
19
18
  .map(({ value, label }) => ({
@@ -47,9 +46,7 @@ export function getIsAssignmentView(pConnect) {
47
46
  * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
48
47
  */
49
48
  export function getInstructions(pConnect, instructions: string = 'casestep'): string | undefined {
50
- const caseStepInstructions =
51
- PCore.getConstants().CASE_INFO.INSTRUCTIONS &&
52
- pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
49
+ const caseStepInstructions = PCore.getConstants().CASE_INFO.INSTRUCTIONS && pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
53
50
 
54
51
  // Determine if this view is the current assignment/step view
55
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 {
@@ -5,14 +5,11 @@
5
5
  * PCore/PConnect is being run
6
6
  */
7
7
 
8
-
9
- export const sdkVersion = "8.7";
8
+ export const sdkVersion = '8.7';
10
9
 
11
10
  export function compareSdkPCoreVersions() {
12
-
13
11
  // const theConstellationVersion = PCore.getPCoreVersion();
14
12
 
15
13
  // eslint-disable-next-line no-console
16
14
  console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
17
-
18
15
  }