@pega/react-sdk-overrides 0.23.26 → 0.23.27
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/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +32 -63
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import React, { useCallback, useMemo, useState, createElement
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { useCallback, useMemo, useState, createElement } from 'react';
|
|
3
2
|
import Button from '@material-ui/core/Button';
|
|
4
3
|
|
|
5
4
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import { isEmptyObject } from '@pega/react-sdk-components/lib/components/helpers/common-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
8
7
|
import './PromotedFilters.css';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
10
|
+
|
|
11
|
+
// Can't use PromotedFilterProps until getContainerManager() knows about addTransientItem
|
|
12
|
+
// Currently just expects "object"
|
|
13
|
+
interface PromotedFilterProps extends PConnProps {
|
|
14
|
+
// If any, enter additional props that only exist on this component
|
|
15
|
+
viewName: string;
|
|
16
|
+
filters: any[];
|
|
17
|
+
listViewProps: any;
|
|
18
|
+
pageClass: string;
|
|
19
|
+
parameters?: object;
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
const localeCategory = 'SimpleTable';
|
|
12
23
|
const SUPPORTED_TYPES_IN_PROMOTED_FILTERS = [
|
|
13
24
|
'TextInput',
|
|
@@ -52,17 +63,20 @@ function Filters({ filters, transientItemID, localeReference }) {
|
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
function isValidInput(input) {
|
|
55
|
-
return Object.values(input).findIndex(
|
|
66
|
+
return Object.values(input).findIndex(v => v) >= 0;
|
|
56
67
|
}
|
|
57
68
|
|
|
58
|
-
export default function PromotedFilters(props) {
|
|
69
|
+
export default function PromotedFilters(props: PromotedFilterProps) {
|
|
70
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
71
|
+
const ListView = getComponentFromMap('ListView');
|
|
72
|
+
|
|
59
73
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
60
74
|
const { getPConnect, viewName, filters, listViewProps, pageClass, parameters } = props;
|
|
61
75
|
const [initTable, setInitTable] = useState(false);
|
|
62
76
|
const [payload, setPayload] = useState({});
|
|
63
77
|
const filtersProperties = {};
|
|
64
78
|
|
|
65
|
-
filters.forEach(
|
|
79
|
+
filters.forEach(filter => {
|
|
66
80
|
filtersProperties[PCore.getAnnotationUtils().getPropertyName(filter.config.value)] = '';
|
|
67
81
|
});
|
|
68
82
|
|
|
@@ -84,7 +98,7 @@ export default function PromotedFilters(props) {
|
|
|
84
98
|
lhs: {
|
|
85
99
|
field
|
|
86
100
|
},
|
|
87
|
-
comparator:
|
|
101
|
+
comparator: 'EQ',
|
|
88
102
|
rhs: {
|
|
89
103
|
value
|
|
90
104
|
}
|
|
@@ -95,12 +109,12 @@ export default function PromotedFilters(props) {
|
|
|
95
109
|
}
|
|
96
110
|
|
|
97
111
|
const getFilterData = useCallback(
|
|
98
|
-
|
|
112
|
+
e => {
|
|
99
113
|
e.preventDefault(); // to prevent un-intended forms submission.
|
|
100
114
|
|
|
101
115
|
const changes = PCore.getFormUtils().getChanges(transientItemID);
|
|
102
116
|
const formValues = {};
|
|
103
|
-
Object.keys(changes).forEach(
|
|
117
|
+
Object.keys(changes).forEach(key => {
|
|
104
118
|
if (!['context_data', 'pageInstructions'].includes(key)) {
|
|
105
119
|
formValues[key] = changes[key];
|
|
106
120
|
}
|
|
@@ -112,7 +126,7 @@ export default function PromotedFilters(props) {
|
|
|
112
126
|
dataViewParameters: parameters
|
|
113
127
|
};
|
|
114
128
|
|
|
115
|
-
if (!
|
|
129
|
+
if (!isEmptyObject(promotedFilters)) {
|
|
116
130
|
Query.query = { filter: { filterConditions: promotedFilters } };
|
|
117
131
|
}
|
|
118
132
|
setPayload(Query);
|
|
@@ -128,34 +142,30 @@ export default function PromotedFilters(props) {
|
|
|
128
142
|
}, [transientItemID]);
|
|
129
143
|
|
|
130
144
|
return (
|
|
131
|
-
|
|
145
|
+
<>
|
|
132
146
|
<div>{listViewProps.title}</div>
|
|
133
|
-
<div className=
|
|
134
|
-
<Filters filters={filters} transientItemID={transientItemID} localeReference={listViewProps.localeReference}/>
|
|
147
|
+
<div className='psdk-grid-filter'>
|
|
148
|
+
<Filters filters={filters} transientItemID={transientItemID} localeReference={listViewProps.localeReference} />
|
|
135
149
|
</div>
|
|
136
150
|
<div>
|
|
137
151
|
<Button key='1' type='button' onClick={clearFilterData} data-testid='clear' variant='contained' color='primary'>
|
|
138
|
-
|
|
152
|
+
{localizedVal('Clear', localeCategory)}
|
|
139
153
|
</Button>
|
|
140
|
-
<Button style={{float: 'right'}} key='2' type='submit' onClick={getFilterData} data-testid='search' variant='contained' color='primary'>
|
|
141
|
-
|
|
154
|
+
<Button style={{ float: 'right' }} key='2' type='submit' onClick={getFilterData} data-testid='search' variant='contained' color='primary'>
|
|
155
|
+
{localizedVal('Search', localeCategory)}
|
|
142
156
|
</Button>
|
|
143
157
|
</div>
|
|
144
|
-
{initTable &&
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
{initTable && (
|
|
159
|
+
<ListView
|
|
160
|
+
{...listViewProps}
|
|
161
|
+
title=''
|
|
162
|
+
payload={payload}
|
|
163
|
+
isSearchable
|
|
164
|
+
tableDisplay={{
|
|
165
|
+
show: initTable
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
)}
|
|
169
|
+
</>
|
|
151
170
|
);
|
|
152
171
|
}
|
|
153
|
-
|
|
154
|
-
PromotedFilters.propTypes = {
|
|
155
|
-
getPConnect: PropTypes.func.isRequired,
|
|
156
|
-
viewName: PropTypes.string.isRequired,
|
|
157
|
-
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
158
|
-
listViewProps: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
159
|
-
pageClass: PropTypes.string.isRequired,
|
|
160
|
-
parameters: PropTypes.object
|
|
161
|
-
};
|
|
@@ -1,28 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import SimpleTableManual from '@pega/react-sdk-components/lib/components/template/SimpleTable/SimpleTableManual';
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import { useRef } from 'react';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import { buildMetaForListView, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
// Can't use SimpleTableProps until getComponentConfig() and getFieldMetadata() are NOT private
|
|
10
|
+
interface SimpleTableProps extends PConnProps {
|
|
11
|
+
// If any, enter additional props that only exist on this component
|
|
12
|
+
multiRecordDisplayAs: string;
|
|
13
|
+
allowTableEdit: boolean;
|
|
14
|
+
contextClass: any;
|
|
15
|
+
label: string;
|
|
16
|
+
propertyLabel?: string;
|
|
17
|
+
displayMode?: string;
|
|
18
|
+
fieldMetadata?: any;
|
|
19
|
+
hideLabel?: boolean;
|
|
20
|
+
parameters?: any;
|
|
21
|
+
isDataObject?: boolean;
|
|
22
|
+
type?: string;
|
|
23
|
+
ruleClass?: string;
|
|
24
|
+
authorContext?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function SimpleTable(props: SimpleTableProps) {
|
|
29
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
30
|
+
const ListView = getComponentFromMap('ListView');
|
|
31
|
+
const FieldGroupTemplate = getComponentFromMap('FieldGroupTemplate');
|
|
32
|
+
const SimpleTableManual = getComponentFromMap('SimpleTableManual');
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
getPConnect,
|
|
36
|
+
multiRecordDisplayAs,
|
|
37
|
+
allowTableEdit,
|
|
38
|
+
label: labelProp,
|
|
39
|
+
propertyLabel,
|
|
40
|
+
displayMode,
|
|
41
|
+
fieldMetadata,
|
|
42
|
+
hideLabel,
|
|
43
|
+
parameters,
|
|
44
|
+
isDataObject,
|
|
45
|
+
type,
|
|
46
|
+
ruleClass,
|
|
47
|
+
authorContext,
|
|
48
|
+
name
|
|
49
|
+
} = props;
|
|
9
50
|
|
|
10
51
|
let { contextClass } = props;
|
|
11
52
|
if (!contextClass) {
|
|
53
|
+
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
12
54
|
let listName = getPConnect().getComponentConfig().referenceList;
|
|
13
55
|
listName = PCore.getAnnotationUtils().getPropertyName(listName);
|
|
14
|
-
contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
|
|
56
|
+
// was... contextClass = getPConnect().getFieldMetadata(listName)?.pageClass;
|
|
57
|
+
// @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
|
|
58
|
+
const theFieldMetadata = getPConnect().getFieldMetadata(listName);
|
|
59
|
+
if (theFieldMetadata) {
|
|
60
|
+
contextClass = theFieldMetadata.pageClass;
|
|
61
|
+
} else {
|
|
62
|
+
contextClass = undefined;
|
|
63
|
+
}
|
|
15
64
|
}
|
|
16
65
|
if (multiRecordDisplayAs === 'fieldGroup') {
|
|
17
66
|
const fieldGroupProps = { ...props, contextClass };
|
|
18
67
|
return <FieldGroupTemplate {...fieldGroupProps} />;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const label = labelProp || propertyLabel;
|
|
71
|
+
const propsToUse = { label, ...getPConnect().getInheritedProps() };
|
|
72
|
+
const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
|
|
73
|
+
|
|
74
|
+
if (fieldMetadata && fieldMetadata.type === 'Page List' && fieldMetadata.dataRetrievalType === 'refer') {
|
|
75
|
+
const {
|
|
76
|
+
children: [{ children: rawFields }],
|
|
77
|
+
parameters: rawParams
|
|
78
|
+
} = (getPConnect().getRawMetadata() as any).config;
|
|
79
|
+
if (isDisplayModeEnabled && hideLabel) {
|
|
80
|
+
propsToUse.label = '';
|
|
25
81
|
}
|
|
26
|
-
|
|
82
|
+
|
|
83
|
+
const metaForListView = buildMetaForListView(
|
|
84
|
+
fieldMetadata,
|
|
85
|
+
rawFields,
|
|
86
|
+
type,
|
|
87
|
+
ruleClass,
|
|
88
|
+
name,
|
|
89
|
+
propsToUse.label,
|
|
90
|
+
isDataObject,
|
|
91
|
+
parameters // resolved params
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const metaForPConnect = JSON.parse(JSON.stringify(metaForListView));
|
|
95
|
+
// @ts-ignore - PCore.getMetadataUtils().getPropertyMetadata - An argument for 'currentClassID' was not provided.
|
|
96
|
+
metaForPConnect.config.parameters = rawParams ?? PCore.getMetadataUtils().getPropertyMetadata(name)?.datasource?.parameters;
|
|
97
|
+
|
|
98
|
+
const { referenceListStr: referenceList } = getContext(getPConnect());
|
|
99
|
+
let requiredContextForQueryInDisplayMode = {};
|
|
100
|
+
if (isDisplayModeEnabled) {
|
|
101
|
+
requiredContextForQueryInDisplayMode = {
|
|
102
|
+
referenceList
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const options = {
|
|
106
|
+
context: getPConnect().getContextName(),
|
|
107
|
+
pageReference: getPConnect().getPageReference(),
|
|
108
|
+
...requiredContextForQueryInDisplayMode
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const refToPConnect = useRef(PCore.createPConnect({ meta: metaForPConnect, options }).getPConnect).current; // getPConnect should be created only once.
|
|
112
|
+
/* BUG-637178 : need to send context */
|
|
113
|
+
const listViewProps = {
|
|
114
|
+
...metaForListView.config,
|
|
115
|
+
getPConnect: refToPConnect,
|
|
116
|
+
displayMode,
|
|
117
|
+
fieldName: authorContext,
|
|
118
|
+
bInForm: true
|
|
119
|
+
};
|
|
120
|
+
return <ListView {...listViewProps} />;
|
|
121
|
+
}
|
|
122
|
+
const simpleTableManualProps: any = { ...props, contextClass };
|
|
123
|
+
if (allowTableEdit === false) {
|
|
124
|
+
simpleTableManualProps.hideAddRow = true;
|
|
125
|
+
simpleTableManualProps.hideDeleteRow = true;
|
|
126
|
+
simpleTableManualProps.disableDragDrop = true;
|
|
27
127
|
}
|
|
128
|
+
return <SimpleTableManual {...simpleTableManualProps} />;
|
|
28
129
|
}
|