@pega/react-sdk-overrides 24.2.11 → 25.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/designSystemExtension/AlertBanner/AlertBanner.css +46 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +37 -20
- package/lib/designSystemExtension/Banner/Banner.css +1 -1
- package/lib/designSystemExtension/Banner/Banner.tsx +10 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +53 -37
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -13
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +8 -9
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +9 -9
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +7 -8
- package/lib/designSystemExtension/Operator/Operator.tsx +21 -19
- package/lib/designSystemExtension/Pulse/Pulse.tsx +1 -1
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +32 -4
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +7 -14
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +13 -2
- package/lib/field/AutoComplete/AutoComplete.tsx +1 -1
- package/lib/field/CancelAlert/CancelAlert.css +4 -4
- package/lib/field/CancelAlert/CancelAlert.tsx +6 -6
- package/lib/field/Checkbox/Checkbox.tsx +97 -4
- package/lib/field/Currency/Currency.tsx +3 -3
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +3 -7
- package/lib/field/DateTime/DateTime.tsx +3 -8
- package/lib/field/Decimal/Decimal.tsx +3 -5
- package/lib/field/Dropdown/Dropdown.tsx +5 -7
- package/lib/field/Email/Email.tsx +11 -13
- package/lib/field/Group/Group.tsx +10 -8
- package/lib/field/Integer/Integer.tsx +5 -7
- package/lib/field/Location/Location.css +4 -0
- package/lib/field/Location/Location.tsx +258 -0
- package/lib/field/Location/config-ext.json +8 -0
- package/lib/field/Location/index.tsx +1 -0
- package/lib/field/Multiselect/utils.ts +1 -1
- package/lib/field/ObjectReference/ObjectReference.tsx +235 -0
- package/lib/field/ObjectReference/index.tsx +1 -0
- package/lib/field/ObjectReference/utils.ts +111 -0
- package/lib/field/Percentage/Percentage.tsx +3 -7
- package/lib/field/Phone/Phone.tsx +7 -5
- package/lib/field/RadioButtons/RadioButtons.tsx +47 -2
- package/lib/field/RichText/RichText.css +79 -0
- package/lib/field/RichText/RichText.tsx +3 -1
- package/lib/field/ScalarList/ScalarList.tsx +2 -3
- package/lib/field/SelectableCard/SelectableCard.tsx +189 -0
- package/lib/field/SelectableCard/index.tsx +1 -0
- package/lib/field/SelectableCard/utils.tsx +223 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +160 -28
- package/lib/field/SemanticLink/utils.ts +1 -1
- package/lib/field/TextArea/TextArea.tsx +5 -7
- package/lib/field/TextContent/TextContent.tsx +1 -2
- package/lib/field/TextInput/TextInput.tsx +5 -7
- package/lib/field/Time/Time.tsx +3 -7
- package/lib/field/URL/URL.tsx +5 -7
- package/lib/field/UserReference/UserReference.tsx +2 -3
- package/lib/helpers/attachmentShared.ts +6 -0
- package/lib/helpers/common-utils.ts +3 -4
- package/lib/helpers/data_page.ts +0 -1
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Currency.ts +9 -4
- package/lib/helpers/formatters/CurrencyMap.ts +0 -2
- package/lib/helpers/object-utils.ts +10 -0
- package/lib/helpers/simpleTableHelpers.ts +118 -6
- package/lib/helpers/utils.ts +8 -1
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +28 -21
- package/lib/infra/Assignment/Assignment.tsx +47 -31
- package/lib/infra/Assignment/useValidationBanner.ts +29 -0
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +2 -2
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +22 -102
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +1 -2
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +12 -6
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +8 -13
- package/lib/infra/Containers/container-helpers.ts +47 -1
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +3 -6
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -4
- package/lib/infra/DeferLoad/DeferLoad.tsx +26 -13
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +1 -3
- package/lib/infra/MultiStep/MultiStep.css +48 -70
- package/lib/infra/MultiStep/MultiStep.tsx +27 -53
- package/lib/infra/NavBar/NavBar.css +1 -1
- package/lib/infra/NavBar/NavBar.tsx +49 -34
- package/lib/infra/Reference/Reference.tsx +8 -4
- package/lib/infra/Region/Region.tsx +1 -1
- package/lib/infra/RootContainer/RootContainer.tsx +6 -8
- package/lib/infra/Stages/Stages.tsx +3 -4
- package/lib/infra/View/View.tsx +9 -9
- package/lib/template/AdvancedSearch/AdvancedSearch.tsx +86 -0
- package/lib/template/AdvancedSearch/SearchGroup/persistUtils.ts +52 -0
- package/lib/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +244 -0
- package/lib/template/AdvancedSearch/SearchGroups/hooks.ts +37 -0
- package/lib/template/AdvancedSearch/SearchGroups/index.tsx +1 -0
- package/lib/template/AdvancedSearch/SearchGroups/utils.ts +29 -0
- package/lib/template/AdvancedSearch/TemplateContext.ts +11 -0
- package/lib/template/AdvancedSearch/config-ext.json +9 -0
- package/lib/template/AdvancedSearch/index.tsx +1 -0
- package/lib/template/AppShell/AppShell.css +1 -5
- package/lib/template/AppShell/AppShell.tsx +16 -17
- package/lib/template/BannerPage/BannerPage.tsx +2 -2
- package/lib/template/CaseSummary/CaseSummary.tsx +25 -43
- package/lib/template/CaseView/CaseView.tsx +28 -35
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +1 -1
- package/lib/template/Confirmation/Confirmation.tsx +2 -3
- package/lib/template/DataReference/DataReference.tsx +312 -106
- package/lib/template/DataReference/DataReferenceAdvancedSearchContext.ts +10 -0
- package/lib/template/DataReference/SearchForm.tsx +149 -0
- package/lib/template/DataReference/utils.ts +90 -0
- package/lib/template/DefaultForm/DefaultForm.tsx +3 -3
- package/lib/template/DefaultForm/utils/index.ts +1 -3
- package/lib/template/DefaultPage/DefaultPage.tsx +108 -0
- package/lib/template/DefaultPage/index.tsx +1 -0
- package/lib/template/Details/Details/Details.tsx +11 -11
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +2 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +11 -11
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +11 -11
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +1 -1
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +12 -6
- package/lib/template/HierarchicalForm/HierarchicalForm.tsx +58 -0
- package/lib/template/HierarchicalForm/hooks.ts +224 -0
- package/lib/template/HierarchicalForm/index.tsx +1 -0
- package/lib/template/InlineDashboard/InlineDashboard.tsx +14 -16
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +2 -2
- package/lib/template/ListPage/ListPage.tsx +1 -1
- package/lib/template/ListView/ListView.tsx +342 -204
- package/lib/template/ListView/hooks.ts +1 -5
- package/lib/template/ListView/utils.ts +38 -5
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +17 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +5 -5
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +11 -11
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +2 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +2 -2
- package/lib/template/ObjectPage/index.tsx +1 -0
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +1 -1
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +2 -2
- package/lib/template/PromotedFilters/PromotedFilters.tsx +1 -2
- package/lib/template/SelfServiceCaseView/SelfServiceCaseView.tsx +153 -0
- package/lib/template/SelfServiceCaseView/index.tsx +1 -0
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +2 -3
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +45 -34
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +1 -1
- package/lib/template/SimpleTable/SimpleTableSelectReadonly/SimpleTableSelectReadonly.tsx +179 -0
- package/lib/template/SimpleTable/SimpleTableSelectReadonly/index.tsx +1 -0
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +10 -2
- package/lib/template/SubTabs/SubTabs.tsx +2 -2
- package/lib/template/SubTabs/tabUtils.ts +118 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +9 -10
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +1 -1
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +9 -10
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +5 -5
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +11 -11
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +2 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +2 -2
- package/lib/template/WssNavBar/WssNavBar.css +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +6 -6
- package/lib/template/utils.tsx +58 -0
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +1 -1
- package/lib/widget/Attachment/Attachment.css +6 -8
- package/lib/widget/Attachment/Attachment.tsx +303 -225
- package/lib/widget/Attachment/Attachment.types.ts +96 -0
- package/lib/widget/Attachment/AttachmentUtils.ts +316 -0
- package/lib/widget/CaseHistory/CaseHistory.tsx +5 -5
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.css +0 -14
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +3 -3
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +7 -6
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +29 -22
- package/lib/widget/Followers/Followers.tsx +2 -4
- package/lib/widget/QuickCreate/QuickCreate.tsx +1 -2
- package/lib/widget/SummaryItem/SummaryItem.css +9 -11
- package/lib/widget/SummaryItem/SummaryItem.tsx +2 -2
- package/lib/widget/SummaryList/SummaryList.tsx +1 -1
- package/lib/widget/ToDo/ToDo.css +1 -13
- package/lib/widget/ToDo/ToDo.tsx +37 -36
- package/package.json +1 -1
- package/lib/helpers/attachmentHelpers.ts +0 -76
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo, useCallback, useRef, Children, type PropsWithChildren, type SyntheticEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
import useGetTabsCount from '@pega/react-sdk-components/lib/hooks/useGetTabsCount';
|
|
4
|
+
import { searchtabsClick as tabClick, getActiveTabId, getFirstVisibleTabId } from '@pega/react-sdk-components/lib/components/template/SubTabs/tabUtils';
|
|
5
|
+
import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
|
|
6
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
|
|
8
|
+
const ComponentName = 'HierarchicalForm';
|
|
9
|
+
|
|
10
|
+
const getLandingPageViewName = (contextName: string) => {
|
|
11
|
+
const target = contextName.substring(0, contextName.lastIndexOf('_'));
|
|
12
|
+
const activeContainerItemID = PCore.getContainerUtils().getActiveContainerItemName(target);
|
|
13
|
+
const containerItemData = PCore.getContainerUtils().getContainerItemData(target, activeContainerItemID);
|
|
14
|
+
return containerItemData?.view?.config?.name;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface HierarchicalFormProps extends PConnProps {
|
|
18
|
+
tabsVisibility?: Record<string, boolean>;
|
|
19
|
+
template?: string;
|
|
20
|
+
instructions?: string;
|
|
21
|
+
lastUpdateCaseTime?: string | number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useHierarchicalForm(props: PropsWithChildren<HierarchicalFormProps>) {
|
|
25
|
+
const { children = [], getPConnect, tabsVisibility = {}, template } = props;
|
|
26
|
+
const [tabErrors, setTabErrors] = useState<Record<string, any>>({});
|
|
27
|
+
const tabErrorsRef = useRef<Record<string, any>>({});
|
|
28
|
+
const submitAttemptedRef = useRef(false);
|
|
29
|
+
const { lastUpdateCaseTime = getPConnect().getValue('caseInfo.lastUpdateTime') } = props;
|
|
30
|
+
const fullCaseId = getPConnect().getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID);
|
|
31
|
+
|
|
32
|
+
const deferLoadedTabs: any = Children.toArray(children)[0];
|
|
33
|
+
deferLoadedTabs.props.getPConnect().setInheritedProp('template', template);
|
|
34
|
+
|
|
35
|
+
const navigationKey = useMemo(() => {
|
|
36
|
+
const parentNavKey = `${
|
|
37
|
+
getPConnect().getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID) || getLandingPageViewName(getPConnect().getContextName())
|
|
38
|
+
}`;
|
|
39
|
+
return `${parentNavKey}-${getPConnect().getMetadata()?.name}-${ComponentName}`;
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
const instructions = getInstructions(getPConnect(), props.instructions);
|
|
43
|
+
|
|
44
|
+
const storedTab = (PCore.getNavigationUtils().getComponentState(navigationKey) as any)?.activeTab;
|
|
45
|
+
|
|
46
|
+
const tabsFromChildren = deferLoadedTabs.props.getPConnect().getChildren();
|
|
47
|
+
|
|
48
|
+
const firstTabId = getFirstVisibleTabId(deferLoadedTabs, undefined);
|
|
49
|
+
|
|
50
|
+
const [currentTabId, setCurrentTabId] = useState(getActiveTabId(tabsFromChildren, storedTab || firstTabId));
|
|
51
|
+
const [tabVisibilityStr, setTabVisibilityStr] = useState('');
|
|
52
|
+
const { data: tabData, refreshTabData } = useGetTabsCount(deferLoadedTabs, 'hierarchical', currentTabId, template);
|
|
53
|
+
|
|
54
|
+
const handleCaseRefresh = (message: any) => {
|
|
55
|
+
if (message.subtype === 'tab') {
|
|
56
|
+
refreshTabData();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
let index = 0;
|
|
62
|
+
let caseSubId = '';
|
|
63
|
+
deferLoadedTabs.props
|
|
64
|
+
.getPConnect()
|
|
65
|
+
.getChildren()
|
|
66
|
+
?.forEach((child: any) => {
|
|
67
|
+
const rawConfigProps = child.getPConnect().getRawConfigProps();
|
|
68
|
+
if ('visibility' in rawConfigProps) {
|
|
69
|
+
tabsVisibility[`${index}`] = rawConfigProps.visibility;
|
|
70
|
+
}
|
|
71
|
+
index += 1;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
getPConnect().registerAdditionalProps({ tabsVisibility });
|
|
75
|
+
getPConnect().registerAdditionalProps({ lastUpdateCaseTime: '@P caseInfo.lastUpdateTime' });
|
|
76
|
+
|
|
77
|
+
if (fullCaseId) {
|
|
78
|
+
caseSubId = PCore.getMessagingServiceManager().getCaseSubscription(fullCaseId).subscribe({ caseId: fullCaseId }, handleCaseRefresh);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return () => {
|
|
82
|
+
if (fullCaseId) PCore.getMessagingServiceManager().getCaseSubscription(fullCaseId).unsubscribe(caseSubId);
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
refreshTabData();
|
|
88
|
+
}, [lastUpdateCaseTime]);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const isVisibilityAvailable =
|
|
92
|
+
Object.values(tabsVisibility).length > 0 && Object.values(tabsVisibility).every(visibility => typeof visibility === 'boolean');
|
|
93
|
+
if (isVisibilityAvailable) {
|
|
94
|
+
let str = '';
|
|
95
|
+
Object.keys(tabsVisibility).forEach(key => {
|
|
96
|
+
str += key + tabsVisibility[key];
|
|
97
|
+
});
|
|
98
|
+
setTabVisibilityStr(str);
|
|
99
|
+
}
|
|
100
|
+
}, [tabsVisibility]);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (tabData && tabData.length) {
|
|
104
|
+
const activeTabId = getActiveTabId(tabData, currentTabId);
|
|
105
|
+
if (activeTabId !== currentTabId) {
|
|
106
|
+
setCurrentTabId(activeTabId);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, [tabVisibilityStr, tabData]);
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
PCore.getNavigationUtils().setComponentState(navigationKey, { activeTab: currentTabId });
|
|
113
|
+
const activeTabNavKey = `${getPConnect().getValue(PCore.getConstants().CASE_INFO.CASE_INFO_ID)}-CaseView-ActiveTab`;
|
|
114
|
+
PCore.getNavigationUtils().setComponentState(activeTabNavKey, { id: currentTabId });
|
|
115
|
+
|
|
116
|
+
return () => {
|
|
117
|
+
if (getPConnect().getContextName()?.includes('/modal')) {
|
|
118
|
+
PCore.getNavigationUtils().setComponentState(navigationKey, { activeTab: firstTabId });
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}, [currentTabId, children]);
|
|
122
|
+
|
|
123
|
+
const handleTabClick = useCallback(
|
|
124
|
+
(event: SyntheticEvent, id: string) => {
|
|
125
|
+
tabClick(id, tabData, currentTabId, setCurrentTabId);
|
|
126
|
+
},
|
|
127
|
+
[tabData, currentTabId]
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const tabItems = useMemo(() => tabData?.filter((tab: any) => tab.visibility()) ?? [], [tabData, tabVisibilityStr]);
|
|
131
|
+
|
|
132
|
+
const tabsRef = useRef(tabItems);
|
|
133
|
+
tabsRef.current = tabItems;
|
|
134
|
+
|
|
135
|
+
const updateTabErrorsOnViewMutate = useCallback((messageObject: any, tab: any) => {
|
|
136
|
+
if (!messageObject.type) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const previousTabErrors = tabErrorsRef.current;
|
|
140
|
+
let currentTabState = previousTabErrors[tab.id] || {};
|
|
141
|
+
const { MESSAGES_TYPE_ERROR } = PCore.getConstants().MESSAGES;
|
|
142
|
+
if (messageObject.type !== MESSAGES_TYPE_ERROR) {
|
|
143
|
+
delete currentTabState[messageObject.fieldName];
|
|
144
|
+
currentTabState = Object.keys(currentTabState).length > 0 ? currentTabState : undefined;
|
|
145
|
+
} else {
|
|
146
|
+
currentTabState = { ...currentTabState, [messageObject.fieldName]: messageObject.messages };
|
|
147
|
+
}
|
|
148
|
+
const newErrors = { ...previousTabErrors, [tab.id]: currentTabState };
|
|
149
|
+
tabErrorsRef.current = newErrors;
|
|
150
|
+
setTabErrors(newErrors);
|
|
151
|
+
}, []);
|
|
152
|
+
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
const rawConfig = '_rawConfig';
|
|
155
|
+
tabItems.forEach((tab: any) => {
|
|
156
|
+
PCore.getContextTreeManager().onViewMutate(
|
|
157
|
+
tab.getPConnect().getContextName(),
|
|
158
|
+
tab.getPConnect().getPageReference(),
|
|
159
|
+
tab.getPConnect()[rawConfig].config?.name,
|
|
160
|
+
(messageObject: any) => updateTabErrorsOnViewMutate(messageObject, tab)
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
}, [tabItems, updateTabErrorsOnViewMutate]);
|
|
164
|
+
|
|
165
|
+
const navigateToFirstErrorTab = useCallback(() => {
|
|
166
|
+
const currentErrors = tabErrorsRef.current;
|
|
167
|
+
const firstTabWithError = tabsRef.current.find((tab: any) => {
|
|
168
|
+
const tabErrorState = currentErrors[tab.id];
|
|
169
|
+
return tabErrorState && Object.keys(tabErrorState).length > 0;
|
|
170
|
+
});
|
|
171
|
+
if (firstTabWithError) {
|
|
172
|
+
submitAttemptedRef.current = false;
|
|
173
|
+
setCurrentTabId(firstTabWithError.id);
|
|
174
|
+
}
|
|
175
|
+
}, []);
|
|
176
|
+
|
|
177
|
+
const highlightFirstErrorTab = useCallback(() => {
|
|
178
|
+
submitAttemptedRef.current = true;
|
|
179
|
+
navigateToFirstErrorTab();
|
|
180
|
+
}, [navigateToFirstErrorTab]);
|
|
181
|
+
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
const { CURRENT_ASSIGNMENT_UPDATED } = PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS;
|
|
184
|
+
PCore.getPubSubUtils().subscribe(
|
|
185
|
+
CURRENT_ASSIGNMENT_UPDATED,
|
|
186
|
+
() => {
|
|
187
|
+
tabErrorsRef.current = {};
|
|
188
|
+
submitAttemptedRef.current = false;
|
|
189
|
+
setTabErrors({});
|
|
190
|
+
},
|
|
191
|
+
'CURRENT_ASSIGNMENT_UPDATED-HierarchicalForm'
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
PCore.getPubSubUtils().subscribe(
|
|
195
|
+
PCore.getConstants().PUB_SUB_EVENTS.ERROR_ON_FINISH_ASSIGNMENT,
|
|
196
|
+
highlightFirstErrorTab,
|
|
197
|
+
'ERROR_ON_FINISH_ASSIGNMENT-HierarchicalForm'
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
return () => {
|
|
201
|
+
PCore.getPubSubUtils().unsubscribe(CURRENT_ASSIGNMENT_UPDATED, 'CURRENT_ASSIGNMENT_UPDATED-HierarchicalForm');
|
|
202
|
+
PCore.getPubSubUtils().unsubscribe(
|
|
203
|
+
PCore.getConstants().PUB_SUB_EVENTS.ERROR_ON_FINISH_ASSIGNMENT,
|
|
204
|
+
'ERROR_ON_FINISH_ASSIGNMENT-HierarchicalForm'
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
}, []);
|
|
208
|
+
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (submitAttemptedRef.current) {
|
|
211
|
+
navigateToFirstErrorTab();
|
|
212
|
+
}
|
|
213
|
+
}, [tabErrors, navigateToFirstErrorTab]);
|
|
214
|
+
|
|
215
|
+
const processedTabs = useMemo(() => {
|
|
216
|
+
return tabItems.map(tab => {
|
|
217
|
+
const errorKeys = Object.keys(tabErrors[tab.id] ?? {});
|
|
218
|
+
const errors = errorKeys.length > 0 ? errorKeys.reduce((sum, fieldName) => sum + tabErrors[tab.id][fieldName].length, 0) : undefined;
|
|
219
|
+
return { ...tab, errors };
|
|
220
|
+
});
|
|
221
|
+
}, [tabItems, tabErrors]);
|
|
222
|
+
|
|
223
|
+
return { currentTabId, handleTabClick, processedTabs, instructions };
|
|
224
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './HierarchicalForm';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import { Grid2, Typography } from '@mui/material';
|
|
3
3
|
import makeStyles from '@mui/styles/makeStyles';
|
|
4
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
4
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
5
|
|
|
6
6
|
interface InlineDashboardProps extends PConnProps {
|
|
7
7
|
// If any, enter additional props that only exist on this component
|
|
@@ -50,24 +50,22 @@ export default function InlineDashboard(props: PropsWithChildren<InlineDashboard
|
|
|
50
50
|
</Typography>
|
|
51
51
|
|
|
52
52
|
{filterPosition === 'block-start' && (
|
|
53
|
-
<
|
|
54
|
-
<
|
|
53
|
+
<Grid2 container spacing={2} direction='column-reverse' className={classes.containerStyles}>
|
|
54
|
+
<Grid2 size={{ xs: 12 }} className={classes.colStyles}>
|
|
55
55
|
{childrenToRender[0]}
|
|
56
|
-
</
|
|
57
|
-
<
|
|
56
|
+
</Grid2>
|
|
57
|
+
<Grid2 id='filters' size={{ xs: 12 }} className={classes.filterContainerStyles}>
|
|
58
58
|
{childrenToRender[1]}
|
|
59
|
-
</
|
|
60
|
-
</
|
|
59
|
+
</Grid2>
|
|
60
|
+
</Grid2>
|
|
61
61
|
)}
|
|
62
62
|
{filterPosition !== 'block-start' && (
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
</Grid>
|
|
67
|
-
<Grid id='filters' item xs={3} className={classes.inlineStyles}>
|
|
63
|
+
<Grid2 container spacing={2} direction={direction} className={classes.containerStyles}>
|
|
64
|
+
<Grid2 size={{ xs: 9 }}>{childrenToRender[0]}</Grid2>
|
|
65
|
+
<Grid2 id='filters' size={{ xs: 3 }} className={classes.inlineStyles}>
|
|
68
66
|
{childrenToRender[1]}
|
|
69
|
-
</
|
|
70
|
-
</
|
|
67
|
+
</Grid2>
|
|
68
|
+
</Grid2>
|
|
71
69
|
)}
|
|
72
70
|
</>
|
|
73
71
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useMemo, Children, useEffect, useState, PropsWithChildren } from 'react';
|
|
1
|
+
import { useMemo, Children, useEffect, useState, type PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
3
|
import { buildFilterComponents } from '@pega/react-sdk-components/lib/components/infra/DashboardFilter/filterUtils';
|
|
4
4
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
6
|
|
|
7
7
|
interface InlineDashboardPageProps extends PConnProps {
|
|
8
8
|
// If any, enter additional props that only exist on this component
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
2
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
2
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
3
|
|
|
4
4
|
interface ListPageProps extends PConnProps {
|
|
5
5
|
// If any, enter additional props that only exist on this component
|