@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,1391 @@
1
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
2
+ import type { Theme } from '@mui/material/styles';
3
+ import createStyles from '@mui/styles/createStyles';
4
+ import makeStyles from '@mui/styles/makeStyles';
5
+ import Table from '@mui/material/Table';
6
+ import TableBody from '@mui/material/TableBody';
7
+ import TableCell from '@mui/material/TableCell';
8
+ import TableContainer from '@mui/material/TableContainer';
9
+ import TableHead from '@mui/material/TableHead';
10
+ import TablePagination from '@mui/material/TablePagination';
11
+ import TableRow from '@mui/material/TableRow';
12
+ import TableSortLabel from '@mui/material/TableSortLabel';
13
+ import Paper from '@mui/material/Paper';
14
+ import MoreIcon from '@mui/icons-material/MoreVert';
15
+ import FilterListIcon from '@mui/icons-material/FilterList';
16
+ import SubjectIcon from '@mui/icons-material/Subject';
17
+ import SearchIcon from '@mui/icons-material/Search';
18
+ import TextField from '@mui/material/TextField';
19
+ import Grid from '@mui/material/Grid';
20
+ import Menu from '@mui/material/Menu';
21
+ import MenuItem from '@mui/material/MenuItem';
22
+ import Dialog from '@mui/material/Dialog';
23
+ import DialogActions from '@mui/material/DialogActions';
24
+ import DialogContent from '@mui/material/DialogContent';
25
+ import DialogTitle from '@mui/material/DialogTitle';
26
+ import Select from '@mui/material/Select';
27
+ import Button from '@mui/material/Button';
28
+ import Link from '@mui/material/Link';
29
+ import Typography from '@mui/material/Typography';
30
+ import Snackbar from '@mui/material/Snackbar';
31
+ import IconButton from '@mui/material/IconButton';
32
+ import CloseIcon from '@mui/icons-material/Close';
33
+ import { Radio } from '@mui/material';
34
+ import Checkbox from '@mui/material/Checkbox';
35
+ import { filterData } from '../../helpers/simpleTableHelpers';
36
+
37
+ import './ListView.css';
38
+ import { getDateFormatInfo } from '../../helpers/date-format-utils';
39
+ import { getCurrencyOptions } from '../../field/Currency/currency-utils';
40
+ import { getGenericFieldsLocalizedValue } from '../../helpers/common-utils';
41
+ import { format } from '../../helpers/formatters';
42
+
43
+ import useInit from './hooks';
44
+ import type { PConnProps } from '@pega/sdk-react';
45
+
46
+ interface ListViewProps extends PConnProps {
47
+ // If any, enter additional props that only exist on this component
48
+ bInForm?: boolean;
49
+ globalSearch?: boolean;
50
+ referenceList?: any[];
51
+ // rowClickAction?: any;
52
+ selectionMode?: string;
53
+ referenceType?: string;
54
+ payload?: any;
55
+ parameters?: any;
56
+ compositeKeys?: any;
57
+ showDynamicFields?: boolean;
58
+ readonlyContextList?: any;
59
+ value: any;
60
+ viewName?: string;
61
+ showRecords?: boolean;
62
+ displayAs?: string;
63
+ localeReference?: string;
64
+ }
65
+
66
+ const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
67
+
68
+ let myRows: any[];
69
+
70
+ let menuColumnId = '';
71
+ let menuColumnType = '';
72
+ let menuColumnLabel = '';
73
+
74
+ let sortColumnId: any;
75
+
76
+ const filterByColumns: any[] = [];
77
+
78
+ export default function ListView(props: ListViewProps) {
79
+ const { getPConnect, bInForm = true } = props;
80
+ const {
81
+ globalSearch,
82
+ referenceList,
83
+ /* rowClickAction, */
84
+ selectionMode,
85
+ referenceType,
86
+ payload,
87
+ parameters,
88
+ compositeKeys,
89
+ showDynamicFields,
90
+ viewName,
91
+ readonlyContextList: selectedValues,
92
+ value,
93
+ displayAs,
94
+ localeReference
95
+ } = props;
96
+ let { showRecords } = props;
97
+ const ref = useRef({}).current;
98
+ const cosmosTableRef = useRef();
99
+ // List component context
100
+ const [listContext, setListContext] = useState<any>({});
101
+ const { meta } = listContext;
102
+ const { current: uniqueId } = useRef(crypto.randomUUID());
103
+
104
+ useInit({
105
+ ...props,
106
+ setListContext,
107
+ ref,
108
+ showDynamicFields,
109
+ cosmosTableRef
110
+ });
111
+
112
+ useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName });
113
+
114
+ const thePConn = getPConnect();
115
+ const componentConfig = thePConn.getComponentConfig();
116
+ const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
117
+
118
+ /** By default, pyGUID is used for Data classes and pyID is for Work classes as row-id/key */
119
+ const defRowID = referenceType === 'Case' ? 'pyID' : 'pyGUID';
120
+
121
+ /** If compositeKeys is defined, use dynamic value, else fallback to pyID or pyGUID. */
122
+ const rowID = compositeKeys && compositeKeys?.length === 1 ? compositeKeys[0] : defRowID;
123
+
124
+ const [arRows, setRows] = useState<any[]>([]);
125
+ const [rowsData, setRowsData] = useState<any[]>([]);
126
+ const [arColumns, setColumns] = useState<any[]>([]);
127
+ const [response, setResponse] = useState<any[]>([]);
128
+
129
+ const [order, setOrder] = useState<Order>('asc');
130
+ const [orderBy, setOrderBy] = useState<keyof any>('');
131
+
132
+ const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
133
+ const [open, setOpen] = useState(false);
134
+
135
+ const [showSnackbar, setShowSnackbar] = useState(false);
136
+ const [snackbarMessage, setSnackbarMessage] = useState('');
137
+
138
+ const [selectedValue, setSelectedValue] = useState(value);
139
+
140
+ // Tracks selected row keys for multi-select mode (mirrors Angular's SelectionModel)
141
+ const [selectedRowSet, setSelectedRowSet] = useState<Set<string>>(new Set());
142
+
143
+ // This basically will hold the list of all current filters
144
+ const filters = useRef({});
145
+
146
+ // Will contain the list of columns specific for an instance
147
+ const columnList: any = useRef([]);
148
+ const filterPayload: any = useRef();
149
+ // Will be sent in the dashboardFilterPayload
150
+ let selectParam: any[] = [];
151
+
152
+ // dataview parameters coming from the ListPage
153
+ // This constant will also be used for parameters coming from from other components/utility functions in future
154
+ const dataViewParameters = parameters;
155
+
156
+ const useStyles = makeStyles((theme: Theme) =>
157
+ createStyles({
158
+ root: {
159
+ width: '100%'
160
+ },
161
+ paper: {
162
+ width: '100%',
163
+ marginTop: theme.spacing(2),
164
+ marginBottom: theme.spacing(2),
165
+ display: 'grid',
166
+ borderRadius: 16,
167
+ padding: 20
168
+ },
169
+ table: {
170
+ minWidth: 750
171
+ },
172
+ tableInForm: {
173
+ minWidth: 750,
174
+ maxHeight: 550,
175
+ overflow: 'auto'
176
+ },
177
+ moreIcon: {
178
+ verticalAlign: 'bottom'
179
+ },
180
+ filteredIcon: {
181
+ verticalAlign: 'bottom'
182
+ },
183
+ cell: {
184
+ whiteSpace: 'nowrap'
185
+ },
186
+ visuallyHidden: {
187
+ border: 0,
188
+ clip: 'rect(0 0 0 0)',
189
+ height: 1,
190
+ margin: -1,
191
+ overflow: 'hidden',
192
+ padding: 0,
193
+ position: 'absolute',
194
+ top: 20,
195
+ width: 1
196
+ }
197
+ })
198
+ );
199
+
200
+ const classes = useStyles();
201
+
202
+ // Hook to clear the selections and update table in AdvancedSearch template when switching between search views
203
+ function useClearSelectionsAndUpdateTable({ getPConnect, uniqueId, viewName }) {
204
+ const clearSelectionsAndRefreshList = useCallback(
205
+ ({ viewName: name, clearSelections }) => {
206
+ if (name === viewName) {
207
+ const { selectionMode } = getPConnect().getRawConfigProps();
208
+ if (!selectionMode) {
209
+ return;
210
+ }
211
+ if (clearSelections) {
212
+ if (selectionMode === 'single') {
213
+ getPConnect().getListActions().setSelectedRows({});
214
+ } else {
215
+ getPConnect().getListActions().clearSelectedRows();
216
+ setSelectedRowSet(new Set());
217
+ }
218
+ }
219
+ }
220
+ },
221
+ [getPConnect, viewName]
222
+ );
223
+
224
+ useEffect(() => {
225
+ const identifier = `clear-and-update-advanced-search-selections-${uniqueId}`;
226
+ PCore.getPubSubUtils().subscribe('update-advanced-search-selections', clearSelectionsAndRefreshList, identifier);
227
+
228
+ return () => {
229
+ PCore.getPubSubUtils().unsubscribe('update-advanced-search-selections', identifier);
230
+ };
231
+ }, [uniqueId, clearSelectionsAndRefreshList]);
232
+ }
233
+
234
+ const handleRequestSort = (event: React.MouseEvent<unknown>, property: keyof any) => {
235
+ const isAsc = orderBy === property && order === 'asc';
236
+ setOrder(isAsc ? 'desc' : 'asc');
237
+ setOrderBy(property);
238
+ };
239
+
240
+ const createSortHandler = (property: keyof any) => (event: React.MouseEvent<unknown>) => {
241
+ sortColumnId = property;
242
+ handleRequestSort(event, property);
243
+ };
244
+
245
+ function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
246
+ if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
247
+ return -1;
248
+ }
249
+ if (!a[orderedBy] || b[orderedBy] > a[orderedBy]) {
250
+ return 1;
251
+ }
252
+ return 0;
253
+ }
254
+
255
+ type Order = 'asc' | 'desc';
256
+
257
+ interface Comparator<T> {
258
+ (a: T, b: T): number;
259
+ }
260
+
261
+ function getComparator<T, Key extends keyof T>(theOrder: Order, orderedBy: Key): Comparator<T> {
262
+ return theOrder === 'desc' ? (a: T, b: T) => descendingComparator(a, b, orderedBy) : (a: T, b: T) => -descendingComparator(a, b, orderedBy);
263
+ }
264
+
265
+ function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
266
+ const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
267
+ stabilizedThis.sort((a, b) => {
268
+ const order = comparator(a[0], b[0]);
269
+ if (order !== 0) return order;
270
+ return a[1] - b[1];
271
+ });
272
+ return stabilizedThis.map(el => el[0]);
273
+ }
274
+
275
+ const [page, setPage] = useState(0);
276
+ const [rowsPerPage, setRowsPerPage] = useState(10);
277
+
278
+ const handleChangePage = (event: unknown, newPage: number) => {
279
+ setPage(newPage);
280
+ };
281
+
282
+ const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
283
+ setRowsPerPage(+event.target.value);
284
+ setPage(0);
285
+ };
286
+
287
+ const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
288
+ function getHeaderCells(colFields, fields) {
289
+ return colFields.map((field: any, index) => {
290
+ let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
291
+ if (theField.indexOf('.') === 0) {
292
+ theField = theField.substring(1);
293
+ }
294
+ const colIndex = fields.findIndex(ele => ele.name === theField);
295
+ // const displayAsLink = field.config.displayAsLink;
296
+ const { additionalDetails = {} } = field.config;
297
+ let shouldDisplayAsSemanticLink = additionalDetails.type === 'DISPLAY_LINK';
298
+ // TODO: This "if" check has been added for backward compatibility, to be removed once the users are notified about the changes in view metadata of US-517164
299
+ if (!shouldDisplayAsSemanticLink) {
300
+ shouldDisplayAsSemanticLink = 'displayAsLink' in field.config && field.config.displayAsLink;
301
+ }
302
+ const headerRow: any = {};
303
+ headerRow.id = fields[index].id;
304
+ headerRow.type = field.type;
305
+ headerRow.displayAsLink = shouldDisplayAsSemanticLink;
306
+ headerRow.numeric = field.type === 'Decimal' || field.type === 'Integer' || field.type === 'Percentage' || field.type === 'Currency' || false;
307
+ headerRow.disablePadding = false;
308
+ headerRow.label = fields[index].label;
309
+ if (colIndex > -1) {
310
+ headerRow.classID = fields[colIndex].classID;
311
+ }
312
+ if (shouldDisplayAsSemanticLink) {
313
+ headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
314
+ if (field.config.value?.startsWith('@CA')) {
315
+ headerRow.isAssociation = true;
316
+ }
317
+ }
318
+ return headerRow;
319
+ });
320
+ }
321
+
322
+ function getUsingData(arTableData): any[] {
323
+ if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
324
+ const record = arTableData?.length > 0 ? arTableData[0] : '';
325
+ if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
326
+ console.error('pyGUID or pyID values are mandatory to select the required row from the list');
327
+ }
328
+ }
329
+ return arTableData?.map((data: any) => {
330
+ return data;
331
+ });
332
+ }
333
+
334
+ /** Will return field from a filter expression */
335
+ function getFieldFromFilter(filter, dateRange = false) {
336
+ let fieldValue;
337
+ if (dateRange) {
338
+ fieldValue = filter?.AND[0]?.condition.lhs.field;
339
+ } else {
340
+ fieldValue = filter?.condition.lhs.field;
341
+ }
342
+ return fieldValue;
343
+ }
344
+
345
+ // Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
346
+ function processFilterChange(data) {
347
+ let filterId;
348
+ let filterExpression;
349
+ let isDateRange;
350
+ let field;
351
+ let dashboardFilterPayload: any = {
352
+ query: {
353
+ filter: {},
354
+ select: []
355
+ }
356
+ };
357
+ if (displayAs === 'advancedSearch') {
358
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
359
+ Object.entries(data).reduce((acc, [item, value]) => {
360
+ const { filterId, filterExpression } = value as any;
361
+ filters.current[filterId] = filterExpression;
362
+ return acc; // Ensure the accumulator is returned
363
+ }, {});
364
+ } else {
365
+ ({ filterId, filterExpression } = data);
366
+ filters.current[filterId] = filterExpression;
367
+ isDateRange = data.filterExpression?.AND;
368
+ field = getFieldFromFilter(filterExpression, isDateRange);
369
+ selectParam = [];
370
+ // Constructing the select parameters list (will be sent in dashboardFilterPayload)
371
+ columnList.current.forEach(col => {
372
+ selectParam.push({
373
+ field: col
374
+ });
375
+ });
376
+
377
+ // Checking if the triggered filter is applicable for this list
378
+ if (data.filterExpression !== null && !(columnList.current?.length && columnList.current?.includes(field))) {
379
+ return;
380
+ }
381
+ }
382
+ // Will be AND by default but making it dynamic in case we support dynamic relational ops in future
383
+ const relationalOp = 'AND';
384
+ // This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
385
+ let validFilter = false;
386
+
387
+ let index = 1;
388
+ // Iterating over the current filters list to create filter data which will be POSTed
389
+ for (const filterExp of Object.keys(filters.current)) {
390
+ const filter = filters.current[filterExp];
391
+ // If the filter is null then we can skip this iteration
392
+ if (filter === null) {
393
+ continue;
394
+ }
395
+
396
+ // Checking if the filter is of type- Date Range
397
+ isDateRange = filter?.AND;
398
+ field = getFieldFromFilter(filter, isDateRange);
399
+
400
+ if (!(columnList.current.length && columnList.current.includes(field))) {
401
+ continue;
402
+ }
403
+ // If we reach here that implies we've at least one valid filter, hence setting the flag
404
+ validFilter = true;
405
+ /** Below are the 2 cases for- Text & Date-Range filter types where we'll construct filter data which will be sent in the dashboardFilterPayload
406
+ * In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
407
+ */
408
+ if (isDateRange) {
409
+ const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
410
+ dashboardFilterPayload.query.filter.filterConditions = {
411
+ ...dashboardFilterPayload.query.filter.filterConditions,
412
+ [`T${index++}`]: { ...filter[relationalOp][0].condition },
413
+ [`T${index++}`]: { ...filter[relationalOp][1].condition }
414
+ };
415
+ if (dashboardFilterPayload.query.filter.logic) {
416
+ dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} (T${
417
+ index - 2
418
+ } ${dateRelationalOp} T${index - 1})`;
419
+ } else {
420
+ dashboardFilterPayload.query.filter.logic = `(T${index - 2} ${relationalOp} T${index - 1})`;
421
+ }
422
+
423
+ dashboardFilterPayload.query.select = selectParam;
424
+ } else {
425
+ dashboardFilterPayload.query.filter.filterConditions = {
426
+ ...dashboardFilterPayload.query.filter.filterConditions,
427
+ [`T${index++}`]: { ...filter.condition, ...(filter.condition.comparator === 'CONTAINS' ? { ignoreCase: true } : {}) }
428
+ };
429
+
430
+ if (dashboardFilterPayload.query.filter.logic) {
431
+ dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} T${index - 1}`;
432
+ } else {
433
+ dashboardFilterPayload.query.filter.logic = `T${index - 1}`;
434
+ }
435
+
436
+ dashboardFilterPayload.query.select = selectParam;
437
+ }
438
+ }
439
+
440
+ // Reset the dashboardFilterPayload if we end up with no valid filters for the list
441
+ if (!validFilter) {
442
+ dashboardFilterPayload = undefined;
443
+ }
444
+ filterPayload.current = dashboardFilterPayload;
445
+ fetchDataFromServer();
446
+ }
447
+
448
+ // Will be triggered when EVENT_DASHBOARD_FILTER_CLEAR_ALL fires
449
+ function processFilterClear() {
450
+ filterPayload.current = undefined;
451
+ fetchDataFromServer();
452
+ }
453
+
454
+ function fetchAllData(fields): any {
455
+ if (displayAs === 'advancedSearch' && !showRecords) {
456
+ return Promise.resolve({ data: null });
457
+ }
458
+ let query: any = null;
459
+ if (payload) {
460
+ query = payload.query;
461
+ } else if (fields?.length && meta.isQueryable) {
462
+ if (filterPayload.current) {
463
+ query = {
464
+ select: fields,
465
+ filter: filterPayload.current?.query?.filter
466
+ };
467
+ } else {
468
+ query = { select: fields };
469
+ }
470
+ } else if (filterPayload.current) {
471
+ query = filterPayload.current?.query;
472
+ }
473
+ const context = getPConnect().getContextName();
474
+ // getDataAsync isn't returning correct data for the Page(i.e. ListView within a page) case
475
+ return !bInForm
476
+ ? // @ts-ignore - 3rd parameter "context" should be optional in getData method
477
+ PCore.getDataApiUtils().getData(referenceList, payload)
478
+ : // @ts-ignore - Argument of type 'null' is not assignable to parameter of type 'object'
479
+ PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
480
+ }
481
+
482
+ const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
483
+ const listFields: any = [];
484
+ if (colId) {
485
+ const field = getField(fieldDefs, colId);
486
+ listFields.push({
487
+ field: field.name
488
+ });
489
+ } else {
490
+ // NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields
491
+ // corresponding to `state.groups` are set up. Needed in Client-mode grouping/pagination.
492
+ fieldDefs.forEach(field => {
493
+ if (!listFields.find(f => f.field === field.name)) {
494
+ listFields.push({
495
+ field: field.name
496
+ });
497
+ }
498
+ });
499
+ patchQueryFields.forEach(k => {
500
+ if (!listFields.find(f => f.field === k)) {
501
+ listFields.push({
502
+ field: k
503
+ });
504
+ }
505
+ });
506
+ }
507
+
508
+ compositeKeys.forEach(k => {
509
+ if (!listFields.find(f => f.field === k)) {
510
+ listFields.push({
511
+ field: k
512
+ });
513
+ }
514
+ });
515
+ return listFields;
516
+ };
517
+
518
+ const addItemKeyInSelect = (fieldDefs, itemKey, select, compositeKeys) => {
519
+ const elementFound = getField(fieldDefs, itemKey);
520
+
521
+ if (
522
+ itemKey &&
523
+ !elementFound &&
524
+ Array.isArray(select) &&
525
+ !(compositeKeys !== null && compositeKeys?.length) &&
526
+ !select.find(sel => sel.field === itemKey)
527
+ ) {
528
+ return [
529
+ ...select,
530
+ {
531
+ field: itemKey
532
+ }
533
+ ];
534
+ }
535
+
536
+ return select;
537
+ };
538
+
539
+ const getField = (fieldDefs, columnId) => {
540
+ const fieldsMap = getFieldsMap(fieldDefs);
541
+ return fieldsMap.get(columnId);
542
+ };
543
+
544
+ const getFieldsMap = fieldDefs => {
545
+ const fieldsMap = new Map();
546
+ fieldDefs.forEach(element => {
547
+ fieldsMap.set(element.id, element);
548
+ });
549
+ return fieldsMap;
550
+ };
551
+
552
+ async function fetchDataFromServer() {
553
+ let bCallSetRowsColumns = true;
554
+ const { fieldDefs, itemKey, patchQueryFields } = meta;
555
+ let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
556
+ listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
557
+ const workListJSON = await fetchAllData(listFields);
558
+
559
+ // this is an unresovled version of this.fields$, need unresolved, so can get the property reference
560
+ const columnFields = componentConfig.presets[0].children[0].children;
561
+
562
+ const tableDataResults = !bInForm ? workListJSON.data.data : workListJSON.data;
563
+
564
+ const myColumns = getHeaderCells(columnFields, fieldDefs);
565
+
566
+ const selectParams: any = [];
567
+
568
+ myColumns.forEach(column => {
569
+ column.label = PCore.getLocaleUtils().getLocaleValue(column.label, localeReference);
570
+ selectParams.push({
571
+ field: column.id
572
+ });
573
+ });
574
+
575
+ const colList: any = [];
576
+
577
+ selectParams.forEach(col => {
578
+ colList.push(col.field);
579
+ });
580
+
581
+ columnList.current = colList;
582
+
583
+ setResponse(tableDataResults);
584
+
585
+ const usingDataResults = getUsingData(tableDataResults);
586
+
587
+ // store globally, so can be searched, filtered, etc.
588
+ myRows = usingDataResults;
589
+
590
+ setRowsData(myRows);
591
+ // At this point, if we have data ready to render and haven't been asked
592
+ // to NOT call setRows and setColumns, call them
593
+ if (bCallSetRowsColumns) {
594
+ setRows(myRows);
595
+ setColumns(myColumns);
596
+
597
+ if (selectionMode === SELECTION_MODE.MULTI && selectedValues?.length > 0) {
598
+ const readonlyIds = new Set<string>(selectedValues.map((element: any) => element[rowID]));
599
+ const initialSet = new Set<string>();
600
+ myRows?.forEach(row => {
601
+ if (readonlyIds.has(row[rowID])) {
602
+ initialSet.add(row[rowID]);
603
+ }
604
+ });
605
+ setSelectedRowSet(initialSet);
606
+ }
607
+ }
608
+
609
+ return () => {
610
+ // Inspired by https://juliangaramendy.dev/blog/use-promise-subscription
611
+ // The useEffect closure lets us have access to the bCallSetRowsColumns
612
+ // variable inside the useEffect and inside the "then" clause of the
613
+ // workListData promise
614
+ // So, if this cleanup code gets run before the promise .then is called,
615
+ // we can avoid calling the useState setters which would otherwise show a warning
616
+ bCallSetRowsColumns = false;
617
+ };
618
+ }
619
+
620
+ function prepareFilters(data) {
621
+ return Object.entries(data.payload).reduce((acc, [field, value]) => {
622
+ if (value) {
623
+ let comparator = 'EQ';
624
+ const filterRecord = listContext.meta.fieldDefs.filter(item => item.id === field);
625
+ if (filterRecord?.[0]?.meta.type === 'TextInput') {
626
+ comparator = 'CONTAINS';
627
+ }
628
+ acc[field] = {
629
+ filterExpression: {
630
+ condition: {
631
+ lhs: {
632
+ field
633
+ },
634
+ comparator,
635
+ rhs: {
636
+ value
637
+ }
638
+ }
639
+ },
640
+ filterId: field
641
+ };
642
+ }
643
+ return acc;
644
+ }, {});
645
+ }
646
+
647
+ useEffect(() => {
648
+ if (listContext.meta) {
649
+ const identifier = `promoted-filters-queryable-${uniqueId}`;
650
+ fetchDataFromServer();
651
+ setTimeout(() => {
652
+ PCore.getPubSubUtils().subscribe(
653
+ PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
654
+ data => {
655
+ processFilterChange(data);
656
+ },
657
+ `dashboard-component-${'id'}`,
658
+ false,
659
+ getPConnect().getContextName()
660
+ );
661
+ PCore.getPubSubUtils().subscribe(
662
+ PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
663
+ () => {
664
+ filters.current = {};
665
+ processFilterClear();
666
+ },
667
+ `dashboard-component-${'id'}`,
668
+ false,
669
+ getPConnect().getContextName()
670
+ );
671
+ PCore.getPubSubUtils().subscribe(
672
+ PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS,
673
+ data => {
674
+ showRecords = data.showRecords;
675
+ const filterData = prepareFilters(data);
676
+ processFilterChange(filterData);
677
+ },
678
+ identifier
679
+ );
680
+ }, 0);
681
+
682
+ return function cleanupSubscriptions() {
683
+ PCore.getPubSubUtils().unsubscribe(
684
+ PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
685
+ `dashboard-component-${'id'}`,
686
+ getPConnect().getContextName()
687
+ );
688
+ PCore.getPubSubUtils().unsubscribe(
689
+ PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
690
+ `dashboard-component-${'id'}`,
691
+ getPConnect().getContextName()
692
+ );
693
+ PCore.getPubSubUtils().unsubscribe(PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS, identifier);
694
+ };
695
+ }
696
+ }, [listContext]);
697
+
698
+ function searchFilter(value: string, rows: any[]) {
699
+ const cols = arColumns.map(ele => {
700
+ return ele.id;
701
+ });
702
+
703
+ function filterArray(el: any): boolean {
704
+ return Object.keys(el).some(key => {
705
+ // only search columns that are displayed (pzInsKey and pxRefObjectClass are added and may or may not be displayed)
706
+ if (cols.includes(key)) {
707
+ const myVal = el[key];
708
+ if (myVal !== null && typeof myVal !== 'undefined') {
709
+ const strVal = String(myVal); // Ensure myVal is a string
710
+ return strVal.toLowerCase().includes(value.toLowerCase());
711
+ }
712
+ }
713
+ return false;
714
+ });
715
+ }
716
+
717
+ rows = rows.filter(filterArray);
718
+
719
+ return rows;
720
+ }
721
+
722
+ function _onSearch(event: any) {
723
+ const searchValue = event.target.value;
724
+ const filteredRows = searchFilter(searchValue, rowsData?.slice());
725
+
726
+ setRows(filteredRows);
727
+ }
728
+
729
+ function showToast(message: string) {
730
+ const theMessage = `Assignment: ${message}`;
731
+
732
+ console.error(theMessage);
733
+ setSnackbarMessage(message);
734
+ setShowSnackbar(true);
735
+ }
736
+
737
+ function openAssignment(row) {
738
+ const { pxRefObjectClass, pzInsKey } = row;
739
+ const sTarget = thePConn.getContainerName();
740
+
741
+ const options = { containerName: sTarget, channelName: '' };
742
+
743
+ thePConn
744
+ .getActionsApi()
745
+ .openAssignment(pzInsKey, pxRefObjectClass, options)
746
+ .then(() => {
747
+ // console.log("openAssignment successful");
748
+ })
749
+ .catch(() => {
750
+ showToast(`openAssignment failed!`);
751
+ });
752
+ }
753
+
754
+ // function _rowClick(row: any) {
755
+ // // eslint-disable-next-line sonarjs/no-small-switch
756
+ // switch (rowClickAction) {
757
+ // case 'openAssignment':
758
+ // openAssignment(row);
759
+ // break;
760
+
761
+ // default:
762
+ // break;
763
+ // }
764
+ // }
765
+
766
+ function openWork(row) {
767
+ const { pxRefObjectKey } = row;
768
+ const pxRefObjectClass = row.pxRefObjectClass || row.pxObjClass;
769
+ if (pxRefObjectClass !== '' && pxRefObjectKey !== '') {
770
+ thePConn.getActionsApi().openWorkByHandle(pxRefObjectKey, pxRefObjectClass);
771
+ }
772
+ }
773
+
774
+ function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {
775
+ if (reason === 'clickaway') {
776
+ return;
777
+ }
778
+ setShowSnackbar(false);
779
+ }
780
+
781
+ function _menuClick(event, columnId: string, columnType: string, label: string) {
782
+ menuColumnId = columnId;
783
+ menuColumnType = columnType;
784
+ menuColumnLabel = label;
785
+
786
+ setAnchorEl(event.currentTarget);
787
+ }
788
+
789
+ function _menuClose() {
790
+ setAnchorEl(null);
791
+ }
792
+
793
+ const [filterBy, setFilterBy] = useState<string>();
794
+ const [containsDateOrTime, setContainsDateOrTime] = useState<boolean>(false);
795
+ const [filterType, setFilterType] = useState<string>('string');
796
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
797
+ const [displayDialogFilterName, setDisplayDialogFilterName] = useState<string>('');
798
+ const [displayDialogContainsFilter, setDisplayDialogContainsFilter] = useState<string>('contains');
799
+ const [displayDialogContainsValue, setDisplayDialogContainsValue] = useState<string>('');
800
+ const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
801
+ const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
802
+
803
+ function _filterMenu() {
804
+ setAnchorEl(null);
805
+
806
+ let bFound = false;
807
+
808
+ for (const filterObj of filterByColumns) {
809
+ if (filterObj.ref === menuColumnId) {
810
+ setFilterBy(menuColumnLabel);
811
+ if (filterObj.type === 'Date' || filterObj.type === 'DateTime' || filterObj.type === 'Time') {
812
+ setContainsDateOrTime(true);
813
+ setFilterType(filterObj.type);
814
+ setDisplayDialogDateFilter(filterObj.containsFilter);
815
+ setDisplayDialogDateValue(filterObj.containsFilterValue);
816
+ } else {
817
+ setContainsDateOrTime(false);
818
+ setFilterType('string');
819
+ setDisplayDialogContainsFilter(filterObj.containsFilter);
820
+ setDisplayDialogContainsValue(filterObj.containsFilterValue);
821
+ }
822
+ bFound = true;
823
+ break;
824
+ }
825
+ }
826
+
827
+ if (!bFound) {
828
+ setFilterBy(menuColumnLabel);
829
+ setDisplayDialogFilterName(menuColumnId);
830
+ setDisplayDialogContainsValue('');
831
+
832
+ switch (menuColumnType) {
833
+ case 'Date':
834
+ case 'DateTime':
835
+ case 'Time':
836
+ setContainsDateOrTime(true);
837
+ setFilterType(menuColumnType);
838
+ break;
839
+ default:
840
+ setContainsDateOrTime(false);
841
+ setFilterType('string');
842
+ break;
843
+ }
844
+ }
845
+
846
+ // open dialog
847
+ setOpen(true);
848
+ }
849
+
850
+ function _groupMenu() {
851
+ setAnchorEl(null);
852
+ }
853
+
854
+ function _closeDialog() {
855
+ setOpen(false);
856
+ }
857
+
858
+ function _showFilteredIcon(columnId) {
859
+ for (const filterObj of filterByColumns) {
860
+ if (filterObj.ref === columnId) {
861
+ if (filterObj.containsFilterValue !== '') {
862
+ return true;
863
+ }
864
+ return false;
865
+ }
866
+ }
867
+
868
+ return false;
869
+ }
870
+
871
+ function updateFilterWithInfo() {
872
+ let bFound = false;
873
+ for (const filterObj of filterByColumns) {
874
+ if (filterObj.ref === menuColumnId) {
875
+ filterObj.type = filterType;
876
+ if (containsDateOrTime) {
877
+ filterObj.containsFilter = displayDialogDateFilter;
878
+ filterObj.containsFilterValue = displayDialogDateValue;
879
+ } else {
880
+ filterObj.containsFilter = displayDialogContainsFilter;
881
+ filterObj.containsFilterValue = displayDialogContainsValue;
882
+ }
883
+ bFound = true;
884
+ break;
885
+ }
886
+ }
887
+
888
+ if (!bFound) {
889
+ // add in
890
+ const filterObj: any = {};
891
+ filterObj.ref = menuColumnId;
892
+ filterObj.type = filterType;
893
+ if (containsDateOrTime) {
894
+ filterObj.containsFilter = displayDialogDateFilter;
895
+ filterObj.containsFilterValue = displayDialogDateValue;
896
+ } else {
897
+ filterObj.containsFilter = displayDialogContainsFilter;
898
+ filterObj.containsFilterValue = displayDialogContainsValue;
899
+ }
900
+
901
+ filterByColumns.push(filterObj);
902
+ }
903
+ }
904
+
905
+ function filterSortGroupBy() {
906
+ // get original data set
907
+ let theData = myRows.slice();
908
+
909
+ // last filter config data is global
910
+ theData = theData.filter(filterData(filterByColumns));
911
+
912
+ // move data to array and then sort
913
+ setRows(theData);
914
+ createSortHandler(sortColumnId);
915
+ }
916
+
917
+ function _dialogContainsFilter(event) {
918
+ // dialogContainsFilter = event.target.value;
919
+ setDisplayDialogContainsFilter(event.target.value);
920
+ }
921
+
922
+ function _dialogContainsValue(event) {
923
+ // dialogContainsValue = event.target.value;
924
+ setDisplayDialogContainsValue(event.target.value);
925
+ }
926
+
927
+ function _dialogDateFilter(event) {
928
+ // dialogDateFilter = event.target.value;
929
+ setDisplayDialogDateFilter(event.target.value);
930
+ }
931
+
932
+ function _dialogDateValue(event) {
933
+ setDisplayDialogDateValue(event.target.value);
934
+ }
935
+
936
+ function _submitFilter() {
937
+ updateFilterWithInfo();
938
+ filterSortGroupBy();
939
+
940
+ setOpen(false);
941
+ }
942
+
943
+ function _showButton(name, row) {
944
+ let bReturn = false;
945
+ const { pxRefObjectClass, pzInsKey, pxRefObjectKey } = row;
946
+ switch (name) {
947
+ case 'pxTaskLabel':
948
+ if (pxRefObjectClass !== '' && pzInsKey !== '') {
949
+ bReturn = true;
950
+ }
951
+ break;
952
+
953
+ case 'pxRefObjectInsName':
954
+ if (pxRefObjectClass !== '' && pxRefObjectKey !== '') {
955
+ bReturn = true;
956
+ }
957
+ break;
958
+
959
+ default:
960
+ break;
961
+ }
962
+
963
+ return bReturn;
964
+ }
965
+
966
+ function _listViewClick(row, column) {
967
+ const name = column.id;
968
+ if (column.displayAsLink) {
969
+ const { pxObjClass } = row;
970
+ let { pzInsKey } = row;
971
+ if (column.isAssociation) {
972
+ const associationCategory = name.split(':')[0];
973
+ pzInsKey = row[`${associationCategory}:pzInsKey`];
974
+ }
975
+ if (column.isAssignmentLink) {
976
+ thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
977
+ containerName: 'primary',
978
+ channelName: ''
979
+ });
980
+ } else {
981
+ thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
982
+ }
983
+ } else {
984
+ switch (name) {
985
+ case 'pxTaskLabel':
986
+ openAssignment(row);
987
+ break;
988
+
989
+ case 'pxRefObjectInsName':
990
+ openWork(row);
991
+ break;
992
+
993
+ default:
994
+ break;
995
+ }
996
+ }
997
+ }
998
+
999
+ function _listTitle() {
1000
+ const defaultTitle = 'List';
1001
+ let title = resolvedConfigProps.title || resolvedConfigProps?.label || defaultTitle;
1002
+ const inheritedProps = resolvedConfigProps?.inheritedProps;
1003
+
1004
+ // Let any title in resolvedConfigProps that isn't the default take precedence
1005
+ // but only look in inheritedProps if they exist
1006
+ if (title === defaultTitle && inheritedProps) {
1007
+ for (const inheritedProp of inheritedProps) {
1008
+ if (inheritedProp?.prop === 'label') {
1009
+ title = inheritedProp?.value;
1010
+ break;
1011
+ }
1012
+ }
1013
+ }
1014
+
1015
+ return title;
1016
+ }
1017
+
1018
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
1019
+ const value = event.target.value;
1020
+ const reqObj = {};
1021
+ if (compositeKeys?.length > 1) {
1022
+ const index = response.findIndex(element => element[rowID] === value);
1023
+ const selectedRow = response[index];
1024
+ compositeKeys.forEach(element => {
1025
+ reqObj[element] = selectedRow[element];
1026
+ });
1027
+ } else {
1028
+ reqObj[rowID] = value;
1029
+ }
1030
+ getPConnect()?.getListActions?.()?.setSelectedRows([reqObj]);
1031
+ setSelectedValue(value);
1032
+ };
1033
+
1034
+ const getSelectedValue = (row: any, checked: boolean) => {
1035
+ const rowValue = row[rowID];
1036
+ const reqObj: any = {};
1037
+ if (compositeKeys?.length > 1) {
1038
+ const index = response.findIndex(element => element[rowID] === rowValue);
1039
+ const selectedRow = response[index];
1040
+ compositeKeys.forEach(element => {
1041
+ reqObj[element] = selectedRow[element];
1042
+ });
1043
+ reqObj.$selected = checked;
1044
+ } else {
1045
+ reqObj[rowID] = rowValue;
1046
+ reqObj.$selected = checked;
1047
+ }
1048
+ return reqObj;
1049
+ };
1050
+
1051
+ const onCheckboxClick = (row: any) => {
1052
+ const rowKey = row[rowID];
1053
+ const newSet = new Set(selectedRowSet);
1054
+ if (newSet.has(rowKey)) {
1055
+ newSet.delete(rowKey);
1056
+ } else {
1057
+ newSet.add(rowKey);
1058
+ }
1059
+ setSelectedRowSet(newSet);
1060
+ const checked = newSet.has(rowKey);
1061
+ const requiredValue = getSelectedValue(row, checked);
1062
+ getPConnect()?.getListActions()?.setSelectedRows([requiredValue]);
1063
+ };
1064
+
1065
+ const isAllSelected = (): boolean => {
1066
+ const numSelected = selectedRowSet.size;
1067
+ const numRows = arRows?.length || 0;
1068
+ return numRows > 0 && numSelected === numRows;
1069
+ };
1070
+
1071
+ const toggleAllRows = () => {
1072
+ if (isAllSelected()) {
1073
+ setSelectedRowSet(new Set());
1074
+ getPConnect()?.getListActions()?.clearSelectedRows();
1075
+ return;
1076
+ }
1077
+ if (selectedRowSet.size > 0 && !isAllSelected()) {
1078
+ getPConnect()?.getListActions()?.clearSelectedRows();
1079
+ }
1080
+ const newSet = new Set<string>();
1081
+ arRows.forEach(row => newSet.add(row[rowID]));
1082
+ setSelectedRowSet(newSet);
1083
+ const requiredValues = arRows.map(row => getSelectedValue(row, true));
1084
+ getPConnect()?.getListActions()?.setSelectedRows(requiredValues);
1085
+ };
1086
+
1087
+ const processColumnValue = (column, value) => {
1088
+ let val;
1089
+ const type = column.type;
1090
+ let theDateFormatInfo;
1091
+ let theFormat;
1092
+ let theCurrencyOptions;
1093
+ switch (type) {
1094
+ case 'Date':
1095
+ case 'DateTime':
1096
+ theDateFormatInfo = getDateFormatInfo();
1097
+ theFormat = type === 'DateTime' ? `${theDateFormatInfo.dateFormatStringLong} hh:mm a` : theDateFormatInfo.dateFormatStringLong;
1098
+ val = format(value, column.type, { format: theFormat });
1099
+ break;
1100
+
1101
+ case 'Currency':
1102
+ theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale() as string);
1103
+ val = format(value, column.type, theCurrencyOptions);
1104
+ break;
1105
+
1106
+ default:
1107
+ val = column.format && typeof value === 'number' ? column.format(value) : value || '---';
1108
+ }
1109
+ return val;
1110
+ };
1111
+
1112
+ return (
1113
+ <>
1114
+ {arColumns && arColumns.length > 0 && (
1115
+ <Paper className={classes.paper}>
1116
+ <Grid container justifyContent='space-between'>
1117
+ <Typography variant='h6' color='textPrimary' gutterBottom>
1118
+ {_listTitle()}
1119
+ </Typography>
1120
+ {globalSearch && (
1121
+ <Grid container spacing={1} alignItems='flex-end'>
1122
+ <Grid>
1123
+ <SearchIcon />
1124
+ </Grid>
1125
+ <Grid>
1126
+ <TextField
1127
+ label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
1128
+ fullWidth
1129
+ variant='outlined'
1130
+ placeholder=''
1131
+ size='small'
1132
+ id='search'
1133
+ onChange={_onSearch}
1134
+ />
1135
+ </Grid>
1136
+ </Grid>
1137
+ )}
1138
+ </Grid>
1139
+ {!bInForm ? (
1140
+ <TableContainer id='list-view' className={classes.tableInForm}>
1141
+ <Table stickyHeader aria-label='sticky table'>
1142
+ <TableHead>
1143
+ <TableRow>
1144
+ {arColumns.map(column => {
1145
+ return (
1146
+ <TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
1147
+ <TableSortLabel
1148
+ active={orderBy === column.id}
1149
+ direction={orderBy === column.id ? order : 'asc'}
1150
+ onClick={createSortHandler(column.id)}
1151
+ >
1152
+ {column.label}
1153
+ {_showFilteredIcon(column.id) && <FilterListIcon className={classes.filteredIcon} />}
1154
+ {orderBy === column.id ? (
1155
+ <span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
1156
+ ) : null}
1157
+ </TableSortLabel>
1158
+ <MoreIcon
1159
+ className={classes.moreIcon}
1160
+ onClick={event => {
1161
+ _menuClick(event, column.id, column.type, column.label);
1162
+ }}
1163
+ />
1164
+ </TableCell>
1165
+ );
1166
+ })}
1167
+ </TableRow>
1168
+ </TableHead>
1169
+ <TableBody>
1170
+ {arRows &&
1171
+ stableSort(arRows, getComparator(order, orderBy))
1172
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1173
+ .map(row => {
1174
+ return (
1175
+ <TableRow key={row.pxRefObjectInsName || row.pyID}>
1176
+ {arColumns.map(column => {
1177
+ const value = row[column.id];
1178
+ return (
1179
+ <TableCell key={column.id} align={column.align} className={classes.cell}>
1180
+ {_showButton(column.id, row) || column.displayAsLink ? (
1181
+ <Link
1182
+ component='button'
1183
+ onClick={() => {
1184
+ _listViewClick(row, column);
1185
+ }}
1186
+ underline='hover'
1187
+ >
1188
+ {column.format && typeof value === 'number' ? column.format(value) : value}
1189
+ </Link>
1190
+ ) : (
1191
+ <>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
1192
+ )}
1193
+ </TableCell>
1194
+ );
1195
+ })}
1196
+ </TableRow>
1197
+ );
1198
+ })}
1199
+ </TableBody>
1200
+ </Table>
1201
+ </TableContainer>
1202
+ ) : (
1203
+ <TableContainer id='list-view'>
1204
+ <Table>
1205
+ <TableHead>
1206
+ <TableRow>
1207
+ {selectionMode === SELECTION_MODE.SINGLE && <TableCell padding='checkbox' />}
1208
+ {selectionMode === SELECTION_MODE.MULTI && (
1209
+ <TableCell padding='checkbox'>
1210
+ <Checkbox
1211
+ indeterminate={selectedRowSet.size > 0 && !isAllSelected()}
1212
+ checked={arRows?.length > 0 && isAllSelected()}
1213
+ onChange={toggleAllRows}
1214
+ />
1215
+ </TableCell>
1216
+ )}
1217
+ {arColumns.map(column => {
1218
+ return (
1219
+ <TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
1220
+ <TableSortLabel
1221
+ active={orderBy === column.id}
1222
+ direction={orderBy === column.id ? order : 'asc'}
1223
+ onClick={createSortHandler(column.id)}
1224
+ >
1225
+ {column.label}
1226
+ {orderBy === column.id ? (
1227
+ <span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
1228
+ ) : null}
1229
+ </TableSortLabel>
1230
+ </TableCell>
1231
+ );
1232
+ })}
1233
+ </TableRow>
1234
+ </TableHead>
1235
+ <TableBody>
1236
+ {arRows &&
1237
+ arRows.length > 0 &&
1238
+ stableSort(arRows, getComparator(order, orderBy))
1239
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1240
+ .map(row => {
1241
+ return (
1242
+ <TableRow key={row[rowID]}>
1243
+ {selectionMode === SELECTION_MODE.SINGLE && (
1244
+ <TableCell padding='checkbox'>
1245
+ <Radio
1246
+ onChange={handleChange}
1247
+ value={row[rowID]}
1248
+ name='radio-buttons'
1249
+ inputProps={{ 'aria-label': 'A' }}
1250
+ checked={selectedValue === row[rowID]}
1251
+ />
1252
+ </TableCell>
1253
+ )}
1254
+ {selectionMode === SELECTION_MODE.MULTI && (
1255
+ <TableCell padding='checkbox'>
1256
+ <Checkbox onChange={() => onCheckboxClick(row)} checked={selectedRowSet.has(row[rowID])} />
1257
+ </TableCell>
1258
+ )}
1259
+ {arColumns.map(column => {
1260
+ const value = row[column.id];
1261
+ return (
1262
+ <TableCell className={classes.cell} key={column.id} align={column.align}>
1263
+ {processColumnValue(column, value)}
1264
+ </TableCell>
1265
+ );
1266
+ })}
1267
+ </TableRow>
1268
+ );
1269
+ })}
1270
+ </TableBody>
1271
+ </Table>
1272
+ {(!arRows || arRows.length === 0) && (
1273
+ <div className='no-records'>{getGenericFieldsLocalizedValue('COSMOSFIELDS.lists', 'No records found.')}</div>
1274
+ )}
1275
+ </TableContainer>
1276
+ )}
1277
+ {arRows && arRows.length > 0 && (
1278
+ <TablePagination
1279
+ id='pagination'
1280
+ rowsPerPageOptions={[10, 25, 100]}
1281
+ component='div'
1282
+ count={arRows.length}
1283
+ rowsPerPage={rowsPerPage}
1284
+ page={page}
1285
+ onPageChange={handleChangePage}
1286
+ onRowsPerPageChange={handleChangeRowsPerPage}
1287
+ />
1288
+ )}
1289
+ </Paper>
1290
+ )}
1291
+ <Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={_menuClose}>
1292
+ <MenuItem onClick={_filterMenu}>
1293
+ <FilterListIcon /> Filter
1294
+ </MenuItem>
1295
+ <MenuItem onClick={_groupMenu}>
1296
+ <SubjectIcon /> Group
1297
+ </MenuItem>
1298
+ </Menu>
1299
+ <Dialog open={open} onClose={_closeDialog} aria-labelledby='form-dialog-title'>
1300
+ <DialogTitle id='form-dialog-title'>Filter: {filterBy}</DialogTitle>
1301
+ <DialogContent>
1302
+ {containsDateOrTime ? (
1303
+ <>
1304
+ <Select variant='standard' value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
1305
+ <MenuItem value='notequal'>is not equal to</MenuItem>
1306
+ <MenuItem value='after'>after</MenuItem>
1307
+ <MenuItem value='before'>before</MenuItem>
1308
+ <MenuItem value='null'>is null</MenuItem>
1309
+ <MenuItem value='notnull'>is not null</MenuItem>
1310
+ </Select>
1311
+ {filterType === 'Date' && (
1312
+ <TextField
1313
+ variant='standard'
1314
+ autoFocus
1315
+ margin='dense'
1316
+ id='containsFilter'
1317
+ type='date'
1318
+ fullWidth
1319
+ value={displayDialogDateValue}
1320
+ onChange={_dialogDateValue}
1321
+ />
1322
+ )}
1323
+ {filterType === 'DateTime' && (
1324
+ <TextField
1325
+ variant='standard'
1326
+ autoFocus
1327
+ margin='dense'
1328
+ id='containsFilter'
1329
+ type='datetime-local'
1330
+ fullWidth
1331
+ value={displayDialogDateValue}
1332
+ onChange={_dialogDateValue}
1333
+ />
1334
+ )}
1335
+ {filterType === 'Time' && (
1336
+ <TextField
1337
+ variant='standard'
1338
+ autoFocus
1339
+ margin='dense'
1340
+ id='containsFilter'
1341
+ type='time'
1342
+ fullWidth
1343
+ value={displayDialogDateValue}
1344
+ onChange={_dialogDateValue}
1345
+ />
1346
+ )}
1347
+ </>
1348
+ ) : (
1349
+ <>
1350
+ <Select variant='standard' fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
1351
+ <MenuItem value='contains'>Contains</MenuItem>
1352
+ <MenuItem value='equals'>Equals</MenuItem>
1353
+ <MenuItem value='startswith'>Starts with</MenuItem>
1354
+ </Select>
1355
+ <TextField
1356
+ variant='standard'
1357
+ autoFocus
1358
+ margin='dense'
1359
+ id='containsFilter'
1360
+ type='text'
1361
+ fullWidth
1362
+ value={displayDialogContainsValue}
1363
+ onChange={_dialogContainsValue}
1364
+ />
1365
+ </>
1366
+ )}
1367
+ </DialogContent>
1368
+ <DialogActions>
1369
+ <Button onClick={_closeDialog} color='secondary'>
1370
+ Cancel
1371
+ </Button>
1372
+ <Button onClick={_submitFilter} color='primary'>
1373
+ Submit
1374
+ </Button>
1375
+ </DialogActions>
1376
+ </Dialog>
1377
+
1378
+ <Snackbar
1379
+ open={showSnackbar}
1380
+ autoHideDuration={3000}
1381
+ onClose={handleSnackbarClose}
1382
+ message={snackbarMessage}
1383
+ action={
1384
+ <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
1385
+ <CloseIcon fontSize='small' />
1386
+ </IconButton>
1387
+ }
1388
+ />
1389
+ </>
1390
+ );
1391
+ }