@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,244 @@
|
|
|
1
|
+
import React, { createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Button, Grid2, Select, MenuItem, Box } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
5
|
+
import TemplateContext from '@pega/react-sdk-components/lib/components/template/AdvancedSearch/TemplateContext';
|
|
6
|
+
import componentCachePersistUtils from '@pega/react-sdk-components/lib/components/template/AdvancedSearch/SearchGroup/persistUtils';
|
|
7
|
+
|
|
8
|
+
import { getCacheInfo, isValidInput } from './utils';
|
|
9
|
+
import { useCacheWhenListViewReady } from './hooks';
|
|
10
|
+
|
|
11
|
+
export const initializeSearchFields = (searchFields, getPConnect, referenceListClassID, searchFieldRestoreValues = {}) => {
|
|
12
|
+
const filtersProperties = {};
|
|
13
|
+
searchFields.forEach(field => {
|
|
14
|
+
let val = '';
|
|
15
|
+
const { value, defaultValue = '' } = field.config;
|
|
16
|
+
const propPath = PCore.getAnnotationUtils().getPropertyName(value);
|
|
17
|
+
|
|
18
|
+
if (searchFieldRestoreValues[propPath]) {
|
|
19
|
+
val = searchFieldRestoreValues[propPath];
|
|
20
|
+
} else if (PCore.getAnnotationUtils().isProperty(defaultValue)) {
|
|
21
|
+
val = getPConnect().getValue(defaultValue.split(' ')[1]);
|
|
22
|
+
} else if (defaultValue.startsWith('@L')) {
|
|
23
|
+
val = defaultValue.split(' ')[1];
|
|
24
|
+
} else {
|
|
25
|
+
val = defaultValue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
filtersProperties[propPath] = val;
|
|
29
|
+
|
|
30
|
+
const valueSplit = value.split('@P ')[1]?.split('.').filter(Boolean) ?? [];
|
|
31
|
+
valueSplit.pop();
|
|
32
|
+
|
|
33
|
+
if (valueSplit.length) {
|
|
34
|
+
let path = '';
|
|
35
|
+
let currentClassID = referenceListClassID;
|
|
36
|
+
valueSplit.forEach(item => {
|
|
37
|
+
path = path.length ? `${path}.${item}` : item;
|
|
38
|
+
currentClassID = (PCore.getMetadataUtils().getPropertyMetadata(item, currentClassID) as any).pageClass;
|
|
39
|
+
if (currentClassID) {
|
|
40
|
+
filtersProperties[`${path}.classID`] = currentClassID;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return filtersProperties;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const flattenObj = obj => {
|
|
49
|
+
const result = {};
|
|
50
|
+
Object.keys(obj).forEach(key => {
|
|
51
|
+
if (!['context_data', 'pageInstructions'].includes(key)) {
|
|
52
|
+
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
|
53
|
+
const temp = flattenObj(obj[key]);
|
|
54
|
+
Object.keys(temp).forEach(nestedKey => {
|
|
55
|
+
result[`${key}.${nestedKey}`] = temp[nestedKey];
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
result[key] = obj[key];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default function SearchGroups(props) {
|
|
66
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
67
|
+
const { getPConnect, editableField, localeReference, setShowRecords, searchSelectCacheKey, cache } = props;
|
|
68
|
+
const referenceFieldName = editableField.replaceAll('.', '_');
|
|
69
|
+
|
|
70
|
+
const state: any = useRef({ searchFields: {}, activeGroupId: '' }).current;
|
|
71
|
+
const options = componentCachePersistUtils.getComponentStateOptions(getPConnect);
|
|
72
|
+
|
|
73
|
+
const { searchGroups: groups, referenceList } = getPConnect().getConfigProps();
|
|
74
|
+
const { useCache, initialActiveGroupId } = getCacheInfo(cache, groups);
|
|
75
|
+
const [activeGroupId, setActiveGroupId] = useState(initialActiveGroupId);
|
|
76
|
+
const [transientItemID, setTransientItemID] = useState<any>(null);
|
|
77
|
+
const [previousFormValues, setPreviousFormValues] = useState<any>(null);
|
|
78
|
+
const viewName = getPConnect().getCurrentView();
|
|
79
|
+
|
|
80
|
+
const rawGroupsConfig = getPConnect().getRawConfigProps().searchGroups;
|
|
81
|
+
const activeGroupIndex = groups.findIndex(group => group.config.id === activeGroupId);
|
|
82
|
+
const { children: searchFieldsChildren = [] } = activeGroupIndex !== -1 ? rawGroupsConfig[activeGroupIndex] : {};
|
|
83
|
+
const searchFields = searchFieldsChildren.map(field => ({
|
|
84
|
+
...field,
|
|
85
|
+
config: { ...field.config, isSearchField: true }
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
const searchByRef = useRef(null);
|
|
89
|
+
const searchFieldsRef = useRef(null);
|
|
90
|
+
const isValidatorField = searchFields.some(field => field.config.validator);
|
|
91
|
+
const { classID: referenceListClassID } = PCore.getMetadataUtils().getDataPageMetadata(referenceList) as any;
|
|
92
|
+
|
|
93
|
+
const initialSearchFields = useMemo(
|
|
94
|
+
() =>
|
|
95
|
+
initializeSearchFields(
|
|
96
|
+
searchFields,
|
|
97
|
+
getPConnect,
|
|
98
|
+
referenceListClassID,
|
|
99
|
+
useCache && cache.activeGroupId === activeGroupId ? cache.searchFields : {}
|
|
100
|
+
),
|
|
101
|
+
[activeGroupId, getPConnect, cache.searchFields]
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (transientItemID) {
|
|
106
|
+
const filtersWithClassID = {
|
|
107
|
+
...initialSearchFields,
|
|
108
|
+
classID: referenceListClassID
|
|
109
|
+
};
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
PCore.getContainerUtils().replaceTransientData({ transientItemID, data: filtersWithClassID });
|
|
112
|
+
}
|
|
113
|
+
}, [activeGroupId]);
|
|
114
|
+
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const filtersWithClassID = {
|
|
117
|
+
...initialSearchFields,
|
|
118
|
+
classID: referenceListClassID
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const transientId = getPConnect()
|
|
122
|
+
.getContainerManager()
|
|
123
|
+
.addTransientItem({ id: `${referenceFieldName}-${viewName}`, data: filtersWithClassID });
|
|
124
|
+
setTransientItemID(transientId);
|
|
125
|
+
}, []);
|
|
126
|
+
|
|
127
|
+
const getFilterData = useCallback(() => {
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
let changes = PCore.getFormUtils().getSubmitData(transientItemID, {
|
|
130
|
+
isTransientContext: true,
|
|
131
|
+
includeDisabledFields: true
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (Object.keys(cache.searchFields ?? {}).length > 0 && Object.keys(changes).length === 1) {
|
|
135
|
+
changes = cache.searchFields;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const formValues = flattenObj(changes);
|
|
139
|
+
|
|
140
|
+
if (!PCore.isDeepEqual(previousFormValues, formValues) && PCore.getFormUtils().isFormValid(transientItemID) && isValidInput(formValues)) {
|
|
141
|
+
if (isValidatorField) {
|
|
142
|
+
// @ts-ignore
|
|
143
|
+
PCore.getMessageManager().clearContextMessages({ context: transientItemID });
|
|
144
|
+
}
|
|
145
|
+
setPreviousFormValues(formValues);
|
|
146
|
+
setShowRecords(true);
|
|
147
|
+
PCore.getPubSubUtils().publish(PCore.getEvents().getTransientEvent().UPDATE_PROMOTED_FILTERS, {
|
|
148
|
+
payload: formValues,
|
|
149
|
+
showRecords: true,
|
|
150
|
+
viewName
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
state.activeGroupId = activeGroupId;
|
|
155
|
+
state.searchFields = changes;
|
|
156
|
+
state.selectedCategory = viewName;
|
|
157
|
+
|
|
158
|
+
componentCachePersistUtils.setComponentCache({ cacheKey: searchSelectCacheKey, state, options });
|
|
159
|
+
}, [transientItemID, setShowRecords, viewName, activeGroupId, previousFormValues]);
|
|
160
|
+
|
|
161
|
+
const resetFilterData = useCallback(() => {
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
PCore.getNavigationUtils().resetComponentCache(searchSelectCacheKey);
|
|
164
|
+
const resetPayload = {
|
|
165
|
+
transientItemID,
|
|
166
|
+
data: initializeSearchFields(searchFields, getPConnect, referenceListClassID),
|
|
167
|
+
options: { reset: true }
|
|
168
|
+
};
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
PCore.getContainerUtils().updateTransientData(resetPayload);
|
|
171
|
+
}, [transientItemID, initialSearchFields]);
|
|
172
|
+
|
|
173
|
+
useCacheWhenListViewReady(cache, viewName, useCache, getFilterData, searchSelectCacheKey);
|
|
174
|
+
|
|
175
|
+
const searchDropdown = groups.length > 1 && (
|
|
176
|
+
<Grid2 container spacing={2}>
|
|
177
|
+
<Select value={activeGroupId} onChange={e => setActiveGroupId(e.target.value)} ref={searchByRef} fullWidth>
|
|
178
|
+
{groups.map(group => (
|
|
179
|
+
<MenuItem key={group.config.id} value={group.config.id}>
|
|
180
|
+
{group.config.label}
|
|
181
|
+
</MenuItem>
|
|
182
|
+
))}
|
|
183
|
+
</Select>
|
|
184
|
+
</Grid2>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const actionButtons = (
|
|
188
|
+
<Box display='flex' gap={2}>
|
|
189
|
+
<Button variant='outlined' onClick={resetFilterData}>
|
|
190
|
+
{localizedVal('Reset', 'SimpleTable')}
|
|
191
|
+
</Button>
|
|
192
|
+
<Button variant='contained' onClick={getFilterData}>
|
|
193
|
+
{localizedVal('Search', 'SimpleTable')}
|
|
194
|
+
</Button>
|
|
195
|
+
</Box>
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
const searchFieldsViewConfig = {
|
|
199
|
+
name: 'SearchFields',
|
|
200
|
+
type: 'View',
|
|
201
|
+
config: {
|
|
202
|
+
template: 'DefaultForm',
|
|
203
|
+
NumCols: '3',
|
|
204
|
+
contextName: transientItemID,
|
|
205
|
+
readOnly: false,
|
|
206
|
+
context: transientItemID,
|
|
207
|
+
localeReference
|
|
208
|
+
},
|
|
209
|
+
children: [
|
|
210
|
+
{
|
|
211
|
+
name: 'Fields',
|
|
212
|
+
type: 'Region',
|
|
213
|
+
children: searchFields
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const searchFieldsC11nEnv = PCore.createPConnect({
|
|
219
|
+
meta: searchFieldsViewConfig,
|
|
220
|
+
options: {
|
|
221
|
+
hasForm: true,
|
|
222
|
+
contextName: transientItemID
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const templateContext = useContext(TemplateContext);
|
|
227
|
+
const templateContextValue = useMemo(() => ({ ...templateContext, outerColumnCount: undefined }), []);
|
|
228
|
+
|
|
229
|
+
const searchFieldsViewComp = transientItemID ? (
|
|
230
|
+
<TemplateContext.Provider value={templateContextValue}>
|
|
231
|
+
<div ref={searchFieldsRef}>{createElement(createPConnectComponent(), { ...searchFieldsC11nEnv })}</div>
|
|
232
|
+
</TemplateContext.Provider>
|
|
233
|
+
) : null;
|
|
234
|
+
|
|
235
|
+
const childrenToRender = [searchDropdown, searchFieldsViewComp, actionButtons];
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<Box display='flex' flexDirection='column' gap={2}>
|
|
239
|
+
{childrenToRender.map((child, index) => (
|
|
240
|
+
<React.Fragment key={index}>{child}</React.Fragment>
|
|
241
|
+
))}
|
|
242
|
+
</Box>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const listViewConstants = {
|
|
4
|
+
EVENTS: {
|
|
5
|
+
LIST_VIEW_READY: 'LIST_VIEW_READY'
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* This hook registers a callback for the whenever list view component is ready
|
|
10
|
+
* then makes a call to get the data using the search fields pre-filled with cache data.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export function useCacheWhenListViewReady(
|
|
14
|
+
cache: { searchFields: unknown },
|
|
15
|
+
viewName: string,
|
|
16
|
+
useCache: boolean,
|
|
17
|
+
getFilterData: (params: { isCalledFromCache: boolean }) => void,
|
|
18
|
+
searchSelectCacheKey: string
|
|
19
|
+
) {
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (Object.keys(cache.searchFields ?? {}).length > 0) {
|
|
22
|
+
PCore.getPubSubUtils().subscribe(
|
|
23
|
+
listViewConstants.EVENTS.LIST_VIEW_READY,
|
|
24
|
+
({ viewName: viewNameFromListView }: { viewName: string }) => {
|
|
25
|
+
if (viewNameFromListView === viewName && useCache) {
|
|
26
|
+
getFilterData({ isCalledFromCache: true });
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
`${searchSelectCacheKey}-listview-ready`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
PCore.getPubSubUtils().unsubscribe(listViewConstants.EVENTS.LIST_VIEW_READY, `${searchSelectCacheKey}-listview-ready`);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SearchGroups';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function isEmpty(value: any): boolean {
|
|
2
|
+
return (
|
|
3
|
+
// null or undefined
|
|
4
|
+
value === null ||
|
|
5
|
+
value === undefined ||
|
|
6
|
+
((Array.isArray(value) || typeof value === 'string') && value.length === 0) ||
|
|
7
|
+
// is an Object and has no keys
|
|
8
|
+
(value.constructor === Object && Object.keys(value).length === 0)
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function getCacheInfo(
|
|
13
|
+
cache: { selectedCategory: string; activeGroupId: string; searchFields: unknown },
|
|
14
|
+
groups: { config: { id: string } }[]
|
|
15
|
+
) {
|
|
16
|
+
let initialActiveGroupId = groups.length ? groups[0].config.id : '';
|
|
17
|
+
|
|
18
|
+
let useCache = false;
|
|
19
|
+
if (cache.activeGroupId && groups?.find(group => group.config.id === cache.activeGroupId)) {
|
|
20
|
+
initialActiveGroupId = cache.activeGroupId;
|
|
21
|
+
useCache = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return { useCache, initialActiveGroupId };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isValidInput(input: { [s: string]: unknown }) {
|
|
28
|
+
return Object.values(input).some(value => !isEmpty(value));
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const TemplateContext = createContext({
|
|
4
|
+
depth: 0,
|
|
5
|
+
columnCount: 1,
|
|
6
|
+
outerColumnCount: undefined,
|
|
7
|
+
templateOverrideMode: undefined,
|
|
8
|
+
inheritParentLayout: undefined,
|
|
9
|
+
lastContainerItem: undefined
|
|
10
|
+
});
|
|
11
|
+
export default TemplateContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AdvancedSearch';
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
align-items: center;
|
|
23
23
|
height: 100%;
|
|
24
24
|
width: 100%;
|
|
25
|
-
background-color:
|
|
25
|
+
background-color: 'var(--app-background-color)';
|
|
26
26
|
position: fixed;
|
|
27
27
|
z-index: 999;
|
|
28
28
|
top: 0rem;
|
|
@@ -33,7 +33,3 @@
|
|
|
33
33
|
.progress-spinner {
|
|
34
34
|
text-align: center;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
::ng-deep snack-bar-container.snackbar-newline {
|
|
38
|
-
white-space: pre-line;
|
|
39
|
-
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
1
|
+
import { type PropsWithChildren, useEffect, useState } from 'react';
|
|
2
2
|
import makeStyles from '@mui/styles/makeStyles';
|
|
3
3
|
import Avatar from '@mui/material/Avatar';
|
|
4
4
|
|
|
5
5
|
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
6
|
import { NavContext } from '@pega/react-sdk-components/lib/components/helpers/reactContextHelpers';
|
|
7
7
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
8
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
9
|
|
|
10
10
|
import './AppShell.css';
|
|
11
11
|
|
|
@@ -29,9 +29,7 @@ interface AppShellProps extends PConnProps {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const useStyles = makeStyles(theme => ({
|
|
32
|
-
root: {
|
|
33
|
-
display: 'flex'
|
|
34
|
-
},
|
|
32
|
+
root: {},
|
|
35
33
|
content: {
|
|
36
34
|
flexGrow: 1,
|
|
37
35
|
height: '100vh',
|
|
@@ -83,7 +81,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
83
81
|
const classes = useStyles();
|
|
84
82
|
const actionsAPI = pConn.getActionsApi();
|
|
85
83
|
const localeReference = pConn.getValue('.pyLocaleReference', ''); // 2nd arg empty string until typedef marked correctly
|
|
86
|
-
const [imageBlobUrl, setImageBlobUrl] = useState<string | null>(null);
|
|
84
|
+
const [imageBlobUrl, setImageBlobUrl] = useState<string | Blob | null>(null);
|
|
87
85
|
// useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
|
|
88
86
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
89
87
|
const [appName, setAppName] = useState('');
|
|
@@ -114,10 +112,15 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
114
112
|
});
|
|
115
113
|
|
|
116
114
|
setMapChildren(tempMap);
|
|
115
|
+
|
|
116
|
+
/* TODO: We're setting the `pyPortalTemplate` for now, this would be handled by the CoreJS in the future releases */
|
|
117
|
+
if (portalTemplate === 'wss') {
|
|
118
|
+
PCore.getEnvironmentInfo().setEnvironmentInfo({ ...PCore.getEnvironmentInfo().environmentInfoObject, pyPortalTemplate: 'wss' } as any);
|
|
119
|
+
}
|
|
117
120
|
}, []);
|
|
118
121
|
|
|
119
122
|
useEffect(() => {
|
|
120
|
-
// @ts-
|
|
123
|
+
// @ts-expect-error
|
|
121
124
|
const caseTypesAvailableToCreateDP = PCore.getEnvironmentInfo().environmentInfoObject?.pxApplication?.pyCaseTypesAvailableToCreateDP;
|
|
122
125
|
if (caseTypesAvailableToCreateDP) {
|
|
123
126
|
const portalID = pConn.getValue('.pyOwner');
|
|
@@ -135,8 +138,8 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
135
138
|
}
|
|
136
139
|
}, []);
|
|
137
140
|
|
|
138
|
-
const [iconURL, setIconURL] = useState('');
|
|
139
|
-
const [fullIconURL, setFullIconURL] = useState('');
|
|
141
|
+
const [iconURL, setIconURL] = useState<string | Blob>('');
|
|
142
|
+
const [fullIconURL, setFullIconURL] = useState<string | Blob>('');
|
|
140
143
|
useEffect(() => {
|
|
141
144
|
// using the default icon then fetch it from the static folder (not auth involved)
|
|
142
145
|
if (
|
|
@@ -152,14 +155,12 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
152
155
|
// not using default icon to fetch it using the way which uses authentication
|
|
153
156
|
else {
|
|
154
157
|
PCore.getAssetLoader()
|
|
155
|
-
.
|
|
156
|
-
.then(blob => window.URL.createObjectURL(blob))
|
|
158
|
+
.getSvcImageUrl(portalLogo)
|
|
157
159
|
.then(data => {
|
|
158
160
|
setIconURL(data);
|
|
159
161
|
setFullIconURL(data);
|
|
160
162
|
})
|
|
161
163
|
.catch(() => {
|
|
162
|
-
// eslint-disable-next-line no-console
|
|
163
164
|
console.error(`${localizedVal('Unable to load the image for the portal logo/icon with the insName', 'AppShell')}:${portalLogo}`);
|
|
164
165
|
});
|
|
165
166
|
}
|
|
@@ -168,8 +169,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
168
169
|
useEffect(() => {
|
|
169
170
|
if (imageKey && portalTemplate === 'wss') {
|
|
170
171
|
PCore.getAssetLoader()
|
|
171
|
-
.
|
|
172
|
-
.then(blob => window.URL.createObjectURL(blob))
|
|
172
|
+
.getSvcImageUrl(imageKey)
|
|
173
173
|
.then(imagePath => setImageBlobUrl(imagePath));
|
|
174
174
|
}
|
|
175
175
|
}, []);
|
|
@@ -213,7 +213,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
213
213
|
|
|
214
214
|
if (portalTemplate === 'wss') {
|
|
215
215
|
return (
|
|
216
|
-
<div id='AppShell'>
|
|
216
|
+
<div id='AppShell' className={classes.root}>
|
|
217
217
|
<WssNavBar
|
|
218
218
|
portalName={portalName}
|
|
219
219
|
imageSrc={iconURL}
|
|
@@ -239,9 +239,8 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
return (
|
|
242
|
-
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
243
242
|
<NavContext.Provider value={{ open, setOpen }}>
|
|
244
|
-
<div id='AppShell' className={classes.root}>
|
|
243
|
+
<div id='AppShell' className={classes.root} style={{ display: 'flex' }}>
|
|
245
244
|
<NavBar
|
|
246
245
|
getPConnect={getPConnect}
|
|
247
246
|
pConn={getPConnect()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Children, PropsWithChildren, useMemo } from 'react';
|
|
1
|
+
import { Children, type PropsWithChildren, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
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 BannerPageProps extends PConnProps {
|
|
7
7
|
// If any, enter additional props that only exist on this component
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
1
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
|
-
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
4
4
|
|
|
5
5
|
interface CaseSummaryProps extends PConnProps {
|
|
6
|
+
arPrimaryFields: any[];
|
|
7
|
+
arSecondaryFields: any[];
|
|
6
8
|
// If any, enter additional props that only exist on this component
|
|
7
9
|
}
|
|
8
10
|
|
|
@@ -10,27 +12,12 @@ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>)
|
|
|
10
12
|
// Get emitted components from map (so we can get any override that may exist)
|
|
11
13
|
const CaseSummaryFields = getComponentFromMap('CaseSummaryFields');
|
|
12
14
|
|
|
13
|
-
const {
|
|
15
|
+
const { children } = props;
|
|
16
|
+
let { arPrimaryFields = [], arSecondaryFields = [] } = props;
|
|
14
17
|
|
|
15
|
-
const thePConn = getPConnect();
|
|
16
|
-
const theConfigProps: any = thePConn.getConfigProps();
|
|
17
|
-
// const { status, showStatus } = theConfigProps;
|
|
18
|
-
const status = theConfigProps.status;
|
|
19
|
-
const showStatus = theConfigProps.showStatus;
|
|
20
18
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
21
19
|
const localeCategory = 'ModalContainer';
|
|
22
|
-
// from Constellation DX Components
|
|
23
|
-
// get the primary and secondary fields with the raw data (which has the non-resolved property values)
|
|
24
|
-
// const regionsRaw = getPConnect().getRawMetadata().children;
|
|
25
|
-
// const primaryFieldsRaw = regionsRaw[0].children;
|
|
26
|
-
// const secondaryFieldsRaw = regionsRaw[1].children;
|
|
27
20
|
|
|
28
|
-
// From other SDKs
|
|
29
|
-
// may want to move these into useEffect/useState combo
|
|
30
|
-
let arPrimaryFields: any[] = [];
|
|
31
|
-
let arSecondaryFields: any[] = [];
|
|
32
|
-
|
|
33
|
-
/* eslint-disable @typescript-eslint/no-shadow */
|
|
34
21
|
function prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
|
|
35
22
|
const { config, children } = pConnectMeta;
|
|
36
23
|
const pConnect = getPConnect();
|
|
@@ -62,35 +49,30 @@ export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>)
|
|
|
62
49
|
return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
|
|
63
50
|
}
|
|
64
51
|
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
field.config
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
field
|
|
80
|
-
|
|
52
|
+
if (arPrimaryFields.length === 0 && arSecondaryFields.length === 0) {
|
|
53
|
+
for (const child of children as ReactElement[]) {
|
|
54
|
+
const childPConn = (child as ReactElement).props.getPConnect();
|
|
55
|
+
const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
|
|
56
|
+
if (childPConnData.name.toLowerCase() === 'primary fields') {
|
|
57
|
+
arPrimaryFields = childPConnData.children;
|
|
58
|
+
arPrimaryFields.forEach(field => {
|
|
59
|
+
if (field.config?.value && typeof field.config?.value === 'string') {
|
|
60
|
+
field.config.value = localizedVal(field.config.value, localeCategory);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
} else if (childPConnData.name.toLowerCase() === 'secondary fields') {
|
|
64
|
+
const secondarySummaryFields = prepareCaseSummaryData(childPConn);
|
|
65
|
+
arSecondaryFields = childPConnData.children;
|
|
66
|
+
arSecondaryFields.forEach((field, index) => {
|
|
67
|
+
field.config.displayLabel = secondarySummaryFields[index]?.value?.props?.label;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
81
70
|
}
|
|
82
71
|
}
|
|
83
72
|
|
|
84
|
-
// At this point, should hand off to another component for layout and rendering
|
|
85
|
-
// of primary and secondary fields in the Case Summary
|
|
86
|
-
|
|
87
|
-
// debugging/investigation help
|
|
88
|
-
// console.log(`CaseSummary: arPrimaryFields: ${JSON.stringify(arPrimaryFields)}`);
|
|
89
|
-
// console.log(`CaseSummary: arSecondaryFields: ${JSON.stringify(arSecondaryFields)}`);
|
|
90
|
-
|
|
91
73
|
return (
|
|
92
74
|
<div id='CaseSummary'>
|
|
93
|
-
<CaseSummaryFields
|
|
75
|
+
<CaseSummaryFields theFields={arPrimaryFields} />
|
|
94
76
|
<CaseSummaryFields theFields={arSecondaryFields} />
|
|
95
77
|
</div>
|
|
96
78
|
);
|