@pega/react-sdk-components 0.24.4 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bridge/react_pconnect.d.ts.map +1 -1
- package/lib/bridge/react_pconnect.js +2 -1
- package/lib/bridge/react_pconnect.js.map +1 -1
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js +1 -1
- package/lib/components/designSystemExtension/AlertBanner/AlertBanner.js.map +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.js +1 -1
- package/lib/components/designSystemExtension/Banner/Banner.js.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +11 -11
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js +4 -4
- package/lib/components/designSystemExtension/DetailsFields/DetailsFields.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +4 -4
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js +4 -4
- package/lib/components/designSystemExtension/FieldGroupList/FieldGroupList.js.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +6 -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 +6 -6
- package/lib/components/designSystemExtension/Operator/Operator.js.map +1 -1
- package/lib/components/designSystemExtension/Pulse/Pulse.js +2 -2
- package/lib/components/designSystemExtension/Pulse/Pulse.js.map +1 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js +3 -2
- package/lib/components/designSystemExtension/RichTextEditor/RichTextEditor.js.map +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js +1 -1
- package/lib/components/designSystemExtension/WssQuickCreate/WssQuickCreate.js.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.js +4 -4
- package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.js +3 -6
- package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.js +4 -4
- package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/field/Currency/Currency.d.ts.map +1 -1
- package/lib/components/field/Currency/Currency.js +9 -8
- package/lib/components/field/Currency/Currency.js.map +1 -1
- package/lib/components/field/Date/Date.d.ts.map +1 -1
- package/lib/components/field/Date/Date.js +21 -9
- package/lib/components/field/Date/Date.js.map +1 -1
- package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
- package/lib/components/field/DateTime/DateTime.js +38 -9
- package/lib/components/field/DateTime/DateTime.js.map +1 -1
- package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
- package/lib/components/field/Decimal/Decimal.js +8 -5
- package/lib/components/field/Decimal/Decimal.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +18 -12
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Email/Email.d.ts.map +1 -1
- package/lib/components/field/Email/Email.js +21 -5
- package/lib/components/field/Email/Email.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/Integer/Integer.d.ts.map +1 -1
- package/lib/components/field/Integer/Integer.js +17 -6
- package/lib/components/field/Integer/Integer.js.map +1 -1
- package/lib/components/field/Multiselect/Multiselect.d.ts.map +1 -1
- package/lib/components/field/Multiselect/Multiselect.js +12 -8
- package/lib/components/field/Multiselect/Multiselect.js.map +1 -1
- package/lib/components/field/Multiselect/utils.js +1 -1
- package/lib/components/field/Multiselect/utils.js.map +1 -1
- package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
- package/lib/components/field/Percentage/Percentage.js +7 -4
- package/lib/components/field/Percentage/Percentage.js.map +1 -1
- package/lib/components/field/Phone/Phone.d.ts.map +1 -1
- package/lib/components/field/Phone/Phone.js +4 -4
- package/lib/components/field/Phone/Phone.js.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +6 -12
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/RichText/RichText.js +1 -1
- package/lib/components/field/RichText/RichText.js.map +1 -1
- package/lib/components/field/ScalarList/ScalarList.d.ts.map +1 -1
- package/lib/components/field/ScalarList/ScalarList.js +5 -5
- package/lib/components/field/ScalarList/ScalarList.js.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.js +4 -4
- package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
- package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/field/TextArea/TextArea.js +20 -4
- package/lib/components/field/TextArea/TextArea.js.map +1 -1
- package/lib/components/field/TextContent/TextContent.js +1 -1
- package/lib/components/field/TextContent/TextContent.js.map +1 -1
- package/lib/components/field/TextInput/TextInput.js +2 -2
- package/lib/components/field/TextInput/TextInput.js.map +1 -1
- package/lib/components/field/Time/Time.d.ts.map +1 -1
- package/lib/components/field/Time/Time.js +31 -8
- package/lib/components/field/Time/Time.js.map +1 -1
- package/lib/components/field/URL/URL.d.ts.map +1 -1
- package/lib/components/field/URL/URL.js +19 -4
- package/lib/components/field/URL/URL.js.map +1 -1
- package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
- package/lib/components/field/UserReference/UserReference.js +3 -5
- package/lib/components/field/UserReference/UserReference.js.map +1 -1
- package/lib/components/helpers/common-utils.d.ts +7 -0
- package/lib/components/helpers/common-utils.d.ts.map +1 -1
- package/lib/components/helpers/common-utils.js +21 -1
- package/lib/components/helpers/common-utils.js.map +1 -1
- package/lib/components/helpers/field-group-utils.js +2 -2
- package/lib/components/helpers/field-group-utils.js.map +1 -1
- package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
- package/lib/components/helpers/formatters/Currency.js +12 -15
- package/lib/components/helpers/formatters/Currency.js.map +1 -1
- package/lib/components/helpers/formatters/common.d.ts +2 -2
- package/lib/components/helpers/formatters/common.d.ts.map +1 -1
- package/lib/components/helpers/formatters/common.js +2 -1
- package/lib/components/helpers/formatters/common.js.map +1 -1
- package/lib/components/helpers/formatters/index.d.ts.map +1 -1
- package/lib/components/helpers/formatters/index.js +2 -3
- package/lib/components/helpers/formatters/index.js.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.d.ts +1 -1
- package/lib/components/helpers/simpleTableHelpers.js +1 -1
- package/lib/components/helpers/simpleTableHelpers.js.map +1 -1
- package/lib/components/infra/ActionButtons/ActionButtons.js +3 -3
- package/lib/components/infra/ActionButtons/ActionButtons.js.map +1 -1
- package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
- package/lib/components/infra/Assignment/Assignment.js +11 -13
- 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 +12 -22
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.js +1 -5
- package/lib/components/infra/Containers/FlowContainer/helpers.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 +9 -4
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js +7 -7
- package/lib/components/infra/Containers/ModalViewContainer/ModalViewContainer.js.map +1 -1
- package/lib/components/infra/Containers/SimpleView/helper.js +1 -1
- package/lib/components/infra/Containers/SimpleView/helper.js.map +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js +1 -1
- package/lib/components/infra/Containers/ViewContainer/ViewContainer.js.map +1 -1
- package/lib/components/infra/Containers/container-helpers.d.ts +2 -0
- package/lib/components/infra/Containers/container-helpers.d.ts.map +1 -0
- package/lib/components/infra/Containers/{helpers.js → container-helpers.js} +1 -1
- package/lib/components/infra/Containers/container-helpers.js.map +1 -0
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.js +4 -6
- 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 +3 -5
- package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts +1 -0
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.js +7 -8
- package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.d.ts +1 -1
- package/lib/components/infra/MultiStep/MultiStep.d.ts.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.js +12 -11
- package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/infra/NavBar/NavBar.css +1 -0
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +24 -16
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js +5 -6
- package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
- package/lib/components/infra/Stages/Stages.js +4 -4
- package/lib/components/infra/Stages/Stages.js.map +1 -1
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.d.ts.map +1 -1
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js +4 -3
- package/lib/components/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.js.map +1 -1
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js +2 -2
- package/lib/components/infra/VerticalTabs/VerticalTabs/VerticalTabs.js.map +1 -1
- package/lib/components/infra/View/View.d.ts +1 -0
- package/lib/components/infra/View/View.d.ts.map +1 -1
- package/lib/components/infra/View/View.js +32 -2
- package/lib/components/infra/View/View.js.map +1 -1
- package/lib/components/template/AdvancedSearch/AdvancedSearch.d.ts +2 -0
- package/lib/components/template/AdvancedSearch/AdvancedSearch.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/AdvancedSearch.js +69 -0
- package/lib/components/template/AdvancedSearch/AdvancedSearch.js.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.d.ts +24 -0
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.js +32 -0
- package/lib/components/template/AdvancedSearch/SearchGroup/persistUtils.js.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.d.ts +3 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.js +181 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/SearchGroups.js.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/hooks.d.ts +10 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/hooks.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/hooks.js +26 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/hooks.js.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/index.d.ts +2 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/index.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/index.js +2 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/index.js.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/utils.d.ts +16 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/utils.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/utils.js +22 -0
- package/lib/components/template/AdvancedSearch/SearchGroups/utils.js.map +1 -0
- package/lib/components/template/AdvancedSearch/TemplateContext.d.ts +11 -0
- package/lib/components/template/AdvancedSearch/TemplateContext.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/TemplateContext.js +11 -0
- package/lib/components/template/AdvancedSearch/TemplateContext.js.map +1 -0
- package/lib/components/template/AdvancedSearch/index.d.ts +2 -0
- package/lib/components/template/AdvancedSearch/index.d.ts.map +1 -0
- package/lib/components/template/AdvancedSearch/index.js +2 -0
- package/lib/components/template/AdvancedSearch/index.js.map +1 -0
- package/lib/components/template/AppShell/AppShell.d.ts +2 -0
- package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/template/AppShell/AppShell.js +33 -10
- package/lib/components/template/AppShell/AppShell.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts +1 -0
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +7 -7
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js +6 -6
- package/lib/components/template/CaseViewActionsMenu/CaseViewActionsMenu.js.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.js +3 -2
- package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/template/DataReference/DataReference.d.ts +7 -0
- package/lib/components/template/DataReference/DataReference.d.ts.map +1 -1
- package/lib/components/template/DataReference/DataReference.js +245 -81
- package/lib/components/template/DataReference/DataReference.js.map +1 -1
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.d.ts +8 -0
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.d.ts.map +1 -0
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.js +9 -0
- package/lib/components/template/DataReference/DataReferenceAdvancedSearchContext.js.map +1 -0
- package/lib/components/template/DataReference/SearchForm.d.ts +3 -0
- package/lib/components/template/DataReference/SearchForm.d.ts.map +1 -0
- package/lib/components/template/DataReference/SearchForm.js +86 -0
- package/lib/components/template/DataReference/SearchForm.js.map +1 -0
- package/lib/components/template/DataReference/utils.d.ts +15 -0
- package/lib/components/template/DataReference/utils.d.ts.map +1 -0
- package/lib/components/template/DataReference/utils.js +75 -0
- package/lib/components/template/DataReference/utils.js.map +1 -0
- package/lib/components/template/DefaultForm/utils/index.d.ts.map +1 -1
- package/lib/components/template/DefaultForm/utils/index.js +1 -2
- package/lib/components/template/DefaultForm/utils/index.js.map +1 -1
- package/lib/components/template/Details/Details/Details.js +2 -2
- package/lib/components/template/Details/Details/Details.js.map +1 -1
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js +3 -3
- package/lib/components/template/Details/DetailsSubTabs/DetailsSubTabs.js.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +2 -2
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +2 -2
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
- package/lib/components/template/Details/DynamicTabs/DynamicTabs.d.ts.map +1 -1
- package/lib/components/template/Details/DynamicTabs/DynamicTabs.js +4 -4
- package/lib/components/template/Details/DynamicTabs/DynamicTabs.js.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +9 -5
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.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 +3 -0
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +151 -66
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/utils.d.ts.map +1 -1
- package/lib/components/template/ListView/utils.js +29 -6
- package/lib/components/template/ListView/utils.js.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +2 -2
- 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 +1 -2
- package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +0 -2
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts +2 -0
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +67 -44
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js +2 -4
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
- package/lib/components/template/SubTabs/SubTabs.js +2 -2
- package/lib/components/template/SubTabs/SubTabs.js.map +1 -1
- package/lib/components/template/SubTabs/tabUtils.d.ts +10 -0
- package/lib/components/template/SubTabs/tabUtils.d.ts.map +1 -1
- package/lib/components/template/SubTabs/tabUtils.js +102 -1
- package/lib/components/template/SubTabs/tabUtils.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js +2 -2
- package/lib/components/template/TwoColumn/TwoColumn/TwoColumn.js.map +1 -1
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js +2 -2
- package/lib/components/template/TwoColumn/TwoColumnTab/TwoColumnTab.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +2 -2
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
- package/lib/components/template/WssNavBar/WssNavBar.js +9 -9
- package/lib/components/template/WssNavBar/WssNavBar.js.map +1 -1
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.js +2 -2
- package/lib/components/widget/AppAnnouncement/AppAnnouncement.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.css +1 -0
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +7 -10
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.d.ts.map +1 -1
- package/lib/components/widget/CaseHistory/CaseHistory.js +8 -7
- package/lib/components/widget/CaseHistory/CaseHistory.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +4 -4
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
- package/lib/components/widget/Followers/Followers.js +2 -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.d.ts.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js +3 -3
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/widget/ToDo/ToDo.d.ts.map +1 -1
- package/lib/components/widget/ToDo/ToDo.js +60 -17
- package/lib/components/widget/ToDo/ToDo.js.map +1 -1
- package/lib/doc/KeyReleaseUpdates.md +19 -7
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useFocusFirstField.d.ts +7 -0
- package/lib/hooks/useFocusFirstField.d.ts.map +1 -0
- package/lib/hooks/useFocusFirstField.js +20 -0
- package/lib/hooks/useFocusFirstField.js.map +1 -0
- package/lib/hooks/useGetTabsCount.d.ts +11 -0
- package/lib/hooks/useGetTabsCount.d.ts.map +1 -0
- package/lib/hooks/useGetTabsCount.js +166 -0
- package/lib/hooks/useGetTabsCount.js.map +1 -0
- package/lib/hooks/useIsMount.d.ts +2 -0
- package/lib/hooks/useIsMount.d.ts.map +1 -0
- package/lib/hooks/useIsMount.js +9 -0
- package/lib/hooks/useIsMount.js.map +1 -0
- package/lib/hooks/useScrolltoTop.d.ts +7 -0
- package/lib/hooks/useScrolltoTop.d.ts.map +1 -0
- package/lib/hooks/useScrolltoTop.js +13 -0
- package/lib/hooks/useScrolltoTop.js.map +1 -0
- package/lib/sdk-pega-component-map.d.ts +7 -1
- package/lib/sdk-pega-component-map.js +7 -1
- package/lib/sdk-pega-component-map.js.map +1 -1
- package/lib/theme.d.ts +11 -0
- package/lib/theme.d.ts.map +1 -0
- package/lib/theme.js +31 -0
- package/lib/theme.js.map +1 -0
- package/package.json +30 -1
- package/lib/components/infra/Containers/helpers.d.ts +0 -2
- package/lib/components/infra/Containers/helpers.d.ts.map +0 -1
- package/lib/components/infra/Containers/helpers.js.map +0 -1
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
|
|
4
|
+
import useIsMount from '../../../hooks/useIsMount';
|
|
5
|
+
import componentCachePersistUtils from '../AdvancedSearch/SearchGroup/persistUtils';
|
|
6
|
+
import { getMappedKey } from '../AdvancedSearch/SearchGroup/persistUtils';
|
|
7
|
+
import DataReferenceAdvancedSearchContext from './DataReferenceAdvancedSearchContext';
|
|
8
|
+
import { getFirstChildConfig } from './utils';
|
|
4
9
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
5
10
|
export default function DataReference(props) {
|
|
6
11
|
// Get emitted components from map (so we can get any override that may exist)
|
|
7
12
|
const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');
|
|
8
13
|
const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');
|
|
9
|
-
const
|
|
14
|
+
const SearchForm = getComponentFromMap('SearchForm');
|
|
15
|
+
const { children, getPConnect, label, showLabel, displayMode, allowAndPersistChangesInReviewMode, referenceType, selectionMode, displayAs, ruleClass, parameters, hideLabel, imagePosition, showImageDescription, showPromotedFilters, isCreationOfNewRecordAllowedForReference, contextClass, inline, selectionList } = props;
|
|
16
|
+
const isMounted = useIsMount();
|
|
10
17
|
let childrenToRender = children;
|
|
11
18
|
const pConn = getPConnect();
|
|
12
19
|
const [dropDownDataSource, setDropDownDataSource] = useState(null);
|
|
@@ -15,44 +22,72 @@ export default function DataReference(props) {
|
|
|
15
22
|
propsToUse.label = '';
|
|
16
23
|
}
|
|
17
24
|
const rawViewMetadata = pConn.getRawMetadata();
|
|
18
|
-
const
|
|
25
|
+
const refFieldMetadata = pConn.getFieldMetadata(rawViewMetadata.config?.authorContext);
|
|
19
26
|
const [firstChildMeta] = rawViewMetadata.children;
|
|
20
27
|
const refList = rawViewMetadata.config.referenceList;
|
|
21
28
|
const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');
|
|
22
|
-
|
|
23
|
-
const
|
|
29
|
+
const isDisplayModeEnabled = ['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode);
|
|
30
|
+
const isDDSourceDeferred = (firstChildMeta?.type === 'Dropdown' && selectionMode === SELECTION_MODE.SINGLE && refFieldMetadata?.descriptors) ||
|
|
31
|
+
firstChildMeta.config.deferDatasource;
|
|
32
|
+
const pyID = getMappedKey('pyID');
|
|
33
|
+
const isInfinity = pyID === 'pyID';
|
|
34
|
+
const { allowImplicitRefresh } = isInfinity
|
|
35
|
+
? PCore.getFieldDefaultUtils().fieldDefaults.DataReference || {}
|
|
36
|
+
: {
|
|
37
|
+
allowImplicitRefresh: true
|
|
38
|
+
};
|
|
24
39
|
let firstChildPConnect;
|
|
40
|
+
const localizedPlaceholderOption = placeholder => {
|
|
41
|
+
const { GENERIC_BUNDLE_KEY } = PCore.getLocaleUtils?.() ?? {};
|
|
42
|
+
const localizedDefaultPlaceholder = pConn.getLocalizedValue('select_placeholder_default', 'CosmosFields', GENERIC_BUNDLE_KEY);
|
|
43
|
+
// If we have a placeholder, push that option in the list of items
|
|
44
|
+
if (placeholder === 'Select...' && localizedDefaultPlaceholder !== 'select_placeholder_default') {
|
|
45
|
+
return localizedDefaultPlaceholder;
|
|
46
|
+
}
|
|
47
|
+
return pConn.getLocalizedValue(placeholder);
|
|
48
|
+
};
|
|
49
|
+
if (['Dropdown', 'AutoComplete'].includes(firstChildMeta?.type)) {
|
|
50
|
+
firstChildMeta.config.placeholder = localizedPlaceholderOption(firstChildMeta.config.placeholder);
|
|
51
|
+
}
|
|
52
|
+
if (['Checkbox', 'RadioButtons'].includes(firstChildMeta?.type) && firstChildMeta.config.variant === 'card') {
|
|
53
|
+
firstChildMeta.config.imagePosition = imagePosition;
|
|
54
|
+
firstChildMeta.config.showImageDescription = showImageDescription;
|
|
55
|
+
}
|
|
25
56
|
/* Only for dropdown when it has param use data api to get the data back and add it to datasource */
|
|
26
57
|
useEffect(() => {
|
|
27
|
-
if (
|
|
58
|
+
if (rawViewMetadata.config?.parameters && !isDDSourceDeferred && ['Checkbox', 'Dropdown', 'RadioButtons'].includes(firstChildMeta?.type)) {
|
|
28
59
|
const { value, key, text } = firstChildMeta.config.datasource.fields;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
if (firstChildMeta.config.variant !== 'card' || (firstChildMeta.config.variant === 'card' && !isMounted)) {
|
|
61
|
+
PCore.getDataApiUtils().getData(refList, {
|
|
62
|
+
dataViewParameters: parameters
|
|
63
|
+
}, '')
|
|
64
|
+
.then(res => {
|
|
65
|
+
if (res.data.data !== null) {
|
|
66
|
+
const ddDataSource = firstChildMeta.config.datasource.filterDownloadedFields
|
|
67
|
+
? res.data.data
|
|
68
|
+
: res.data.data
|
|
69
|
+
.map(listItem => ({
|
|
70
|
+
key: listItem[key.split(' .', 2)[1]],
|
|
71
|
+
text: listItem[text.split(' .', 2)[1]],
|
|
72
|
+
value: listItem[value.split(' .', 2)[1]]
|
|
73
|
+
}))
|
|
74
|
+
.filter(item => item.key);
|
|
75
|
+
// Filtering out undefined entries that will break preview
|
|
76
|
+
setDropDownDataSource(ddDataSource);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const ddDataSource = [];
|
|
80
|
+
setDropDownDataSource(ddDataSource);
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
.catch(err => {
|
|
84
|
+
// eslint-disable-next-line no-console
|
|
85
|
+
console.error(err?.stack);
|
|
86
|
+
return Promise.resolve({
|
|
87
|
+
data: { data: [] }
|
|
88
|
+
});
|
|
54
89
|
});
|
|
55
|
-
}
|
|
90
|
+
}
|
|
56
91
|
}
|
|
57
92
|
}, [firstChildMeta, rawViewMetadata, parameters]);
|
|
58
93
|
if (firstChildMeta?.type !== 'Region') {
|
|
@@ -77,28 +112,39 @@ export default function DataReference(props) {
|
|
|
77
112
|
if (!canBeChangedInReviewMode) {
|
|
78
113
|
firstChildMeta.config.displayMode = displayMode;
|
|
79
114
|
}
|
|
80
|
-
if (firstChildMeta.type === 'SimpleTableSelect' && selectionMode === SELECTION_MODE.MULTI) {
|
|
81
|
-
propName = PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.selectionList);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
propName = PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.value);
|
|
85
|
-
}
|
|
86
115
|
}
|
|
87
116
|
const handleSelection = event => {
|
|
88
117
|
const caseKey = pConn.getCaseInfo().getKey();
|
|
89
118
|
const refreshOptions = { autoDetectRefresh: true };
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
PCore.getDeferLoadManager().refreshActiveComponents(pConn.getContextName());
|
|
119
|
+
if (pConn.getRawMetadata()?.children?.length > 0 && pConn.getRawMetadata()?.children[0].config?.value) {
|
|
120
|
+
refreshOptions.propertyName = pConn.getRawMetadata()?.children[0].config.value;
|
|
121
|
+
refreshOptions.classID = pConn.getRawMetadata().classID;
|
|
94
122
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
// AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value if event.id is unset
|
|
124
|
+
// When value is empty propValue will be undefined here and no value will be set for the reference
|
|
125
|
+
const propValue = event?.id || event?.target?.value;
|
|
126
|
+
const propName = firstChildMeta.type === 'SimpleTableSelect' && selectionMode === SELECTION_MODE.MULTI
|
|
127
|
+
? PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.selectionList)
|
|
128
|
+
: PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.value);
|
|
129
|
+
const hasAssociatedViewConfigured = rawViewMetadata.children[1].children?.length;
|
|
130
|
+
if (pConn.getContextName().includes('modal') || pConn.getContextName().includes('workarea')) {
|
|
131
|
+
if (hasAssociatedViewConfigured || allowImplicitRefresh) {
|
|
132
|
+
const pageReference = pConn.getPageReference();
|
|
133
|
+
let pgRef = null;
|
|
134
|
+
if (pageReference.startsWith('objectInfo')) {
|
|
135
|
+
pgRef = pageReference.replace('objectInfo.content', '');
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
pgRef = pageReference.replace('caseInfo.content', '');
|
|
139
|
+
}
|
|
140
|
+
const viewName = rawViewMetadata.name;
|
|
141
|
+
getPConnect()
|
|
142
|
+
.getActionsApi()
|
|
143
|
+
.refreshCaseView(caseKey, viewName, pgRef, refreshOptions)
|
|
144
|
+
.catch(() => { });
|
|
145
|
+
}
|
|
98
146
|
}
|
|
99
|
-
|
|
100
|
-
const propValue = event?.id || event?.target.value;
|
|
101
|
-
if (propValue && canBeChangedInReviewMode && isDisplayModeEnabled) {
|
|
147
|
+
else if (propValue && canBeChangedInReviewMode && isDisplayModeEnabled) {
|
|
102
148
|
PCore.getDataApiUtils().getCaseEditLock(caseKey, '').then(caseResponse => {
|
|
103
149
|
const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
|
|
104
150
|
let curr = {};
|
|
@@ -132,53 +178,171 @@ export default function DataReference(props) {
|
|
|
132
178
|
// rerenders without any actual change
|
|
133
179
|
const recreatedFirstChild = useMemo(() => {
|
|
134
180
|
const { type, config } = firstChildMeta;
|
|
135
|
-
if (firstChildMeta?.type
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
181
|
+
if (firstChildMeta?.type === 'Region' && displayAs !== 'advancedSearch') {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if ((displayAs === 'readonly' || isDisplayModeEnabled) && !canBeChangedInReviewMode && selectionMode === SELECTION_MODE.SINGLE) {
|
|
185
|
+
return (_jsx(SingleReferenceReadonly, { config: config, getPConnect: firstChildPConnect, label: propsToUse.label, type: type, displayAs: displayAs, displayMode: displayMode, ruleClass: ruleClass, referenceType: referenceType, hideLabel: hideLabel, dataRelationshipContext: rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null }));
|
|
186
|
+
}
|
|
187
|
+
if ((['readonly', 'readonlyMulti', 'map'].includes(displayAs) || isDisplayModeEnabled) && selectionMode === SELECTION_MODE.MULTI) {
|
|
188
|
+
return (_jsx(MultiReferenceReadonly, { config: {
|
|
189
|
+
...firstChildMeta.config,
|
|
190
|
+
localeReference: rawViewMetadata.config.localeReference
|
|
191
|
+
}, getPConnect: firstChildPConnect, displayAs: displayAs, label: propsToUse.label, hideLabel: hideLabel, displayMode: displayMode }));
|
|
192
|
+
}
|
|
193
|
+
/* Editable variants */
|
|
194
|
+
// Datasource w/ parameters cannot load the dropdown before the parameters
|
|
195
|
+
if (type === 'Dropdown' && dropDownDataSource === null && !isDDSourceDeferred && rawViewMetadata.config?.parameters) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
if (firstChildMeta.config?.readOnly) {
|
|
199
|
+
delete firstChildMeta.config.readOnly;
|
|
200
|
+
}
|
|
201
|
+
// 2) Set datasource
|
|
202
|
+
if (['Dropdown', 'Checkbox', 'RadioButtons'].includes(firstChildMeta?.type) &&
|
|
203
|
+
!firstChildMeta.config.deferDatasource &&
|
|
204
|
+
firstChildMeta.config.datasource) {
|
|
205
|
+
firstChildMeta.config.datasource.source =
|
|
206
|
+
(firstChildMeta.config.variant === 'card' && dropDownDataSource) ||
|
|
207
|
+
(firstChildMeta.config.variant !== 'card' && rawViewMetadata.config?.parameters)
|
|
208
|
+
? dropDownDataSource
|
|
209
|
+
: '@DATASOURCE '.concat(refList).concat('.pxResults');
|
|
210
|
+
}
|
|
211
|
+
else if (firstChildMeta?.type === 'AutoComplete') {
|
|
212
|
+
firstChildMeta.config.datasource = refList;
|
|
213
|
+
if (rawViewMetadata.config?.parameters) {
|
|
214
|
+
firstChildMeta.config.parameters = parameters;
|
|
144
215
|
}
|
|
145
|
-
|
|
146
|
-
|
|
216
|
+
}
|
|
217
|
+
// 3) Pass through configs
|
|
218
|
+
if (firstChildMeta.config) {
|
|
219
|
+
firstChildMeta.config.showPromotedFilters = showPromotedFilters;
|
|
220
|
+
if (!canBeChangedInReviewMode) {
|
|
221
|
+
firstChildMeta.config.displayMode = displayMode;
|
|
147
222
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
223
|
+
}
|
|
224
|
+
// 4) Define field meta
|
|
225
|
+
let fieldMetaData = null;
|
|
226
|
+
if (isDDSourceDeferred && !firstChildMeta.config.deferDatasource) {
|
|
227
|
+
fieldMetaData = {
|
|
228
|
+
datasourceMetadata: refFieldMetadata
|
|
229
|
+
};
|
|
230
|
+
if (rawViewMetadata.config?.parameters) {
|
|
231
|
+
fieldMetaData.datasourceMetadata.datasource.parameters = parameters;
|
|
151
232
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
233
|
+
fieldMetaData.datasourceMetadata.datasource.propertyForDisplayText = firstChildMeta?.config?.datasource?.fields?.text.startsWith('@P')
|
|
234
|
+
? firstChildMeta?.config?.datasource?.fields?.text?.substring(3)
|
|
235
|
+
: firstChildMeta?.config?.datasource?.fields?.text;
|
|
236
|
+
fieldMetaData.datasourceMetadata.datasource.propertyForValue = firstChildMeta?.config?.datasource?.fields?.value.startsWith('@P')
|
|
237
|
+
? firstChildMeta?.config?.datasource?.fields?.value?.substring(3)
|
|
238
|
+
: firstChildMeta?.config?.datasource?.fields?.value;
|
|
239
|
+
fieldMetaData.datasourceMetadata.datasource.name = rawViewMetadata.config?.referenceList;
|
|
240
|
+
}
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
const { disableStartingFieldsForReference = false } = PCore.getEnvironmentInfo().environmentInfoObject?.features?.form || {};
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
let { isCreateNewReferenceEnabled = false } = PCore.getEnvironmentInfo().environmentInfoObject?.features?.form || {};
|
|
245
|
+
if (isCreateNewReferenceEnabled) {
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
isCreateNewReferenceEnabled = isCreationOfNewRecordAllowedForReference && PCore.getAccessPrivilege().hasCreateAccess(contextClass);
|
|
248
|
+
}
|
|
249
|
+
const startingFields = {};
|
|
250
|
+
const createNewRecord = () => {
|
|
251
|
+
if (referenceType === 'Case' || firstChildMeta?.config?.referenceType === 'Case') {
|
|
252
|
+
if (!disableStartingFieldsForReference) {
|
|
253
|
+
startingFields.pyAddCaseContextPage = { pyID: pConn.getCaseInfo().getKey()?.split(' ')?.pop() };
|
|
168
254
|
}
|
|
169
|
-
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
return pConn.getActionsApi().createWork(contextClass, {
|
|
257
|
+
openCaseViewAfterCreate: false,
|
|
258
|
+
startingFields
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
if (referenceType === 'Data' || firstChildMeta?.config?.referenceType === 'Data') {
|
|
262
|
+
return getPConnect().getActionsApi().showDataObjectCreateView(contextClass);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const additionalInfo = refFieldMetadata?.additionalInformation
|
|
266
|
+
? {
|
|
267
|
+
content: refFieldMetadata.additionalInformation
|
|
268
|
+
}
|
|
269
|
+
: undefined;
|
|
270
|
+
const dataReferenceConfigToChild = {
|
|
271
|
+
selectionMode,
|
|
272
|
+
additionalInfo,
|
|
273
|
+
descriptors: selectionMode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
|
|
274
|
+
datasourceMetadata: fieldMetaData?.datasourceMetadata,
|
|
275
|
+
required: propsToUse.required,
|
|
276
|
+
visibility: propsToUse.visibility,
|
|
277
|
+
disabled: propsToUse.disabled,
|
|
278
|
+
label: propsToUse.label,
|
|
279
|
+
displayAs,
|
|
280
|
+
readOnly: false,
|
|
281
|
+
...(selectionMode === SELECTION_MODE.SINGLE && {
|
|
282
|
+
referenceType
|
|
283
|
+
}),
|
|
284
|
+
...(selectionMode === SELECTION_MODE.SINGLE &&
|
|
285
|
+
displayAs === 'advancedSearch' && {
|
|
286
|
+
value: rawViewMetadata.config.value,
|
|
287
|
+
contextPage: rawViewMetadata.config.contextPage
|
|
288
|
+
}),
|
|
289
|
+
...(selectionMode === SELECTION_MODE.MULTI &&
|
|
290
|
+
displayAs === 'advancedSearch' && {
|
|
291
|
+
selectionList,
|
|
292
|
+
readonlyContextList: rawViewMetadata.config.readonlyContextList
|
|
293
|
+
}),
|
|
294
|
+
dataRelationshipContext: rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null,
|
|
295
|
+
hideLabel,
|
|
296
|
+
onRecordChange: handleSelection,
|
|
297
|
+
createNewRecord: isCreateNewReferenceEnabled ? createNewRecord : undefined,
|
|
298
|
+
inline
|
|
299
|
+
};
|
|
300
|
+
const searchSelectCacheKey = componentCachePersistUtils.getComponentStateKey(getPConnect, rawViewMetadata.config.name);
|
|
301
|
+
const dataReferenceAdvancedSearchContext = {
|
|
302
|
+
dataReferenceConfigToChild,
|
|
303
|
+
isCreateNewReferenceEnabled,
|
|
304
|
+
disableStartingFieldsForReference,
|
|
305
|
+
pyID,
|
|
306
|
+
searchSelectCacheKey
|
|
307
|
+
};
|
|
308
|
+
if (displayAs === 'advancedSearch') {
|
|
309
|
+
return (_jsx(DataReferenceAdvancedSearchContext.Provider, { value: dataReferenceAdvancedSearchContext, children: _jsx(SearchForm, { getPConnect: getPConnect, searchSelectCacheKey: searchSelectCacheKey, children: children }) }));
|
|
170
310
|
}
|
|
311
|
+
return firstChildPConnect().createComponent({
|
|
312
|
+
type,
|
|
313
|
+
config: {
|
|
314
|
+
...getFirstChildConfig({
|
|
315
|
+
firstChildMeta,
|
|
316
|
+
getPConnect,
|
|
317
|
+
rawViewMetadata,
|
|
318
|
+
contextClass,
|
|
319
|
+
dataReferenceConfigToChild,
|
|
320
|
+
isCreateNewReferenceEnabled,
|
|
321
|
+
disableStartingFieldsForReference,
|
|
322
|
+
pyID
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
});
|
|
171
326
|
}, [firstChildMeta.config?.datasource?.source, parameters, dropDownDataSource, propsToUse.required, propsToUse.disabled]);
|
|
172
327
|
// Only include the views region for rendering when it has content
|
|
173
328
|
if (firstChildMeta?.type !== 'Region') {
|
|
174
329
|
const viewsRegion = rawViewMetadata.children[1];
|
|
175
330
|
if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {
|
|
331
|
+
viewsRegion.children.map(child => {
|
|
332
|
+
child.config.isEmbeddedInDataReference = true;
|
|
333
|
+
return child;
|
|
334
|
+
});
|
|
176
335
|
childrenToRender = [recreatedFirstChild, ...children.slice(1)];
|
|
177
336
|
}
|
|
178
337
|
else {
|
|
179
338
|
childrenToRender = [recreatedFirstChild];
|
|
180
339
|
}
|
|
181
340
|
}
|
|
182
|
-
|
|
341
|
+
else if (displayAs === 'advancedSearch') {
|
|
342
|
+
childrenToRender = [recreatedFirstChild];
|
|
343
|
+
}
|
|
344
|
+
return childrenToRender.length === 1 ? ((childrenToRender[0] ?? null)) : (_jsx("div", { children: childrenToRender.map((child, index) => (
|
|
345
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
346
|
+
_jsx(React.Fragment, { children: child }, index))) }));
|
|
183
347
|
}
|
|
184
348
|
//# sourceMappingURL=DataReference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataReference.js","sourceRoot":"","sources":["../../../../src/components/template/DataReference/DataReference.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAkBhF,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAA4C;IAChF,8EAA8E;IAC9E,MAAM,uBAAuB,GAAG,mBAAmB,CAAC,yBAAyB,CAAC,CAAC;IAC/E,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,wBAAwB,CAAC,CAAC;IAE7E,MAAM,EACJ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,kCAAkC,EAClC,aAAa,EACb,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACV,GAAG,KAAK,CAAC;IACV,IAAI,gBAAgB,GAAG,QAA0B,CAAC;IAClD,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,kBA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AACJ,CAAC","sourcesContent":["import { PropsWithChildren, ReactElement, useEffect, useMemo, useState } from 'react';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnProps } from '../../../types/PConnProps';\n\n// ReferenceProps can't be used until getComponentConfig() is NOT private\ninterface DataReferenceProps extends PConnProps {\n // If any, enter additional props that only exist on this component\n label: string;\n showLabel: any;\n displayMode: string;\n allowAndPersistChangesInReviewMode: boolean;\n referenceType: string;\n selectionMode: string;\n displayAs: string;\n ruleClass: string;\n parameters: string[]; // need to fix\n hideLabel: boolean;\n}\n\nconst SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };\n\nexport default function DataReference(props: PropsWithChildren<DataReferenceProps>) {\n // Get emitted components from map (so we can get any override that may exist)\n const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');\n const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');\n\n const {\n children,\n getPConnect,\n label,\n showLabel,\n displayMode,\n allowAndPersistChangesInReviewMode,\n referenceType,\n selectionMode,\n displayAs,\n ruleClass,\n parameters,\n hideLabel\n } = props;\n let childrenToRender = children as ReactElement[];\n const pConn = getPConnect();\n const [dropDownDataSource, setDropDownDataSource] = useState(null);\n const propsToUse: any = { label, showLabel, ...pConn.getInheritedProps() };\n if (propsToUse.showLabel === false) {\n propsToUse.label = '';\n }\n const rawViewMetadata: any = pConn.getRawMetadata();\n const viewName = rawViewMetadata.name;\n const [firstChildMeta] = rawViewMetadata.children;\n const refList = rawViewMetadata.config.referenceList;\n const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');\n let propName;\n const isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode);\n let firstChildPConnect;\n\n /* Only for dropdown when it has param use data api to get the data back and add it to datasource */\n useEffect(() => {\n if (firstChildMeta?.type === 'Dropdown' && rawViewMetadata.config?.parameters) {\n const { value, key, text } = firstChildMeta.config.datasource.fields;\n (\n PCore.getDataApiUtils().getData(\n refList,\n {\n dataViewParameters: parameters\n } as any,\n ''\n ) as Promise<any>\n )\n .then(res => {\n if (res.data.data !== null) {\n const ddDataSource = res.data.data\n .map(listItem => ({\n key: listItem[key.split(' .', 2)[1]],\n text: listItem[text.split(' .', 2)[1]],\n value: listItem[value.split(' .', 2)[1]]\n }))\n .filter(item => item.key);\n // Filtering out undefined entries that will break preview\n setDropDownDataSource(ddDataSource);\n } else {\n const ddDataSource: any = [];\n setDropDownDataSource(ddDataSource);\n }\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.error(err?.stack);\n return Promise.resolve({\n data: { data: [] }\n });\n });\n }\n }, [firstChildMeta, rawViewMetadata, parameters]);\n\n if (firstChildMeta?.type !== 'Region') {\n firstChildPConnect = getPConnect().getChildren()?.[0].getPConnect;\n /* remove refresh When condition from those old view so that it will not be used for runtime */\n if (firstChildMeta.config?.readOnly) {\n delete firstChildMeta.config.readOnly;\n }\n if (firstChildMeta?.type === 'Dropdown') {\n firstChildMeta.config.datasource.source = rawViewMetadata.config?.parameters\n ? dropDownDataSource\n : '@DATASOURCE '.concat(refList).concat('.pxResults');\n } else if (firstChildMeta?.type === 'AutoComplete') {\n firstChildMeta.config.datasource = refList;\n\n /* Insert the parameters to the component only if present */\n if (rawViewMetadata.config?.parameters) {\n firstChildMeta.config.parameters = parameters;\n }\n }\n // set displayMode conditionally\n if (!canBeChangedInReviewMode) {\n firstChildMeta.config.displayMode = displayMode;\n }\n if (firstChildMeta.type === 'SimpleTableSelect' && selectionMode === SELECTION_MODE.MULTI) {\n propName = PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.selectionList);\n } else {\n propName = PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.value);\n }\n }\n\n const handleSelection = event => {\n const caseKey = pConn.getCaseInfo().getKey();\n const refreshOptions = { autoDetectRefresh: true };\n if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName', '')) {\n // 2nd arg empty string until typedef marked correctly\n getPConnect().getActionsApi().refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName', ''), '', refreshOptions); // 2nd arg empty string until typedef marked correctly\n PCore.getDeferLoadManager().refreshActiveComponents(pConn.getContextName());\n } else {\n const pgRef = pConn.getPageReference().replace('caseInfo.content', '');\n getPConnect().getActionsApi().refreshCaseView(caseKey, viewName, pgRef, refreshOptions);\n }\n\n // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value\n const propValue = event?.id || event?.target.value;\n if (propValue && canBeChangedInReviewMode && isDisplayModeEnabled) {\n (PCore.getDataApiUtils().getCaseEditLock(caseKey, '') as Promise<any>).then(caseResponse => {\n const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');\n let curr = {};\n const commitData = curr;\n\n pageTokens.forEach(el => {\n if (el !== '') {\n curr[el] = {};\n curr = curr[el];\n }\n });\n\n // expecting format like {Customer: {pyID:\"C-100\"}}\n const propArr = propName.split('.');\n propArr.forEach((element, idx) => {\n if (idx + 1 === propArr.length) {\n curr[element] = propValue;\n } else {\n curr[element] = {};\n curr = curr[element];\n }\n });\n\n (\n PCore.getDataApiUtils().updateCaseEditFieldsData(\n caseKey,\n { [caseKey]: commitData },\n caseResponse.headers.etag,\n pConn.getContextName()\n ) as Promise<any>\n ).then(response => {\n PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), response.data.data.caseInfo.lastUpdateTime);\n PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);\n });\n });\n }\n };\n\n // Re-create first child with overridden props\n // Memoized child in order to stop unmount and remount of the child component when data reference\n // rerenders without any actual change\n const recreatedFirstChild = useMemo(() => {\n const { type, config } = firstChildMeta;\n if (firstChildMeta?.type !== 'Region') {\n pConn.clearErrorMessages({\n // Need to add empty string for category and context to match typdef\n property: propName,\n category: '',\n context: ''\n });\n if (!canBeChangedInReviewMode && isDisplayModeEnabled && selectionMode === SELECTION_MODE.SINGLE) {\n return (\n <SingleReferenceReadonly\n config={config}\n getPConnect={firstChildPConnect}\n label={propsToUse.label}\n type={type}\n displayAs={displayAs}\n displayMode={displayMode}\n ruleClass={ruleClass}\n referenceType={referenceType}\n hideLabel={hideLabel}\n dataRelationshipContext={rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null}\n />\n );\n }\n\n if (isDisplayModeEnabled && selectionMode === SELECTION_MODE.MULTI) {\n return <MultiReferenceReadonly config={config} getPConnect={firstChildPConnect} label={propsToUse.label} hideLabel={hideLabel} />;\n }\n\n // In the case of a datasource with parameters you cannot load the dropdown before the parameters\n if (type === 'Dropdown' && rawViewMetadata.config?.parameters && dropDownDataSource === null) {\n return null;\n }\n\n return firstChildPConnect().createComponent(\n {\n type,\n config: {\n ...config,\n required: propsToUse.required,\n visibility: propsToUse.visibility,\n disabled: propsToUse.disabled,\n label: propsToUse.label,\n viewName: getPConnect().getCurrentView(),\n parameters: rawViewMetadata.config.parameters,\n readOnly: false,\n localeReference: rawViewMetadata.config.localeReference,\n ...(selectionMode === SELECTION_MODE.SINGLE ? { referenceType } : ''),\n dataRelationshipContext: rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null,\n hideLabel,\n onRecordChange: handleSelection\n }\n },\n '',\n '',\n {}\n ); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);\n }\n }, [firstChildMeta.config?.datasource?.source, parameters, dropDownDataSource, propsToUse.required, propsToUse.disabled]);\n\n // Only include the views region for rendering when it has content\n if (firstChildMeta?.type !== 'Region') {\n const viewsRegion = rawViewMetadata.children[1];\n if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {\n childrenToRender = [recreatedFirstChild, ...(children as ReactElement[]).slice(1)];\n } else {\n childrenToRender = [recreatedFirstChild];\n }\n }\n\n return childrenToRender.length === 1 ? (\n childrenToRender[0] ?? null\n ) : (\n <div>\n {childrenToRender.map(child => (\n <>{child}</>\n ))}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataReference.js","sourceRoot":"","sources":["../../../../src/components/template/DataReference/DataReference.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAmC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,0BAA0B,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,kCAAkC,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAwB9C,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAA4C;IAChF,8EAA8E;IAC9E,MAAM,uBAAuB,GAAG,mBAAmB,CAAC,yBAAyB,CAAC,CAAC;IAC/E,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,wBAAwB,CAAC,CAAC;IAC7E,MAAM,UAAU,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,EACJ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,EACX,kCAAkC,EAClC,aAAa,EACb,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,wCAAwC,EACxC,YAAY,EACZ,MAAM,EACN,aAAa,EACd,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IAC/B,IAAI,gBAAgB,GAAG,QAA0B,CAAC;IAClD,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,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QAAQ,CAAC,CAAC,CAAC;IAE1H,kEAAkE;IAClE,IAAI,cAAc,EAAE,IAAI,KAAK,QAAQ,EAAE;QACrC,MAAM,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAChD,IAAI,WAAW,EAAE,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE;YAChE,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAC/B,KAAK,CAAC,MAAM,CAAC,yBAAyB,GAAG,IAAI,CAAC;gBAC9C,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;YACH,gBAAgB,GAAG,CAAC,mBAAmB,EAAE,GAAI,QAA2B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACpF;aAAM;YACL,gBAAgB,GAAG,CAAC,mBAAmB,CAAC,CAAC;SAC1C;KACF;SAAM,IAAI,SAAS,KAAK,gBAAgB,EAAE;QACzC,gBAAgB,GAAG,CAAC,mBAAmB,CAAC,CAAC;KAC1C;IAED,OAAO,gBAAgB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACrC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAC9B,CAAC,CAAC,CAAC,CACF,wBACG,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QACtC,oDAAoD;QACpD,KAAC,KAAK,CAAC,QAAQ,cAAc,KAAK,IAAb,KAAK,CAA0B,CACrD,CAAC,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { PropsWithChildren, ReactElement, useEffect, useMemo, useState } from 'react';\n\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnProps } from '../../../types/PConnProps';\nimport useIsMount from '../../../hooks/useIsMount';\nimport componentCachePersistUtils from '../AdvancedSearch/SearchGroup/persistUtils';\nimport { getMappedKey } from '../AdvancedSearch/SearchGroup/persistUtils';\nimport DataReferenceAdvancedSearchContext from './DataReferenceAdvancedSearchContext';\nimport { getFirstChildConfig } from './utils';\n\n// ReferenceProps can't be used until getComponentConfig() is NOT private\ninterface DataReferenceProps extends PConnProps {\n // If any, enter additional props that only exist on this component\n label: string;\n showLabel: any;\n displayMode: string;\n allowAndPersistChangesInReviewMode: boolean;\n referenceType: string;\n selectionMode: string;\n displayAs: string;\n ruleClass: string;\n parameters: string[]; // need to fix\n hideLabel: boolean;\n imagePosition: string;\n showImageDescription: string;\n showPromotedFilters: boolean;\n isCreationOfNewRecordAllowedForReference: boolean;\n contextClass: string;\n inline: any;\n selectionList: any;\n}\n\nconst SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };\n\nexport default function DataReference(props: PropsWithChildren<DataReferenceProps>) {\n // Get emitted components from map (so we can get any override that may exist)\n const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');\n const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');\n const SearchForm = getComponentFromMap('SearchForm');\n const {\n children,\n getPConnect,\n label,\n showLabel,\n displayMode,\n allowAndPersistChangesInReviewMode,\n referenceType,\n selectionMode,\n displayAs,\n ruleClass,\n parameters,\n hideLabel,\n imagePosition,\n showImageDescription,\n showPromotedFilters,\n isCreationOfNewRecordAllowedForReference,\n contextClass,\n inline,\n selectionList\n } = props;\n\n const isMounted = useIsMount();\n let childrenToRender = children as ReactElement[];\n const pConn = getPConnect();\n const [dropDownDataSource, setDropDownDataSource] = useState(null);\n const propsToUse: any = { label, showLabel, ...pConn.getInheritedProps() };\n if (propsToUse.showLabel === false) {\n propsToUse.label = '';\n }\n const rawViewMetadata: any = pConn.getRawMetadata();\n const refFieldMetadata = pConn.getFieldMetadata(rawViewMetadata.config?.authorContext);\n\n const [firstChildMeta] = rawViewMetadata.children;\n const refList = rawViewMetadata.config.referenceList;\n const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');\n const isDisplayModeEnabled = ['STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode);\n const isDDSourceDeferred =\n (firstChildMeta?.type === 'Dropdown' && selectionMode === SELECTION_MODE.SINGLE && refFieldMetadata?.descriptors) ||\n firstChildMeta.config.deferDatasource;\n const pyID = getMappedKey('pyID');\n const isInfinity = pyID === 'pyID';\n const { allowImplicitRefresh } = isInfinity\n ? PCore.getFieldDefaultUtils().fieldDefaults.DataReference || {}\n : {\n allowImplicitRefresh: true\n };\n\n let firstChildPConnect;\n\n const localizedPlaceholderOption = placeholder => {\n const { GENERIC_BUNDLE_KEY } = PCore.getLocaleUtils?.() ?? {};\n const localizedDefaultPlaceholder = pConn.getLocalizedValue('select_placeholder_default', 'CosmosFields', GENERIC_BUNDLE_KEY);\n // If we have a placeholder, push that option in the list of items\n if (placeholder === 'Select...' && localizedDefaultPlaceholder !== 'select_placeholder_default') {\n return localizedDefaultPlaceholder;\n }\n return pConn.getLocalizedValue(placeholder);\n };\n\n if (['Dropdown', 'AutoComplete'].includes(firstChildMeta?.type)) {\n firstChildMeta.config.placeholder = localizedPlaceholderOption(firstChildMeta.config.placeholder);\n }\n\n if (['Checkbox', 'RadioButtons'].includes(firstChildMeta?.type) && firstChildMeta.config.variant === 'card') {\n firstChildMeta.config.imagePosition = imagePosition;\n firstChildMeta.config.showImageDescription = showImageDescription;\n }\n\n /* Only for dropdown when it has param use data api to get the data back and add it to datasource */\n useEffect(() => {\n if (rawViewMetadata.config?.parameters && !isDDSourceDeferred && ['Checkbox', 'Dropdown', 'RadioButtons'].includes(firstChildMeta?.type)) {\n const { value, key, text } = firstChildMeta.config.datasource.fields;\n if (firstChildMeta.config.variant !== 'card' || (firstChildMeta.config.variant === 'card' && !isMounted)) {\n (\n PCore.getDataApiUtils().getData(\n refList,\n {\n dataViewParameters: parameters\n } as any,\n ''\n ) as Promise<any>\n )\n .then(res => {\n if (res.data.data !== null) {\n const ddDataSource = firstChildMeta.config.datasource.filterDownloadedFields\n ? res.data.data\n : res.data.data\n .map(listItem => ({\n key: listItem[key.split(' .', 2)[1]],\n text: listItem[text.split(' .', 2)[1]],\n value: listItem[value.split(' .', 2)[1]]\n }))\n .filter(item => item.key);\n // Filtering out undefined entries that will break preview\n setDropDownDataSource(ddDataSource);\n } else {\n const ddDataSource: any = [];\n setDropDownDataSource(ddDataSource);\n }\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.error(err?.stack);\n return Promise.resolve({\n data: { data: [] }\n });\n });\n }\n }\n }, [firstChildMeta, rawViewMetadata, parameters]);\n\n if (firstChildMeta?.type !== 'Region') {\n firstChildPConnect = getPConnect().getChildren()?.[0].getPConnect;\n /* remove refresh When condition from those old view so that it will not be used for runtime */\n if (firstChildMeta.config?.readOnly) {\n delete firstChildMeta.config.readOnly;\n }\n if (firstChildMeta?.type === 'Dropdown') {\n firstChildMeta.config.datasource.source = rawViewMetadata.config?.parameters\n ? dropDownDataSource\n : '@DATASOURCE '.concat(refList).concat('.pxResults');\n } else if (firstChildMeta?.type === 'AutoComplete') {\n firstChildMeta.config.datasource = refList;\n\n /* Insert the parameters to the component only if present */\n if (rawViewMetadata.config?.parameters) {\n firstChildMeta.config.parameters = parameters;\n }\n }\n // set displayMode conditionally\n if (!canBeChangedInReviewMode) {\n firstChildMeta.config.displayMode = displayMode;\n }\n }\n\n const handleSelection = event => {\n const caseKey = pConn.getCaseInfo().getKey();\n const refreshOptions: any = { autoDetectRefresh: true };\n\n if (pConn.getRawMetadata()?.children?.length > 0 && pConn.getRawMetadata()?.children[0].config?.value) {\n refreshOptions.propertyName = pConn.getRawMetadata()?.children[0].config.value;\n refreshOptions.classID = (pConn.getRawMetadata() as any).classID;\n }\n\n // AutoComplete sets value on event.id whereas Dropdown sets it on event.target.value if event.id is unset\n // When value is empty propValue will be undefined here and no value will be set for the reference\n const propValue = event?.id || event?.target?.value;\n const propName =\n firstChildMeta.type === 'SimpleTableSelect' && selectionMode === SELECTION_MODE.MULTI\n ? PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.selectionList)\n : PCore.getAnnotationUtils().getPropertyName(firstChildMeta.config.value);\n\n const hasAssociatedViewConfigured = rawViewMetadata.children[1].children?.length;\n\n if (pConn.getContextName().includes('modal') || pConn.getContextName().includes('workarea')) {\n if (hasAssociatedViewConfigured || allowImplicitRefresh) {\n const pageReference = pConn.getPageReference();\n let pgRef: any = null;\n if (pageReference.startsWith('objectInfo')) {\n pgRef = pageReference.replace('objectInfo.content', '');\n } else {\n pgRef = pageReference.replace('caseInfo.content', '');\n }\n const viewName = rawViewMetadata.name;\n getPConnect()\n .getActionsApi()\n .refreshCaseView(caseKey, viewName, pgRef, refreshOptions)\n .catch(() => {});\n }\n } else if (propValue && canBeChangedInReviewMode && isDisplayModeEnabled) {\n (PCore.getDataApiUtils().getCaseEditLock(caseKey, '') as Promise<any>).then(caseResponse => {\n const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');\n let curr = {};\n const commitData = curr;\n\n pageTokens.forEach(el => {\n if (el !== '') {\n curr[el] = {};\n curr = curr[el];\n }\n });\n\n // expecting format like {Customer: {pyID:\"C-100\"}}\n const propArr = propName.split('.');\n propArr.forEach((element, idx) => {\n if (idx + 1 === propArr.length) {\n curr[element] = propValue;\n } else {\n curr[element] = {};\n curr = curr[element];\n }\n });\n\n (\n PCore.getDataApiUtils().updateCaseEditFieldsData(\n caseKey,\n { [caseKey]: commitData },\n caseResponse.headers.etag,\n pConn.getContextName()\n ) as Promise<any>\n ).then(response => {\n PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), response.data.data.caseInfo.lastUpdateTime);\n PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);\n });\n });\n }\n };\n\n // Re-create first child with overridden props\n // Memoized child in order to stop unmount and remount of the child component when data reference\n // rerenders without any actual change\n const recreatedFirstChild = useMemo(() => {\n const { type, config } = firstChildMeta;\n if (firstChildMeta?.type === 'Region' && displayAs !== 'advancedSearch') {\n return;\n }\n\n if ((displayAs === 'readonly' || isDisplayModeEnabled) && !canBeChangedInReviewMode && selectionMode === SELECTION_MODE.SINGLE) {\n return (\n <SingleReferenceReadonly\n config={config}\n getPConnect={firstChildPConnect}\n label={propsToUse.label}\n type={type}\n displayAs={displayAs}\n displayMode={displayMode}\n ruleClass={ruleClass}\n referenceType={referenceType}\n hideLabel={hideLabel}\n dataRelationshipContext={rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null}\n />\n );\n }\n\n if ((['readonly', 'readonlyMulti', 'map'].includes(displayAs) || isDisplayModeEnabled) && selectionMode === SELECTION_MODE.MULTI) {\n return (\n <MultiReferenceReadonly\n config={{\n ...firstChildMeta.config,\n localeReference: rawViewMetadata.config.localeReference\n }}\n getPConnect={firstChildPConnect}\n displayAs={displayAs}\n label={propsToUse.label}\n hideLabel={hideLabel}\n displayMode={displayMode}\n />\n );\n }\n\n /* Editable variants */\n // Datasource w/ parameters cannot load the dropdown before the parameters\n if (type === 'Dropdown' && dropDownDataSource === null && !isDDSourceDeferred && rawViewMetadata.config?.parameters) {\n return null;\n }\n\n if (firstChildMeta.config?.readOnly) {\n delete firstChildMeta.config.readOnly;\n }\n\n // 2) Set datasource\n if (\n ['Dropdown', 'Checkbox', 'RadioButtons'].includes(firstChildMeta?.type) &&\n !firstChildMeta.config.deferDatasource &&\n firstChildMeta.config.datasource\n ) {\n firstChildMeta.config.datasource.source =\n (firstChildMeta.config.variant === 'card' && dropDownDataSource) ||\n (firstChildMeta.config.variant !== 'card' && rawViewMetadata.config?.parameters)\n ? dropDownDataSource\n : '@DATASOURCE '.concat(refList).concat('.pxResults');\n } else if (firstChildMeta?.type === 'AutoComplete') {\n firstChildMeta.config.datasource = refList;\n\n if (rawViewMetadata.config?.parameters) {\n firstChildMeta.config.parameters = parameters;\n }\n }\n\n // 3) Pass through configs\n if (firstChildMeta.config) {\n firstChildMeta.config.showPromotedFilters = showPromotedFilters;\n if (!canBeChangedInReviewMode) {\n firstChildMeta.config.displayMode = displayMode;\n }\n }\n\n // 4) Define field meta\n let fieldMetaData: any = null;\n if (isDDSourceDeferred && !firstChildMeta.config.deferDatasource) {\n fieldMetaData = {\n datasourceMetadata: refFieldMetadata\n };\n if (rawViewMetadata.config?.parameters) {\n fieldMetaData.datasourceMetadata.datasource.parameters = parameters;\n }\n fieldMetaData.datasourceMetadata.datasource.propertyForDisplayText = firstChildMeta?.config?.datasource?.fields?.text.startsWith('@P')\n ? firstChildMeta?.config?.datasource?.fields?.text?.substring(3)\n : firstChildMeta?.config?.datasource?.fields?.text;\n fieldMetaData.datasourceMetadata.datasource.propertyForValue = firstChildMeta?.config?.datasource?.fields?.value.startsWith('@P')\n ? firstChildMeta?.config?.datasource?.fields?.value?.substring(3)\n : firstChildMeta?.config?.datasource?.fields?.value;\n fieldMetaData.datasourceMetadata.datasource.name = rawViewMetadata.config?.referenceList;\n }\n // @ts-ignore\n const { disableStartingFieldsForReference = false } = PCore.getEnvironmentInfo().environmentInfoObject?.features?.form || {};\n // @ts-ignore\n let { isCreateNewReferenceEnabled = false } = PCore.getEnvironmentInfo().environmentInfoObject?.features?.form || {};\n\n if (isCreateNewReferenceEnabled) {\n // @ts-ignore\n isCreateNewReferenceEnabled = isCreationOfNewRecordAllowedForReference && PCore.getAccessPrivilege().hasCreateAccess(contextClass);\n }\n\n const startingFields: any = {};\n const createNewRecord = () => {\n if (referenceType === 'Case' || firstChildMeta?.config?.referenceType === 'Case') {\n if (!disableStartingFieldsForReference) {\n startingFields.pyAddCaseContextPage = { pyID: pConn.getCaseInfo().getKey()?.split(' ')?.pop() };\n }\n // @ts-ignore\n return pConn.getActionsApi().createWork(contextClass, {\n openCaseViewAfterCreate: false,\n startingFields\n });\n }\n if (referenceType === 'Data' || firstChildMeta?.config?.referenceType === 'Data') {\n return getPConnect().getActionsApi().showDataObjectCreateView(contextClass);\n }\n };\n\n const additionalInfo = refFieldMetadata?.additionalInformation\n ? {\n content: refFieldMetadata.additionalInformation\n }\n : undefined;\n\n const dataReferenceConfigToChild = {\n selectionMode,\n additionalInfo,\n descriptors: selectionMode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,\n datasourceMetadata: fieldMetaData?.datasourceMetadata,\n required: propsToUse.required,\n visibility: propsToUse.visibility,\n disabled: propsToUse.disabled,\n label: propsToUse.label,\n displayAs,\n readOnly: false,\n ...(selectionMode === SELECTION_MODE.SINGLE && {\n referenceType\n }),\n ...(selectionMode === SELECTION_MODE.SINGLE &&\n displayAs === 'advancedSearch' && {\n value: rawViewMetadata.config.value,\n contextPage: rawViewMetadata.config.contextPage\n }),\n ...(selectionMode === SELECTION_MODE.MULTI &&\n displayAs === 'advancedSearch' && {\n selectionList,\n readonlyContextList: rawViewMetadata.config.readonlyContextList\n }),\n dataRelationshipContext: rawViewMetadata.config.contextClass && rawViewMetadata.config.name ? rawViewMetadata.config.name : null,\n hideLabel,\n onRecordChange: handleSelection,\n createNewRecord: isCreateNewReferenceEnabled ? createNewRecord : undefined,\n inline\n };\n\n const searchSelectCacheKey = componentCachePersistUtils.getComponentStateKey(getPConnect, rawViewMetadata.config.name);\n\n const dataReferenceAdvancedSearchContext = {\n dataReferenceConfigToChild,\n isCreateNewReferenceEnabled,\n disableStartingFieldsForReference,\n pyID,\n searchSelectCacheKey\n };\n\n if (displayAs === 'advancedSearch') {\n return (\n <DataReferenceAdvancedSearchContext.Provider value={dataReferenceAdvancedSearchContext}>\n <SearchForm getPConnect={getPConnect} searchSelectCacheKey={searchSelectCacheKey}>\n {children}\n </SearchForm>\n </DataReferenceAdvancedSearchContext.Provider>\n );\n }\n\n return firstChildPConnect().createComponent({\n type,\n config: {\n ...getFirstChildConfig({\n firstChildMeta,\n getPConnect,\n rawViewMetadata,\n contextClass,\n dataReferenceConfigToChild,\n isCreateNewReferenceEnabled,\n disableStartingFieldsForReference,\n pyID\n })\n }\n });\n }, [firstChildMeta.config?.datasource?.source, parameters, dropDownDataSource, propsToUse.required, propsToUse.disabled]);\n\n // Only include the views region for rendering when it has content\n if (firstChildMeta?.type !== 'Region') {\n const viewsRegion = rawViewMetadata.children[1];\n if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {\n viewsRegion.children.map(child => {\n child.config.isEmbeddedInDataReference = true;\n return child;\n });\n childrenToRender = [recreatedFirstChild, ...(children as ReactElement[]).slice(1)];\n } else {\n childrenToRender = [recreatedFirstChild];\n }\n } else if (displayAs === 'advancedSearch') {\n childrenToRender = [recreatedFirstChild];\n }\n\n return childrenToRender.length === 1 ? (\n (childrenToRender[0] ?? null)\n ) : (\n <div>\n {childrenToRender.map((child, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <React.Fragment key={index}>{child}</React.Fragment>\n ))}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default DataReferenceAdvancedSearchContext;
|
|
2
|
+
declare const DataReferenceAdvancedSearchContext: import("react").Context<{
|
|
3
|
+
disableStartingFieldsForReference: boolean;
|
|
4
|
+
dataReferenceConfigToChild: {
|
|
5
|
+
selectionMode: string;
|
|
6
|
+
};
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=DataReferenceAdvancedSearchContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataReferenceAdvancedSearchContext.d.ts","sourceRoot":"","sources":["../../../../src/components/template/DataReference/DataReferenceAdvancedSearchContext.js"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const DataReferenceAdvancedSearchContext = createContext({
|
|
3
|
+
disableStartingFieldsForReference: true,
|
|
4
|
+
dataReferenceConfigToChild: {
|
|
5
|
+
selectionMode: 'single'
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
export default DataReferenceAdvancedSearchContext;
|
|
9
|
+
//# sourceMappingURL=DataReferenceAdvancedSearchContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataReferenceAdvancedSearchContext.js","sourceRoot":"","sources":["../../../../src/components/template/DataReference/DataReferenceAdvancedSearchContext.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,kCAAkC,GAAG,aAAa,CAAC;IACvD,iCAAiC,EAAE,IAAI;IACvC,0BAA0B,EAAE;QAC1B,aAAa,EAAE,QAAQ;KACxB;CACF,CAAC,CAAC;AAEH,eAAe,kCAAkC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nconst DataReferenceAdvancedSearchContext = createContext({\n disableStartingFieldsForReference: true,\n dataReferenceConfigToChild: {\n selectionMode: 'single'\n }\n});\n\nexport default DataReferenceAdvancedSearchContext;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchForm.d.ts","sourceRoot":"","sources":["../../../../src/components/template/DataReference/SearchForm.tsx"],"names":[],"mappings":"AAyCA,QAAA,MAAM,UAAU,yDAwGf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|