@pega/react-sdk-components 0.25.2 → 0.25.4
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.
- package/lib/bridge/helpers/sdk_component_map.d.ts.map +1 -1
- package/lib/bridge/helpers/sdk_component_map.js +0 -6
- package/lib/bridge/helpers/sdk_component_map.js.map +1 -1
- package/lib/bridge/react_pconnect.js +11 -13
- package/lib/bridge/react_pconnect.js.map +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.css +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.js +2 -2
- package/lib/components/designSystemExtension/Banner/Banner.js.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +5 -8
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js +6 -8
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +3 -5
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +2 -2
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +4 -6
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.d.ts.map +1 -1
- package/lib/components/designSystemExtension/Operator/Operator.js +3 -4
- package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js +27 -3
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js.map +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.css +4 -4
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.css +4 -4
- package/lib/components/field/CancelAlert/CancelAlert.js +2 -2
- package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts +8 -0
- package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.js +52 -3
- package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/field/Currency/currency-utils.d.ts.map +1 -1
- package/lib/components/field/Currency/currency-utils.js +0 -2
- package/lib/components/field/Currency/currency-utils.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +2 -6
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Group/Group.js +2 -2
- package/lib/components/field/Group/Group.js.map +1 -1
- package/lib/components/field/Location/Location.d.ts +10 -0
- package/lib/components/field/Location/Location.d.ts.map +1 -0
- package/lib/components/field/Location/Location.js +157 -0
- package/lib/components/field/Location/Location.js.map +1 -0
- package/lib/components/field/Location/index.d.ts +2 -0
- package/lib/components/field/Location/index.d.ts.map +1 -0
- package/lib/components/field/Location/index.js +2 -0
- package/lib/components/field/Location/index.js.map +1 -0
- package/lib/components/field/ObjectReference/ObjectReference.d.ts +16 -0
- package/lib/components/field/ObjectReference/ObjectReference.d.ts.map +1 -0
- package/lib/components/field/ObjectReference/ObjectReference.js +165 -0
- package/lib/components/field/ObjectReference/ObjectReference.js.map +1 -0
- package/lib/components/field/ObjectReference/index.d.ts +2 -0
- package/lib/components/field/ObjectReference/index.d.ts.map +1 -0
- package/lib/components/field/ObjectReference/index.js +2 -0
- package/lib/components/field/ObjectReference/index.js.map +1 -0
- package/lib/components/field/ObjectReference/utils.d.ts +17 -0
- package/lib/components/field/ObjectReference/utils.d.ts.map +1 -0
- package/lib/components/field/ObjectReference/utils.js +99 -0
- package/lib/components/field/ObjectReference/utils.js.map +1 -0
- package/lib/components/field/RadioButtons/RadioButtons.d.ts +7 -0
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +12 -1
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/ScalarList/ScalarList.d.ts.map +1 -1
- package/lib/components/field/ScalarList/ScalarList.js +1 -2
- package/lib/components/field/ScalarList/ScalarList.js.map +1 -1
- package/lib/components/field/SelectableCard/SelectableCard.d.ts +2 -0
- package/lib/components/field/SelectableCard/SelectableCard.d.ts.map +1 -0
- package/lib/components/field/SelectableCard/SelectableCard.js +57 -0
- package/lib/components/field/SelectableCard/SelectableCard.js.map +1 -0
- package/lib/components/field/SelectableCard/index.d.ts +2 -0
- package/lib/components/field/SelectableCard/index.d.ts.map +1 -0
- package/lib/components/field/SelectableCard/index.js +2 -0
- package/lib/components/field/SelectableCard/index.js.map +1 -0
- package/lib/components/field/SelectableCard/utils.d.ts +14 -0
- package/lib/components/field/SelectableCard/utils.d.ts.map +1 -0
- package/lib/components/field/SelectableCard/utils.js +185 -0
- package/lib/components/field/SelectableCard/utils.js.map +1 -0
- package/lib/components/field/SemanticLink/SemanticLink.d.ts +9 -1
- package/lib/components/field/SemanticLink/SemanticLink.d.ts.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.js +128 -15
- package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
- package/lib/components/field/SemanticLink/utils.js +1 -1
- package/lib/components/field/SemanticLink/utils.js.map +1 -1
- package/lib/components/field/TextContent/TextContent.d.ts.map +1 -1
- package/lib/components/field/TextContent/TextContent.js +0 -1
- package/lib/components/field/TextContent/TextContent.js.map +1 -1
- package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
- package/lib/components/field/UserReference/UserReference.js +0 -1
- package/lib/components/field/UserReference/UserReference.js.map +1 -1
- package/lib/components/helpers/attachmentHelpers.d.ts +14 -11
- package/lib/components/helpers/attachmentHelpers.d.ts.map +1 -1
- package/lib/components/helpers/attachmentHelpers.js +52 -30
- package/lib/components/helpers/attachmentHelpers.js.map +1 -1
- package/lib/components/helpers/common-utils.d.ts +1 -1
- package/lib/components/helpers/common-utils.js.map +1 -1
- package/lib/components/helpers/data_page.d.ts.map +1 -1
- package/lib/components/helpers/data_page.js +0 -1
- package/lib/components/helpers/data_page.js.map +1 -1
- package/lib/components/helpers/formatters/CurrencyMap.d.ts.map +1 -1
- package/lib/components/helpers/formatters/CurrencyMap.js +0 -1
- package/lib/components/helpers/formatters/CurrencyMap.js.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.d.ts +15 -1
- package/lib/components/helpers/simpleTableHelpers.d.ts.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.js +110 -4
- package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
- package/lib/components/helpers/utils.d.ts +1 -0
- package/lib/components/helpers/utils.d.ts.map +1 -1
- package/lib/components/helpers/utils.js +7 -1
- package/lib/components/helpers/utils.js.map +1 -1
- package/lib/components/helpers/versionHelpers.d.ts.map +1 -1
- package/lib/components/helpers/versionHelpers.js +0 -1
- package/lib/components/helpers/versionHelpers.js.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.d.ts.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.js +12 -7
- package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
- package/lib/components/infra/Assignment/Assignment.js +0 -1
- package/lib/components/infra/Assignment/Assignment.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +13 -77
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.d.ts.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js +0 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +0 -2
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +3 -4
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
- package/lib/components/infra/Containers/container-helpers.d.ts +1 -0
- package/lib/components/infra/Containers/container-helpers.d.ts.map +1 -1
- package/lib/components/infra/Containers/container-helpers.js +46 -1
- package/lib/components/infra/Containers/container-helpers.js.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.js +0 -2
- package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.js +2 -3
- package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.js +1 -3
- package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js +0 -2
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.css +8 -8
- package/lib/components/infra/NavBar/NavBar.css +1 -1
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +2 -3
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/infra/Reference/Reference.d.ts.map +1 -1
- package/lib/components/infra/Reference/Reference.js +2 -3
- package/lib/components/infra/Reference/Reference.js.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js +0 -1
- package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
- package/lib/components/template/AdvancedSearch/AdvancedSearch.d.ts.map +1 -1
- package/lib/components/template/AdvancedSearch/AdvancedSearch.js +0 -1
- package/lib/components/template/AdvancedSearch/AdvancedSearch.js.map +1 -1
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.d.ts +0 -1
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.d.ts.map +1 -1
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.js +2 -8
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.js.map +1 -1
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.d.ts.map +1 -1
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.js +3 -5
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.js.map +1 -1
- package/lib/components/template/AdvancedSearch/SearchGroups/hooks.js +0 -1
- package/lib/components/template/AdvancedSearch/SearchGroups/hooks.js.map +1 -1
- package/lib/components/template/AppShell/AppShell.css +1 -1
- package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/template/AppShell/AppShell.js +4 -9
- package/lib/components/template/AppShell/AppShell.js.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.d.ts.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.js +0 -1
- package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +4 -5
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.js +0 -1
- package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/template/DataReference/DataReference.d.ts.map +1 -1
- package/lib/components/template/DataReference/DataReference.js +8 -12
- package/lib/components/template/DataReference/DataReference.js.map +1 -1
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.d.ts +1 -1
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.d.ts.map +1 -1
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.js.map +1 -1
- package/lib/components/template/DataReference/SearchForm.d.ts.map +1 -1
- package/lib/components/template/DataReference/SearchForm.js +3 -2
- package/lib/components/template/DataReference/SearchForm.js.map +1 -1
- package/lib/components/template/DataReference/utils.d.ts +4 -4
- package/lib/components/template/DataReference/utils.d.ts.map +1 -1
- package/lib/components/template/DataReference/utils.js +1 -1
- package/lib/components/template/DataReference/utils.js.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
- package/lib/components/template/DefaultPage/DefaultPage.d.ts +36 -0
- package/lib/components/template/DefaultPage/DefaultPage.d.ts.map +1 -0
- package/lib/components/template/DefaultPage/DefaultPage.js +19 -0
- package/lib/components/template/DefaultPage/DefaultPage.js.map +1 -0
- package/lib/components/template/DefaultPage/index.d.ts +2 -0
- package/lib/components/template/DefaultPage/index.d.ts.map +1 -0
- package/lib/components/template/DefaultPage/index.js +2 -0
- package/lib/components/template/DefaultPage/index.js.map +1 -0
- package/lib/components/template/Details/Details/Details.js +2 -3
- package/lib/components/template/Details/Details/Details.js.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +2 -3
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +2 -3
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +1 -2
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
- package/lib/components/template/InlineDashboard/InlineDashboard.d.ts.map +1 -1
- package/lib/components/template/InlineDashboard/InlineDashboard.js +2 -2
- package/lib/components/template/InlineDashboard/InlineDashboard.js.map +1 -1
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +2 -13
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/hooks.d.ts.map +1 -1
- package/lib/components/template/ListView/hooks.js +2 -5
- package/lib/components/template/ListView/hooks.js.map +1 -1
- package/lib/components/template/ListView/utils.js +0 -1
- package/lib/components/template/ListView/utils.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWide/NarrowWide.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +2 -3
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
- package/lib/components/template/OneColumn/OneColumn/OneColumn.js +2 -2
- package/lib/components/template/OneColumn/OneColumn/OneColumn.js.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.js +0 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
- package/lib/components/template/SelfServiceCaseView/SelfServiceCaseView.d.ts +2 -0
- package/lib/components/template/SelfServiceCaseView/SelfServiceCaseView.d.ts.map +1 -0
- package/lib/components/template/SelfServiceCaseView/SelfServiceCaseView.js +4 -0
- package/lib/components/template/SelfServiceCaseView/SelfServiceCaseView.js.map +1 -0
- package/lib/components/template/SelfServiceCaseView/index.d.ts +2 -0
- package/lib/components/template/SelfServiceCaseView/index.d.ts.map +1 -0
- package/lib/components/template/SelfServiceCaseView/index.js +2 -0
- package/lib/components/template/SelfServiceCaseView/index.js.map +1 -0
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +1 -2
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +32 -30
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js +1 -2
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.d.ts.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js +1 -2
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrow/WideNarrow.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +2 -3
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.css +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.js +2 -2
- package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.css +6 -8
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +52 -51
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js +1 -1
- package/lib/components/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.js.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.css +7 -6
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.d.ts.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +3 -4
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
- package/lib/components/widget/Followers/Followers.d.ts.map +1 -1
- package/lib/components/widget/Followers/Followers.js +0 -2
- package/lib/components/widget/Followers/Followers.js.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.js +0 -1
- package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.css +9 -11
- package/lib/components/widget/SummaryItem/SummaryItem.js +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/widget/ToDo/ToDo.css +1 -13
- package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
- package/lib/components/widget/ToDo/ToDo.js +11 -5
- package/lib/components/widget/ToDo/ToDo.js.map +1 -1
- package/lib/hooks/useGetTabsCount.d.ts.map +1 -1
- package/lib/hooks/useGetTabsCount.js +2 -3
- package/lib/hooks/useGetTabsCount.js.map +1 -1
- package/lib/sdk-pega-component-map.d.ts +10 -0
- package/lib/sdk-pega-component-map.d.ts.map +1 -1
- package/lib/sdk-pega-component-map.js +11 -0
- package/lib/sdk-pega-component-map.js.map +1 -1
- package/lib/theme.d.ts +23 -0
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +187 -2
- package/lib/theme.js.map +1 -1
- package/lib/types/PConnProps.d.ts +1 -1
- package/package.json +2 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/no-array-index-key */
|
|
3
2
|
import { useState, useEffect } from 'react';
|
|
4
3
|
import { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@mui/material';
|
|
5
4
|
import makeStyles from '@mui/styles/makeStyles';
|
|
@@ -10,12 +9,22 @@ const useStyles = makeStyles(() => ({
|
|
|
10
9
|
checkbox: {
|
|
11
10
|
display: 'flex',
|
|
12
11
|
flexDirection: 'column'
|
|
12
|
+
},
|
|
13
|
+
selectableCard: {
|
|
14
|
+
display: 'grid',
|
|
15
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, 40ch), 1fr))',
|
|
16
|
+
gridAutoRows: '1fr',
|
|
17
|
+
gap: '0.5rem'
|
|
13
18
|
}
|
|
14
19
|
}));
|
|
15
20
|
export default function CheckboxComponent(props) {
|
|
16
21
|
// Get emitted components from map (so we can get any override that may exist)
|
|
17
22
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
18
|
-
const
|
|
23
|
+
const SelectableCard = getComponentFromMap('SelectableCard');
|
|
24
|
+
const { getPConnect, label, caption, value, readOnly, testId, required, disabled, status, helperText, validatemessage, displayMode, hideLabel, trueLabel, falseLabel, selectionMode, datasource, selectionKey, selectionList, primaryField, referenceList, readonlyContextList: selectedvalues, variant, hideFieldLabels, additionalProps, imagePosition, imageSize, showImageDescription, renderMode, image } = props;
|
|
25
|
+
const readOnlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY' || readOnly;
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
|
+
const [theSelectedButton, setSelectedButton] = useState(value);
|
|
19
28
|
const classes = useStyles();
|
|
20
29
|
const helperTextToDisplay = validatemessage || helperText;
|
|
21
30
|
const thePConn = getPConnect();
|
|
@@ -27,11 +36,15 @@ export default function CheckboxComponent(props) {
|
|
|
27
36
|
setChecked(value);
|
|
28
37
|
}, [value]);
|
|
29
38
|
useEffect(() => {
|
|
30
|
-
if (referenceList?.length > 0) {
|
|
39
|
+
if (referenceList?.length > 0 && !readOnlyMode) {
|
|
31
40
|
thePConn.setReferenceList(selectionList);
|
|
32
41
|
updateNewInstuctions(thePConn, selectionList);
|
|
33
42
|
}
|
|
34
43
|
}, [thePConn]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
// This update theSelectedButton which will update the UI to show the selected button correctly
|
|
46
|
+
setSelectedButton(value);
|
|
47
|
+
}, [value]);
|
|
35
48
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
36
49
|
return _jsx(FieldValueList, { name: hideLabel ? '' : caption, value: value ? trueLabel : falseLabel });
|
|
37
50
|
}
|
|
@@ -44,6 +57,42 @@ export default function CheckboxComponent(props) {
|
|
|
44
57
|
const handleBlur = event => {
|
|
45
58
|
thePConn.getValidationApi().validate(event.target.checked);
|
|
46
59
|
};
|
|
60
|
+
const handleCheckboxChange = (event, item) => {
|
|
61
|
+
if (event.target.checked) {
|
|
62
|
+
insertInstruction(thePConn, selectionList, selectionKey, primaryField, item);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
deleteInstruction(thePConn, selectionList, selectionKey, item);
|
|
66
|
+
}
|
|
67
|
+
thePConn.clearErrorMessages({ property: selectionList });
|
|
68
|
+
};
|
|
69
|
+
const actions = thePConn.getActionsApi();
|
|
70
|
+
const commonProps = {
|
|
71
|
+
...additionalProps,
|
|
72
|
+
className: 'standard',
|
|
73
|
+
disabled,
|
|
74
|
+
readOnly,
|
|
75
|
+
onClick: actions.onClick
|
|
76
|
+
};
|
|
77
|
+
if (variant === 'card') {
|
|
78
|
+
return (_jsxs("div", { children: [_jsx("h4", { style: { marginTop: 0, marginBottom: 0 }, children: label }), _jsx("div", { className: classes.selectableCard, children: _jsx(SelectableCard, { ...commonProps, testId: testId, displayMode: displayMode, dataSource: datasource, getPConnect: getPConnect, readOnly: renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY' || readOnly, onChange: e => {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
const recordKey = selectionKey?.split('.').pop();
|
|
81
|
+
const selectedItem = datasource?.source?.find(item => item[recordKey] === e.target.id) ?? {};
|
|
82
|
+
handleCheckboxChange(e, {
|
|
83
|
+
id: selectedItem[recordKey],
|
|
84
|
+
primary: selectedItem[recordKey]
|
|
85
|
+
});
|
|
86
|
+
}, onBlur: () => {
|
|
87
|
+
thePConn.getValidationApi().validate(selectedvalues, selectionList);
|
|
88
|
+
}, hideFieldLabels: hideFieldLabels, recordKey: selectionKey?.split('.').pop(), cardLabel: primaryField.split('.').pop(), image: {
|
|
89
|
+
imagePosition,
|
|
90
|
+
imageSize,
|
|
91
|
+
showImageDescription,
|
|
92
|
+
imageField: image?.split('.').pop(),
|
|
93
|
+
imageDescription: (thePConn?.getRawMetadata()?.config).imageDescription?.split('.').pop()
|
|
94
|
+
}, readOnlyList: selectedvalues, type: 'checkbox', showNoValue: (renderMode === 'ReadOnly' || readOnly || displayMode === 'DISPLAY_ONLY') && selectedvalues.length === 0 }) })] }));
|
|
95
|
+
}
|
|
47
96
|
const handleChangeMultiMode = (event, element) => {
|
|
48
97
|
if (event.target.checked) {
|
|
49
98
|
insertInstruction(thePConn, selectionList, selectionKey, primaryField, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../src/components/field/Checkbox/Checkbox.tsx"],"names":[],"mappings":";AAAA,6CAA6C;AAC7C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBA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IAHf,KAAK,CAIV,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,WAAW,GAAG,cAAK,SAAS,EAAE,OAAO,CAAC,QAAQ,YAAG,gBAAgB,GAAO,CAAC;IAC3E,CAAC;SAAM,CAAC;QACN,WAAW,GAAG,CACZ,KAAC,gBAAgB,IACf,OAAO,EACL,KAAC,QAAQ,IACP,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAC9C,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,EAEJ,KAAK,EAAE,OAAO,EACd,cAAc,EAAC,KAAK,kBACN,MAAM,GACpB,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,WAAW,IAAC,OAAO,EAAC,UAAU,EAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,aAC1E,CAAC,SAAS,IAAI,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,YAAE,KAAK,GAAa,EAChE,KAAC,SAAS,cAAE,WAAW,GAAa,EACpC,KAAC,cAAc,cAAE,mBAAmB,GAAkB,IAC1C,CACf,CAAC;AACJ,CAAC","sourcesContent":["/* eslint-disable react/no-array-index-key */\nimport { useState, useEffect } from 'react';\nimport { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { insertInstruction, deleteInstruction, updateNewInstuctions } from '../../helpers/instructions-utils';\nimport type { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface CheckboxProps extends Omit<PConnFieldProps, 'value'> {\n // If any, enter additional props that only exist on Checkbox here\n value?: boolean;\n caption?: string;\n trueLabel?: string;\n falseLabel?: string;\n selectionMode?: string;\n datasource?: any;\n selectionKey?: string;\n selectionList?: any;\n primaryField: string;\n readonlyContextList: any;\n referenceList: string;\n}\n\nconst useStyles = makeStyles(() => ({\n checkbox: {\n display: 'flex',\n flexDirection: 'column'\n }\n}));\n\nexport default function CheckboxComponent(props: CheckboxProps) {\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 caption,\n value,\n readOnly,\n testId,\n required,\n disabled,\n status,\n helperText,\n validatemessage,\n displayMode,\n hideLabel,\n trueLabel,\n falseLabel,\n selectionMode,\n datasource,\n selectionKey,\n selectionList,\n primaryField,\n referenceList,\n readonlyContextList: selectedvalues\n } = props;\n const classes = useStyles();\n const helperTextToDisplay = validatemessage || helperText;\n const thePConn = getPConnect();\n const actionsApi = thePConn.getActionsApi();\n const propName = (thePConn.getStateProps() as any).value;\n\n const [checked, setChecked] = useState<any>(false);\n useEffect(() => {\n // This update theSelectedButton which will update the UI to show the selected button correctly\n setChecked(value);\n }, [value]);\n\n useEffect(() => {\n if (referenceList?.length > 0) {\n thePConn.setReferenceList(selectionList);\n updateNewInstuctions(thePConn, selectionList);\n }\n }, [thePConn]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} variant='stacked' />;\n }\n\n const handleChange = event => {\n handleEvent(actionsApi, 'changeNblur', propName, event.target.checked);\n };\n\n const handleBlur = event => {\n thePConn.getValidationApi().validate(event.target.checked);\n };\n\n const handleChangeMultiMode = (event, element) => {\n if (event.target.checked) {\n insertInstruction(thePConn, selectionList, selectionKey, primaryField, {\n id: element.key,\n primary: element.text ?? element.value\n });\n } else {\n deleteInstruction(thePConn, selectionList, selectionKey, {\n id: element.key,\n primary: element.text ?? element.value\n });\n }\n thePConn.clearErrorMessages({\n property: selectionList,\n category: '',\n context: ''\n });\n };\n\n let theCheckbox;\n const listOfCheckboxes: any = [];\n if (selectionMode === 'multi') {\n const listSourceItems = datasource?.source ?? [];\n const dataField: any = selectionKey?.split?.('.')[1];\n listSourceItems.forEach((element, index) => {\n listOfCheckboxes.push(\n <FormControlLabel\n control={\n <Checkbox\n key={index}\n checked={selectedvalues?.some?.(data => data[dataField] === element.key)}\n onChange={event => handleChangeMultiMode(event, element)}\n onBlur={() => {\n thePConn.getValidationApi().validate(selectedvalues, selectionList);\n }}\n data-testid={`${testId}:${element.value}`}\n />\n }\n key={index}\n label={element.text ?? element.value}\n labelPlacement='end'\n data-test-id={testId}\n />\n );\n });\n theCheckbox = <div className={classes.checkbox}>{listOfCheckboxes}</div>;\n } else {\n theCheckbox = (\n <FormControlLabel\n control={\n <Checkbox\n color='primary'\n checked={checked}\n onChange={!readOnly ? handleChange : undefined}\n onBlur={!readOnly ? handleBlur : undefined}\n value={value}\n disabled={disabled}\n readOnly={readOnly}\n />\n }\n label={caption}\n labelPlacement='end'\n data-test-id={testId}\n />\n );\n }\n\n return (\n <FormControl variant='standard' required={required} error={status === 'error'}>\n {!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}\n <FormGroup>{theCheckbox}</FormGroup>\n <FormHelperText>{helperTextToDisplay}</FormHelperText>\n </FormControl>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../src/components/field/Checkbox/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,UAA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,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,aAC1E,CAAC,SAAS,IAAI,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,YAAE,KAAK,GAAa,EAChE,KAAC,SAAS,cAAE,WAAW,GAAa,EACpC,KAAC,cAAc,cAAE,mBAAmB,GAAkB,IAC1C,CACf,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\nimport { Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { insertInstruction, deleteInstruction, updateNewInstuctions } from '../../helpers/instructions-utils';\nimport type { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface CheckboxProps extends Omit<PConnFieldProps, 'value'> {\n // If any, enter additional props that only exist on Checkbox here\n value?: boolean;\n caption?: string;\n trueLabel?: string;\n falseLabel?: string;\n selectionMode?: string;\n datasource?: any;\n selectionKey?: string;\n selectionList?: any;\n primaryField: string;\n readonlyContextList: any;\n referenceList: string;\n variant?: string;\n hideFieldLabels: boolean;\n additionalProps: any;\n imagePosition: string;\n imageSize: string;\n showImageDescription: string;\n renderMode: string;\n image: string;\n}\n\nconst useStyles = makeStyles(() => ({\n checkbox: {\n display: 'flex',\n flexDirection: 'column'\n },\n selectableCard: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fit, minmax(min(100%, 40ch), 1fr))',\n gridAutoRows: '1fr',\n gap: '0.5rem'\n }\n}));\n\nexport default function CheckboxComponent(props: CheckboxProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n const SelectableCard = getComponentFromMap('SelectableCard');\n\n const {\n getPConnect,\n label,\n caption,\n value,\n readOnly,\n testId,\n required,\n disabled,\n status,\n helperText,\n validatemessage,\n displayMode,\n hideLabel,\n trueLabel,\n falseLabel,\n selectionMode,\n datasource,\n selectionKey,\n selectionList,\n primaryField,\n referenceList,\n readonlyContextList: selectedvalues,\n variant,\n hideFieldLabels,\n additionalProps,\n imagePosition,\n imageSize,\n showImageDescription,\n renderMode,\n image\n } = props;\n const readOnlyMode = renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY' || readOnly;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [theSelectedButton, setSelectedButton] = useState(value);\n const classes = useStyles();\n const helperTextToDisplay = validatemessage || helperText;\n const thePConn = getPConnect();\n const actionsApi = thePConn.getActionsApi();\n const propName = (thePConn.getStateProps() as any).value;\n\n const [checked, setChecked] = useState<any>(false);\n useEffect(() => {\n // This update theSelectedButton which will update the UI to show the selected button correctly\n setChecked(value);\n }, [value]);\n\n useEffect(() => {\n if (referenceList?.length > 0 && !readOnlyMode) {\n thePConn.setReferenceList(selectionList);\n updateNewInstuctions(thePConn, selectionList);\n }\n }, [thePConn]);\n\n useEffect(() => {\n // This update theSelectedButton which will update the UI to show the selected button correctly\n setSelectedButton(value);\n }, [value]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : caption} value={value ? trueLabel : falseLabel} variant='stacked' />;\n }\n\n const handleChange = event => {\n handleEvent(actionsApi, 'changeNblur', propName, event.target.checked);\n };\n\n const handleBlur = event => {\n thePConn.getValidationApi().validate(event.target.checked);\n };\n\n const handleCheckboxChange = (event, item) => {\n if (event.target.checked) {\n insertInstruction(thePConn, selectionList, selectionKey, primaryField, item);\n } else {\n deleteInstruction(thePConn, selectionList, selectionKey, item);\n }\n thePConn.clearErrorMessages({ property: selectionList });\n };\n\n const actions = thePConn.getActionsApi();\n\n const commonProps = {\n ...additionalProps,\n className: 'standard',\n disabled,\n readOnly,\n onClick: (actions as any).onClick\n };\n\n if (variant === 'card') {\n return (\n <div>\n <h4 style={{ marginTop: 0, marginBottom: 0 }}>{label}</h4>\n <div className={classes.selectableCard}>\n <SelectableCard\n {...commonProps}\n testId={testId}\n displayMode={displayMode}\n dataSource={datasource}\n getPConnect={getPConnect}\n readOnly={renderMode === 'ReadOnly' || displayMode === 'DISPLAY_ONLY' || readOnly}\n onChange={e => {\n e.stopPropagation();\n const recordKey = selectionKey?.split('.').pop();\n const selectedItem = datasource?.source?.find(item => item[recordKey as any] === e.target.id) ?? {};\n handleCheckboxChange(e, {\n id: selectedItem[recordKey as any],\n primary: selectedItem[recordKey as any]\n });\n }}\n onBlur={() => {\n thePConn.getValidationApi().validate(selectedvalues, selectionList);\n }}\n hideFieldLabels={hideFieldLabels}\n recordKey={selectionKey?.split('.').pop()}\n cardLabel={primaryField.split('.').pop()}\n image={{\n imagePosition,\n imageSize,\n showImageDescription,\n imageField: image?.split('.').pop(),\n imageDescription: (thePConn?.getRawMetadata()?.config as any).imageDescription?.split('.').pop()\n }}\n readOnlyList={selectedvalues}\n type='checkbox'\n showNoValue={(renderMode === 'ReadOnly' || readOnly || displayMode === 'DISPLAY_ONLY') && selectedvalues.length === 0}\n />\n </div>\n </div>\n );\n }\n\n const handleChangeMultiMode = (event, element) => {\n if (event.target.checked) {\n insertInstruction(thePConn, selectionList, selectionKey, primaryField, {\n id: element.key,\n primary: element.text ?? element.value\n });\n } else {\n deleteInstruction(thePConn, selectionList, selectionKey, {\n id: element.key,\n primary: element.text ?? element.value\n });\n }\n thePConn.clearErrorMessages({\n property: selectionList,\n category: '',\n context: ''\n });\n };\n\n let theCheckbox;\n const listOfCheckboxes: any = [];\n if (selectionMode === 'multi') {\n const listSourceItems = datasource?.source ?? [];\n const dataField: any = selectionKey?.split?.('.')[1];\n listSourceItems.forEach((element, index) => {\n listOfCheckboxes.push(\n <FormControlLabel\n control={\n <Checkbox\n key={index}\n checked={selectedvalues?.some?.(data => data[dataField] === element.key)}\n onChange={event => handleChangeMultiMode(event, element)}\n onBlur={() => {\n thePConn.getValidationApi().validate(selectedvalues, selectionList);\n }}\n data-testid={`${testId}:${element.value}`}\n />\n }\n key={index}\n label={element.text ?? element.value}\n labelPlacement='end'\n data-test-id={testId}\n />\n );\n });\n theCheckbox = <div className={classes.checkbox}>{listOfCheckboxes}</div>;\n } else {\n theCheckbox = (\n <FormControlLabel\n control={\n <Checkbox\n color='primary'\n checked={checked}\n onChange={!readOnly ? handleChange : undefined}\n onBlur={!readOnly ? handleBlur : undefined}\n value={value}\n disabled={disabled}\n readOnly={readOnly}\n />\n }\n label={caption}\n labelPlacement='end'\n data-test-id={testId}\n />\n );\n }\n\n return (\n <FormControl variant='standard' required={required} error={status === 'error'}>\n {!hideLabel && <FormLabel component='legend'>{label}</FormLabel>}\n <FormGroup>{theCheckbox}</FormGroup>\n <FormHelperText>{helperTextToDisplay}</FormHelperText>\n </FormControl>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency-utils.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Currency/currency-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"currency-utils.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Currency/currency-utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM;;;;CAkCnD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM;;;;CA0BtD,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-named-default
|
|
2
1
|
import { default as CurrencyAlias } from '../../helpers/formatters/Currency';
|
|
3
|
-
// eslint-disable-next-line import/no-named-default
|
|
4
2
|
import { default as CurrencyMapAlias } from '../../helpers/formatters/CurrencyMap';
|
|
5
3
|
export const getCurrencyOptions = (inISOCode) => {
|
|
6
4
|
const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || PCore.getEnvironmentInfo().getLocale() || 'en-US';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency-utils.js","sourceRoot":"","sources":["../../../../src/components/field/Currency/currency-utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"currency-utils.js","sourceRoot":"","sources":["../../../../src/components/field/Currency/currency-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACtD,MAAM,cAAc,GAAG,KAAK,CAAC,kBAAkB,EAAE,CAAC,YAAY,EAAE,IAAI,KAAK,CAAC,kBAAkB,EAAE,CAAC,SAAS,EAAE,IAAI,OAAO,CAAC;IAEtH,IAAI,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;IACvC,IAAI,WAAW,GAAG,cAAc,CAAC;IAEjC,iEAAiE;IACjE,8BAA8B;IAC9B,+BAA+B;IAC/B,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YACxB,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;YACnC,WAAW,GAAG,OAAO,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,iFAAiF;YACjF,MAAM,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9C,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;SAAM,IAAI,cAAc,EAAE,CAAC;QAC1B,6EAA6E;QAC7E,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,oDAAoD;QACpD,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;IACrC,CAAC;IAED,gEAAgE;IAChE,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AACvE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACzD,MAAM,gBAAgB,GAAG;QACvB,iBAAiB,EAAE,GAAG;QACtB,mBAAmB,EAAE,GAAG;QACxB,sBAAsB,EAAE,GAAG;KAC5B,CAAC;IAEF,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEzD,MAAM,SAAS,GAAG,OAAO,CAAC;IAC1B,MAAM,eAAe,GAAG,aAAa,CAAC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAE9E,sDAAsD;IAEtD,4DAA4D;IAC5D,wCAAwC;IACxC,kCAAkC;IAClC,0CAA0C;IAE1C,gBAAgB,CAAC,iBAAiB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IACxD,gBAAgB,CAAC,sBAAsB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,mBAAmB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAE1D,sNAAsN;IAEtN,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["import { default as CurrencyAlias } from '../../helpers/formatters/Currency';\n\nimport { default as CurrencyMapAlias } from '../../helpers/formatters/CurrencyMap';\n\nexport const getCurrencyOptions = (inISOCode: string) => {\n const operatorLocale = PCore.getEnvironmentInfo().getUseLocale() || PCore.getEnvironmentInfo().getLocale() || 'en-US';\n\n let currMapToUse = CurrencyMapAlias.US;\n let localeToUse = operatorLocale;\n\n // Determine CurrencyMap lookup based on ISO code (if specified).\n // If no ISO code, use locale\n // If no locale, default to US\n if (inISOCode) {\n if (inISOCode === 'EUR') {\n currMapToUse = CurrencyMapAlias.NL;\n localeToUse = 'nl-NL';\n } else {\n // For all other ISO codes, use first 2 characters as the lookup from CurrencyMap\n const countryCode = inISOCode.substring(0, 2);\n currMapToUse = CurrencyMapAlias[countryCode];\n }\n } else if (operatorLocale) {\n // No ISO Code so check for operator locale (and force upper case for lookup)\n const countryCode = operatorLocale.substring(3).toUpperCase();\n currMapToUse = CurrencyMapAlias[countryCode];\n } else {\n // no ISO code and no operator locale, default to US\n currMapToUse = CurrencyMapAlias.US;\n }\n\n // If no currMapToUse at this point, default to US as a failsafe\n if (!currMapToUse) {\n currMapToUse = CurrencyMapAlias.US;\n }\n\n const theCode = currMapToUse.currencyCode.substring(0, 3);\n return { locale: localeToUse, style: 'currency', currency: theCode };\n};\n\nexport const getCurrencyCharacters = (inISOCode: string) => {\n const theCurrencyChars = {\n theCurrencySymbol: '$',\n theDecimalIndicator: '.',\n theDigitGroupSeparator: ','\n };\n\n const theCurrencyOptions = getCurrencyOptions(inISOCode);\n\n const testValue = 1234.56;\n const formattedString = CurrencyAlias.Currency(testValue, theCurrencyOptions);\n\n // console.log(`formattedString: ${formattedString}`);\n\n // Here, we have the formatted string (ex: $1,234.56) where:\n // Currency symbol = formattedString[0]\n // Separator = formattedString[2]\n // DecimalIndicator = formattedString[6];\n\n theCurrencyChars.theCurrencySymbol = formattedString[0];\n theCurrencyChars.theDigitGroupSeparator = formattedString[2];\n theCurrencyChars.theDecimalIndicator = formattedString[6];\n\n // console.log(`theCurrencyChars: symbol: ${theCurrencyChars.theCurrencySymbol} | theDigitGroupSeparator: ${theCurrencyChars.theDigitGroupSeparator} | theDecimalIndicator: ${theCurrencyChars.theDecimalIndicator}`);\n\n return theCurrencyChars;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAwCjE,UAAU,aAAc,SAAQ,eAAe;IAE7C,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAwCjE,UAAU,aAAc,SAAQ,eAAe;IAE7C,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,kDAiLpD"}
|
|
@@ -119,14 +119,10 @@ export default function Dropdown(props) {
|
|
|
119
119
|
let readOnlyProp = {};
|
|
120
120
|
const displayFn = (displayM, val) => {
|
|
121
121
|
if (displayM === 'DISPLAY_ONLY') {
|
|
122
|
-
return (_jsx(FieldValueList, { name: hideLabel ? '' : label,
|
|
123
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
124
|
-
value: thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)) }));
|
|
122
|
+
return (_jsx(FieldValueList, { name: hideLabel ? '' : label, value: thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)) }));
|
|
125
123
|
}
|
|
126
124
|
if (displayM === 'STACKED_LARGE_VAL') {
|
|
127
|
-
return (_jsx(FieldValueList, { name: hideLabel ? '' : label,
|
|
128
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
129
|
-
value: thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)), variant: 'stacked' }));
|
|
125
|
+
return (_jsx(FieldValueList, { name: hideLabel ? '' : label, value: thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)), variant: 'stacked' }));
|
|
130
126
|
}
|
|
131
127
|
return null;
|
|
132
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,WA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B,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,yBAAyB,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,IADpH,MAAM,CAAC,GAAG,CAEd,CACZ,CAAC,GACQ,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { TextField } from '@mui/material';\nimport MenuItem from '@mui/material/MenuItem';\nimport isDeepEqual from 'fast-deep-equal/react';\nimport Utils from '../../helpers/utils';\nimport { getDataPage } from '../../helpers/data_page';\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport type { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface IOption {\n key: string;\n value: string;\n}\n\nconst flattenParameters = (params = {}) => {\n const flatParams = {};\n Object.keys(params).forEach(key => {\n const { name, value: theVal } = params[key];\n flatParams[name] = theVal;\n });\n\n return flatParams;\n};\n\nconst preProcessColumns = columnList => {\n return columnList.map(col => {\n const tempColObj = { ...col };\n tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;\n return tempColObj;\n });\n};\n\nconst getDisplayFieldsMetaData = columnList => {\n const displayColumns = columnList.filter(col => col.display === 'true');\n const metaDataObj: any = { key: '', primary: '', secondary: [] };\n const keyCol = columnList.filter(col => col.key === 'true');\n metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';\n for (let index = 0; index < displayColumns.length; index += 1) {\n if (displayColumns[index].primary === 'true') {\n metaDataObj.primary = displayColumns[index].value;\n } else {\n metaDataObj.secondary.push(displayColumns[index].value);\n }\n }\n return metaDataObj;\n};\n\ninterface DropdownProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Dropdown here\n datasource?: any[];\n onRecordChange?: any;\n fieldMetadata?: any;\n listType: string;\n deferDatasource?: boolean;\n datasourceMetadata?: any;\n parameters?: any;\n columns: any[];\n}\n\nexport default function Dropdown(props: DropdownProps) {\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 helperText,\n displayMode,\n deferDatasource,\n datasourceMetadata,\n hideLabel,\n onRecordChange,\n fieldMetadata\n } = props;\n let { placeholder = '' } = props;\n const context = getPConnect().getContextName();\n let { listType, parameters, datasource = [], columns = [] } = props;\n placeholder = placeholder || 'Select...';\n const [options, setOptions] = useState<IOption[]>([]);\n const [theDatasource, setDatasource] = useState<any[] | null>(null);\n const helperTextToDisplay = validatemessage || helperText;\n\n const thePConn = getPConnect();\n const actionsApi = thePConn.getActionsApi();\n const propName = (thePConn.getStateProps() as any).value;\n const className = thePConn.getCaseInfo().getClassName();\n const refName = propName?.slice(propName.lastIndexOf('.') + 1);\n\n if (!isDeepEqual(datasource, theDatasource)) {\n // inbound datasource is different, so update theDatasource (to trigger useEffect)\n setDatasource(datasource);\n }\n\n // convert associated to datapage listtype and transform props\n // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList\n if (deferDatasource && datasourceMetadata?.datasource?.name) {\n listType = 'datapage';\n datasource = datasourceMetadata.datasource.name;\n const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;\n parameters = flattenParameters(dataSourceParameters);\n const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;\n const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;\n columns = [\n {\n key: 'true',\n setProperty: 'Associated property',\n value: valueProp\n },\n {\n display: 'true',\n primary: 'true',\n useForSearch: true,\n value: displayProp\n }\n ];\n }\n columns = preProcessColumns(columns);\n\n useEffect(() => {\n if (theDatasource) {\n const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly\n const optionsList = [...list];\n optionsList.unshift({\n key: placeholder,\n value: thePConn.getLocalizedValue(placeholder, '', '')\n }); // 2nd and 3rd args empty string until typedef marked correctly\n setOptions(optionsList);\n }\n }, [theDatasource]);\n\n useEffect(() => {\n if (listType !== 'associated' && typeof datasource === 'string') {\n getDataPage(datasource, parameters, context).then((results: any) => {\n const optionsData: any[] = [];\n const displayColumn = getDisplayFieldsMetaData(columns);\n results?.forEach(element => {\n const val = element[displayColumn.primary]?.toString();\n const obj = {\n key: element[displayColumn.key] || element.pyGUID,\n value: val\n };\n optionsData.push(obj);\n });\n setOptions(optionsData);\n });\n }\n }, []);\n\n const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;\n\n let displayName = metaData?.datasource?.propertyForDisplayText;\n displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);\n const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';\n const localeClass = localeContext === 'datapage' ? '@baseclass' : className;\n const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;\n const localePath = localeContext === 'datapage' ? displayName : localeName;\n\n let readOnlyProp = {};\n\n const displayFn = (displayM, val) => {\n if (displayM === 'DISPLAY_ONLY') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'\n value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n />\n );\n }\n\n if (displayM === 'STACKED_LARGE_VAL') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'\n value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n variant='stacked'\n />\n );\n }\n\n return null;\n };\n\n if (displayMode) {\n return displayFn(displayMode, options.find(option => option.key === value)?.value || value);\n }\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n const testProps: any = {\n 'data-test-id': testId\n };\n\n const handleChange = evt => {\n const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;\n handleEvent(actionsApi, 'changeNblur', propName, selectedValue);\n if (onRecordChange) {\n onRecordChange(evt);\n }\n };\n\n // Material UI shows a warning if the component is rendered before options are set.\n // So, hold off on rendering anything until options are available...\n return options.length === 0 ? null : (\n <TextField\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly\n size='small'\n required={required}\n disabled={disabled}\n onChange={!readOnly ? handleChange : undefined}\n error={status === 'error'}\n label={label}\n value={value === '' && !readOnly ? placeholder : value}\n select\n slotProps={{\n input: { ...readOnlyProp, ...testProps }\n }}\n >\n {options.map((option: any) => (\n <MenuItem key={option.key} value={option.key}>\n {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n </MenuItem>\n ))}\n </TextField>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAQhF,MAAM,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE,EAAE;IACxC,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,C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uItem';\nimport isDeepEqual from 'fast-deep-equal/react';\nimport Utils from '../../helpers/utils';\nimport { getDataPage } from '../../helpers/data_page';\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport type { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface IOption {\n key: string;\n value: string;\n}\n\nconst flattenParameters = (params = {}) => {\n const flatParams = {};\n Object.keys(params).forEach(key => {\n const { name, value: theVal } = params[key];\n flatParams[name] = theVal;\n });\n\n return flatParams;\n};\n\nconst preProcessColumns = columnList => {\n return columnList.map(col => {\n const tempColObj = { ...col };\n tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;\n return tempColObj;\n });\n};\n\nconst getDisplayFieldsMetaData = columnList => {\n const displayColumns = columnList.filter(col => col.display === 'true');\n const metaDataObj: any = { key: '', primary: '', secondary: [] };\n const keyCol = columnList.filter(col => col.key === 'true');\n metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';\n for (let index = 0; index < displayColumns.length; index += 1) {\n if (displayColumns[index].primary === 'true') {\n metaDataObj.primary = displayColumns[index].value;\n } else {\n metaDataObj.secondary.push(displayColumns[index].value);\n }\n }\n return metaDataObj;\n};\n\ninterface DropdownProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Dropdown here\n datasource?: any[];\n onRecordChange?: any;\n fieldMetadata?: any;\n listType: string;\n deferDatasource?: boolean;\n datasourceMetadata?: any;\n parameters?: any;\n columns: any[];\n}\n\nexport default function Dropdown(props: DropdownProps) {\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 helperText,\n displayMode,\n deferDatasource,\n datasourceMetadata,\n hideLabel,\n onRecordChange,\n fieldMetadata\n } = props;\n let { placeholder = '' } = props;\n const context = getPConnect().getContextName();\n let { listType, parameters, datasource = [], columns = [] } = props;\n placeholder = placeholder || 'Select...';\n const [options, setOptions] = useState<IOption[]>([]);\n const [theDatasource, setDatasource] = useState<any[] | null>(null);\n const helperTextToDisplay = validatemessage || helperText;\n\n const thePConn = getPConnect();\n const actionsApi = thePConn.getActionsApi();\n const propName = (thePConn.getStateProps() as any).value;\n const className = thePConn.getCaseInfo().getClassName();\n const refName = propName?.slice(propName.lastIndexOf('.') + 1);\n\n if (!isDeepEqual(datasource, theDatasource)) {\n // inbound datasource is different, so update theDatasource (to trigger useEffect)\n setDatasource(datasource);\n }\n\n // convert associated to datapage listtype and transform props\n // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList\n if (deferDatasource && datasourceMetadata?.datasource?.name) {\n listType = 'datapage';\n datasource = datasourceMetadata.datasource.name;\n const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;\n parameters = flattenParameters(dataSourceParameters);\n const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;\n const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;\n columns = [\n {\n key: 'true',\n setProperty: 'Associated property',\n value: valueProp\n },\n {\n display: 'true',\n primary: 'true',\n useForSearch: true,\n value: displayProp\n }\n ];\n }\n columns = preProcessColumns(columns);\n\n useEffect(() => {\n if (theDatasource) {\n const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly\n const optionsList = [...list];\n optionsList.unshift({\n key: placeholder,\n value: thePConn.getLocalizedValue(placeholder, '', '')\n }); // 2nd and 3rd args empty string until typedef marked correctly\n setOptions(optionsList);\n }\n }, [theDatasource]);\n\n useEffect(() => {\n if (listType !== 'associated' && typeof datasource === 'string') {\n getDataPage(datasource, parameters, context).then((results: any) => {\n const optionsData: any[] = [];\n const displayColumn = getDisplayFieldsMetaData(columns);\n results?.forEach(element => {\n const val = element[displayColumn.primary]?.toString();\n const obj = {\n key: element[displayColumn.key] || element.pyGUID,\n value: val\n };\n optionsData.push(obj);\n });\n setOptions(optionsData);\n });\n }\n }, []);\n\n const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;\n\n let displayName = metaData?.datasource?.propertyForDisplayText;\n displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);\n const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';\n const localeClass = localeContext === 'datapage' ? '@baseclass' : className;\n const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;\n const localePath = localeContext === 'datapage' ? displayName : localeName;\n\n let readOnlyProp = {};\n\n const displayFn = (displayM, val) => {\n if (displayM === 'DISPLAY_ONLY') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n />\n );\n }\n\n if (displayM === 'STACKED_LARGE_VAL') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n variant='stacked'\n />\n );\n }\n\n return null;\n };\n\n if (displayMode) {\n return displayFn(displayMode, options.find(option => option.key === value)?.value || value);\n }\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n const testProps: any = {\n 'data-test-id': testId\n };\n\n const handleChange = evt => {\n const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;\n handleEvent(actionsApi, 'changeNblur', propName, selectedValue);\n if (onRecordChange) {\n onRecordChange(evt);\n }\n };\n\n // Material UI shows a warning if the component is rendered before options are set.\n // So, hold off on rendering anything until options are available...\n return options.length === 0 ? null : (\n <TextField\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly\n size='small'\n required={required}\n disabled={disabled}\n onChange={!readOnly ? handleChange : undefined}\n error={status === 'error'}\n label={label}\n value={value === '' && !readOnly ? placeholder : value}\n select\n slotProps={{\n input: { ...readOnlyProp, ...testProps }\n }}\n >\n {options.map((option: any) => (\n <MenuItem key={option.key} value={option.key}>\n {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n </MenuItem>\n ))}\n </TextField>\n );\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import Grid2 from '@mui/material/Grid2';
|
|
4
4
|
import FieldGroup from '../../designSystemExtension/FieldGroup';
|
|
5
5
|
export default function Group(props) {
|
|
6
6
|
const { children, heading, showHeading, instructions, collapsible, displayMode, type } = props;
|
|
7
7
|
const isReadOnly = displayMode === 'DISPLAY_ONLY';
|
|
8
8
|
const content = useMemo(() => {
|
|
9
|
-
return (_jsx(
|
|
9
|
+
return (_jsx(Grid2, { container: true, spacing: 2, children: children?.map(child => (_jsx(Grid2, { size: { xs: 12 }, children: child }, child.key))) }));
|
|
10
10
|
}, [children, type, isReadOnly]);
|
|
11
11
|
if (!children)
|
|
12
12
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../src/components/field/Group/Group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,OAAO,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../src/components/field/Group/Group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,OAAO,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,UAAU,MAAM,wCAAwC,CAAC;AAYhE,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAiB;IAC7C,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAE/F,MAAM,UAAU,GAAG,WAAW,KAAK,cAAc,CAAC;IAElD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,OAAO,CACL,KAAC,KAAK,IAAC,SAAS,QAAC,OAAO,EAAE,CAAC,YACxB,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACtB,KAAC,KAAK,IAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,YACpB,KAAK,IADsB,KAAK,CAAC,GAAG,CAE/B,CACT,CAAC,GACI,CACT,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,OAAO,CACL,KAAC,UAAU,IAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,YACtG,OAAO,GACG,CACd,CAAC;AACJ,CAAC","sourcesContent":["import { type ReactElement, useMemo } from 'react';\nimport Grid2 from '@mui/material/Grid2';\nimport FieldGroup from '../../designSystemExtension/FieldGroup';\nimport type { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface GroupProps extends PConnFieldProps {\n children: ReactElement[];\n heading: string;\n showHeading: boolean;\n instructions?: string;\n collapsible: boolean;\n type: string;\n}\n\nexport default function Group(props: GroupProps) {\n const { children, heading, showHeading, instructions, collapsible, displayMode, type } = props;\n\n const isReadOnly = displayMode === 'DISPLAY_ONLY';\n\n const content = useMemo(() => {\n return (\n <Grid2 container spacing={2}>\n {children?.map(child => (\n <Grid2 size={{ xs: 12 }} key={child.key}>\n {child}\n </Grid2>\n ))}\n </Grid2>\n );\n }, [children, type, isReadOnly]);\n\n if (!children) return null;\n\n return (\n <FieldGroup name={showHeading ? heading : undefined} collapsible={collapsible} instructions={instructions}>\n {content}\n </FieldGroup>\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PConnFieldProps } from '../../../types/PConnProps';
|
|
2
|
+
interface LocationProps extends PConnFieldProps {
|
|
3
|
+
coordinates?: string;
|
|
4
|
+
onlyCoordinates?: boolean;
|
|
5
|
+
showMap?: boolean;
|
|
6
|
+
showMapReadOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function Location(props: LocationProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=Location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Location.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Location/Location.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,UAAU,aAAc,SAAQ,eAAe;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA0BD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAsNpD"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useCallback, useRef } from 'react';
|
|
3
|
+
import { Box, TextField, Alert } from '@mui/material';
|
|
4
|
+
import AddLocationAltIcon from '@mui/icons-material/AddLocationAlt';
|
|
5
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
6
|
+
import IconButton from '@mui/material/IconButton';
|
|
7
|
+
import { GoogleMap, Marker, useLoadScript } from '@react-google-maps/api';
|
|
8
|
+
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
|
|
9
|
+
import handleEvent from '../../helpers/event-utils';
|
|
10
|
+
const mapContainerStyle = {
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '300px',
|
|
13
|
+
marginTop: '0px'
|
|
14
|
+
};
|
|
15
|
+
const defaultCenter = {
|
|
16
|
+
lat: 18.5204,
|
|
17
|
+
lng: 73.8567
|
|
18
|
+
};
|
|
19
|
+
const disabledMapOptions = {
|
|
20
|
+
gestureHandling: 'none',
|
|
21
|
+
keyboardShortcuts: false,
|
|
22
|
+
disableDefaultUI: true,
|
|
23
|
+
clickableIcons: false,
|
|
24
|
+
zoomControl: false,
|
|
25
|
+
mapTypeControl: false,
|
|
26
|
+
scaleControl: false,
|
|
27
|
+
streetViewControl: false,
|
|
28
|
+
rotateControl: false,
|
|
29
|
+
fullscreenControl: false
|
|
30
|
+
};
|
|
31
|
+
export default function Location(props) {
|
|
32
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
33
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
34
|
+
const { getPConnect, label, required = false, disabled = false, value = '', validatemessage, status, readOnly = false, testId, displayMode, hideLabel = false, placeholder, helperText, coordinates = '', onlyCoordinates = false, showMap, showMapReadOnly } = props;
|
|
35
|
+
const pConn = getPConnect();
|
|
36
|
+
const actions = pConn.getActionsApi();
|
|
37
|
+
const propName = pConn.getStateProps().value;
|
|
38
|
+
const coordPropName = pConn.getStateProps().coordinates;
|
|
39
|
+
const [inputValue, setInputValue] = useState(value ?? '');
|
|
40
|
+
const [mapCenter, setMapCenter] = useState(defaultCenter);
|
|
41
|
+
const [markerPosition, setMarkerPosition] = useState(null);
|
|
42
|
+
const inputRef = useRef(null);
|
|
43
|
+
const autocompleteRef = useRef(null);
|
|
44
|
+
const { isLoaded } = useLoadScript({
|
|
45
|
+
googleMapsApiKey: pConn.getGoogleMapsAPIKey?.() || '',
|
|
46
|
+
libraries: ['places', 'geocoding']
|
|
47
|
+
});
|
|
48
|
+
const hasError = status === 'error' && !!validatemessage && !disabled;
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (onlyCoordinates && coordinates) {
|
|
51
|
+
setInputValue(coordinates);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
setInputValue(value ?? '');
|
|
55
|
+
}
|
|
56
|
+
if (coordinates) {
|
|
57
|
+
const [lat, lng] = coordinates.split(',').map(parseFloat);
|
|
58
|
+
if (!isNaN(lat) && !isNaN(lng)) {
|
|
59
|
+
setMapCenter({ lat, lng });
|
|
60
|
+
setMarkerPosition({ lat, lng });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [value, coordinates, onlyCoordinates]);
|
|
64
|
+
const handleChange = useCallback((event) => {
|
|
65
|
+
const newValue = event.target.value ?? '';
|
|
66
|
+
setInputValue(newValue);
|
|
67
|
+
handleEvent(actions, 'changeNblur', propName, newValue);
|
|
68
|
+
if (newValue === '' && coordPropName) {
|
|
69
|
+
actions.updateFieldValue(coordPropName, '');
|
|
70
|
+
setMarkerPosition(null);
|
|
71
|
+
}
|
|
72
|
+
}, [actions, propName, coordPropName]);
|
|
73
|
+
const handlePlaceChanged = useCallback(() => {
|
|
74
|
+
if (autocompleteRef.current) {
|
|
75
|
+
const place = autocompleteRef.current.getPlace();
|
|
76
|
+
if (place.geometry?.location) {
|
|
77
|
+
const lat = place.geometry.location.lat();
|
|
78
|
+
const lng = place.geometry.location.lng();
|
|
79
|
+
const address = place.formatted_address || place.name || '';
|
|
80
|
+
const coordinateString = `${lat}, ${lng}`;
|
|
81
|
+
setMapCenter({ lat, lng });
|
|
82
|
+
setMarkerPosition({ lat, lng });
|
|
83
|
+
if (onlyCoordinates) {
|
|
84
|
+
setInputValue(coordinateString);
|
|
85
|
+
handleEvent(actions, 'changeNblur', propName, coordinateString);
|
|
86
|
+
if (coordPropName) {
|
|
87
|
+
actions.updateFieldValue(coordPropName, coordinateString);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
setInputValue(address);
|
|
92
|
+
handleEvent(actions, 'changeNblur', propName, address);
|
|
93
|
+
if (coordPropName) {
|
|
94
|
+
actions.updateFieldValue(coordPropName, coordinateString);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, [actions, propName, coordPropName, onlyCoordinates]);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (isLoaded && inputRef.current && !autocompleteRef.current) {
|
|
102
|
+
autocompleteRef.current = new google.maps.places.Autocomplete(inputRef.current);
|
|
103
|
+
autocompleteRef.current.addListener('place_changed', handlePlaceChanged);
|
|
104
|
+
}
|
|
105
|
+
}, [isLoaded, handlePlaceChanged]);
|
|
106
|
+
const handleGetCurrentLocation = useCallback(() => {
|
|
107
|
+
if (navigator.geolocation) {
|
|
108
|
+
navigator.geolocation.getCurrentPosition(position => {
|
|
109
|
+
const lat = position.coords.latitude;
|
|
110
|
+
const lng = position.coords.longitude;
|
|
111
|
+
const coordinateString = `${lat}, ${lng}`;
|
|
112
|
+
setMapCenter({ lat, lng });
|
|
113
|
+
setMarkerPosition({ lat, lng });
|
|
114
|
+
if (onlyCoordinates) {
|
|
115
|
+
setInputValue(coordinateString);
|
|
116
|
+
handleEvent(actions, 'changeNblur', propName, coordinateString);
|
|
117
|
+
if (coordPropName) {
|
|
118
|
+
actions.updateFieldValue(coordPropName, coordinateString);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
const geocoder = new window.google.maps.Geocoder();
|
|
123
|
+
geocoder.geocode({ location: { lat, lng } }, (results, responseStatus) => {
|
|
124
|
+
if (responseStatus === 'OK' && results && results[0]) {
|
|
125
|
+
const address = results[0].formatted_address;
|
|
126
|
+
setInputValue(address);
|
|
127
|
+
handleEvent(actions, 'changeNblur', propName, address);
|
|
128
|
+
if (coordPropName) {
|
|
129
|
+
actions.updateFieldValue(coordPropName, coordinateString);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, error => {
|
|
135
|
+
console.error('Error getting current location: ', error);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}, [actions, propName, coordPropName, onlyCoordinates]);
|
|
139
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
140
|
+
return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: value });
|
|
141
|
+
}
|
|
142
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
143
|
+
return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: value, variant: 'stacked' });
|
|
144
|
+
}
|
|
145
|
+
const map = (_jsx("div", { style: { opacity: disabled ? 0.7 : 1 }, children: _jsx(Box, { mt: 1, style: { flex: 1 }, children: _jsx(GoogleMap, { mapContainerStyle: mapContainerStyle, center: mapCenter, zoom: 14, options: disabled ? disabledMapOptions : undefined, children: markerPosition && _jsx(Marker, { position: markerPosition }) }) }) }));
|
|
146
|
+
if (readOnly) {
|
|
147
|
+
return (_jsxs("div", { children: [_jsx(TextInput, { ...props }), isLoaded && showMapReadOnly && map] }));
|
|
148
|
+
}
|
|
149
|
+
const testProps = { 'data-test-id': testId };
|
|
150
|
+
return (_jsxs("div", { children: [hasError && (_jsx(Alert, { severity: 'error', sx: { mb: 1 }, children: validatemessage })), isLoaded && (_jsx(TextField, { fullWidth: true, label: hideLabel ? '' : label, required: required, disabled: disabled, error: hasError, placeholder: placeholder ?? 'Search location', helperText: helperText, value: inputValue, onChange: handleChange, inputRef: inputRef, slotProps: {
|
|
151
|
+
input: {
|
|
152
|
+
endAdornment: (_jsx(InputAdornment, { position: 'end', children: _jsx(IconButton, { onClick: handleGetCurrentLocation, disabled: disabled, edge: 'end', children: _jsx(AddLocationAltIcon, {}) }) })),
|
|
153
|
+
inputProps: { ...testProps }
|
|
154
|
+
}
|
|
155
|
+
} })), isLoaded && showMap && map] }));
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=Location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Location.js","sourceRoot":"","sources":["../../../../src/components/field/Location/Location.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,WAAW,MAAM,2BAA2B,CAAC;AASpD,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO;IACf,SAAS,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,eAAe,EAAE,MAAM;IACvB,iBAAiB,EAAE,KAAK;IACxB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,KAAK;IAClB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,KAAK;IACnB,iBAAiB,EAAE,KAAK;IACxB,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE,KAAK;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoB;IACnD,MAAM,SAAS,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE7D,MAAM,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,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ACE,CAClB;wBACD,UAAU,EAAE,EAAE,GAAG,SAAS,EAAE;qBAC7B;iBACF,GACD,CACH,EAEA,QAAQ,IAAI,OAAO,IAAI,GAAG,IACvB,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState, useCallback, useRef } from 'react';\nimport { Box, TextField, Alert } from '@mui/material';\nimport AddLocationAltIcon from '@mui/icons-material/AddLocationAlt';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport IconButton from '@mui/material/IconButton';\nimport { GoogleMap, Marker, useLoadScript } from '@react-google-maps/api';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport type { PConnFieldProps } from '../../../types/PConnProps';\nimport handleEvent from '../../helpers/event-utils';\n\ninterface LocationProps extends PConnFieldProps {\n coordinates?: string;\n onlyCoordinates?: boolean;\n showMap?: boolean;\n showMapReadOnly?: boolean;\n}\n\nconst mapContainerStyle = {\n width: '100%',\n height: '300px',\n marginTop: '0px'\n};\n\nconst defaultCenter = {\n lat: 18.5204,\n lng: 73.8567\n};\n\nconst disabledMapOptions = {\n gestureHandling: 'none',\n keyboardShortcuts: false,\n disableDefaultUI: true,\n clickableIcons: false,\n zoomControl: false,\n mapTypeControl: false,\n scaleControl: false,\n streetViewControl: false,\n rotateControl: false,\n fullscreenControl: false\n};\n\nexport default function Location(props: LocationProps) {\n const TextInput = getComponentFromMap('TextInput');\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required = false,\n disabled = false,\n value = '',\n validatemessage,\n status,\n readOnly = false,\n testId,\n displayMode,\n hideLabel = false,\n placeholder,\n helperText,\n coordinates = '',\n onlyCoordinates = false,\n showMap,\n showMapReadOnly\n } = props;\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n const coordPropName = (pConn.getStateProps() as any).coordinates;\n\n const [inputValue, setInputValue] = useState<string>(value ?? '');\n const [mapCenter, setMapCenter] = useState(defaultCenter);\n const [markerPosition, setMarkerPosition] = useState<google.maps.LatLngLiteral | null>(null);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const autocompleteRef = useRef<google.maps.places.Autocomplete | null>(null);\n\n const { isLoaded } = useLoadScript({\n googleMapsApiKey: pConn.getGoogleMapsAPIKey?.() || '',\n libraries: ['places', 'geocoding']\n });\n\n const hasError = status === 'error' && !!validatemessage && !disabled;\n\n useEffect(() => {\n if (onlyCoordinates && coordinates) {\n setInputValue(coordinates);\n } else {\n setInputValue(value ?? '');\n }\n if (coordinates) {\n const [lat, lng] = coordinates.split(',').map(parseFloat);\n\n if (!isNaN(lat) && !isNaN(lng)) {\n setMapCenter({ lat, lng });\n setMarkerPosition({ lat, lng });\n }\n }\n }, [value, coordinates, onlyCoordinates]);\n\n const handleChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value ?? '';\n setInputValue(newValue);\n handleEvent(actions, 'changeNblur', propName, newValue);\n\n if (newValue === '' && coordPropName) {\n actions.updateFieldValue(coordPropName, '');\n setMarkerPosition(null);\n }\n },\n [actions, propName, coordPropName]\n );\n\n const handlePlaceChanged = useCallback(() => {\n if (autocompleteRef.current) {\n const place = autocompleteRef.current.getPlace();\n if (place.geometry?.location) {\n const lat = place.geometry.location.lat();\n const lng = place.geometry.location.lng();\n const address = place.formatted_address || place.name || '';\n const coordinateString = `${lat}, ${lng}`;\n\n setMapCenter({ lat, lng });\n setMarkerPosition({ lat, lng });\n\n if (onlyCoordinates) {\n setInputValue(coordinateString);\n handleEvent(actions, 'changeNblur', propName, coordinateString);\n if (coordPropName) {\n actions.updateFieldValue(coordPropName, coordinateString);\n }\n } else {\n setInputValue(address);\n handleEvent(actions, 'changeNblur', propName, address);\n if (coordPropName) {\n actions.updateFieldValue(coordPropName, coordinateString);\n }\n }\n }\n }\n }, [actions, propName, coordPropName, onlyCoordinates]);\n\n useEffect(() => {\n if (isLoaded && inputRef.current && !autocompleteRef.current) {\n autocompleteRef.current = new google.maps.places.Autocomplete(inputRef.current);\n autocompleteRef.current.addListener('place_changed', handlePlaceChanged);\n }\n }, [isLoaded, handlePlaceChanged]);\n\n const handleGetCurrentLocation = useCallback(() => {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n position => {\n const lat = position.coords.latitude;\n const lng = position.coords.longitude;\n const coordinateString = `${lat}, ${lng}`;\n\n setMapCenter({ lat, lng });\n setMarkerPosition({ lat, lng });\n\n if (onlyCoordinates) {\n setInputValue(coordinateString);\n handleEvent(actions, 'changeNblur', propName, coordinateString);\n if (coordPropName) {\n actions.updateFieldValue(coordPropName, coordinateString);\n }\n } else {\n const geocoder = new window.google.maps.Geocoder();\n geocoder.geocode({ location: { lat, lng } }, (results, responseStatus) => {\n if (responseStatus === 'OK' && results && results[0]) {\n const address = results[0].formatted_address;\n setInputValue(address);\n handleEvent(actions, 'changeNblur', propName, address);\n if (coordPropName) {\n actions.updateFieldValue(coordPropName, coordinateString);\n }\n }\n });\n }\n },\n error => {\n console.error('Error getting current location: ', error);\n }\n );\n }\n }, [actions, propName, coordPropName, onlyCoordinates]);\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 const map = (\n <div style={{ opacity: disabled ? 0.7 : 1 }}>\n <Box mt={1} style={{ flex: 1 }}>\n <GoogleMap mapContainerStyle={mapContainerStyle} center={mapCenter} zoom={14} options={disabled ? disabledMapOptions : undefined}>\n {markerPosition && <Marker position={markerPosition} />}\n </GoogleMap>\n </Box>\n </div>\n );\n\n if (readOnly) {\n return (\n <div>\n <TextInput {...props} />\n {isLoaded && showMapReadOnly && map}\n </div>\n );\n }\n\n const testProps: any = { 'data-test-id': testId };\n\n return (\n <div>\n {hasError && (\n <Alert severity='error' sx={{ mb: 1 }}>\n {validatemessage}\n </Alert>\n )}\n\n {isLoaded && (\n <TextField\n fullWidth\n label={hideLabel ? '' : label}\n required={required}\n disabled={disabled}\n error={hasError}\n placeholder={placeholder ?? 'Search location'}\n helperText={helperText}\n value={inputValue}\n onChange={handleChange}\n inputRef={inputRef}\n slotProps={{\n input: {\n endAdornment: (\n <InputAdornment position='end'>\n <IconButton onClick={handleGetCurrentLocation} disabled={disabled} edge='end'>\n <AddLocationAltIcon />\n </IconButton>\n </InputAdornment>\n ),\n inputProps: { ...testProps }\n }\n }}\n />\n )}\n\n {isLoaded && showMap && map}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Location/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/field/Location/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default } from './Location';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PConnFieldProps } from '../../../types/PConnProps';
|
|
2
|
+
interface ObjectReferenceProps extends Omit<PConnFieldProps, 'value'> {
|
|
3
|
+
getPConnect: any;
|
|
4
|
+
displayMode: any;
|
|
5
|
+
allowAndPersistChangesInReviewMode: any;
|
|
6
|
+
targetObjectType: any;
|
|
7
|
+
mode: string;
|
|
8
|
+
parameters: object;
|
|
9
|
+
hideLabel: boolean;
|
|
10
|
+
inline: boolean;
|
|
11
|
+
showPromotedFilters: boolean;
|
|
12
|
+
additionalFields: any;
|
|
13
|
+
}
|
|
14
|
+
export default function ObjectReference(props: ObjectReferenceProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=ObjectReference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectReference.d.ts","sourceRoot":"","sources":["../../../../src/components/field/ObjectReference/ObjectReference.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,UAAU,oBAAqB,SAAQ,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC;IAEnE,WAAW,EAAE,GAAG,CAAC;IACjB,WAAW,MAAC;IACZ,kCAAkC,EAAE,GAAG,CAAC;IACxC,gBAAgB,EAAE,GAAG,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAoNlE"}
|