@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
@@ -0,0 +1,230 @@
1
+ import { useRef } from 'react';
2
+ import equal from 'fast-deep-equal';
3
+ import cloneDeep from 'lodash/cloneDeep';
4
+ import { updateNewInstuctions, insertInstruction, deleteInstruction } from '@pega/react-sdk-components/lib/components/helpers/instructions-utils';
5
+
6
+ export const setVisibilityForList = (c11nEnv, visibility) => {
7
+ const { selectionMode, selectionList, renderMode, referenceList } = c11nEnv.getComponentConfig();
8
+ // usecase:multiselect, fieldgroup, editable table
9
+ if ((selectionMode === PCore.getConstants().LIST_SELECTION_MODE.MULTI && selectionList) || (renderMode === 'Editable' && referenceList)) {
10
+ c11nEnv.getListActions().setVisibility(visibility);
11
+ }
12
+ };
13
+
14
+ const useDeepMemo = (memoFn, key) => {
15
+ const ref: any = useRef();
16
+ if (!ref.current || !equal(key, ref.current.key)) {
17
+ ref.current = { key, value: memoFn() };
18
+ }
19
+ return ref.current.value;
20
+ };
21
+
22
+ const preProcessColumns = columns => {
23
+ return columns?.map(col => {
24
+ const tempColObj = { ...col };
25
+ tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
26
+ if (tempColObj.setProperty) {
27
+ tempColObj.setProperty = col.setProperty && col.setProperty.startsWith('.') ? col.setProperty.substring(1) : col.setProperty;
28
+ }
29
+ return tempColObj;
30
+ });
31
+ };
32
+
33
+ const getDisplayFieldsMetaData = columns => {
34
+ const displayColumns = columns?.filter(col => col.display === 'true');
35
+ const metaDataObj: any = {
36
+ key: '',
37
+ primary: '',
38
+ secondary: []
39
+ };
40
+ const keyCol = columns?.filter(col => col.key === 'true');
41
+ metaDataObj.key = keyCol?.length > 0 ? keyCol[0].value : 'auto';
42
+ const itemsRecordsColumn = columns?.filter(col => col.itemsRecordsColumn === 'true');
43
+ if (itemsRecordsColumn?.length > 0) {
44
+ metaDataObj.itemsRecordsColumn = itemsRecordsColumn[0].value;
45
+ }
46
+ const itemsGroupKeyColumn = columns?.filter(col => col.itemsGroupKeyColumn === 'true');
47
+ if (itemsGroupKeyColumn?.length > 0) {
48
+ metaDataObj.itemsGroupKeyColumn = itemsGroupKeyColumn[0].value;
49
+ }
50
+ for (let index = 0; index < displayColumns?.length; index += 1) {
51
+ if (displayColumns[index].secondary === 'true') {
52
+ metaDataObj.secondary.push(displayColumns[index].value);
53
+ } else if (displayColumns[index].primary === 'true') {
54
+ metaDataObj.primary = displayColumns[index].value;
55
+ }
56
+ }
57
+ return metaDataObj;
58
+ };
59
+
60
+ const createSingleTreeObejct = (entry, displayFieldMeta, showSecondaryData, selected) => {
61
+ const secondaryArr: any = [];
62
+ displayFieldMeta.secondary.forEach(col => {
63
+ secondaryArr.push(entry[col]);
64
+ });
65
+ const isSelected = selected.some(item => item.id === entry[displayFieldMeta.key]);
66
+
67
+ return {
68
+ id: entry[displayFieldMeta.key],
69
+ primary: entry[displayFieldMeta.primary],
70
+ secondary: showSecondaryData ? secondaryArr : [],
71
+ selected: isSelected
72
+ };
73
+ };
74
+
75
+ const putItemsDataInItemsTree = (listObjData, displayFieldMeta, itemsTree, showSecondaryInSearchOnly, selected) => {
76
+ let newTreeItems = itemsTree.slice();
77
+ const showSecondaryData = !showSecondaryInSearchOnly;
78
+ for (const obj of listObjData) {
79
+ const items = obj[displayFieldMeta.itemsRecordsColumn].map(entry => createSingleTreeObejct(entry, displayFieldMeta, showSecondaryData, selected));
80
+
81
+ newTreeItems = newTreeItems.map(caseObject => {
82
+ if (caseObject.id === obj[displayFieldMeta.itemsGroupKeyColumn]) {
83
+ caseObject.items = [...items];
84
+ }
85
+ return caseObject;
86
+ });
87
+ }
88
+ return newTreeItems;
89
+ };
90
+
91
+ const prepareSearchResults = (listObjData, displayFieldMeta) => {
92
+ const searchResults: any = [];
93
+ for (const obj of listObjData) {
94
+ searchResults.push(...obj[displayFieldMeta.itemsRecordsColumn]);
95
+ }
96
+ return searchResults;
97
+ };
98
+
99
+ const doSearch = async (
100
+ searchText,
101
+ clickedGroup,
102
+ initialCaseClass,
103
+ displayFieldMeta,
104
+ dataApiObj, // deep clone of the dataApiObj
105
+ itemsTree,
106
+ isGroupData,
107
+ showSecondaryInSearchOnly,
108
+ selected
109
+ ) => {
110
+ let searchTextForUngroupedData = '';
111
+ if (dataApiObj) {
112
+ // creating dataApiObject in grouped data cases
113
+ if (isGroupData) {
114
+ dataApiObj = cloneDeep(dataApiObj);
115
+ dataApiObj.fetchedNQData = false;
116
+ dataApiObj.cache = {};
117
+
118
+ // if we have no search text and no group selected, return the original tree
119
+ if (searchText === '' && clickedGroup === '') {
120
+ return itemsTree;
121
+ }
122
+
123
+ // setting the inital search text & search classes in ApiObject
124
+ dataApiObj.parameters[Object.keys(dataApiObj.parameters)[1]] = searchText;
125
+ dataApiObj.parameters[Object.keys(dataApiObj.parameters)[0]] = initialCaseClass;
126
+
127
+ // if we have a selected group
128
+ if (clickedGroup) {
129
+ // check if the data for this group is already present and no search text
130
+ if (searchText === '') {
131
+ const containsData = itemsTree.find(item => item.id === clickedGroup);
132
+ // do not make API call when items of respective group are already fetched
133
+ if (containsData?.items?.length) return itemsTree;
134
+ }
135
+
136
+ dataApiObj.parameters[Object.keys(dataApiObj.parameters)[0]] = JSON.stringify([clickedGroup]);
137
+ }
138
+ } else {
139
+ searchTextForUngroupedData = searchText;
140
+ }
141
+
142
+ // search API call
143
+ const response = await dataApiObj.fetchData(searchTextForUngroupedData).catch(() => {
144
+ return itemsTree;
145
+ });
146
+
147
+ let listObjData = response.data;
148
+ let newItemsTree = [];
149
+ if (isGroupData) {
150
+ if (searchText) {
151
+ listObjData = prepareSearchResults(listObjData, displayFieldMeta);
152
+ } else {
153
+ newItemsTree = putItemsDataInItemsTree(listObjData, displayFieldMeta, itemsTree, showSecondaryInSearchOnly, selected);
154
+ return newItemsTree;
155
+ }
156
+ }
157
+ const showSecondaryData = showSecondaryInSearchOnly ? !!searchText : true;
158
+ if (listObjData !== undefined && listObjData.length > 0) {
159
+ newItemsTree = listObjData.map(entry => createSingleTreeObejct(entry, displayFieldMeta, showSecondaryData, selected));
160
+ }
161
+ return newItemsTree;
162
+ }
163
+
164
+ return itemsTree;
165
+ };
166
+
167
+ const setValuesToPropertyList = (searchText, assocProp, items, columns, actions, updatePropertyInRedux = true) => {
168
+ const setPropertyList = columns
169
+ ?.filter(col => col.setProperty)
170
+ .map(col => {
171
+ return {
172
+ source: col.value,
173
+ target: col.setProperty,
174
+ key: col.key,
175
+ primary: col.primary
176
+ };
177
+ });
178
+ const valueToSet: any = [];
179
+ if (setPropertyList.length > 0) {
180
+ setPropertyList.forEach(prop => {
181
+ items.forEach(item => {
182
+ if (prop.key === 'true' && item) {
183
+ valueToSet.push(item.id);
184
+ } else if (prop.primary === 'true' || !item) {
185
+ valueToSet.push(searchText);
186
+ }
187
+ });
188
+
189
+ if (updatePropertyInRedux) {
190
+ // BUG-666851 setting options so that the store values are replaced and not merged
191
+ const options = {
192
+ isArrayDeepMerge: false
193
+ };
194
+ if (prop.target === 'Associated property') {
195
+ actions.updateFieldValue(assocProp, valueToSet, options);
196
+ } else {
197
+ actions.updateFieldValue(`.${prop.target}`, valueToSet, options);
198
+ }
199
+ }
200
+ });
201
+ }
202
+ return valueToSet;
203
+ };
204
+
205
+ const getGroupDataForItemsTree = (groupDataSource, groupsDisplayFieldMeta, showSecondaryInSearchOnly) => {
206
+ return groupDataSource?.map(group => {
207
+ const secondaryArr: any = [];
208
+ groupsDisplayFieldMeta.secondary.forEach(col => {
209
+ secondaryArr.push(group[col]);
210
+ });
211
+ return {
212
+ id: group[groupsDisplayFieldMeta.key],
213
+ primary: group[groupsDisplayFieldMeta.primary],
214
+ secondary: showSecondaryInSearchOnly ? [] : secondaryArr,
215
+ items: []
216
+ };
217
+ });
218
+ };
219
+
220
+ export {
221
+ useDeepMemo,
222
+ preProcessColumns,
223
+ getDisplayFieldsMetaData,
224
+ doSearch,
225
+ setValuesToPropertyList,
226
+ getGroupDataForItemsTree,
227
+ updateNewInstuctions,
228
+ insertInstruction,
229
+ deleteInstruction
230
+ };
@@ -1,67 +1,58 @@
1
- import React from 'react';
2
- import { TextField } from '@material-ui/core';
3
- import { makeStyles } from '@material-ui/core/styles';
1
+ import CurrencyTextField from '@unicef/material-ui-currency-textfield';
4
2
 
5
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
6
- import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
7
-
8
- // Inspired by https://stackoverflow.com/questions/50823182/material-ui-remove-up-down-arrow-dials-from-textview
9
- const useStyles = makeStyles((/* theme */) => ({
10
- input: {
11
- '& input[type=number]': {
12
- '-moz-appearance': 'textfield'
13
- },
14
- '& input[type=number]::-webkit-outer-spin-button': {
15
- '-webkit-appearance': 'none',
16
- margin: 0
17
- },
18
- '& input[type=number]::-webkit-inner-spin-button': {
19
- '-webkit-appearance': 'none',
20
- margin: 0
21
- }
22
- }
23
- }));
4
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
6
+ import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
7
+ import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
24
8
 
9
+ /* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
10
+ as per the locale.
11
+ */
25
12
  interface PercentageProps extends PConnFieldProps {
26
13
  // If any, enter additional props that only exist on Percentage here
14
+ currencyISOCode?: string;
27
15
  }
28
16
 
29
17
  export default function Percentage(props: PercentageProps) {
30
18
  // Get emitted components from map (so we can get any override that may exist)
31
- const TextInput = getComponentFromMap('TextInput');
32
19
  const FieldValueList = getComponentFromMap('FieldValueList');
33
20
 
34
- const classes = useStyles();
35
-
36
21
  const {
22
+ getPConnect,
37
23
  label,
38
24
  required,
39
25
  disabled,
40
26
  value = '',
41
27
  validatemessage,
42
28
  status,
43
- onChange,
44
- onBlur,
29
+ // onChange,
30
+ // onBlur,
45
31
  readOnly,
32
+ currencyISOCode = 'USD',
46
33
  testId,
47
34
  helperText,
48
35
  displayMode,
49
- hideLabel
36
+ hideLabel,
37
+ placeholder
50
38
  } = props;
39
+
40
+ const pConn = getPConnect();
41
+ const actions = pConn.getActionsApi();
42
+ const propName = (pConn.getStateProps() as any).value;
51
43
  const helperTextToDisplay = validatemessage || helperText;
52
44
 
45
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
46
+ const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
47
+
53
48
  // console.log(`Percentage: label: ${label} value: ${value}`);
54
49
 
55
50
  if (displayMode === 'LABELS_LEFT') {
56
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
51
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
57
52
  }
58
53
 
59
54
  if (displayMode === 'STACKED_LARGE_VAL') {
60
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
61
- }
62
-
63
- if (readOnly) {
64
- return <TextInput {...props} />;
55
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
65
56
  }
66
57
 
67
58
  let testProp = {};
@@ -70,23 +61,37 @@ export default function Percentage(props: PercentageProps) {
70
61
  'data-test-id': testId
71
62
  };
72
63
 
64
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
65
+ const theCurrDec = theSymbols.theDecimalIndicator;
66
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
67
+
68
+ function PercentageOnBlur(event, inValue) {
69
+ handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
70
+ }
71
+
73
72
  return (
74
- <TextField
75
- className={classes.input}
73
+ <CurrencyTextField
76
74
  fullWidth
77
75
  variant={readOnly ? 'standard' : 'outlined'}
78
76
  helperText={helperTextToDisplay}
79
- placeholder=""
80
- size="small"
77
+ placeholder={placeholder ?? ''}
78
+ size='small'
81
79
  required={required}
82
80
  disabled={disabled}
83
- onChange={onChange}
84
- onBlur={!readOnly ? onBlur : undefined}
81
+ readOnly={!!readOnly}
85
82
  error={status === 'error'}
86
83
  label={label}
87
84
  value={value}
88
- type="number"
89
- inputProps={{ ...testProp }}
85
+ type='text'
86
+ outputFormat='number'
87
+ textAlign='left'
88
+ InputProps={{
89
+ inputProps: { ...testProp }
90
+ }}
91
+ currencySymbol=''
92
+ decimalCharacter={theCurrDec}
93
+ digitGroupSeparator={theCurrSep}
94
+ onBlur={!readOnly ? PercentageOnBlur : undefined}
90
95
  />
91
96
  );
92
97
  }
@@ -4,6 +4,5 @@
4
4
  "description": "Percentage",
5
5
  "type": "Field",
6
6
  "subtype": "Decimal-Percentage",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
1
  import MuiPhoneNumber from 'material-ui-phone-number';
2
+
3
3
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
- import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
5
 
6
6
  interface PhoneProps extends PConnFieldProps {
7
7
  // If any, enter additional props that only exist on Phone here
@@ -24,7 +24,8 @@ export default function Phone(props: PhoneProps) {
24
24
  testId,
25
25
  helperText,
26
26
  displayMode,
27
- hideLabel
27
+ hideLabel,
28
+ placeholder
28
29
  } = props;
29
30
  const helperTextToDisplay = validatemessage || helperText;
30
31
 
@@ -39,7 +40,7 @@ export default function Phone(props: PhoneProps) {
39
40
  }
40
41
 
41
42
  if (displayMode === 'STACKED_LARGE_VAL') {
42
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
43
+ return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
43
44
  }
44
45
 
45
46
  if (readOnly) {
@@ -49,8 +50,8 @@ export default function Phone(props: PhoneProps) {
49
50
  <MuiPhoneNumber
50
51
  fullWidth
51
52
  helperText={helperTextToDisplay}
52
- placeholder=""
53
- size="small"
53
+ placeholder={placeholder ?? ''}
54
+ size='small'
54
55
  required={required}
55
56
  disabled={disabled}
56
57
  onChange={onChange}
@@ -67,13 +68,13 @@ export default function Phone(props: PhoneProps) {
67
68
  );
68
69
  }
69
70
 
70
- const handleChange = (inputVal) => {
71
+ const handleChange = inputVal => {
71
72
  let phoneValue = inputVal && inputVal.replace(/\D+/g, '');
72
73
  phoneValue = `+${phoneValue}`;
73
74
  onChange({ value: phoneValue });
74
75
  };
75
76
 
76
- const handleBlur = (event) => {
77
+ const handleBlur = event => {
77
78
  const phoneValue = event?.target?.value;
78
79
  event.target.value = `+${phoneValue && phoneValue.replace(/\D+/g, '')}`;
79
80
  onBlur(event);
@@ -82,11 +83,11 @@ export default function Phone(props: PhoneProps) {
82
83
  return (
83
84
  <MuiPhoneNumber
84
85
  fullWidth
85
- variant="outlined"
86
+ variant='outlined'
86
87
  helperText={helperTextToDisplay}
87
- placeholder=""
88
- size="small"
89
- defaultCountry="us"
88
+ placeholder={placeholder ?? ''}
89
+ size='small'
90
+ defaultCountry='us'
90
91
  required={required}
91
92
  disabled={disabled}
92
93
  onChange={handleChange}
@@ -1 +1 @@
1
- export { default } from './Phone';
1
+ export { default } from './Phone';
@@ -1,20 +1,19 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import { Radio, RadioGroup, FormControl, FormControlLabel, FormLabel, FormHelperText } from '@material-ui/core';
3
3
 
4
4
  import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
5
5
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
6
6
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
7
- // import type { PConnFieldProps } from '../../../types/PConnProps';
7
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
8
8
 
9
9
  // Can't use RadioButtonProps until getLocaleRuleNameFromKeys is NOT private
10
- // interface RadioButtonsProps extends PConnFieldProps {
11
- // // If any, enter additional props that only exist on RadioButtons here
12
- // inline: boolean,
13
- // fieldMetadata?: any
14
- // }
15
-
10
+ interface RadioButtonsProps extends PConnFieldProps {
11
+ // If any, enter additional props that only exist on RadioButtons here
12
+ inline: boolean;
13
+ fieldMetadata?: any;
14
+ }
16
15
 
17
- export default function RadioButtons(props /* : RadioButtonsProps */ ) {
16
+ export default function RadioButtons(props: RadioButtonsProps) {
18
17
  // Get emitted components from map (so we can get any override that may exist)
19
18
  const FieldValueList = getComponentFromMap('FieldValueList');
20
19
 
@@ -37,15 +36,15 @@ export default function RadioButtons(props /* : RadioButtonsProps */ ) {
37
36
  const thePConn = getPConnect();
38
37
  const theConfigProps = thePConn.getConfigProps();
39
38
  const actionsApi = thePConn.getActionsApi();
40
- const propName = thePConn.getStateProps()["value"];
39
+ const propName = (thePConn.getStateProps() as any).value;
41
40
  const helperTextToDisplay = validatemessage || helperText;
42
41
  const className = thePConn.getCaseInfo().getClassName();
43
42
 
44
- let configProperty = thePConn.getRawMetadata()?.config?.value || '';
43
+ let configProperty = (thePConn.getRawMetadata() as any)?.config?.value || '';
45
44
  configProperty = configProperty.startsWith('@P') ? configProperty.substring(3) : configProperty;
46
45
  configProperty = configProperty.startsWith('.') ? configProperty.substring(1) : configProperty;
47
46
 
48
- const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter((field) => field?.classID === className)[0] : fieldMetadata;
47
+ const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;
49
48
  let displayName = metaData?.datasource?.propertyForDisplayText;
50
49
  displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
51
50
  const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
@@ -66,6 +65,7 @@ export default function RadioButtons(props /* : RadioButtonsProps */ ) {
66
65
  return (
67
66
  <FieldValueList
68
67
  name={hideLabel ? '' : label}
68
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
69
69
  value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
70
70
  />
71
71
  );
@@ -75,25 +75,26 @@ export default function RadioButtons(props /* : RadioButtonsProps */ ) {
75
75
  return (
76
76
  <FieldValueList
77
77
  name={hideLabel ? '' : label}
78
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
78
79
  value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
79
- variant="stacked"
80
+ variant='stacked'
80
81
  />
81
82
  );
82
83
  }
83
84
 
84
- const handleChange = (event) => {
85
+ const handleChange = event => {
85
86
  handleEvent(actionsApi, 'changeNblur', propName, event.target.value);
86
87
  };
87
88
 
88
- const handleBlur = (event) => {
89
+ const handleBlur = event => {
89
90
  thePConn.getValidationApi().validate(event.target.value, ''); // 2nd arg empty string until typedef marked correctly as optional
90
91
  };
91
92
 
92
93
  return (
93
94
  <FormControl error={status === 'error'} required={required}>
94
- <FormLabel component="legend">{label}</FormLabel>
95
+ <FormLabel component='legend'>{label}</FormLabel>
95
96
  <RadioGroup value={theSelectedButton} onChange={handleChange} onBlur={!readOnly ? handleBlur : undefined} row={inline}>
96
- {theOptions.map((theOption) => {
97
+ {theOptions.map(theOption => {
97
98
  return (
98
99
  <FormControlLabel
99
100
  value={theOption.key}
@@ -101,9 +102,10 @@ export default function RadioButtons(props /* : RadioButtonsProps */ ) {
101
102
  label={thePConn.getLocalizedValue(
102
103
  theOption.value,
103
104
  localePath,
105
+ // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
104
106
  thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
105
107
  )}
106
- control={<Radio key={theOption.key} color="primary" disabled={readOnly} />}
108
+ control={<Radio key={theOption.key} color='primary' disabled={readOnly} />}
107
109
  />
108
110
  );
109
111
  })}
@@ -4,6 +4,5 @@
4
4
  "description": "Picklist",
5
5
  "type": "Field",
6
6
  "subtype": "Picklist",
7
- "properties": [
8
- ]
7
+ "properties": []
9
8
  }
@@ -1,7 +1,8 @@
1
- import React, { useRef } from 'react';
1
+ import { useRef } from 'react';
2
+
2
3
  import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
3
4
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
- import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
+ import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
6
 
6
7
  interface RichTextProps extends PConnFieldProps {
7
8
  // If any, enter additional props that only exist on TextArea here
@@ -18,16 +19,16 @@ export default function RichText(props: RichTextProps) {
18
19
  const editorRef: any = useRef(null);
19
20
 
20
21
  let { readOnly, required, disabled } = props;
21
- [readOnly, required, disabled] = [readOnly, required, disabled].map((prop) => prop === true || (typeof prop === 'string' && prop === 'true'));
22
+ [readOnly, required, disabled] = [readOnly, required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
22
23
 
23
24
  const helperTextToDisplay = validatemessage || helperText;
24
25
 
25
26
  if (displayMode === 'LABELS_LEFT') {
26
- return <FieldValueList name={hideLabel ? '' : label} value={value} />;
27
+ return <FieldValueList name={hideLabel ? '' : label} value={value} isHtml />;
27
28
  }
28
29
 
29
30
  if (displayMode === 'STACKED_LARGE_VAL') {
30
- return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
31
+ return <FieldValueList name={hideLabel ? '' : label} value={value} isHtml variant='stacked' />;
31
32
  }
32
33
 
33
34
  let richTextComponent;
@@ -55,7 +56,7 @@ export default function RichText(props: RichTextProps) {
55
56
  }
56
57
  const handleChange = () => {
57
58
  if (status === 'error') {
58
- const property = pConn.getStateProps()["value"];
59
+ const property = (pConn.getStateProps() as any).value;
59
60
  pConn.clearErrorMessages({
60
61
  property,
61
62
  category: '',
@@ -67,7 +68,7 @@ export default function RichText(props: RichTextProps) {
67
68
  const handleBlur = () => {
68
69
  if (editorRef.current) {
69
70
  const editorValue = editorRef.current.getContent({ format: 'html' });
70
- const property = pConn.getStateProps()["value"];
71
+ const property = (pConn.getStateProps() as any).value;
71
72
  handleEvent(actionsApi, 'changeNblur', property, editorValue);
72
73
  }
73
74
  };
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/no-array-index-key */
2
- import React from 'react';
3
2
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
3
  import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
5
4
 
@@ -8,7 +7,7 @@ interface ScalarListProps extends PConnProps {
8
7
  // If any, enter additional props that only exist on this component
9
8
  displayInModal: boolean;
10
9
  hideLabel: boolean;
11
- value: Array<any>;
10
+ value: any[];
12
11
  componentType: string;
13
12
  label: string;
14
13
  displayMode: string;
@@ -30,15 +29,7 @@ export default function ScalarList(props: ScalarListProps) {
30
29
  // Get emitted components from map (so we can get any override that may exist)
31
30
  const FieldValueList = getComponentFromMap('FieldValueList');
32
31
 
33
- const {
34
- label,
35
- getPConnect,
36
- componentType,
37
- value: scalarValues,
38
- displayMode,
39
- hideLabel,
40
- ...restProps
41
- } = props;
32
+ const { label, getPConnect, componentType, value: scalarValues, displayMode, hideLabel, ...restProps } = props;
42
33
 
43
34
  const items = scalarValues?.map(scalarValue => {
44
35
  return getPConnect().createComponent(
@@ -59,12 +50,11 @@ export default function ScalarList(props: ScalarListProps) {
59
50
  });
60
51
 
61
52
  if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) {
62
- const displayComp = (
53
+ return (
63
54
  <div>
64
55
  <CommaSeparatedList items={items} />
65
56
  </div>
66
57
  );
67
- return displayComp;
68
58
  }
69
59
 
70
60
  const displayComp = <CommaSeparatedList items={items} />;
@@ -3,6 +3,5 @@
3
3
  "componentKey": "ScalarList",
4
4
  "name": "ScalarList",
5
5
  "type": "Field",
6
- "properties": [
7
- ]
6
+ "properties": []
8
7
  }