@pega/react-sdk-components 24.1.10 → 24.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/lib/bridge/react_pconnect.d.ts.map +1 -1
  2. package/lib/bridge/react_pconnect.js +2 -1
  3. package/lib/bridge/react_pconnect.js.map +1 -1
  4. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js +1 -1
  5. package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js.map +1 -1
  6. package/lib/components/designSystemExtension/Banner/Banner.js +1 -1
  7. package/lib/components/designSystemExtension/Banner/Banner.js.map +1 -1
  8. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
  9. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
  10. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +11 -11
  11. package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
  12. package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js +4 -4
  13. package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js.map +1 -1
  14. package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +4 -4
  15. package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
  16. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +4 -4
  17. package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
  18. package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +6 -6
  19. package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
  20. package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
  21. package/lib/components/designSystemExtension/Operator/Operator.js +6 -6
  22. package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
  23. package/lib/components/designSystemExtension/Pulse/Pulse.js +2 -2
  24. package/lib/components/designSystemExtension/Pulse/Pulse.js.map +1 -1
  25. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  26. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js +3 -2
  27. package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js.map +1 -1
  28. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js +1 -1
  29. package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
  30. package/lib/components/field/AutoComplete/AutoComplete.js +4 -4
  31. package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
  32. package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
  33. package/lib/components/field/CancelAlert/CancelAlert.js +3 -6
  34. package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
  35. package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
  36. package/lib/components/field/Checkbox/Checkbox.js +4 -4
  37. package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
  38. package/lib/components/field/Currency/Currency.d.ts.map +1 -1
  39. package/lib/components/field/Currency/Currency.js +9 -8
  40. package/lib/components/field/Currency/Currency.js.map +1 -1
  41. package/lib/components/field/Date/Date.d.ts.map +1 -1
  42. package/lib/components/field/Date/Date.js +21 -9
  43. package/lib/components/field/Date/Date.js.map +1 -1
  44. package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
  45. package/lib/components/field/DateTime/DateTime.js +38 -9
  46. package/lib/components/field/DateTime/DateTime.js.map +1 -1
  47. package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
  48. package/lib/components/field/Decimal/Decimal.js +8 -5
  49. package/lib/components/field/Decimal/Decimal.js.map +1 -1
  50. package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
  51. package/lib/components/field/Dropdown/Dropdown.js +18 -12
  52. package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
  53. package/lib/components/field/Email/Email.d.ts.map +1 -1
  54. package/lib/components/field/Email/Email.js +21 -5
  55. package/lib/components/field/Email/Email.js.map +1 -1
  56. package/lib/components/field/Group/Group.js +2 -2
  57. package/lib/components/field/Group/Group.js.map +1 -1
  58. package/lib/components/field/Integer/Integer.d.ts.map +1 -1
  59. package/lib/components/field/Integer/Integer.js +17 -6
  60. package/lib/components/field/Integer/Integer.js.map +1 -1
  61. package/lib/components/field/Multiselect/Multiselect.d.ts.map +1 -1
  62. package/lib/components/field/Multiselect/Multiselect.js +12 -8
  63. package/lib/components/field/Multiselect/Multiselect.js.map +1 -1
  64. package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
  65. package/lib/components/field/Percentage/Percentage.js +7 -4
  66. package/lib/components/field/Percentage/Percentage.js.map +1 -1
  67. package/lib/components/field/Phone/Phone.d.ts.map +1 -1
  68. package/lib/components/field/Phone/Phone.js +4 -4
  69. package/lib/components/field/Phone/Phone.js.map +1 -1
  70. package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
  71. package/lib/components/field/RadioButtons/RadioButtons.js +6 -12
  72. package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
  73. package/lib/components/field/RichText/RichText.js +1 -1
  74. package/lib/components/field/RichText/RichText.js.map +1 -1
  75. package/lib/components/field/ScalarList/ScalarList.d.ts.map +1 -1
  76. package/lib/components/field/ScalarList/ScalarList.js +5 -5
  77. package/lib/components/field/ScalarList/ScalarList.js.map +1 -1
  78. package/lib/components/field/SemanticLink/SemanticLink.js +4 -4
  79. package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
  80. package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
  81. package/lib/components/field/TextArea/TextArea.js +20 -4
  82. package/lib/components/field/TextArea/TextArea.js.map +1 -1
  83. package/lib/components/field/TextContent/TextContent.js +1 -1
  84. package/lib/components/field/TextContent/TextContent.js.map +1 -1
  85. package/lib/components/field/TextInput/TextInput.js +2 -2
  86. package/lib/components/field/TextInput/TextInput.js.map +1 -1
  87. package/lib/components/field/Time/Time.d.ts.map +1 -1
  88. package/lib/components/field/Time/Time.js +31 -8
  89. package/lib/components/field/Time/Time.js.map +1 -1
  90. package/lib/components/field/URL/URL.d.ts.map +1 -1
  91. package/lib/components/field/URL/URL.js +19 -4
  92. package/lib/components/field/URL/URL.js.map +1 -1
  93. package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
  94. package/lib/components/field/UserReference/UserReference.js +3 -5
  95. package/lib/components/field/UserReference/UserReference.js.map +1 -1
  96. package/lib/components/helpers/common-utils.d.ts +7 -0
  97. package/lib/components/helpers/common-utils.d.ts.map +1 -1
  98. package/lib/components/helpers/common-utils.js +21 -1
  99. package/lib/components/helpers/common-utils.js.map +1 -1
  100. package/lib/components/helpers/field-group-utils.js +2 -2
  101. package/lib/components/helpers/field-group-utils.js.map +1 -1
  102. package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
  103. package/lib/components/helpers/formatters/Currency.js +12 -15
  104. package/lib/components/helpers/formatters/Currency.js.map +1 -1
  105. package/lib/components/helpers/formatters/common.d.ts +2 -2
  106. package/lib/components/helpers/formatters/common.d.ts.map +1 -1
  107. package/lib/components/helpers/formatters/common.js +2 -1
  108. package/lib/components/helpers/formatters/common.js.map +1 -1
  109. package/lib/components/helpers/formatters/index.d.ts.map +1 -1
  110. package/lib/components/helpers/formatters/index.js +2 -3
  111. package/lib/components/helpers/formatters/index.js.map +1 -1
  112. package/lib/components/helpers/simpleTableHelpers.d.ts +1 -1
  113. package/lib/components/helpers/simpleTableHelpers.js +1 -1
  114. package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
  115. package/lib/components/infra/ActionButtons/ActionButtons.js +3 -3
  116. package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
  117. package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
  118. package/lib/components/infra/Assignment/Assignment.js +11 -13
  119. package/lib/components/infra/Assignment/Assignment.js.map +1 -1
  120. package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
  121. package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +12 -22
  122. package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
  123. package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
  124. package/lib/components/infra/Containers/FlowContainer/helpers.js +1 -5
  125. package/lib/components/infra/Containers/FlowContainer/helpers.js.map +1 -1
  126. package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.d.ts.map +1 -1
  127. package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js +9 -4
  128. package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js.map +1 -1
  129. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +7 -7
  130. package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
  131. package/lib/components/infra/Containers/SimpleView/helper.js +1 -1
  132. package/lib/components/infra/Containers/SimpleView/helper.js.map +1 -1
  133. package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +1 -1
  134. package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
  135. package/lib/components/infra/Containers/container-helpers.d.ts +2 -0
  136. package/lib/components/infra/Containers/container-helpers.d.ts.map +1 -0
  137. package/lib/components/infra/Containers/{helpers.js → container-helpers.js} +1 -1
  138. package/lib/components/infra/Containers/container-helpers.js.map +1 -0
  139. package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
  140. package/lib/components/infra/DashboardFilter/DashboardFilter.js +3 -4
  141. package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
  142. package/lib/components/infra/DashboardFilter/filterUtils.d.ts.map +1 -1
  143. package/lib/components/infra/DashboardFilter/filterUtils.js +3 -5
  144. package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
  145. package/lib/components/infra/DeferLoad/DeferLoad.d.ts +1 -0
  146. package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
  147. package/lib/components/infra/DeferLoad/DeferLoad.js +7 -8
  148. package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
  149. package/lib/components/infra/MultiStep/MultiStep.d.ts +1 -1
  150. package/lib/components/infra/MultiStep/MultiStep.d.ts.map +1 -1
  151. package/lib/components/infra/MultiStep/MultiStep.js +12 -11
  152. package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
  153. package/lib/components/infra/NavBar/NavBar.css +1 -0
  154. package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
  155. package/lib/components/infra/NavBar/NavBar.js +24 -16
  156. package/lib/components/infra/NavBar/NavBar.js.map +1 -1
  157. package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
  158. package/lib/components/infra/RootContainer/RootContainer.js +5 -6
  159. package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
  160. package/lib/components/infra/Stages/Stages.js +4 -4
  161. package/lib/components/infra/Stages/Stages.js.map +1 -1
  162. package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.d.ts.map +1 -1
  163. package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js +4 -3
  164. package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js.map +1 -1
  165. package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js +2 -2
  166. package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js.map +1 -1
  167. package/lib/components/infra/View/View.d.ts +1 -0
  168. package/lib/components/infra/View/View.d.ts.map +1 -1
  169. package/lib/components/infra/View/View.js +32 -2
  170. package/lib/components/infra/View/View.js.map +1 -1
  171. package/lib/components/template/AppShell/AppShell.d.ts +2 -0
  172. package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
  173. package/lib/components/template/AppShell/AppShell.js +33 -10
  174. package/lib/components/template/AppShell/AppShell.js.map +1 -1
  175. package/lib/components/template/CaseView/CaseView.d.ts +1 -0
  176. package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
  177. package/lib/components/template/CaseView/CaseView.js +7 -7
  178. package/lib/components/template/CaseView/CaseView.js.map +1 -1
  179. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js +6 -6
  180. package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js.map +1 -1
  181. package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
  182. package/lib/components/template/Confirmation/Confirmation.js +3 -2
  183. package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
  184. package/lib/components/template/DataReference/DataReference.js +2 -2
  185. package/lib/components/template/DataReference/DataReference.js.map +1 -1
  186. package/lib/components/template/Details/Details/Details.js +2 -2
  187. package/lib/components/template/Details/Details/Details.js.map +1 -1
  188. package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js +3 -3
  189. package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js.map +1 -1
  190. package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +2 -2
  191. package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
  192. package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +2 -2
  193. package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
  194. package/lib/components/template/Details/DynamicTabs/DynamicTabs.d.ts.map +1 -1
  195. package/lib/components/template/Details/DynamicTabs/DynamicTabs.js +4 -4
  196. package/lib/components/template/Details/DynamicTabs/DynamicTabs.js.map +1 -1
  197. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
  198. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +9 -5
  199. package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
  200. package/lib/components/template/InlineDashboard/InlineDashboard.js +2 -2
  201. package/lib/components/template/InlineDashboard/InlineDashboard.js.map +1 -1
  202. package/lib/components/template/ListView/ListView.d.ts.map +1 -1
  203. package/lib/components/template/ListView/ListView.js +45 -45
  204. package/lib/components/template/ListView/ListView.js.map +1 -1
  205. package/lib/components/template/ListView/utils.d.ts.map +1 -1
  206. package/lib/components/template/ListView/utils.js +1 -2
  207. package/lib/components/template/ListView/utils.js.map +1 -1
  208. package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +2 -2
  209. package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
  210. package/lib/components/template/OneColumn/OneColumn/OneColumn.js +2 -2
  211. package/lib/components/template/OneColumn/OneColumn/OneColumn.js.map +1 -1
  212. package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
  213. package/lib/components/template/PromotedFilters/PromotedFilters.js +1 -2
  214. package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
  215. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
  216. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +0 -2
  217. package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
  218. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts +2 -0
  219. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
  220. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +67 -44
  221. package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
  222. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
  223. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js +2 -4
  224. package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
  225. package/lib/components/template/SubTabs/SubTabs.js +2 -2
  226. package/lib/components/template/SubTabs/SubTabs.js.map +1 -1
  227. package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js +2 -2
  228. package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js.map +1 -1
  229. package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js +2 -2
  230. package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js.map +1 -1
  231. package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +2 -2
  232. package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
  233. package/lib/components/template/WssNavBar/WssNavBar.js +9 -9
  234. package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
  235. package/lib/components/widget/AppAnnouncement/AppAnnouncement.js +2 -2
  236. package/lib/components/widget/AppAnnouncement/AppAnnouncement.js.map +1 -1
  237. package/lib/components/widget/Attachment/Attachment.css +1 -0
  238. package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
  239. package/lib/components/widget/Attachment/Attachment.js +7 -10
  240. package/lib/components/widget/Attachment/Attachment.js.map +1 -1
  241. package/lib/components/widget/CaseHistory/CaseHistory.d.ts.map +1 -1
  242. package/lib/components/widget/CaseHistory/CaseHistory.js +8 -7
  243. package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
  244. package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js +1 -1
  245. package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js.map +1 -1
  246. package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
  247. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +4 -4
  248. package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
  249. package/lib/components/widget/Followers/Followers.js +2 -2
  250. package/lib/components/widget/Followers/Followers.js.map +1 -1
  251. package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
  252. package/lib/components/widget/QuickCreate/QuickCreate.js +0 -1
  253. package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
  254. package/lib/components/widget/SummaryItem/SummaryItem.d.ts.map +1 -1
  255. package/lib/components/widget/SummaryItem/SummaryItem.js +3 -3
  256. package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
  257. package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
  258. package/lib/components/widget/ToDo/ToDo.js +60 -17
  259. package/lib/components/widget/ToDo/ToDo.js.map +1 -1
  260. package/lib/hooks/index.d.ts +2 -0
  261. package/lib/hooks/index.d.ts.map +1 -1
  262. package/lib/hooks/index.js +2 -0
  263. package/lib/hooks/index.js.map +1 -1
  264. package/lib/hooks/useFocusFirstField.d.ts +7 -0
  265. package/lib/hooks/useFocusFirstField.d.ts.map +1 -0
  266. package/lib/hooks/useFocusFirstField.js +20 -0
  267. package/lib/hooks/useFocusFirstField.js.map +1 -0
  268. package/lib/hooks/useScrolltoTop.d.ts +7 -0
  269. package/lib/hooks/useScrolltoTop.d.ts.map +1 -0
  270. package/lib/hooks/useScrolltoTop.js +13 -0
  271. package/lib/hooks/useScrolltoTop.js.map +1 -0
  272. package/lib/theme.d.ts +11 -0
  273. package/lib/theme.d.ts.map +1 -0
  274. package/lib/theme.js +31 -0
  275. package/lib/theme.js.map +1 -0
  276. package/package.json +1 -1
  277. package/lib/components/infra/Containers/helpers.d.ts +0 -2
  278. package/lib/components/infra/Containers/helpers.d.ts.map +0 -1
  279. package/lib/components/infra/Containers/helpers.js.map +0 -1
@@ -1,14 +1,23 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { TextField } from '@material-ui/core';
2
+ import { useEffect, useState } from 'react';
3
+ import { TextField } from '@mui/material';
4
+ import handleEvent from '../../helpers/event-utils';
3
5
  import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
4
6
  export default function TextArea(props) {
5
7
  // Get emitted components from map (so we can get any override that may exist)
6
8
  const FieldValueList = getComponentFromMap('FieldValueList');
7
- const { label, required, disabled, value = '', validatemessage, status, onChange, onBlur, readOnly, testId, fieldMetadata, helperText, displayMode, hideLabel, placeholder } = props;
9
+ const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, fieldMetadata, helperText, displayMode, hideLabel, placeholder } = props;
8
10
  const helperTextToDisplay = validatemessage || helperText;
11
+ const pConn = getPConnect();
12
+ const actions = pConn.getActionsApi();
13
+ const propName = pConn.getStateProps().value;
9
14
  const maxLength = fieldMetadata?.maxLength;
15
+ const [inputValue, setInputValue] = useState('');
10
16
  let readOnlyProp = {};
11
- if (displayMode === 'LABELS_LEFT') {
17
+ useEffect(() => {
18
+ setInputValue(value);
19
+ }, [value]);
20
+ if (displayMode === 'DISPLAY_ONLY') {
12
21
  return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: value });
13
22
  }
14
23
  if (displayMode === 'STACKED_LARGE_VAL') {
@@ -23,6 +32,13 @@ export default function TextArea(props) {
23
32
  testProp = {
24
33
  'data-test-id': testId
25
34
  };
26
- return (_jsx(TextField, { multiline: true, minRows: 5, maxRows: 5, fullWidth: true, variant: readOnly ? 'standard' : 'outlined', helperText: helperTextToDisplay, placeholder: placeholder ?? '', size: 'small', required: required, disabled: disabled, onChange: onChange, onBlur: !readOnly ? onBlur : undefined, error: status === 'error', label: label, value: value, InputProps: { ...readOnlyProp, inputProps: { maxLength, ...testProp } } }));
35
+ function handleChange(event) {
36
+ // update internal value
37
+ setInputValue(event?.target?.value);
38
+ }
39
+ function handleBlur() {
40
+ handleEvent(actions, 'changeNblur', propName, inputValue);
41
+ }
42
+ return (_jsx(TextField, { multiline: true, minRows: 5, maxRows: 5, fullWidth: true, variant: readOnly ? 'standard' : 'outlined', helperText: helperTextToDisplay, placeholder: placeholder ?? '', size: 'small', required: required, disabled: disabled, onChange: handleChange, onBlur: !readOnly ? handleBlur : undefined, error: status === 'error', label: label, value: inputValue, InputProps: { ...readOnlyProp, inputProps: { maxLength, ...testProp } } }));
27
43
  }
28
44
  //# sourceMappingURL=TextArea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../src/components/field/TextArea/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAA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AQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAC3C,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,WAAW,IAAI,EAAE,EAC9B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACtC,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,EAAE,GACvE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { TextField } from '@material-ui/core';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface TextAreaProps extends PConnFieldProps {\n // If any, enter additional props that only exist on TextArea here\n fieldMetadata?: any;\n}\n\nexport default function TextArea(props: TextAreaProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n onChange,\n onBlur,\n readOnly,\n testId,\n fieldMetadata,\n helperText,\n displayMode,\n hideLabel,\n placeholder\n } = props;\n const helperTextToDisplay = validatemessage || helperText;\n\n const maxLength = fieldMetadata?.maxLength;\n\n let readOnlyProp = {};\n\n if (displayMode === 'LABELS_LEFT') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n // Not just emitting a read only Textfield like some other components do\n // since we want to preserve the minRows, maxRows info.\n readOnlyProp = { readOnly: true };\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n return (\n <TextField\n multiline\n minRows={5}\n maxRows={5}\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n onChange={onChange}\n onBlur={!readOnly ? onBlur : undefined}\n error={status === 'error'}\n label={label}\n value={value}\n InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../src/components/field/TextArea/TextArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAQhF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACnD,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE7D,MAAM,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,eAAe,EACf,MAAM,EACN,QAAQ,EACR,MAAM,EACN,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACZ,GAAG,KAAK,CAAC;IACV,MAAM,mBAAmB,GAAG,eAAe,IAAI,UAAU,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAI,KAAK,CAAC,aAAa,EAAU,CAAC,KAAK,CAAC;IACtD,MAAM,SAAS,GAAG,aAAa,EAAE,SAAS,CAAC;IAE3C,MAAM,CAAC,UAAU,EAAE,aAAa,CA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IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,EAAE,GACvE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { TextField } from '@mui/material';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface TextAreaProps extends PConnFieldProps {\n // If any, enter additional props that only exist on TextArea here\n fieldMetadata?: any;\n}\n\nexport default function TextArea(props: TextAreaProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n readOnly,\n testId,\n fieldMetadata,\n helperText,\n displayMode,\n hideLabel,\n placeholder\n } = props;\n const helperTextToDisplay = validatemessage || helperText;\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n const maxLength = fieldMetadata?.maxLength;\n\n const [inputValue, setInputValue] = useState('');\n\n let readOnlyProp = {};\n\n useEffect(() => {\n setInputValue(value);\n }, [value]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n // Not just emitting a read only Textfield like some other components do\n // since we want to preserve the minRows, maxRows info.\n readOnlyProp = { readOnly: true };\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n function handleChange(event) {\n // update internal value\n setInputValue(event?.target?.value);\n }\n\n function handleBlur() {\n handleEvent(actions, 'changeNblur', propName, inputValue);\n }\n\n return (\n <TextField\n multiline\n minRows={5}\n maxRows={5}\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n onChange={handleChange}\n onBlur={!readOnly ? handleBlur : undefined}\n error={status === 'error'}\n label={label}\n value={inputValue}\n InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}\n />\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Typography } from '@material-ui/core';
2
+ import { Typography } from '@mui/material';
3
3
  export default function TextContent(props) {
4
4
  const { content, displayAs } = props;
5
5
  let theVariant = 'body1';
@@ -1 +1 @@
1
- {"version":3,"file":"TextContent.js","sourceRoot":"","sources":["../../../../src/components/field/TextContent/TextContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU/C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAuB;IAIzD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAsD,KAAK,CAAC;IAExF,IAAI,UAAU,GAAqB,OAAO,CAAC;IAE3C,QAAQ,SAAS,EAAE;QACjB,KAAK,WAAW;YACd,UAAU,GAAG,OAAO,CAAC;YACrB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER;YACE,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,+CAA+C,SAAS,EAAE,CAAC,CAAC;YAC1E,MAAM;KACT;IAED,OAAO,KAAC,UAAU,IAAC,OAAO,EAAE,UAAU,YAAG,OAAO,GAAc,CAAC;AACjE,CAAC","sourcesContent":["import { Typography } from '@material-ui/core';\n\nimport { PConnProps } from '../../../types/PConnProps';\n\ninterface TextContentProps extends PConnProps {\n // If any, enter additional props that only exist on TextContent here\n content: string;\n displayAs: 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';\n}\n\nexport default function TextContent(props: TextContentProps) {\n type ExpectedDisplayAs = 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';\n type ExpectedVariants = 'body1' | 'h1' | 'h2' | 'h3' | 'h4';\n\n const { content, displayAs }: { content: string; displayAs: ExpectedDisplayAs } = props;\n\n let theVariant: ExpectedVariants = 'body1';\n\n switch (displayAs) {\n case 'Paragraph':\n theVariant = 'body1';\n break;\n\n case 'Heading 1':\n theVariant = 'h1';\n break;\n\n case 'Heading 2':\n theVariant = 'h2';\n break;\n\n case 'Heading 3':\n theVariant = 'h3';\n break;\n\n case 'Heading 4':\n theVariant = 'h4';\n break;\n\n default:\n // eslint-disable-next-line no-console\n console.error(`TextContent got an expected displayAs prop: ${displayAs}`);\n break;\n }\n\n return <Typography variant={theVariant}>{content}</Typography>;\n}\n"]}
1
+ {"version":3,"file":"TextContent.js","sourceRoot":"","sources":["../../../../src/components/field/TextContent/TextContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAU3C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAuB;IAIzD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAsD,KAAK,CAAC;IAExF,IAAI,UAAU,GAAqB,OAAO,CAAC;IAE3C,QAAQ,SAAS,EAAE;QACjB,KAAK,WAAW;YACd,UAAU,GAAG,OAAO,CAAC;YACrB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER,KAAK,WAAW;YACd,UAAU,GAAG,IAAI,CAAC;YAClB,MAAM;QAER;YACE,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,+CAA+C,SAAS,EAAE,CAAC,CAAC;YAC1E,MAAM;KACT;IAED,OAAO,KAAC,UAAU,IAAC,OAAO,EAAE,UAAU,YAAG,OAAO,GAAc,CAAC;AACjE,CAAC","sourcesContent":["import { Typography } from '@mui/material';\n\nimport { PConnProps } from '../../../types/PConnProps';\n\ninterface TextContentProps extends PConnProps {\n // If any, enter additional props that only exist on TextContent here\n content: string;\n displayAs: 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';\n}\n\nexport default function TextContent(props: TextContentProps) {\n type ExpectedDisplayAs = 'Paragraph' | 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Heading 4';\n type ExpectedVariants = 'body1' | 'h1' | 'h2' | 'h3' | 'h4';\n\n const { content, displayAs }: { content: string; displayAs: ExpectedDisplayAs } = props;\n\n let theVariant: ExpectedVariants = 'body1';\n\n switch (displayAs) {\n case 'Paragraph':\n theVariant = 'body1';\n break;\n\n case 'Heading 1':\n theVariant = 'h1';\n break;\n\n case 'Heading 2':\n theVariant = 'h2';\n break;\n\n case 'Heading 3':\n theVariant = 'h3';\n break;\n\n case 'Heading 4':\n theVariant = 'h4';\n break;\n\n default:\n // eslint-disable-next-line no-console\n console.error(`TextContent got an expected displayAs prop: ${displayAs}`);\n break;\n }\n\n return <Typography variant={theVariant}>{content}</Typography>;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from 'react';
3
- import { TextField } from '@material-ui/core';
3
+ import { TextField } from '@mui/material';
4
4
  import handleEvent from '../../helpers/event-utils';
5
5
  import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
6
6
  export default function TextInput(props) {
@@ -19,7 +19,7 @@ export default function TextInput(props) {
19
19
  useEffect(() => {
20
20
  setInputValue(value);
21
21
  }, [value]);
22
- if (displayMode === 'LABELS_LEFT') {
22
+ if (displayMode === 'DISPLAY_ONLY') {
23
23
  return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: value });
24
24
  }
25
25
  if (displayMode === 'STACKED_LARGE_VAL') {
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../src/components/field/TextInput/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAQhF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAqB;IACrD,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE7D,MAAM,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,eAAe,EACf,MAAM;IACN,sBAAsB;IACtB,QAAQ,EACR,MAAM,EACN,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACZ,GAAG,KAAK,CAAC;IAEV,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAI,KAAK,CAAC,aAAa,EAAU,CAAC,KAAK,CAAC;IAEtD,MAAM,mBAAmB,GAAG,eAAe,IAAI,UAAU,CA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IAAI,EAAE,EAC9B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,EAAE,GACvE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\nimport { TextField } from '@material-ui/core';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface TextInputProps extends PConnFieldProps {\n // If any, enter additional props that only exist on TextInput here\n fieldMetadata?: any;\n}\n\nexport default function TextInput(props: TextInputProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n /* onChange, onBlur */\n readOnly,\n testId,\n fieldMetadata,\n helperText,\n displayMode,\n hideLabel,\n placeholder\n } = props;\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n\n const helperTextToDisplay = validatemessage || helperText;\n\n const [inputValue, setInputValue] = useState('');\n const maxLength = fieldMetadata?.maxLength;\n\n let readOnlyProp = {}; // Note: empty if NOT ReadOnly\n\n useEffect(() => {\n setInputValue(value);\n }, [value]);\n\n if (displayMode === 'LABELS_LEFT') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n function handleChange(event) {\n // update internal value\n setInputValue(event?.target?.value);\n }\n\n function handleBlur() {\n handleEvent(actions, 'changeNblur', propName, inputValue);\n }\n\n return (\n <TextField\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n onChange={handleChange}\n onBlur={!readOnly ? handleBlur : undefined}\n error={status === 'error'}\n label={label}\n value={inputValue}\n InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../src/components/field/TextInput/TextInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAQhF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAqB;IACrD,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE7D,MAAM,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,eAAe,EACf,MAAM;IACN,sBAAsB;IACtB,QAAQ,EACR,MAAM,EACN,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACZ,GAAG,KAAK,CAAC;IAEV,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAI,KAAK,CAAC,aAAa,EAAU,CAAC,KAAK,CAAC;I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,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,WAAW,IAAI,EAAE,EAC9B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,EAAE,GACvE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\nimport { TextField } from '@mui/material';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface TextInputProps extends PConnFieldProps {\n // If any, enter additional props that only exist on TextInput here\n fieldMetadata?: any;\n}\n\nexport default function TextInput(props: TextInputProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n /* onChange, onBlur */\n readOnly,\n testId,\n fieldMetadata,\n helperText,\n displayMode,\n hideLabel,\n placeholder\n } = props;\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n\n const helperTextToDisplay = validatemessage || helperText;\n\n const [inputValue, setInputValue] = useState('');\n const maxLength = fieldMetadata?.maxLength;\n\n let readOnlyProp = {}; // Note: empty if NOT ReadOnly\n\n useEffect(() => {\n setInputValue(value);\n }, [value]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n function handleChange(event) {\n // update internal value\n setInputValue(event?.target?.value);\n }\n\n function handleBlur() {\n handleEvent(actions, 'changeNblur', propName, inputValue);\n }\n\n return (\n <TextField\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n onChange={handleChange}\n onBlur={!readOnly ? handleBlur : undefined}\n error={status === 'error'}\n label={label}\n value={inputValue}\n InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}\n />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Time/Time.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,SAAU,SAAQ,eAAe;CAE1C;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,SAAS,2CAgE5C"}
1
+ {"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Time/Time.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,SAAU,SAAQ,eAAe;CAE1C;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,SAAS,2CAsE5C"}
@@ -1,15 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { KeyboardTimePicker } from '@material-ui/pickers';
3
- import AccessTimeIcon from '@material-ui/icons/AccessTime';
2
+ import { TimePicker } from '@mui/x-date-pickers/TimePicker';
3
+ // import AccessTimeIcon from '@mui/icons-material/AccessTime';
4
4
  import dayjs from 'dayjs';
5
+ import handleEvent from '../../helpers/event-utils';
5
6
  import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
6
7
  export default function Time(props) {
7
8
  // Get emitted components from map (so we can get any override that may exist)
8
9
  const FieldValueList = getComponentFromMap('FieldValueList');
9
10
  const TextInput = getComponentFromMap('TextInput');
10
- const { label, required, disabled, value = '', validatemessage, status, onChange, readOnly, helperText, displayMode, hideLabel, testId } = props;
11
+ const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, helperText, displayMode, hideLabel, testId } = props;
11
12
  const helperTextToDisplay = validatemessage || helperText;
12
- if (displayMode === 'LABELS_LEFT') {
13
+ const pConn = getPConnect();
14
+ const actions = pConn.getActionsApi();
15
+ const propName = pConn.getStateProps().value;
16
+ if (displayMode === 'DISPLAY_ONLY') {
13
17
  return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: value });
14
18
  }
15
19
  if (displayMode === 'STACKED_LARGE_VAL') {
@@ -23,11 +27,11 @@ export default function Time(props) {
23
27
  'data-test-id': testId
24
28
  };
25
29
  const handleChange = date => {
26
- const theValue = date && date.isValid() ? date.format('HH:mm') : null;
27
- onChange({ value: theValue });
30
+ const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;
31
+ handleEvent(actions, 'changeNblur', propName, theValue);
28
32
  };
29
33
  let timeValue = null;
30
- if (value) {
34
+ if (value && Object.keys(value).length) {
31
35
  const timeArray = value.split(':').map(itm => Number(itm));
32
36
  timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);
33
37
  }
@@ -35,6 +39,25 @@ export default function Time(props) {
35
39
  // TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field
36
40
  // try an older version of the lib or use DateTimePicker
37
41
  //
38
- return (_jsx(KeyboardTimePicker, { variant: 'inline', inputVariant: 'outlined', placeholder: 'hh:mm am', keyboardIcon: _jsx(AccessTimeIcon, {}), fullWidth: true, required: required, disabled: disabled, error: status === 'error', helperText: helperTextToDisplay, minutesStep: 5, size: 'small', label: label, autoOk: true, mask: '__:__ _m', format: 'hh:mm a', value: timeValue, onChange: handleChange, InputProps: { inputProps: { ...testProp } } }));
42
+ return (_jsx(TimePicker
43
+ // keyboardIcon={<AccessTimeIcon />}
44
+ // fullWidth
45
+ , {
46
+ // keyboardIcon={<AccessTimeIcon />}
47
+ // fullWidth
48
+ disabled: disabled, minutesStep: 5, label: label,
49
+ // autoOk
50
+ // mask='__:__ _m'
51
+ format: 'hh:mm a', value: timeValue, onChange: handleChange, slotProps: {
52
+ textField: {
53
+ variant: 'outlined',
54
+ placeholder: 'hh:mm am',
55
+ required,
56
+ error: status === 'error',
57
+ helperText: helperTextToDisplay,
58
+ size: 'small',
59
+ InputProps: { ...testProp }
60
+ }
61
+ } }));
39
62
  }
40
63
  //# sourceMappingURL=Time.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../../src/components/field/Time/Time.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAOhF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAgB;IAC3C,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACjJ,MAAM,mBAAmB,GAAG,eAAe,IAAI,UAAU,CAAC;IAE1D,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,OAAO,KAAC,c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vB,WAAW,EAAC,UAAU,EACtB,YAAY,EAAE,KAAC,cAAc,KAAG,EAChC,SAAS,QACT,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,CAAC,EACd,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,MAAM,QACN,IAAI,EAAC,UAAU,EACf,MAAM,EAAC,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE,GAC3C,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { KeyboardTimePicker } from '@material-ui/pickers';\nimport AccessTimeIcon from '@material-ui/icons/AccessTime';\nimport dayjs from 'dayjs';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface TimeProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Time here\n}\n\nexport default function Time(props: TimeProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n const TextInput = getComponentFromMap('TextInput');\n\n const { label, required, disabled, value = '', validatemessage, status, onChange, readOnly, helperText, displayMode, hideLabel, testId } = props;\n const helperTextToDisplay = validatemessage || helperText;\n\n if (displayMode === 'LABELS_LEFT') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n return <TextInput {...props} />;\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = date => {\n const theValue = date && date.isValid() ? date.format('HH:mm') : null;\n onChange({ value: theValue });\n };\n\n let timeValue: any = null;\n if (value) {\n const timeArray = value.split(':').map(itm => Number(itm));\n timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);\n }\n\n //\n // TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field\n // try an older version of the lib or use DateTimePicker\n //\n\n return (\n <KeyboardTimePicker\n variant='inline'\n inputVariant='outlined'\n placeholder='hh:mm am'\n keyboardIcon={<AccessTimeIcon />}\n fullWidth\n required={required}\n disabled={disabled}\n error={status === 'error'}\n helperText={helperTextToDisplay}\n minutesStep={5}\n size='small'\n label={label}\n autoOk\n mask='__:__ _m'\n format='hh:mm a'\n value={timeValue}\n onChange={handleChange}\n InputProps={{ inputProps: { ...testProp } }}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"Time.js","sourceRoot":"","sources":["../../../../src/components/field/Time/Time.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,+DAA+D;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAOhF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAgB;IAC3C,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACpJ,MAAM,mBAAmB,GAAG,eAAe,IAAI,UAAU,CAAC;IAC1D,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;IACtC,MA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AAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7D;IAED,EAAE;IACF,iGAAiG;IACjG,8DAA8D;IAC9D,EAAE;IAEF,OAAO,CACL,KAAC,UAAU;IACT,oCAAoC;IACpC,YAAY;;QADZ,oCAAoC;QACpC,YAAY;QAEZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,CAAC,EACd,KAAK,EAAE,KAAK;QACZ,SAAS;QACT,kBAAkB;QAClB,MAAM,EAAC,SAAS,EAChB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE;YACT,SAAS,EAAE;gBACT,OAAO,EAAE,UAAU;gBACnB,WAAW,EAAE,UAAU;gBACvB,QAAQ;gBACR,KAAK,EAAE,MAAM,KAAK,OAAO;gBACzB,UAAU,EAAE,mBAAmB;gBAC/B,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE;aAC5B;SACF,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { TimePicker } from '@mui/x-date-pickers/TimePicker';\n// import AccessTimeIcon from '@mui/icons-material/AccessTime';\nimport dayjs from 'dayjs';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface TimeProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Time here\n}\n\nexport default function Time(props: TimeProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n const TextInput = getComponentFromMap('TextInput');\n\n const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, helperText, displayMode, hideLabel, testId } = props;\n const helperTextToDisplay = validatemessage || helperText;\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n return <TextInput {...props} />;\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = date => {\n const theValue = date && date.isValid() ? date.format('HH:mm:ss') : null;\n handleEvent(actions, 'changeNblur', propName, theValue);\n };\n\n let timeValue: any = null;\n if (value && Object.keys(value).length) {\n const timeArray = value.split(':').map(itm => Number(itm));\n timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);\n }\n\n //\n // TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field\n // try an older version of the lib or use DateTimePicker\n //\n\n return (\n <TimePicker\n // keyboardIcon={<AccessTimeIcon />}\n // fullWidth\n\n disabled={disabled}\n minutesStep={5}\n label={label}\n // autoOk\n // mask='__:__ _m'\n format='hh:mm a'\n value={timeValue}\n onChange={handleChange}\n slotProps={{\n textField: {\n variant: 'outlined',\n placeholder: 'hh:mm am',\n required,\n error: status === 'error',\n helperText: helperTextToDisplay,\n size: 'small',\n InputProps: { ...testProp }\n }\n }}\n />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"URL.d.ts","sourceRoot":"","sources":["../../../../src/components/field/URL/URL.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,iBAAkB,SAAQ,eAAe;CAElD;AAKD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA2D5D"}
1
+ {"version":3,"file":"URL.d.ts","sourceRoot":"","sources":["../../../../src/components/field/URL/URL.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,iBAAkB,SAAQ,eAAe;CAElD;AAKD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA4E5D"}
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { TextField } from '@material-ui/core';
2
+ import { useEffect, useState } from 'react';
3
+ import { TextField } from '@mui/material';
4
+ import handleEvent from '../../helpers/event-utils';
3
5
  import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
4
6
  // NOTE: that we had to change the name from URL to URLComponent
5
7
  // Otherwise, we were getting all kinds of weird errors when we
@@ -8,9 +10,16 @@ export default function URLComponent(props) {
8
10
  // Get emitted components from map (so we can get any override that may exist)
9
11
  const FieldValueList = getComponentFromMap('FieldValueList');
10
12
  const TextInput = getComponentFromMap('TextInput');
11
- const { label, required, disabled, value = '', validatemessage, status, onChange, onBlur, readOnly, testId, helperText, displayMode, hideLabel, placeholder } = props;
13
+ const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel, placeholder } = props;
12
14
  const helperTextToDisplay = validatemessage || helperText;
13
- if (displayMode === 'LABELS_LEFT') {
15
+ const [inputValue, setInputValue] = useState('');
16
+ const pConn = getPConnect();
17
+ const actions = pConn.getActionsApi();
18
+ const propName = pConn.getStateProps().value;
19
+ useEffect(() => {
20
+ setInputValue(value);
21
+ }, [value]);
22
+ if (displayMode === 'DISPLAY_ONLY') {
14
23
  return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: value });
15
24
  }
16
25
  if (displayMode === 'STACKED_LARGE_VAL') {
@@ -23,6 +32,12 @@ export default function URLComponent(props) {
23
32
  testProp = {
24
33
  'data-test-id': testId
25
34
  };
26
- return (_jsx(TextField, { type: 'url', fullWidth: true, variant: 'outlined', helperText: helperTextToDisplay, placeholder: placeholder ?? '', size: 'small', required: required, disabled: disabled, onChange: onChange, onBlur: !readOnly ? onBlur : undefined, error: status === 'error', label: label, value: value, InputProps: { inputProps: { ...testProp } } }));
35
+ const handleChange = event => {
36
+ setInputValue(event?.target?.value);
37
+ };
38
+ function handleBlur() {
39
+ handleEvent(actions, 'changeNblur', propName, inputValue);
40
+ }
41
+ return (_jsx(TextField, { type: 'url', fullWidth: true, variant: 'outlined', helperText: helperTextToDisplay, placeholder: placeholder ?? '', size: 'small', required: required, disabled: disabled, onChange: handleChange, onBlur: !readOnly ? handleBlur : undefined, error: status === 'error', label: label, value: inputValue, InputProps: { inputProps: { ...testProp } } }));
27
42
  }
28
43
  //# sourceMappingURL=URL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"URL.js","sourceRoot":"","sources":["../../../../src/components/field/URL/URL.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAOhF,gEAAgE;AAChE,gEAAgE;AAChE,mCAAmC;AACnC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAwB;IAC3D,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,eAAe,EACf,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACZ,GAAG,KAAK,CAAC;IACV,MAAM,mBAAmB,GAAG,eAAe,IAAI,UAAU,CAAC;IAE1D,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,OAAO,KAAC,cAAc,IAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;KACvE;IAED,IAAI,WAAW,KAAK,mBAAmB,EAAE;QACvC,OAAO,KAAC,cAAc,IAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,SAAS,GAAG,CAAC;KACzF;IAED,IAAI,QAAQ,EAAE;QACZ,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAC;KACjC;IAED,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,QAAQ,GAAG;QACT,cAAc,EAAE,MAAM;KACvB,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAC,KAAK,EACV,SAAS,QACT,OAAO,EAAC,UAAU,EAClB,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,WAAW,IAAI,EAAE,EAC9B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACtC,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE,GAC3C,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { TextField } from '@material-ui/core';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface URLComponentProps extends PConnFieldProps {\n // If any, enter additional props that only exist on URLComponent here\n}\n\n// NOTE: that we had to change the name from URL to URLComponent\n// Otherwise, we were getting all kinds of weird errors when we\n// referred to URL as a component.\nexport default function URLComponent(props: URLComponentProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n const TextInput = getComponentFromMap('TextInput');\n\n const {\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n onChange,\n onBlur,\n readOnly,\n testId,\n helperText,\n displayMode,\n hideLabel,\n placeholder\n } = props;\n const helperTextToDisplay = validatemessage || helperText;\n\n if (displayMode === 'LABELS_LEFT') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n return <TextInput {...props} />;\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n return (\n <TextField\n type='url'\n fullWidth\n variant='outlined'\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n onChange={onChange}\n onBlur={!readOnly ? onBlur : undefined}\n error={status === 'error'}\n label={label}\n value={value}\n InputProps={{ inputProps: { ...testProp } }}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"URL.js","sourceRoot":"","sources":["../../../../src/components/field/URL/URL.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAOhF,gEAAgE;AAChE,gEAAgE;AAChE,mCAAmC;AACnC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAwB;IAC3D,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,eAAe,EACf,MAAM,EACN,QAAQ,EACR,MAAM,EACN,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACZ,GAAG,KAAK,CAAC;IACV,MAAM,mBAAmB,GAAG,eAAe,IAAI,UAAU,CAAC;IAE1D,MAAM,CAAC,UAAU,EAAE,a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W,IAAI,EAAE,EAC9B,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE,GAC3C,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { TextField } from '@mui/material';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface URLComponentProps extends PConnFieldProps {\n // If any, enter additional props that only exist on URLComponent here\n}\n\n// NOTE: that we had to change the name from URL to URLComponent\n// Otherwise, we were getting all kinds of weird errors when we\n// referred to URL as a component.\nexport default function URLComponent(props: URLComponentProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n const TextInput = getComponentFromMap('TextInput');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n readOnly,\n testId,\n helperText,\n displayMode,\n hideLabel,\n placeholder\n } = props;\n const helperTextToDisplay = validatemessage || helperText;\n\n const [inputValue, setInputValue] = useState('');\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n\n useEffect(() => {\n setInputValue(value);\n }, [value]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;\n }\n\n if (readOnly) {\n return <TextInput {...props} />;\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = event => {\n setInputValue(event?.target?.value);\n };\n\n function handleBlur() {\n handleEvent(actions, 'changeNblur', propName, inputValue);\n }\n\n return (\n <TextField\n type='url'\n fullWidth\n variant='outlined'\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n onChange={handleChange}\n onBlur={!readOnly ? handleBlur : undefined}\n error={status === 'error'}\n label={label}\n value={inputValue}\n InputProps={{ inputProps: { ...testProp } }}\n />\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"UserReference.d.ts","sourceRoot":"","sources":["../../../../src/components/field/UserReference/UserReference.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQvD,UAAU,kBAAmB,SAAQ,UAAU;IAE7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;;AA0KD,wBAAiD"}
1
+ {"version":3,"file":"UserReference.d.ts","sourceRoot":"","sources":["../../../../src/components/field/UserReference/UserReference.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQvD,UAAU,kBAAmB,SAAQ,UAAU;IAE7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;;AAwKD,wBAAiD"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { memo, useEffect, useState } from 'react';
3
- import { Typography } from '@material-ui/core';
3
+ import { Typography } from '@mui/material';
4
4
  import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
5
5
  import FieldValueList from '../../designSystemExtension/FieldValueList';
6
6
  import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
@@ -38,10 +38,8 @@ const UserReference = (props) => {
38
38
  dataViewName: OPERATORS_DP
39
39
  };
40
40
  PCore.getRestClient()
41
- // @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
42
- // @ts-ignore - Expected 3 arguments, but got 2
43
41
  .invokeRestApi('getListData', { queryPayload })
44
- .then((res) => {
42
+ .then(res => {
45
43
  const ddDataSource = res.data.data.map(listItem => ({
46
44
  key: listItem.pyUserIdentifier,
47
45
  value: listItem.pyUserName
@@ -55,7 +53,7 @@ const UserReference = (props) => {
55
53
  }
56
54
  }, [displayAs, readOnly, showAsFormattedText, value]);
57
55
  let userReferenceComponent = null;
58
- if (displayMode === 'LABELS_LEFT') {
56
+ if (displayMode === 'DISPLAY_ONLY') {
59
57
  return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: userName || '' });
60
58
  }
61
59
  if (displayMode === 'STACKED_LARGE_VAL') {
@@ -1 +1 @@
1
- {"version":3,"file":"UserReference.js","sourceRoot":"","sources":["../../../../src/components/field/UserReference/UserReference.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,cAAc,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,aAAa,GAAG,gBAAgB,CAAC;AACvC,MAAM,UAAU,GAAG,YAAY,CAAC;AAsBhC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,EAAE;IAClD,8EAA8E;IAC9E,MAAM,YAAY,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAEjD,MAAM,EACJ,KAAK,GAAG,EAAE,EACV,SAAS,GAAG,EAAE,EACd,WAAW,GAAG,EAAE,EAChB,WAAW,EACX,KAAK,GAAG,EAAE,EACV,MAAM,GAAG,EAAE,EACX,UAAU,GAAG,EAAE,EACf,eAAe,GAAG,EAAE,EACpB,WAAW,GAAG,EAAE,EAChB,mBAAmB,GAAG,KAAK,EAC3B,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,EAClB,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;KACF;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAC;AAEF,oGAAoG;AACpG,2FAA2F;AAC3F,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;IAC5C,OAAO,CACL,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC;QACzD,SAAS,CAAC,eAAe,KAAK,SAAS,CAAC,eAAe;QACvD,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { memo, useEffect, useState } from 'react';\nimport { Typography } from '@material-ui/core';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnProps } from '../../../types/PConnProps';\n\nimport FieldValueList from '../../designSystemExtension/FieldValueList';\nimport { getUserId, isUserNameAvailable } from './UserReferenceUtils';\n\nconst DROPDOWN_LIST = 'Drop-down list';\nconst SEARCH_BOX = 'Search box';\n\ninterface UserReferenceProps extends PConnProps {\n // If any, enter additional props that only exist on URLComponent here\n displayAs?: string;\n displayMode?: string;\n label?: string;\n value?: any;\n testId?: string;\n placeholder?: string;\n helperText?: string;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n validatemessage?: string;\n showAsFormattedText?: boolean;\n additionalProps?: object;\n hideLabel?: boolean;\n variant?: string;\n onChange?: any;\n}\n\nconst UserReference = (props: UserReferenceProps) => {\n // Get emitted components from map (so we can get any override that may exist)\n const AutoComplete = getComponentFromMap('AutoComplete');\n const Dropdown = getComponentFromMap('Dropdown');\n\n const {\n label = '',\n displayAs = '',\n displayMode = '',\n getPConnect,\n value = '',\n testId = '',\n helperText = '',\n validatemessage = '',\n placeholder = '',\n showAsFormattedText = false,\n additionalProps = {},\n hideLabel = false,\n readOnly = false,\n required = false,\n disabled = false,\n onChange,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n variant = 'inline'\n } = props;\n const [dropDownDataSource, setDropDownDataSource] = useState([]);\n const [userName, setUserName] = useState('');\n const OPERATORS_DP = PCore.getEnvironmentInfo().getDefaultOperatorDP();\n const userId = getUserId(value);\n\n useEffect(() => {\n if (userId && readOnly && showAsFormattedText) {\n if (isUserNameAvailable(value)) {\n setUserName(value.userName);\n } else {\n // if same user ref field is referred in view as editable & readonly formatted text\n // referenced users won't be available, so get user details from dx api\n const { getOperatorDetails } = PCore.getUserApi();\n getOperatorDetails(userId).then((res: any) => {\n if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {\n setUserName(res.data.pyOperatorInfo.pyUserName);\n }\n });\n }\n } else if (displayAs === DROPDOWN_LIST) {\n const queryPayload = {\n dataViewName: OPERATORS_DP\n };\n\n PCore.getRestClient()\n // @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'\n // @ts-ignore - Expected 3 arguments, but got 2\n .invokeRestApi('getListData', { queryPayload })\n .then((res: any) => {\n const ddDataSource = res.data.data.map(listItem => ({\n key: listItem.pyUserIdentifier,\n value: listItem.pyUserName\n }));\n setDropDownDataSource(ddDataSource);\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [displayAs, readOnly, showAsFormattedText, value]);\n\n let userReferenceComponent: any = null;\n\n if (displayMode === 'LABELS_LEFT') {\n return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} variant='stacked' />;\n }\n\n if (readOnly && showAsFormattedText) {\n if (userId) {\n userReferenceComponent = (\n <>\n {/*\n TODO: This has to be replaced with Operator Component\n */}\n <div>\n <Typography variant='caption'>{label}</Typography>\n <Typography variant='body1'>{userName}</Typography>\n </div>\n </>\n );\n }\n } else {\n if (displayAs === SEARCH_BOX) {\n const columns = [\n {\n value: 'pyUserName',\n display: 'true',\n useForSearch: true,\n primary: 'true'\n },\n {\n value: 'pyUserIdentifier',\n setProperty: 'Associated property',\n key: 'true',\n display: 'true',\n secondary: 'true',\n useForSearch: 'true'\n }\n ];\n\n userReferenceComponent = (\n <AutoComplete\n additionalProps={additionalProps}\n label={label}\n getPConnect={getPConnect}\n datasource={OPERATORS_DP}\n listType='datapage'\n columns={columns}\n testId={testId}\n placeholder={placeholder}\n readOnly={readOnly}\n disabled={disabled}\n required={required}\n helperText={helperText}\n validatemessage={validatemessage}\n value={userId}\n hideLabel={hideLabel}\n onChange={onChange}\n />\n );\n }\n if (displayAs === DROPDOWN_LIST) {\n userReferenceComponent = (\n <Dropdown\n additionalProps={additionalProps}\n datasource={dropDownDataSource}\n listType='associated'\n getPConnect={getPConnect}\n label={label}\n value={userId}\n testId={testId}\n placeholder={placeholder}\n readOnly={readOnly}\n disabled={disabled}\n required={required}\n helperText={helperText}\n validatemessage={validatemessage}\n hideLabel={hideLabel}\n onChange={onChange}\n />\n );\n }\n }\n return userReferenceComponent;\n};\n\n// as objects are there in props, shallow comparision fails & re-rendering of comp happens even with\n// same key value pairs in obj. hence using custom comparison function on when to re-render\nconst comparisonFn = (prevProps, nextProps) => {\n return (\n getUserId(prevProps.value) === getUserId(nextProps.value) &&\n prevProps.validatemessage === nextProps.validatemessage &&\n prevProps.required === nextProps.required &&\n prevProps.disabled === nextProps.disabled &&\n prevProps.readOnly === nextProps.readOnly\n );\n};\n\nexport default memo(UserReference, comparisonFn);\n"]}
1
+ {"version":3,"file":"UserReference.js","sourceRoot":"","sources":["../../../../src/components/field/UserRe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AS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { memo, useEffect, useState } from 'react';\nimport { Typography } from '@mui/material';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnProps } from '../../../types/PConnProps';\n\nimport FieldValueList from '../../designSystemExtension/FieldValueList';\nimport { getUserId, isUserNameAvailable } from './UserReferenceUtils';\n\nconst DROPDOWN_LIST = 'Drop-down list';\nconst SEARCH_BOX = 'Search box';\n\ninterface UserReferenceProps extends PConnProps {\n // If any, enter additional props that only exist on URLComponent here\n displayAs?: string;\n displayMode?: string;\n label?: string;\n value?: any;\n testId?: string;\n placeholder?: string;\n helperText?: string;\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n validatemessage?: string;\n showAsFormattedText?: boolean;\n additionalProps?: object;\n hideLabel?: boolean;\n variant?: string;\n onChange?: any;\n}\n\nconst UserReference = (props: UserReferenceProps) => {\n // Get emitted components from map (so we can get any override that may exist)\n const AutoComplete = getComponentFromMap('AutoComplete');\n const Dropdown = getComponentFromMap('Dropdown');\n\n const {\n label = '',\n displayAs = '',\n displayMode = '',\n getPConnect,\n value = '',\n testId = '',\n helperText = '',\n validatemessage = '',\n placeholder = '',\n showAsFormattedText = false,\n additionalProps = {},\n hideLabel = false,\n readOnly = false,\n required = false,\n disabled = false,\n onChange,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n variant = 'inline'\n } = props;\n const [dropDownDataSource, setDropDownDataSource] = useState([]);\n const [userName, setUserName] = useState('');\n const OPERATORS_DP = PCore.getEnvironmentInfo().getDefaultOperatorDP();\n const userId = getUserId(value);\n\n useEffect(() => {\n if (userId && readOnly && showAsFormattedText) {\n if (isUserNameAvailable(value)) {\n setUserName(value.userName);\n } else {\n // if same user ref field is referred in view as editable & readonly formatted text\n // referenced users won't be available, so get user details from dx api\n const { getOperatorDetails } = PCore.getUserApi();\n getOperatorDetails(userId).then((res: any) => {\n if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {\n setUserName(res.data.pyOperatorInfo.pyUserName);\n }\n });\n }\n } else if (displayAs === DROPDOWN_LIST) {\n const queryPayload = {\n dataViewName: OPERATORS_DP\n };\n\n PCore.getRestClient()\n .invokeRestApi('getListData', { queryPayload })\n .then(res => {\n const ddDataSource = res.data.data.map(listItem => ({\n key: listItem.pyUserIdentifier,\n value: listItem.pyUserName\n }));\n setDropDownDataSource(ddDataSource);\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [displayAs, readOnly, showAsFormattedText, value]);\n\n let userReferenceComponent: any = null;\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={userName || ''} variant='stacked' />;\n }\n\n if (readOnly && showAsFormattedText) {\n if (userId) {\n userReferenceComponent = (\n <>\n {/*\n TODO: This has to be replaced with Operator Component\n */}\n <div>\n <Typography variant='caption'>{label}</Typography>\n <Typography variant='body1'>{userName}</Typography>\n </div>\n </>\n );\n }\n } else {\n if (displayAs === SEARCH_BOX) {\n const columns = [\n {\n value: 'pyUserName',\n display: 'true',\n useForSearch: true,\n primary: 'true'\n },\n {\n value: 'pyUserIdentifier',\n setProperty: 'Associated property',\n key: 'true',\n display: 'true',\n secondary: 'true',\n useForSearch: 'true'\n }\n ];\n\n userReferenceComponent = (\n <AutoComplete\n additionalProps={additionalProps}\n label={label}\n getPConnect={getPConnect}\n datasource={OPERATORS_DP}\n listType='datapage'\n columns={columns}\n testId={testId}\n placeholder={placeholder}\n readOnly={readOnly}\n disabled={disabled}\n required={required}\n helperText={helperText}\n validatemessage={validatemessage}\n value={userId}\n hideLabel={hideLabel}\n onChange={onChange}\n />\n );\n }\n if (displayAs === DROPDOWN_LIST) {\n userReferenceComponent = (\n <Dropdown\n additionalProps={additionalProps}\n datasource={dropDownDataSource}\n listType='associated'\n getPConnect={getPConnect}\n label={label}\n value={userId}\n testId={testId}\n placeholder={placeholder}\n readOnly={readOnly}\n disabled={disabled}\n required={required}\n helperText={helperText}\n validatemessage={validatemessage}\n hideLabel={hideLabel}\n onChange={onChange}\n />\n );\n }\n }\n return userReferenceComponent;\n};\n\n// as objects are there in props, shallow comparision fails & re-rendering of comp happens even with\n// same key value pairs in obj. hence using custom comparison function on when to re-render\nconst comparisonFn = (prevProps, nextProps) => {\n return (\n getUserId(prevProps.value) === getUserId(nextProps.value) &&\n prevProps.validatemessage === nextProps.validatemessage &&\n prevProps.required === nextProps.required &&\n prevProps.disabled === nextProps.disabled &&\n prevProps.readOnly === nextProps.readOnly\n );\n};\n\nexport default memo(UserReference, comparisonFn);\n"]}
@@ -1,2 +1,9 @@
1
1
  export declare function isEmptyObject(obj: Object): boolean;
2
+ /**
3
+ * Get a localized value from the Generic Fields
4
+ * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
5
+ * @param key - The key of the string to localize
6
+ * @returns The localized string or the key itself if no translation is found
7
+ */
8
+ export declare function getGenericFieldsLocalizedValue(path: string, key: string): string;
2
9
  //# sourceMappingURL=common-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-utils.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/common-utils.ts"],"names":[],"mappings":"AACA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD"}
1
+ {"version":3,"file":"common-utils.d.ts","sourceRoot":"","sources":["../../../src/components/helpers/common-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBhF"}
@@ -1,5 +1,25 @@
1
- /* eslint-disable import/prefer-default-export */
2
1
  export function isEmptyObject(obj) {
3
2
  return Object.keys(obj).length === 0;
4
3
  }
4
+ /**
5
+ * Get a localized value from the Generic Fields
6
+ * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
7
+ * @param key - The key of the string to localize
8
+ * @returns The localized string or the key itself if no translation is found
9
+ */
10
+ export function getGenericFieldsLocalizedValue(path, key) {
11
+ const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;
12
+ const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];
13
+ if (!localeStore)
14
+ return key;
15
+ // Split the path and traverse the object
16
+ const pathParts = path.split('.');
17
+ let currentObj = localeStore;
18
+ for (const part of pathParts) {
19
+ if (!currentObj[part])
20
+ return key;
21
+ currentObj = currentObj[part];
22
+ }
23
+ return currentObj[key] || key;
24
+ }
5
25
  //# sourceMappingURL=common-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-utils.js","sourceRoot":"","sources":["../../../src/components/helpers/common-utils.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvC,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\nexport function isEmptyObject(obj: Object): boolean {\n return Object.keys(obj).length === 0;\n}\n"]}
1
+ {"version":3,"file":"common-utils.js","sourceRoot":"","sources":["../../../src/components/helpers/common-utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,IAAY,EAAE,GAAW;IACtE,MAAM,kBAAkB,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC,kBAAkB,CAAC;IACrE,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAE3E,IAAI,CAAC,WAAW;QAAE,OAAO,GAAG,CAAC;IAE7B,yCAAyC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,UAAU,GAAG,WAAW,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;QAC5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,GAAG,CAAC;QAClC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;KAC/B;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;AAChC,CAAC","sourcesContent":["export function isEmptyObject(obj: Object): boolean {\n return Object.keys(obj).length === 0;\n}\n\n/**\n * Get a localized value from the Generic Fields\n * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')\n * @param key - The key of the string to localize\n * @returns The localized string or the key itself if no translation is found\n */\nexport function getGenericFieldsLocalizedValue(path: string, key: string): string {\n const GENERIC_BUNDLE_KEY = PCore.getLocaleUtils().GENERIC_BUNDLE_KEY;\n const localeStore = PCore.getLocaleUtils().localeStore[GENERIC_BUNDLE_KEY];\n\n if (!localeStore) return key;\n\n // Split the path and traverse the object\n const pathParts = path.split('.');\n let currentObj = localeStore;\n\n for (const part of pathParts) {\n if (!currentObj[part]) return key;\n currentObj = currentObj[part];\n }\n\n return currentObj[key] || key;\n}\n"]}
@@ -42,8 +42,8 @@ export function buildView(pConn, index, viewConfigPath) {
42
42
  }
43
43
  };
44
44
  const view = PCore.createPConnect(config);
45
- if (pConn.getConfigProps()?.displayMode === 'LABELS_LEFT') {
46
- view.getPConnect()?.setInheritedProp('displayMode', 'LABELS_LEFT');
45
+ if (pConn.getConfigProps()?.displayMode === 'DISPLAY_ONLY') {
46
+ view.getPConnect()?.setInheritedProp('displayMode', 'DISPLAY_ONLY');
47
47
  }
48
48
  return createElement(createPConnectComponent(), view);
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"field-group-utils.js","sourceRoot":"","sources":["../../../src/components/helpers/field-group-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAEpD,OAAO,uBAAuB,MAAM,6BAA6B,CAAC;AAElE;;;;GAIG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,EAAE;IACtC,IAAI,WAAW,GAAG,KAAK,CAAC,kBAAkB,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9E,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC9B,WAAW,GAAG,KAAK,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,WAAW,EAAE,SAAS,EAAE;YAC1B,WAAW,GAAG,WAAW,EAAE,SAAS,CAAC;SACtC;aAAM,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;YAC9E,WAAW,GAAG,GAAG,WAAW,YAAY,CAAC;SAC1C;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc;IACpD,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;IACvC,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,gBAAgB,EAAE,GAAG,aAAa,IAAI,KAAK,GAAG,CAAC;IAC1H,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAElH,OAAO,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC;IAE/B,MAAM,MAAM,GAAG;QACb,IAAI;QACJ,OAAO,EAAE;YACP,OAAO;YACP,aAAa;YACb,aAAa;YACb,OAAO,EAAE,IAAI;SACd;KACF,CAAC;IAEF,MAAM,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,WAAW,KAAK,aAAa,EAAE;QACzD,IAAI,CAAC,WAAW,EAAE,EAAE,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;KACpE;IACD,OAAO,aAAa,CAAC,uBAAuB,EAAE,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { createElement, ReactElement } from 'react';\n\nimport createPConnectComponent from '../../bridge/react_pconnect';\n\n/**\n *\n * @param {*} pConn - pConnect object of the view\n * @returns {string} - returns the name of referenceList\n */\n\nexport const getReferenceList = pConn => {\n let resolvePage = pConn.getComponentConfig().referenceList.replace('@P ', '');\n if (resolvePage.includes('D_')) {\n resolvePage = pConn.resolveDatasourceReference(resolvePage);\n if (resolvePage?.pxResults) {\n resolvePage = resolvePage?.pxResults;\n } else if (resolvePage.startsWith('D_') && !resolvePage.endsWith('.pxResults')) {\n resolvePage = `${resolvePage}.pxResults`;\n }\n }\n return resolvePage;\n};\n\n/**\n * creates and returns react element of the view\n * @param {*} pConn - pConnect object of the view\n * @param {*} index - index of the fieldGroup item\n * @param {*} viewConfigPath - boolean value to check for children in config\n * @returns {*} - return the react element of the view\n */\nexport function buildView(pConn, index, viewConfigPath): ReactElement {\n const context = pConn.getContextName();\n const referenceList = getReferenceList(pConn);\n\n const isDatapage = referenceList.startsWith('D_');\n const pageReference = isDatapage ? `${referenceList}[${index}]` : `${pConn.getPageReference()}${referenceList}[${index}]`;\n const meta = viewConfigPath ? pConn.getRawMetadata().children[0].children[0] : pConn.getRawMetadata().children[0];\n\n delete meta?.config?.ruleClass;\n\n const config = {\n meta,\n options: {\n context,\n pageReference,\n referenceList,\n hasForm: true\n }\n };\n\n const view = PCore.createPConnect(config);\n if (pConn.getConfigProps()?.displayMode === 'LABELS_LEFT') {\n view.getPConnect()?.setInheritedProp('displayMode', 'LABELS_LEFT');\n }\n return createElement(createPConnectComponent(), view);\n}\n"]}
1
+ {"version":3,"file":"field-group-utils.js","sourceRoot":"","sources":["../../../src/components/helpers/field-group-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAEpD,OAAO,uBAAuB,MAAM,6BAA6B,CAAC;AAElE;;;;GAIG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,EAAE;IACtC,IAAI,WAAW,GAAG,KAAK,CAAC,kBAAkB,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9E,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC9B,WAAW,GAAG,KAAK,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,WAAW,EAAE,SAAS,EAAE;YAC1B,WAAW,GAAG,WAAW,EAAE,SAAS,CAAC;SACtC;aAAM,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;YAC9E,WAAW,GAAG,GAAG,W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pconnect';\n\n/**\n *\n * @param {*} pConn - pConnect object of the view\n * @returns {string} - returns the name of referenceList\n */\n\nexport const getReferenceList = pConn => {\n let resolvePage = pConn.getComponentConfig().referenceList.replace('@P ', '');\n if (resolvePage.includes('D_')) {\n resolvePage = pConn.resolveDatasourceReference(resolvePage);\n if (resolvePage?.pxResults) {\n resolvePage = resolvePage?.pxResults;\n } else if (resolvePage.startsWith('D_') && !resolvePage.endsWith('.pxResults')) {\n resolvePage = `${resolvePage}.pxResults`;\n }\n }\n return resolvePage;\n};\n\n/**\n * creates and returns react element of the view\n * @param {*} pConn - pConnect object of the view\n * @param {*} index - index of the fieldGroup item\n * @param {*} viewConfigPath - boolean value to check for children in config\n * @returns {*} - return the react element of the view\n */\nexport function buildView(pConn, index, viewConfigPath): ReactElement {\n const context = pConn.getContextName();\n const referenceList = getReferenceList(pConn);\n\n const isDatapage = referenceList.startsWith('D_');\n const pageReference = isDatapage ? `${referenceList}[${index}]` : `${pConn.getPageReference()}${referenceList}[${index}]`;\n const meta = viewConfigPath ? pConn.getRawMetadata().children[0].children[0] : pConn.getRawMetadata().children[0];\n\n delete meta?.config?.ruleClass;\n\n const config = {\n meta,\n options: {\n context,\n pageReference,\n referenceList,\n hasForm: true\n }\n };\n\n const view = PCore.createPConnect(config);\n if (pConn.getConfigProps()?.displayMode === 'DISPLAY_ONLY') {\n view.getPConnect()?.setInheritedProp('displayMode', 'DISPLAY_ONLY');\n }\n return createElement(createPConnectComponent(), view);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../../../src/components/helpers/formatters/Currency.ts"],"names":[],"mappings":";;;;;;;;AAiEA,wBAWE"}
1
+ {"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../../../src/components/helpers/formatters/Currency.ts"],"names":[],"mappings":";;;;;;;;AAgEA,wBAOE"}
@@ -4,10 +4,7 @@ import CurrencyMap from './CurrencyMap';
4
4
  function NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}) {
5
5
  const currentLocale = getLocale(locale);
6
6
  if (value !== null && value !== undefined) {
7
- return Number(value).toLocaleString(currentLocale, {
8
- minimumFractionDigits: decPlaces,
9
- maximumFractionDigits: decPlaces
10
- });
7
+ return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });
11
8
  }
12
9
  return value;
13
10
  }
@@ -15,13 +12,16 @@ function CurrencyFormatter(value, { symbol = true, position = 'before', locale =
15
12
  const currentLocale = getLocale(locale);
16
13
  let formattedValue = value;
17
14
  if (value !== null && value !== undefined && value !== '') {
18
- formattedValue = NumberFormatter(value, {
19
- locale: currentLocale,
20
- decPlaces,
21
- style,
22
- currency
23
- });
24
- let countryCode = currentLocale?.split('-')[1].toUpperCase();
15
+ formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });
16
+ // For currency other than EUR, we need to determine the country code from currency code
17
+ // If currency is EUR, we use the locale to determine the country code
18
+ let countryCode;
19
+ if (currency !== 'EUR') {
20
+ countryCode = currency.substring(0, 2);
21
+ }
22
+ else {
23
+ countryCode = currentLocale?.split('-')[1].toUpperCase();
24
+ }
25
25
  // If countryCode is still undefined, setting it as US
26
26
  if (!countryCode) {
27
27
  countryCode = 'US';
@@ -58,10 +58,7 @@ export default {
58
58
  Currency: (value, options) => CurrencyFormatter(value, options),
59
59
  'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),
60
60
  Decimal: (value, options) => NumberFormatter(value, options),
61
- 'Decimal-Auto': (value, options) => NumberFormatter(value, {
62
- ...options,
63
- decPlaces: Number.isInteger(value) ? 0 : 2
64
- }),
61
+ 'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),
65
62
  Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),
66
63
  Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })
67
64
  };
@@ -1 +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OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,cAAc,EAAE,CAAC;KAC7E;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,eAAe;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC;IAC/D,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC5F,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC;IAC5D,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CACjC,eAAe,CAAC,KAAK,EAAE;QACrB,GAAG,OAAO;QACV,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C,CAAC;IACJ,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACjF,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;CACpF,CAAC","sourcesContent":["import { getLocale } from './common';\nimport CurrencyMap from './CurrencyMap';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {\n const currentLocale: string | undefined = getLocale(locale);\n if (value !== null && value !== undefined) {\n return Number(value).toLocaleString(currentLocale, {\n minimumFractionDigits: decPlaces,\n maximumFractionDigits: decPlaces\n });\n }\n return value;\n}\n\nfunction CurrencyFormatter(\n value: string,\n { symbol = true, position = 'before', locale = 'en-US', decPlaces = 2, style = 'currency', currency = 'USD' } = {}\n): string {\n const currentLocale: string | undefined = getLocale(locale);\n let formattedValue: string = value;\n if (value !== null && value !== undefined && value !== '') {\n formattedValue = NumberFormatter(value, {\n locale: currentLocale,\n decPlaces,\n style,\n currency\n });\n\n let countryCode: string | undefined = currentLocale?.split('-')[1].toUpperCase();\n\n // If countryCode is still undefined, setting it as US\n if (!countryCode) {\n countryCode = 'US';\n }\n\n let code: string;\n if (symbol) {\n code = CurrencyMap[countryCode]?.symbolFormat;\n } else {\n code = CurrencyMap[countryCode]?.currencyCode;\n }\n\n // if position is provided, change placeholder accordingly.\n if (position && code) {\n if (position.toLowerCase() === 'before' && code.startsWith('{#}')) {\n code = code.slice(3) + code.slice(0, 3);\n } else if (position.toLowerCase() === 'after' && code.indexOf('{#}') === code.length - 3) {\n code = code.slice(-3) + code.slice(0, -3);\n }\n }\n return code?.replace('{#}', formattedValue) || formattedValue;\n }\n return formattedValue;\n}\n\nfunction SymbolFormatter(value, { symbol = '$', suffix = true, locale = 'en-US' } = {}): string {\n let formattedValue: string = value;\n if (value !== null && value !== undefined) {\n formattedValue = NumberFormatter(value, { locale });\n return suffix ? `${formattedValue}${symbol}` : `${symbol}${formattedValue}`;\n }\n return formattedValue;\n}\n\nexport default {\n Currency: (value, options) => CurrencyFormatter(value, options),\n 'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),\n Decimal: (value, options) => NumberFormatter(value, options),\n 'Decimal-Auto': (value, options) =>\n NumberFormatter(value, {\n ...options,\n decPlaces: Number.isInteger(value) ? 0 : 2\n }),\n Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),\n Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })\n};\n"]}
1
+ {"version":3,"file":"Currency.js","sourceR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int/no-unused-vars\nfunction NumberFormatter(value, { locale = 'en-US', decPlaces = 2, style = '', currency = 'USD' } = {}): string {\n const currentLocale: string | undefined = getLocale(locale);\n if (value !== null && value !== undefined) {\n return Number(value).toLocaleString(currentLocale, { minimumFractionDigits: decPlaces, maximumFractionDigits: decPlaces });\n }\n return value;\n}\n\nfunction CurrencyFormatter(\n value: string,\n { symbol = true, position = 'before', locale = 'en-US', decPlaces = 2, style = 'currency', currency = 'USD' } = {}\n): string {\n const currentLocale: string | undefined = getLocale(locale);\n let formattedValue: string = value;\n if (value !== null && value !== undefined && value !== '') {\n formattedValue = NumberFormatter(value, { locale: currentLocale, decPlaces, style, currency });\n\n // For currency other than EUR, we need to determine the country code from currency code\n // If currency is EUR, we use the locale to determine the country code\n let countryCode: string | undefined;\n if (currency !== 'EUR') {\n countryCode = currency.substring(0, 2);\n } else {\n countryCode = currentLocale?.split('-')[1].toUpperCase();\n }\n\n // If countryCode is still undefined, setting it as US\n if (!countryCode) {\n countryCode = 'US';\n }\n\n let code: string;\n if (symbol) {\n code = CurrencyMap[countryCode]?.symbolFormat;\n } else {\n code = CurrencyMap[countryCode]?.currencyCode;\n }\n\n // if position is provided, change placeholder accordingly.\n if (position && code) {\n if (position.toLowerCase() === 'before' && code.startsWith('{#}')) {\n code = code.slice(3) + code.slice(0, 3);\n } else if (position.toLowerCase() === 'after' && code.indexOf('{#}') === code.length - 3) {\n code = code.slice(-3) + code.slice(0, -3);\n }\n }\n return code?.replace('{#}', formattedValue) || formattedValue;\n }\n return formattedValue;\n}\n\nfunction SymbolFormatter(value, { symbol = '$', suffix = true, locale = 'en-US' } = {}): string {\n let formattedValue: string = value;\n if (value !== null && value !== undefined) {\n formattedValue = NumberFormatter(value, { locale });\n return suffix ? `${formattedValue}${symbol}` : `${symbol}${formattedValue}`;\n }\n return formattedValue;\n}\n\nexport default {\n Currency: (value, options) => CurrencyFormatter(value, options),\n 'Currency-Code': (value, options) => CurrencyFormatter(value, { ...options, symbol: false }),\n Decimal: (value, options) => NumberFormatter(value, options),\n 'Decimal-Auto': (value, options) => NumberFormatter(value, { ...options, decPlaces: Number.isInteger(value) ? 0 : 2 }),\n Integer: (value, options) => NumberFormatter(value, { ...options, decPlaces: 0 }),\n Percentage: (value, options) => SymbolFormatter(value, { ...options, symbol: '%' })\n};\n"]}
@@ -1,3 +1,3 @@
1
- export declare function getLocale(locale?: string): string;
2
- export declare function getCurrentTimezone(timezone?: string): any;
1
+ export declare function getLocale(locale?: string): string | undefined;
2
+ export declare function getCurrentTimezone(timezone?: string): string;
3
3
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/components/helpers/formatters/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,MAAM,GAAE,MAAW,UAO5C;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,MAA2B,OAGvE"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/components/helpers/formatters/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,MAAM,GAAE,MAAW,sBAO5C;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,UAInD"}