@pega/sdk 0.0.1

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 (465) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +111 -0
  3. package/SECURITY.md +10 -0
  4. package/dist/index.js +753 -0
  5. package/package.json +41 -0
  6. package/templates/angular-sdk-reference/.github/AGENTS.md +23 -0
  7. package/templates/angular-sdk-reference/.github/copilot-instructions.md +40 -0
  8. package/templates/angular-sdk-reference/.github/skills/pega-sdk-component.md +48 -0
  9. package/templates/angular-sdk-reference/angular.json +34 -0
  10. package/templates/angular-sdk-reference/package.json +31 -0
  11. package/templates/angular-sdk-reference/sdk-config.json +26 -0
  12. package/templates/angular-sdk-reference/src/app/app.component.ts +54 -0
  13. package/templates/angular-sdk-reference/src/index.html +12 -0
  14. package/templates/angular-sdk-reference/src/main.ts +4 -0
  15. package/templates/angular-sdk-reference/src/styles.css +19 -0
  16. package/templates/angular-sdk-reference/tsconfig.json +32 -0
  17. package/templates/react-native-sdk-reference/.github/AGENTS.md +23 -0
  18. package/templates/react-native-sdk-reference/.github/copilot-instructions.md +40 -0
  19. package/templates/react-native-sdk-reference/.github/skills/pega-sdk-component.md +48 -0
  20. package/templates/react-native-sdk-reference/App.tsx +51 -0
  21. package/templates/react-native-sdk-reference/app.json +11 -0
  22. package/templates/react-native-sdk-reference/package.json +22 -0
  23. package/templates/react-native-sdk-reference/sdk-config.json +14 -0
  24. package/templates/react-native-sdk-reference/tsconfig.json +12 -0
  25. package/templates/react-sdk-reference/.github/copilot-instructions.md +185 -0
  26. package/templates/react-sdk-reference/.github/instructions/component-map.instructions.md +40 -0
  27. package/templates/react-sdk-reference/.github/instructions/dse-component.instructions.md +77 -0
  28. package/templates/react-sdk-reference/.github/instructions/field-component.instructions.md +73 -0
  29. package/templates/react-sdk-reference/.github/instructions/template-component.instructions.md +94 -0
  30. package/templates/react-sdk-reference/.github/instructions/widget-component.instructions.md +89 -0
  31. package/templates/react-sdk-reference/.github/prompts/add-component.prompt.md +21 -0
  32. package/templates/react-sdk-reference/.github/prompts/component-manifest.json +111 -0
  33. package/templates/react-sdk-reference/.github/prompts/identify-components.prompt.md +110 -0
  34. package/templates/react-sdk-reference/.github/prompts/replace-all-fields.prompt.md +48 -0
  35. package/templates/react-sdk-reference/.github/prompts/replace-component.prompt.md +81 -0
  36. package/templates/react-sdk-reference/.github/prompts/replace-design-system.prompt.md +524 -0
  37. package/templates/react-sdk-reference/.github/prompts/replace-field.prompt.md +41 -0
  38. package/templates/react-sdk-reference/.github/prompts/swap-design-system.prompt.md +49 -0
  39. package/templates/react-sdk-reference/.github/skills/component-contracts.md +140 -0
  40. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/AlertBanner.md +135 -0
  41. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/Banner.md +149 -0
  42. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/CaseSummaryFields.md +154 -0
  43. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/DetailsFields.md +144 -0
  44. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/FieldGroup.md +131 -0
  45. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/FieldGroupList.md +111 -0
  46. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/FieldValueList.md +115 -0
  47. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/Operator.md +149 -0
  48. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/Pulse.md +83 -0
  49. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/RichTextEditor.md +206 -0
  50. package/templates/react-sdk-reference/.github/skills/design-system-extension-skills/WssQuickCreate.md +135 -0
  51. package/templates/react-sdk-reference/.github/skills/design-system-extension.md +249 -0
  52. package/templates/react-sdk-reference/.github/skills/field-components.md +262 -0
  53. package/templates/react-sdk-reference/.github/skills/field-skills/AutoComplete.md +112 -0
  54. package/templates/react-sdk-reference/.github/skills/field-skills/CancelAlert.md +203 -0
  55. package/templates/react-sdk-reference/.github/skills/field-skills/Checkbox.md +158 -0
  56. package/templates/react-sdk-reference/.github/skills/field-skills/Currency.md +106 -0
  57. package/templates/react-sdk-reference/.github/skills/field-skills/Date.md +99 -0
  58. package/templates/react-sdk-reference/.github/skills/field-skills/DateTime.md +103 -0
  59. package/templates/react-sdk-reference/.github/skills/field-skills/Decimal.md +98 -0
  60. package/templates/react-sdk-reference/.github/skills/field-skills/Dropdown.md +114 -0
  61. package/templates/react-sdk-reference/.github/skills/field-skills/Email.md +107 -0
  62. package/templates/react-sdk-reference/.github/skills/field-skills/Group.md +90 -0
  63. package/templates/react-sdk-reference/.github/skills/field-skills/Integer.md +87 -0
  64. package/templates/react-sdk-reference/.github/skills/field-skills/Location.md +136 -0
  65. package/templates/react-sdk-reference/.github/skills/field-skills/Multiselect.md +164 -0
  66. package/templates/react-sdk-reference/.github/skills/field-skills/ObjectReference.md +164 -0
  67. package/templates/react-sdk-reference/.github/skills/field-skills/Percentage.md +92 -0
  68. package/templates/react-sdk-reference/.github/skills/field-skills/Phone.md +110 -0
  69. package/templates/react-sdk-reference/.github/skills/field-skills/RadioButtons.md +146 -0
  70. package/templates/react-sdk-reference/.github/skills/field-skills/RichText.md +138 -0
  71. package/templates/react-sdk-reference/.github/skills/field-skills/ScalarList.md +124 -0
  72. package/templates/react-sdk-reference/.github/skills/field-skills/SelectableCard.md +216 -0
  73. package/templates/react-sdk-reference/.github/skills/field-skills/SemanticLink.md +148 -0
  74. package/templates/react-sdk-reference/.github/skills/field-skills/TextArea.md +96 -0
  75. package/templates/react-sdk-reference/.github/skills/field-skills/TextContent.md +101 -0
  76. package/templates/react-sdk-reference/.github/skills/field-skills/TextInput.md +104 -0
  77. package/templates/react-sdk-reference/.github/skills/field-skills/Time.md +88 -0
  78. package/templates/react-sdk-reference/.github/skills/field-skills/URL.md +85 -0
  79. package/templates/react-sdk-reference/.github/skills/field-skills/UserReference.md +180 -0
  80. package/templates/react-sdk-reference/.github/skills/run-and-verify.md +68 -0
  81. package/templates/react-sdk-reference/.github/skills/swap-design-system.md +105 -0
  82. package/templates/react-sdk-reference/.github/skills/template-components.md +285 -0
  83. package/templates/react-sdk-reference/.github/skills/template-skills/AdvancedSearch.md +144 -0
  84. package/templates/react-sdk-reference/.github/skills/template-skills/AppShell.md +122 -0
  85. package/templates/react-sdk-reference/.github/skills/template-skills/BannerPage.md +83 -0
  86. package/templates/react-sdk-reference/.github/skills/template-skills/CaseSummary.md +100 -0
  87. package/templates/react-sdk-reference/.github/skills/template-skills/CaseView.md +131 -0
  88. package/templates/react-sdk-reference/.github/skills/template-skills/CaseViewActionsMenu.md +126 -0
  89. package/templates/react-sdk-reference/.github/skills/template-skills/Confirmation.md +107 -0
  90. package/templates/react-sdk-reference/.github/skills/template-skills/DataReference.md +120 -0
  91. package/templates/react-sdk-reference/.github/skills/template-skills/DefaultForm.md +102 -0
  92. package/templates/react-sdk-reference/.github/skills/template-skills/DefaultPage.md +110 -0
  93. package/templates/react-sdk-reference/.github/skills/template-skills/Details.md +88 -0
  94. package/templates/react-sdk-reference/.github/skills/template-skills/DetailsSubTabs.md +95 -0
  95. package/templates/react-sdk-reference/.github/skills/template-skills/DetailsThreeColumn.md +78 -0
  96. package/templates/react-sdk-reference/.github/skills/template-skills/DetailsTwoColumn.md +78 -0
  97. package/templates/react-sdk-reference/.github/skills/template-skills/DynamicTabs.md +101 -0
  98. package/templates/react-sdk-reference/.github/skills/template-skills/FieldGroupTemplate.md +109 -0
  99. package/templates/react-sdk-reference/.github/skills/template-skills/HierarchicalForm.md +113 -0
  100. package/templates/react-sdk-reference/.github/skills/template-skills/InlineDashboard.md +104 -0
  101. package/templates/react-sdk-reference/.github/skills/template-skills/InlineDashboardPage.md +85 -0
  102. package/templates/react-sdk-reference/.github/skills/template-skills/ListPage.md +68 -0
  103. package/templates/react-sdk-reference/.github/skills/template-skills/ListView.md +139 -0
  104. package/templates/react-sdk-reference/.github/skills/template-skills/MultiReferenceReadOnly.md +80 -0
  105. package/templates/react-sdk-reference/.github/skills/template-skills/NarrowWide.md +141 -0
  106. package/templates/react-sdk-reference/.github/skills/template-skills/OneColumn.md +109 -0
  107. package/templates/react-sdk-reference/.github/skills/template-skills/PromotedFilters.md +124 -0
  108. package/templates/react-sdk-reference/.github/skills/template-skills/SelfServiceCaseView.md +135 -0
  109. package/templates/react-sdk-reference/.github/skills/template-skills/SimpleTable.md +127 -0
  110. package/templates/react-sdk-reference/.github/skills/template-skills/SingleReferenceReadOnly.md +103 -0
  111. package/templates/react-sdk-reference/.github/skills/template-skills/SubTabs.md +79 -0
  112. package/templates/react-sdk-reference/.github/skills/template-skills/TwoColumn.md +131 -0
  113. package/templates/react-sdk-reference/.github/skills/template-skills/WideNarrow.md +150 -0
  114. package/templates/react-sdk-reference/.github/skills/template-skills/WssNavBar.md +135 -0
  115. package/templates/react-sdk-reference/.github/skills/widget-components.md +234 -0
  116. package/templates/react-sdk-reference/.github/skills/widget-skills/AppAnnouncement.md +82 -0
  117. package/templates/react-sdk-reference/.github/skills/widget-skills/Attachment.md +146 -0
  118. package/templates/react-sdk-reference/.github/skills/widget-skills/CaseHistory.md +107 -0
  119. package/templates/react-sdk-reference/.github/skills/widget-skills/FileUtility.md +200 -0
  120. package/templates/react-sdk-reference/.github/skills/widget-skills/Followers.md +99 -0
  121. package/templates/react-sdk-reference/.github/skills/widget-skills/QuickCreate.md +114 -0
  122. package/templates/react-sdk-reference/.github/skills/widget-skills/SummaryItem.md +167 -0
  123. package/templates/react-sdk-reference/.github/skills/widget-skills/ToDo.md +190 -0
  124. package/templates/react-sdk-reference/AGENTS.md +59 -0
  125. package/templates/react-sdk-reference/assets/icons/analytics-good-solid.svg +3 -0
  126. package/templates/react-sdk-reference/assets/icons/cart-solid.svg +3 -0
  127. package/templates/react-sdk-reference/assets/icons/headset.svg +3 -0
  128. package/templates/react-sdk-reference/assets/icons/mobile-phone-solid.svg +3 -0
  129. package/templates/react-sdk-reference/assets/icons/money-solid.svg +3 -0
  130. package/templates/react-sdk-reference/assets/icons/multi-device-solid.svg +3 -0
  131. package/templates/react-sdk-reference/index.html +36 -0
  132. package/templates/react-sdk-reference/package.json +52 -0
  133. package/templates/react-sdk-reference/sdk-config.json +26 -0
  134. package/templates/react-sdk-reference/src/AppSelector.tsx +18 -0
  135. package/templates/react-sdk-reference/src/FallbackComponent.tsx +40 -0
  136. package/templates/react-sdk-reference/src/MashupApp.styles.ts +105 -0
  137. package/templates/react-sdk-reference/src/MashupApp.tsx +254 -0
  138. package/templates/react-sdk-reference/src/PortalApp.tsx +175 -0
  139. package/templates/react-sdk-reference/src/components/component-map.ts +255 -0
  140. package/templates/react-sdk-reference/src/components/designSystemExtension/AlertBanner/AlertBanner.css +46 -0
  141. package/templates/react-sdk-reference/src/components/designSystemExtension/AlertBanner/AlertBanner.tsx +91 -0
  142. package/templates/react-sdk-reference/src/components/designSystemExtension/AlertBanner/index.tsx +1 -0
  143. package/templates/react-sdk-reference/src/components/designSystemExtension/Banner/Banner.css +39 -0
  144. package/templates/react-sdk-reference/src/components/designSystemExtension/Banner/Banner.tsx +53 -0
  145. package/templates/react-sdk-reference/src/components/designSystemExtension/Banner/index.tsx +1 -0
  146. package/templates/react-sdk-reference/src/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +16 -0
  147. package/templates/react-sdk-reference/src/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +270 -0
  148. package/templates/react-sdk-reference/src/components/designSystemExtension/CaseSummaryFields/index.tsx +1 -0
  149. package/templates/react-sdk-reference/src/components/designSystemExtension/DetailsFields/DetailsFields.tsx +164 -0
  150. package/templates/react-sdk-reference/src/components/designSystemExtension/DetailsFields/index.tsx +1 -0
  151. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx +79 -0
  152. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/index.tsx +1 -0
  153. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/FieldGroupList.tsx +58 -0
  154. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/index.tsx +1 -0
  155. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx +84 -0
  156. package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/index.tsx +1 -0
  157. package/templates/react-sdk-reference/src/components/designSystemExtension/Operator/Operator.tsx +220 -0
  158. package/templates/react-sdk-reference/src/components/designSystemExtension/Operator/index.tsx +1 -0
  159. package/templates/react-sdk-reference/src/components/designSystemExtension/Pulse/Pulse.tsx +33 -0
  160. package/templates/react-sdk-reference/src/components/designSystemExtension/Pulse/index.tsx +1 -0
  161. package/templates/react-sdk-reference/src/components/designSystemExtension/RichTextEditor/RichTextEditor.tsx +201 -0
  162. package/templates/react-sdk-reference/src/components/designSystemExtension/RichTextEditor/index.tsx +1 -0
  163. package/templates/react-sdk-reference/src/components/designSystemExtension/WssQuickCreate/WssQuickCreate.css +33 -0
  164. package/templates/react-sdk-reference/src/components/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +48 -0
  165. package/templates/react-sdk-reference/src/components/designSystemExtension/WssQuickCreate/index.tsx +1 -0
  166. package/templates/react-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +218 -0
  167. package/templates/react-sdk-reference/src/components/field/AutoComplete/config-ext.json +10 -0
  168. package/templates/react-sdk-reference/src/components/field/AutoComplete/index.tsx +1 -0
  169. package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.css +24 -0
  170. package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.tsx +148 -0
  171. package/templates/react-sdk-reference/src/components/field/CancelAlert/index.tsx +1 -0
  172. package/templates/react-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +263 -0
  173. package/templates/react-sdk-reference/src/components/field/Checkbox/config-ext.json +9 -0
  174. package/templates/react-sdk-reference/src/components/field/Checkbox/index.tsx +1 -0
  175. package/templates/react-sdk-reference/src/components/field/Currency/Currency.tsx +111 -0
  176. package/templates/react-sdk-reference/src/components/field/Currency/config-ext.json +9 -0
  177. package/templates/react-sdk-reference/src/components/field/Currency/currency-utils.ts +67 -0
  178. package/templates/react-sdk-reference/src/components/field/Currency/index.tsx +1 -0
  179. package/templates/react-sdk-reference/src/components/field/Date/Date.tsx +94 -0
  180. package/templates/react-sdk-reference/src/components/field/Date/config-ext.json +9 -0
  181. package/templates/react-sdk-reference/src/components/field/Date/index.tsx +1 -0
  182. package/templates/react-sdk-reference/src/components/field/DateTime/DateTime.tsx +101 -0
  183. package/templates/react-sdk-reference/src/components/field/DateTime/config-ext.json +8 -0
  184. package/templates/react-sdk-reference/src/components/field/DateTime/index.tsx +1 -0
  185. package/templates/react-sdk-reference/src/components/field/Decimal/Decimal.tsx +122 -0
  186. package/templates/react-sdk-reference/src/components/field/Decimal/config-ext.json +8 -0
  187. package/templates/react-sdk-reference/src/components/field/Decimal/index.tsx +1 -0
  188. package/templates/react-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +238 -0
  189. package/templates/react-sdk-reference/src/components/field/Dropdown/config-ext.json +8 -0
  190. package/templates/react-sdk-reference/src/components/field/Dropdown/index.tsx +1 -0
  191. package/templates/react-sdk-reference/src/components/field/Email/Email.tsx +96 -0
  192. package/templates/react-sdk-reference/src/components/field/Email/config-ext.json +8 -0
  193. package/templates/react-sdk-reference/src/components/field/Email/index.tsx +1 -0
  194. package/templates/react-sdk-reference/src/components/field/Group/Group.tsx +41 -0
  195. package/templates/react-sdk-reference/src/components/field/Group/config-ext.json +7 -0
  196. package/templates/react-sdk-reference/src/components/field/Group/index.tsx +1 -0
  197. package/templates/react-sdk-reference/src/components/field/Integer/Integer.tsx +100 -0
  198. package/templates/react-sdk-reference/src/components/field/Integer/config-ext.json +8 -0
  199. package/templates/react-sdk-reference/src/components/field/Integer/index.tsx +1 -0
  200. package/templates/react-sdk-reference/src/components/field/Location/Location.css +4 -0
  201. package/templates/react-sdk-reference/src/components/field/Location/Location.tsx +258 -0
  202. package/templates/react-sdk-reference/src/components/field/Location/config-ext.json +8 -0
  203. package/templates/react-sdk-reference/src/components/field/Location/index.tsx +1 -0
  204. package/templates/react-sdk-reference/src/components/field/Multiselect/Multiselect.tsx +238 -0
  205. package/templates/react-sdk-reference/src/components/field/Multiselect/index.tsx +1 -0
  206. package/templates/react-sdk-reference/src/components/field/Multiselect/utils.ts +230 -0
  207. package/templates/react-sdk-reference/src/components/field/ObjectReference/ObjectReference.tsx +235 -0
  208. package/templates/react-sdk-reference/src/components/field/ObjectReference/index.tsx +1 -0
  209. package/templates/react-sdk-reference/src/components/field/ObjectReference/utils.ts +111 -0
  210. package/templates/react-sdk-reference/src/components/field/Percentage/Percentage.tsx +112 -0
  211. package/templates/react-sdk-reference/src/components/field/Percentage/config-ext.json +8 -0
  212. package/templates/react-sdk-reference/src/components/field/Percentage/index.tsx +1 -0
  213. package/templates/react-sdk-reference/src/components/field/Phone/Phone.tsx +113 -0
  214. package/templates/react-sdk-reference/src/components/field/Phone/config-ext.json +8 -0
  215. package/templates/react-sdk-reference/src/components/field/Phone/index.tsx +1 -0
  216. package/templates/react-sdk-reference/src/components/field/RadioButtons/RadioButtons.tsx +158 -0
  217. package/templates/react-sdk-reference/src/components/field/RadioButtons/config-ext.json +8 -0
  218. package/templates/react-sdk-reference/src/components/field/RadioButtons/index.tsx +1 -0
  219. package/templates/react-sdk-reference/src/components/field/RichText/RichText.css +79 -0
  220. package/templates/react-sdk-reference/src/components/field/RichText/RichText.tsx +98 -0
  221. package/templates/react-sdk-reference/src/components/field/RichText/config-ext.json +10 -0
  222. package/templates/react-sdk-reference/src/components/field/RichText/index.tsx +1 -0
  223. package/templates/react-sdk-reference/src/components/field/ScalarList/ScalarList.tsx +63 -0
  224. package/templates/react-sdk-reference/src/components/field/ScalarList/config-ext.json +7 -0
  225. package/templates/react-sdk-reference/src/components/field/ScalarList/index.tsx +1 -0
  226. package/templates/react-sdk-reference/src/components/field/SelectableCard/SelectableCard.tsx +189 -0
  227. package/templates/react-sdk-reference/src/components/field/SelectableCard/index.tsx +1 -0
  228. package/templates/react-sdk-reference/src/components/field/SelectableCard/utils.tsx +223 -0
  229. package/templates/react-sdk-reference/src/components/field/SemanticLink/SemanticLink.tsx +208 -0
  230. package/templates/react-sdk-reference/src/components/field/SemanticLink/config-ext.json +7 -0
  231. package/templates/react-sdk-reference/src/components/field/SemanticLink/index.tsx +1 -0
  232. package/templates/react-sdk-reference/src/components/field/SemanticLink/utils.ts +49 -0
  233. package/templates/react-sdk-reference/src/components/field/TextArea/TextArea.tsx +94 -0
  234. package/templates/react-sdk-reference/src/components/field/TextArea/config-ext.json +8 -0
  235. package/templates/react-sdk-reference/src/components/field/TextArea/index.tsx +1 -0
  236. package/templates/react-sdk-reference/src/components/field/TextContent/TextContent.tsx +46 -0
  237. package/templates/react-sdk-reference/src/components/field/TextContent/config-ext.json +7 -0
  238. package/templates/react-sdk-reference/src/components/field/TextContent/index.tsx +1 -0
  239. package/templates/react-sdk-reference/src/components/field/TextInput/TextInput.tsx +92 -0
  240. package/templates/react-sdk-reference/src/components/field/TextInput/config-ext.json +8 -0
  241. package/templates/react-sdk-reference/src/components/field/TextInput/index.tsx +1 -0
  242. package/templates/react-sdk-reference/src/components/field/Time/Time.tsx +79 -0
  243. package/templates/react-sdk-reference/src/components/field/Time/config-ext.json +8 -0
  244. package/templates/react-sdk-reference/src/components/field/Time/index.tsx +1 -0
  245. package/templates/react-sdk-reference/src/components/field/URL/URL.tsx +89 -0
  246. package/templates/react-sdk-reference/src/components/field/URL/config-ext.json +8 -0
  247. package/templates/react-sdk-reference/src/components/field/URL/index.tsx +1 -0
  248. package/templates/react-sdk-reference/src/components/field/UserReference/UserReference.tsx +198 -0
  249. package/templates/react-sdk-reference/src/components/field/UserReference/UserReferenceUtils.ts +13 -0
  250. package/templates/react-sdk-reference/src/components/field/UserReference/config-ext.json +7 -0
  251. package/templates/react-sdk-reference/src/components/field/UserReference/index.tsx +1 -0
  252. package/templates/react-sdk-reference/src/components/helpers/attachmentShared.ts +6 -0
  253. package/templates/react-sdk-reference/src/components/helpers/case-utils.tsx +99 -0
  254. package/templates/react-sdk-reference/src/components/helpers/common-utils.ts +26 -0
  255. package/templates/react-sdk-reference/src/components/helpers/data_page.ts +20 -0
  256. package/templates/react-sdk-reference/src/components/helpers/date-format-utils.ts +76 -0
  257. package/templates/react-sdk-reference/src/components/helpers/event-utils.ts +20 -0
  258. package/templates/react-sdk-reference/src/components/helpers/field-group-utils.ts +63 -0
  259. package/templates/react-sdk-reference/src/components/helpers/formatters/Boolean.ts +21 -0
  260. package/templates/react-sdk-reference/src/components/helpers/formatters/Currency.ts +77 -0
  261. package/templates/react-sdk-reference/src/components/helpers/formatters/CurrencyMap.ts +913 -0
  262. package/templates/react-sdk-reference/src/components/helpers/formatters/Date.ts +71 -0
  263. package/templates/react-sdk-reference/src/components/helpers/formatters/common.ts +14 -0
  264. package/templates/react-sdk-reference/src/components/helpers/formatters/index.ts +130 -0
  265. package/templates/react-sdk-reference/src/components/helpers/instructions-utils.ts +38 -0
  266. package/templates/react-sdk-reference/src/components/helpers/object-utils.ts +10 -0
  267. package/templates/react-sdk-reference/src/components/helpers/reactContextHelpers.ts +3 -0
  268. package/templates/react-sdk-reference/src/components/helpers/simpleTableHelpers.ts +452 -0
  269. package/templates/react-sdk-reference/src/components/helpers/state-utils.tsx +43 -0
  270. package/templates/react-sdk-reference/src/components/helpers/template-utils.ts +76 -0
  271. package/templates/react-sdk-reference/src/components/helpers/utils.ts +349 -0
  272. package/templates/react-sdk-reference/src/components/helpers/versionHelpers.ts +14 -0
  273. package/templates/react-sdk-reference/src/components/index.ts +8 -0
  274. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
  275. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
  276. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +329 -0
  277. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
  278. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
  279. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
  280. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/TemplateContext.ts +11 -0
  281. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/config-ext.json +9 -0
  282. package/templates/react-sdk-reference/src/components/template/AdvancedSearch/index.tsx +1 -0
  283. package/templates/react-sdk-reference/src/components/template/AppShell/AppShell.css +35 -0
  284. package/templates/react-sdk-reference/src/components/template/AppShell/AppShell.tsx +259 -0
  285. package/templates/react-sdk-reference/src/components/template/AppShell/index.tsx +1 -0
  286. package/templates/react-sdk-reference/src/components/template/BannerPage/BannerPage.tsx +54 -0
  287. package/templates/react-sdk-reference/src/components/template/BannerPage/config-ext.json +9 -0
  288. package/templates/react-sdk-reference/src/components/template/BannerPage/index.tsx +1 -0
  289. package/templates/react-sdk-reference/src/components/template/CaseSummary/CaseSummary.tsx +79 -0
  290. package/templates/react-sdk-reference/src/components/template/CaseSummary/config-ext.json +8 -0
  291. package/templates/react-sdk-reference/src/components/template/CaseSummary/index.tsx +1 -0
  292. package/templates/react-sdk-reference/src/components/template/CaseView/CaseView.tsx +261 -0
  293. package/templates/react-sdk-reference/src/components/template/CaseView/config-ext.json +8 -0
  294. package/templates/react-sdk-reference/src/components/template/CaseView/index.tsx +1 -0
  295. package/templates/react-sdk-reference/src/components/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +117 -0
  296. package/templates/react-sdk-reference/src/components/template/CaseViewActionsMenu/index.tsx +1 -0
  297. package/templates/react-sdk-reference/src/components/template/Confirmation/Confirmation.tsx +102 -0
  298. package/templates/react-sdk-reference/src/components/template/Confirmation/config-ext.json +11 -0
  299. package/templates/react-sdk-reference/src/components/template/Confirmation/index.tsx +1 -0
  300. package/templates/react-sdk-reference/src/components/template/DataReference/DataReference.tsx +590 -0
  301. package/templates/react-sdk-reference/src/components/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
  302. package/templates/react-sdk-reference/src/components/template/DataReference/SearchForm.tsx +213 -0
  303. package/templates/react-sdk-reference/src/components/template/DataReference/config-ext.json +8 -0
  304. package/templates/react-sdk-reference/src/components/template/DataReference/index.tsx +1 -0
  305. package/templates/react-sdk-reference/src/components/template/DataReference/utils.ts +90 -0
  306. package/templates/react-sdk-reference/src/components/template/DefaultForm/DefaultForm.css +34 -0
  307. package/templates/react-sdk-reference/src/components/template/DefaultForm/DefaultForm.tsx +74 -0
  308. package/templates/react-sdk-reference/src/components/template/DefaultForm/config-ext.json +8 -0
  309. package/templates/react-sdk-reference/src/components/template/DefaultForm/index.tsx +1 -0
  310. package/templates/react-sdk-reference/src/components/template/DefaultForm/utils/index.ts +26 -0
  311. package/templates/react-sdk-reference/src/components/template/DefaultPage/DefaultPage.tsx +108 -0
  312. package/templates/react-sdk-reference/src/components/template/DefaultPage/index.tsx +1 -0
  313. package/templates/react-sdk-reference/src/components/template/Details/Details/Details.tsx +74 -0
  314. package/templates/react-sdk-reference/src/components/template/Details/Details/index.tsx +1 -0
  315. package/templates/react-sdk-reference/src/components/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +58 -0
  316. package/templates/react-sdk-reference/src/components/template/Details/DetailsSubTabs/config-ext.json +8 -0
  317. package/templates/react-sdk-reference/src/components/template/Details/DetailsSubTabs/index.tsx +1 -0
  318. package/templates/react-sdk-reference/src/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +79 -0
  319. package/templates/react-sdk-reference/src/components/template/Details/DetailsThreeColumn/config-ext.json +8 -0
  320. package/templates/react-sdk-reference/src/components/template/Details/DetailsThreeColumn/index.tsx +1 -0
  321. package/templates/react-sdk-reference/src/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +79 -0
  322. package/templates/react-sdk-reference/src/components/template/Details/DetailsTwoColumn/config-ext.json +8 -0
  323. package/templates/react-sdk-reference/src/components/template/Details/DetailsTwoColumn/index.tsx +1 -0
  324. package/templates/react-sdk-reference/src/components/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
  325. package/templates/react-sdk-reference/src/components/template/Details/DynamicTabs/config.json +36 -0
  326. package/templates/react-sdk-reference/src/components/template/Details/DynamicTabs/index.tsx +1 -0
  327. package/templates/react-sdk-reference/src/components/template/FieldGroupTemplate/FieldGroupTemplate.tsx +116 -0
  328. package/templates/react-sdk-reference/src/components/template/FieldGroupTemplate/index.tsx +1 -0
  329. package/templates/react-sdk-reference/src/components/template/HierarchicalForm/HierarchicalForm.tsx +58 -0
  330. package/templates/react-sdk-reference/src/components/template/HierarchicalForm/hooks.ts +293 -0
  331. package/templates/react-sdk-reference/src/components/template/HierarchicalForm/index.tsx +1 -0
  332. package/templates/react-sdk-reference/src/components/template/InlineDashboard/InlineDashboard.tsx +72 -0
  333. package/templates/react-sdk-reference/src/components/template/InlineDashboard/index.tsx +1 -0
  334. package/templates/react-sdk-reference/src/components/template/InlineDashboardPage/InlineDashboardPage.tsx +39 -0
  335. package/templates/react-sdk-reference/src/components/template/InlineDashboardPage/config-ext.json +9 -0
  336. package/templates/react-sdk-reference/src/components/template/InlineDashboardPage/index.tsx +1 -0
  337. package/templates/react-sdk-reference/src/components/template/ListPage/ListPage.tsx +16 -0
  338. package/templates/react-sdk-reference/src/components/template/ListPage/config-ext.json +7 -0
  339. package/templates/react-sdk-reference/src/components/template/ListPage/index.tsx +1 -0
  340. package/templates/react-sdk-reference/src/components/template/ListView/DefaultViewMeta.ts +220 -0
  341. package/templates/react-sdk-reference/src/components/template/ListView/ListView.css +10 -0
  342. package/templates/react-sdk-reference/src/components/template/ListView/ListView.tsx +1391 -0
  343. package/templates/react-sdk-reference/src/components/template/ListView/config-ext.json +8 -0
  344. package/templates/react-sdk-reference/src/components/template/ListView/hooks.ts +93 -0
  345. package/templates/react-sdk-reference/src/components/template/ListView/index.tsx +1 -0
  346. package/templates/react-sdk-reference/src/components/template/ListView/utils.ts +781 -0
  347. package/templates/react-sdk-reference/src/components/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +52 -0
  348. package/templates/react-sdk-reference/src/components/template/MultiReferenceReadOnly/index.tsx +1 -0
  349. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWide/NarrowWide.css +19 -0
  350. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWide/NarrowWide.tsx +37 -0
  351. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWide/index.tsx +1 -0
  352. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +85 -0
  353. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideDetails/config-ext.json +8 -0
  354. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideDetails/index.tsx +1 -0
  355. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +19 -0
  356. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +22 -0
  357. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/config-ext.json +8 -0
  358. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWideForm/index.tsx +1 -0
  359. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +28 -0
  360. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWidePage/config-ext.json +8 -0
  361. package/templates/react-sdk-reference/src/components/template/NarrowWide/NarrowWidePage/index.tsx +1 -0
  362. package/templates/react-sdk-reference/src/components/template/ObjectPage/index.tsx +1 -0
  363. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumn/OneColumn.tsx +32 -0
  364. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumn/config-ext.json +8 -0
  365. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumn/index.tsx +1 -0
  366. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnPage/OneColumnPage.tsx +17 -0
  367. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnPage/config-ext.json +8 -0
  368. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnPage/index.tsx +1 -0
  369. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnTab/OneColumnTab.tsx +11 -0
  370. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnTab/config-ext.json +8 -0
  371. package/templates/react-sdk-reference/src/components/template/OneColumn/OneColumnTab/index.tsx +1 -0
  372. package/templates/react-sdk-reference/src/components/template/PromotedFilters/PromotedFilters.css +7 -0
  373. package/templates/react-sdk-reference/src/components/template/PromotedFilters/PromotedFilters.tsx +204 -0
  374. package/templates/react-sdk-reference/src/components/template/PromotedFilters/index.tsx +1 -0
  375. package/templates/react-sdk-reference/src/components/template/SelfServiceCaseView/SelfServiceCaseView.tsx +153 -0
  376. package/templates/react-sdk-reference/src/components/template/SelfServiceCaseView/index.tsx +1 -0
  377. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTable/SimpleTable.tsx +126 -0
  378. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTable/config-ext.json +7 -0
  379. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTable/index.tsx +1 -0
  380. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +985 -0
  381. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/index.tsx +1 -0
  382. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +122 -0
  383. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/index.tsx +1 -0
  384. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelectReadonly/SimpleTableSelectReadonly.tsx +207 -0
  385. package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelectReadonly/index.tsx +1 -0
  386. package/templates/react-sdk-reference/src/components/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +71 -0
  387. package/templates/react-sdk-reference/src/components/template/SingleReferenceReadOnly/index.tsx +1 -0
  388. package/templates/react-sdk-reference/src/components/template/SubTabs/SubTabs.tsx +46 -0
  389. package/templates/react-sdk-reference/src/components/template/SubTabs/config-ext.json +8 -0
  390. package/templates/react-sdk-reference/src/components/template/SubTabs/index.tsx +1 -0
  391. package/templates/react-sdk-reference/src/components/template/SubTabs/tabUtils.ts +185 -0
  392. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/TwoColumn.css +12 -0
  393. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/TwoColumn.tsx +54 -0
  394. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/config-ext.json +8 -0
  395. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumn/index.tsx +1 -0
  396. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +17 -0
  397. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnPage/config-ext.json +8 -0
  398. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnPage/index.tsx +1 -0
  399. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
  400. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +54 -0
  401. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/config-ext.json +8 -0
  402. package/templates/react-sdk-reference/src/components/template/TwoColumn/TwoColumnTab/index.tsx +1 -0
  403. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrow/WideNarrow.css +19 -0
  404. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrow/WideNarrow.tsx +37 -0
  405. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrow/index.tsx +1 -0
  406. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +96 -0
  407. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowDetails/config-ext.json +8 -0
  408. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowDetails/index.tsx +1 -0
  409. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +19 -0
  410. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +22 -0
  411. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/config-ext.json +8 -0
  412. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowForm/index.tsx +1 -0
  413. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +28 -0
  414. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowPage/config-ext.json +8 -0
  415. package/templates/react-sdk-reference/src/components/template/WideNarrow/WideNarrowPage/index.tsx +1 -0
  416. package/templates/react-sdk-reference/src/components/template/WssNavBar/WssNavBar.css +11 -0
  417. package/templates/react-sdk-reference/src/components/template/WssNavBar/WssNavBar.tsx +160 -0
  418. package/templates/react-sdk-reference/src/components/template/WssNavBar/index.tsx +1 -0
  419. package/templates/react-sdk-reference/src/components/template/utils.tsx +58 -0
  420. package/templates/react-sdk-reference/src/components/widget/AppAnnouncement/AppAnnouncement.tsx +60 -0
  421. package/templates/react-sdk-reference/src/components/widget/AppAnnouncement/config-ext.json +8 -0
  422. package/templates/react-sdk-reference/src/components/widget/AppAnnouncement/index.tsx +1 -0
  423. package/templates/react-sdk-reference/src/components/widget/Attachment/Attachment.css +95 -0
  424. package/templates/react-sdk-reference/src/components/widget/Attachment/Attachment.tsx +541 -0
  425. package/templates/react-sdk-reference/src/components/widget/Attachment/Attachment.types.ts +96 -0
  426. package/templates/react-sdk-reference/src/components/widget/Attachment/AttachmentUtils.ts +316 -0
  427. package/templates/react-sdk-reference/src/components/widget/Attachment/index.tsx +1 -0
  428. package/templates/react-sdk-reference/src/components/widget/CaseHistory/CaseHistory.tsx +171 -0
  429. package/templates/react-sdk-reference/src/components/widget/CaseHistory/config-ext.json +8 -0
  430. package/templates/react-sdk-reference/src/components/widget/CaseHistory/index.tsx +1 -0
  431. package/templates/react-sdk-reference/src/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +13 -0
  432. package/templates/react-sdk-reference/src/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +32 -0
  433. package/templates/react-sdk-reference/src/components/widget/FileUtility/ActionButtonsForFileUtil/index.tsx +1 -0
  434. package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/FileUtility.css +118 -0
  435. package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/FileUtility.tsx +653 -0
  436. package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/config-ext.json +8 -0
  437. package/templates/react-sdk-reference/src/components/widget/FileUtility/FileUtility/index.tsx +1 -0
  438. package/templates/react-sdk-reference/src/components/widget/Followers/Followers.tsx +43 -0
  439. package/templates/react-sdk-reference/src/components/widget/Followers/config-ext.json +8 -0
  440. package/templates/react-sdk-reference/src/components/widget/Followers/index.tsx +1 -0
  441. package/templates/react-sdk-reference/src/components/widget/QuickCreate/QuickCreate.tsx +88 -0
  442. package/templates/react-sdk-reference/src/components/widget/QuickCreate/config-ext.json +9 -0
  443. package/templates/react-sdk-reference/src/components/widget/QuickCreate/index.tsx +1 -0
  444. package/templates/react-sdk-reference/src/components/widget/SummaryItem/SummaryItem.css +76 -0
  445. package/templates/react-sdk-reference/src/components/widget/SummaryItem/SummaryItem.tsx +89 -0
  446. package/templates/react-sdk-reference/src/components/widget/SummaryItem/index.tsx +1 -0
  447. package/templates/react-sdk-reference/src/components/widget/SummaryList/SummaryList.tsx +23 -0
  448. package/templates/react-sdk-reference/src/components/widget/SummaryList/index.tsx +1 -0
  449. package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.css +81 -0
  450. package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.tsx +507 -0
  451. package/templates/react-sdk-reference/src/components/widget/ToDo/config-ext.json +8 -0
  452. package/templates/react-sdk-reference/src/components/widget/ToDo/index.tsx +1 -0
  453. package/templates/react-sdk-reference/src/main.tsx +13 -0
  454. package/templates/react-sdk-reference/src/mui-theme-augmentation.d.ts +6 -0
  455. package/templates/react-sdk-reference/tsconfig.json +24 -0
  456. package/templates/react-sdk-reference/vite.config.ts +65 -0
  457. package/templates/wc-sdk-reference/.github/AGENTS.md +23 -0
  458. package/templates/wc-sdk-reference/.github/copilot-instructions.md +40 -0
  459. package/templates/wc-sdk-reference/.github/skills/pega-sdk-component.md +48 -0
  460. package/templates/wc-sdk-reference/index.html +21 -0
  461. package/templates/wc-sdk-reference/package.json +19 -0
  462. package/templates/wc-sdk-reference/sdk-config.json +19 -0
  463. package/templates/wc-sdk-reference/src/index.ts +98 -0
  464. package/templates/wc-sdk-reference/tsconfig.json +21 -0
  465. package/templates/wc-sdk-reference/vite.config.ts +8 -0
@@ -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 '../../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
+ };
@@ -0,0 +1,235 @@
1
+ import { useMemo } from 'react';
2
+
3
+ import Grid from '@mui/material/Grid';
4
+
5
+ import { SELECTION_MODE, generateColumns, getDataRelationshipContextFromKey } from './utils';
6
+ import { getComponentFromRegistry } from '@pega/sdk-react';
7
+ import type { PConnFieldProps } from '@pega/sdk-react';
8
+
9
+ interface ObjectReferenceProps extends Omit<PConnFieldProps, 'value'> {
10
+ // If any, enter additional props that only exist on ObjectReference here
11
+ getPConnect: any;
12
+ displayMode;
13
+ allowAndPersistChangesInReviewMode: any;
14
+ targetObjectType: any;
15
+ mode: string;
16
+ parameters: object;
17
+ hideLabel: boolean;
18
+ inline: boolean;
19
+ showPromotedFilters: boolean;
20
+ additionalFields: any;
21
+ }
22
+
23
+ export default function ObjectReference(props: ObjectReferenceProps) {
24
+ const {
25
+ getPConnect,
26
+ displayMode,
27
+ allowAndPersistChangesInReviewMode: editableInReview = false,
28
+ targetObjectType,
29
+ mode = '',
30
+ parameters,
31
+ hideLabel = false,
32
+ inline = false,
33
+ showPromotedFilters = false,
34
+ additionalFields
35
+ } = props;
36
+
37
+ const SingleReferenceReadonly = getComponentFromRegistry('SingleReferenceReadOnly');
38
+
39
+ // Configs
40
+ const pConn = getPConnect();
41
+ const referenceType = targetObjectType === 'case' ? 'Case' : 'Data';
42
+ const rawViewMetadata = pConn.getRawMetadata();
43
+ const refFieldMetadata = pConn.getFieldMetadata(rawViewMetadata?.config?.value?.split('.', 2)[1]);
44
+
45
+ // Destructured properties
46
+ const propsToUse = { ...pConn.getInheritedProps(), ...props };
47
+
48
+ // Computed variables
49
+ const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
50
+ const canBeChangedInReviewMode = editableInReview && ['Autocomplete', 'Dropdown'].includes(rawViewMetadata.config.componentType);
51
+
52
+ // Editable first child on change handler
53
+ const onRecordChange = event => {
54
+ const caseKey = pConn.getCaseInfo().getKey();
55
+ const refreshOptions = { autoDetectRefresh: true, propertyName: '' };
56
+ refreshOptions.propertyName = rawViewMetadata.config?.value;
57
+
58
+ if (!canBeChangedInReviewMode || !pConn.getValue('__currentPageTabViewName')) {
59
+ const pgRef = pConn.getPageReference().replace('caseInfo.content', '');
60
+ const viewName = rawViewMetadata.name;
61
+ if (viewName && viewName.length > 0) {
62
+ getPConnect().getActionsApi().refreshCaseView(caseKey, viewName, pgRef, refreshOptions);
63
+ }
64
+ }
65
+
66
+ // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value if event.id is unset
67
+ // When value is empty propValue will be undefined here and no value will be set for the reference
68
+ const propValue = event?.id || event?.target?.value;
69
+ const propName =
70
+ rawViewMetadata.type === 'SimpleTableSelect' && mode === SELECTION_MODE.MULTI
71
+ ? PCore.getAnnotationUtils().getPropertyName(rawViewMetadata.config.selectionList)
72
+ : PCore.getAnnotationUtils().getPropertyName(rawViewMetadata.config?.value);
73
+
74
+ if (propValue && canBeChangedInReviewMode && isDisplayModeEnabled) {
75
+ PCore.getCaseUtils()
76
+ .getCaseEditLock(caseKey, '')
77
+ .then(caseResponse => {
78
+ const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
79
+ let curr = {};
80
+ const commitData = curr;
81
+
82
+ pageTokens.forEach(el => {
83
+ if (el !== '') {
84
+ curr[el] = {};
85
+ curr = curr[el];
86
+ }
87
+ });
88
+
89
+ // expecting format like {Customer: {pyID:"C-100"}}
90
+ const propArr = propName.split('.');
91
+ propArr.forEach((element, idx) => {
92
+ if (idx + 1 === propArr.length) {
93
+ curr[element] = propValue;
94
+ } else {
95
+ curr[element] = {};
96
+ curr = curr[element];
97
+ }
98
+ });
99
+
100
+ PCore.getCaseUtils()
101
+ .updateCaseEditFieldsData(caseKey, { [caseKey]: commitData }, caseResponse.headers.etag, pConn.getContextName())
102
+ .then(response => {
103
+ PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), (response.data as any).data.caseInfo.lastUpdateTime);
104
+ PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);
105
+ });
106
+ });
107
+ }
108
+ };
109
+
110
+ // Prepare first child
111
+ const recreatedFirstChild = useMemo(() => {
112
+ const type = rawViewMetadata.config.componentType;
113
+
114
+ /* Read-only variants */
115
+ if (type === 'SemanticLink' && !canBeChangedInReviewMode) {
116
+ const config = {
117
+ ...rawViewMetadata.config,
118
+ primaryField: rawViewMetadata.config.displayField
119
+ };
120
+ config.caseClass = rawViewMetadata.config.targetObjectClass;
121
+ config.text = config.primaryField;
122
+ config.caseID = config.value;
123
+ config.contextPage = `@P .${
124
+ rawViewMetadata.config?.displayField ? getDataRelationshipContextFromKey(rawViewMetadata.config.displayField) : null
125
+ }`;
126
+ config.resourceParams = {
127
+ workID: config.value
128
+ };
129
+ config.resourcePayload = {
130
+ caseClassName: config.caseClass
131
+ };
132
+
133
+ return getPConnect().createComponent({
134
+ type: 'SemanticLink',
135
+ config: {
136
+ ...config,
137
+ displayMode,
138
+ referenceType,
139
+ hideLabel,
140
+ dataRelationshipContext: rawViewMetadata.config?.displayField
141
+ ? getDataRelationshipContextFromKey(rawViewMetadata.config.displayField)
142
+ : null
143
+ }
144
+ });
145
+ }
146
+ if (isDisplayModeEnabled && !canBeChangedInReviewMode) {
147
+ return (
148
+ <SingleReferenceReadonly
149
+ config={{
150
+ ...rawViewMetadata.config,
151
+ primaryField: rawViewMetadata.config.displayField
152
+ }}
153
+ getPConnect={getPConnect}
154
+ label={propsToUse.label}
155
+ type={type}
156
+ displayAs='readonly'
157
+ displayMode={displayMode}
158
+ activeViewRuleClass={rawViewMetadata.config.targetObjectClass} // for older views which may not have context class set, fall back to previous behavior
159
+ referenceType={referenceType}
160
+ hideLabel={hideLabel}
161
+ dataRelationshipContext={
162
+ rawViewMetadata.config?.displayField ? getDataRelationshipContextFromKey(rawViewMetadata.config.displayField) : null
163
+ }
164
+ additionalFields={additionalFields}
165
+ />
166
+ );
167
+ }
168
+
169
+ // 1) Set datasource
170
+ generateColumns(rawViewMetadata.config, pConn, referenceType);
171
+ rawViewMetadata.config.deferDatasource = true;
172
+ rawViewMetadata.config.listType = 'datapage';
173
+ if (['Dropdown', 'AutoComplete'].includes(type) && !rawViewMetadata.config.placeholder) {
174
+ rawViewMetadata.config.placeholder = '@L Select...';
175
+ }
176
+
177
+ // 2) Pass through configs
178
+ rawViewMetadata.config.showPromotedFilters = showPromotedFilters;
179
+
180
+ if (!canBeChangedInReviewMode) {
181
+ rawViewMetadata.config.displayMode = displayMode;
182
+ }
183
+
184
+ // 3) Define field meta
185
+ let fieldMetaData: any = null;
186
+
187
+ fieldMetaData = {
188
+ datasourceMetadata: {
189
+ datasource: {
190
+ parameters: {}
191
+ }
192
+ }
193
+ };
194
+ if (rawViewMetadata.config?.parameters) {
195
+ fieldMetaData.datasourceMetadata.datasource.parameters = parameters;
196
+ }
197
+ fieldMetaData.datasourceMetadata.datasource.propertyForDisplayText = rawViewMetadata?.config?.datasource?.fields?.text.startsWith('@P')
198
+ ? rawViewMetadata?.config?.datasource?.fields?.text?.substring(3)
199
+ : rawViewMetadata?.config?.datasource?.fields?.text;
200
+ fieldMetaData.datasourceMetadata.datasource.propertyForValue = rawViewMetadata?.config?.datasource?.fields?.value.startsWith('@P')
201
+ ? rawViewMetadata?.config?.datasource?.fields?.value?.substring(3)
202
+ : rawViewMetadata?.config?.datasource?.fields?.value;
203
+ fieldMetaData.datasourceMetadata.datasource.name = rawViewMetadata.config?.referenceList;
204
+
205
+ return getPConnect().createComponent({
206
+ type,
207
+ config: {
208
+ ...rawViewMetadata.config,
209
+ descriptors: mode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
210
+ datasourceMetadata: fieldMetaData?.datasourceMetadata,
211
+ required: propsToUse.required,
212
+ visibility: propsToUse.visibility,
213
+ disabled: propsToUse.disabled,
214
+ label: propsToUse.label,
215
+ parameters: rawViewMetadata.config.parameters,
216
+ readOnly: false,
217
+ localeReference: rawViewMetadata.config.localeReference,
218
+ ...(mode === SELECTION_MODE.SINGLE ? { referenceType } : ''),
219
+ contextClass: rawViewMetadata.config.targetObjectClass,
220
+ primaryField: rawViewMetadata.config?.displayField,
221
+ dataRelationshipContext: rawViewMetadata.config?.displayField ? getDataRelationshipContextFromKey(rawViewMetadata.config.displayField) : null,
222
+ hideLabel,
223
+ onRecordChange,
224
+ inline
225
+ }
226
+ });
227
+ }, [rawViewMetadata.config?.datasource?.source, parameters, propsToUse.required, propsToUse.disabled, getPConnect().getPageReference()]);
228
+
229
+ // Prepare children to render
230
+ return (
231
+ <Grid container>
232
+ <Grid>{recreatedFirstChild}</Grid>
233
+ </Grid>
234
+ );
235
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ObjectReference';
@@ -0,0 +1,111 @@
1
+ import { Utils } from '../../helpers/utils';
2
+
3
+ export const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
4
+
5
+ const getLeafNameFromPropertyName = property => property?.substr(property.lastIndexOf('.'));
6
+
7
+ const isSelfReferencedProperty = (param, referenceProp) => param === referenceProp?.split('.', 2)[1];
8
+
9
+ export const AT_FILTEREDLIST = '@FILTERED_LIST';
10
+ export const AT_PROPERTY = '@P';
11
+ export const SQUARE_BRACKET_START = '[';
12
+ export const SQUARE_BRACKET_END = ']';
13
+
14
+ export const SIMPLE_TABLE_MANUAL_READONLY = 'SimpleTableManualReadOnly';
15
+ export const PAGE = '!P!';
16
+ export const PAGELIST = '!PL!';
17
+ export const PERIOD = '.';
18
+ const AT = '@';
19
+
20
+ export function updatePageListPropertyValue(value) {
21
+ value = value.substring(0, value.indexOf(SQUARE_BRACKET_START)) + value.substring(value.indexOf(SQUARE_BRACKET_END) + 1);
22
+ return value;
23
+ }
24
+
25
+ export function getPropertyValue(value) {
26
+ if (value.startsWith(AT)) {
27
+ value = value.substring(value.indexOf(' ') + 1);
28
+ if (value.startsWith(PERIOD)) value = value.substring(1);
29
+ }
30
+ if (value.includes(SQUARE_BRACKET_START)) {
31
+ value = updatePageListPropertyValue(value);
32
+ }
33
+ return value;
34
+ }
35
+
36
+ const getCompositeKeys = (c11nEnv, property) => {
37
+ const { datasource: { parameters = {} } = {} } = c11nEnv.getFieldMetadata(property) || {};
38
+ return Object.values(parameters).reduce((compositeKeys: any, param) => {
39
+ if (isSelfReferencedProperty(property, param)) {
40
+ let propName = getPropertyValue(param);
41
+ propName = propName.substring(propName.indexOf('.'));
42
+ compositeKeys.push(propName);
43
+ }
44
+ return compositeKeys;
45
+ }, []);
46
+ };
47
+
48
+ export const generateColumns = (config, pConn, referenceType) => {
49
+ const displayField = getLeafNameFromPropertyName(config.displayField);
50
+ const referenceProp = config.value.split('.', 2)[1];
51
+ const compositeKeys: any = getCompositeKeys(pConn, referenceProp);
52
+ let value = getLeafNameFromPropertyName(config.value);
53
+
54
+ const columns: any = [];
55
+ if (displayField) {
56
+ columns.push({
57
+ value: displayField,
58
+ display: 'true',
59
+ useForSearch: true,
60
+ primary: 'true'
61
+ });
62
+ }
63
+ if (value && compositeKeys.indexOf(value) !== -1) {
64
+ columns.push({
65
+ value,
66
+ setProperty: 'Associated property',
67
+ key: 'true'
68
+ });
69
+ } else {
70
+ const actualValue = compositeKeys.length > 0 ? compositeKeys[0] : value;
71
+ config.value = `@P .${referenceProp}${actualValue}`;
72
+ value = actualValue;
73
+ columns.push({
74
+ value: actualValue,
75
+ setProperty: 'Associated property',
76
+ key: 'true'
77
+ });
78
+ }
79
+
80
+ config.datasource = {
81
+ fields: {
82
+ key: getLeafNameFromPropertyName(config.value),
83
+ text: getLeafNameFromPropertyName(config.displayField),
84
+ value: getLeafNameFromPropertyName(config.value)
85
+ }
86
+ };
87
+
88
+ if (referenceType === 'Case') {
89
+ columns.push({
90
+ secondary: 'true',
91
+ display: 'true',
92
+ value: Utils.getMappedKey('pyID'),
93
+ useForSearch: true
94
+ });
95
+ }
96
+
97
+ compositeKeys.forEach(key => {
98
+ if (value !== key)
99
+ columns.push({
100
+ value: key,
101
+ display: 'false',
102
+ secondary: 'true',
103
+ useForSearch: false,
104
+ setProperty: `.${referenceProp}${key}`
105
+ });
106
+ });
107
+
108
+ config.columns = columns;
109
+ };
110
+
111
+ export const getDataRelationshipContextFromKey = key => key.split('.', 2)[1];
@@ -0,0 +1,112 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { NumericFormat } from 'react-number-format';
3
+ import { TextField } from '@mui/material';
4
+ import { getComponentFromRegistry } from '@pega/sdk-react';
5
+ import type { PConnFieldProps } from '@pega/sdk-react';
6
+ import { getCurrencyCharacters, getCurrencyOptions } from '../Currency/currency-utils';
7
+ import handleEvent from '../../helpers/event-utils';
8
+ import { format } from '../../helpers/formatters';
9
+
10
+ /* Using react-number-format component here, since it allows formatting decimal values,
11
+ as per the locale.
12
+ */
13
+ interface PercentageProps extends PConnFieldProps {
14
+ // If any, enter additional props that only exist on Percentage here
15
+ currencyISOCode?: string;
16
+ showGroupSeparators?: string;
17
+ decimalPrecision?: number;
18
+ }
19
+
20
+ export default function Percentage(props: PercentageProps) {
21
+ // Get emitted components from map (so we can get any override that may exist)
22
+ const FieldValueList = getComponentFromRegistry('FieldValueList');
23
+
24
+ const {
25
+ getPConnect,
26
+ label,
27
+ required,
28
+ disabled,
29
+ value = '',
30
+ validatemessage,
31
+ status,
32
+ // onChange,
33
+ // onBlur,
34
+ readOnly,
35
+ currencyISOCode = 'USD',
36
+ testId,
37
+ helperText,
38
+ displayMode,
39
+ hideLabel,
40
+ placeholder,
41
+ showGroupSeparators,
42
+ decimalPrecision
43
+ } = props;
44
+
45
+ const [values, setValues] = useState(value.toString());
46
+
47
+ const pConn = getPConnect();
48
+ const actions = pConn.getActionsApi();
49
+ const propName = (pConn.getStateProps() as any).value;
50
+ const helperTextToDisplay = validatemessage || helperText;
51
+
52
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
53
+ const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
54
+
55
+ useEffect(() => {
56
+ setValues(value.toString());
57
+ }, [value]);
58
+
59
+ let readOnlyProp = {}; // Note: empty if NOT ReadOnly
60
+
61
+ if (readOnly) {
62
+ readOnlyProp = { readOnly: true };
63
+ }
64
+
65
+ if (displayMode === 'DISPLAY_ONLY') {
66
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;
67
+ }
68
+
69
+ if (displayMode === 'STACKED_LARGE_VAL') {
70
+ return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
71
+ }
72
+
73
+ const testProps: any = { 'data-test-id': testId };
74
+
75
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
76
+ const theCurrDec = theSymbols.theDecimalIndicator;
77
+ const theCurrSep = theSymbols.theDigitGroupSeparator;
78
+
79
+ function PercentageOnBlur() {
80
+ handleEvent(actions, 'changeNblur', propName, values);
81
+ }
82
+
83
+ const handleChange = val => {
84
+ setValues(val.value);
85
+ };
86
+
87
+ return (
88
+ <NumericFormat
89
+ valueIsNumericString
90
+ fullWidth
91
+ variant={readOnly ? 'standard' : 'outlined'}
92
+ helperText={helperTextToDisplay}
93
+ placeholder={placeholder ?? ''}
94
+ size='small'
95
+ required={required}
96
+ disabled={disabled}
97
+ error={status === 'error'}
98
+ label={label}
99
+ value={values}
100
+ onValueChange={val => {
101
+ handleChange(val);
102
+ }}
103
+ onBlur={!readOnly ? PercentageOnBlur : undefined}
104
+ decimalSeparator={theCurrDec}
105
+ thousandSeparator={showGroupSeparators ? theCurrSep : ''}
106
+ decimalScale={decimalPrecision}
107
+ suffix='%'
108
+ slotProps={{ input: { ...readOnlyProp, inputProps: { ...testProps } } }}
109
+ customInput={TextField}
110
+ />
111
+ );
112
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Percentage",
3
+ "label": "Percentage",
4
+ "description": "Percentage",
5
+ "type": "Field",
6
+ "subtype": "Decimal-Percentage",
7
+ "properties": []
8
+ }