@pega/react-sdk-overrides 8.23.10 → 23.1.10
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.tsx +47 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
- package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
- package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
- package/lib/field/AutoComplete/AutoComplete.tsx +38 -19
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
- package/lib/field/Checkbox/Checkbox.tsx +42 -9
- package/lib/field/Currency/Currency.tsx +24 -16
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +32 -18
- package/lib/field/DateTime/DateTime.tsx +27 -16
- package/lib/field/Decimal/Decimal.tsx +82 -19
- package/lib/field/Dropdown/Dropdown.tsx +60 -15
- package/lib/field/Email/Email.tsx +17 -9
- package/lib/field/Integer/Integer.tsx +15 -7
- package/lib/field/Percentage/Percentage.tsx +15 -7
- package/lib/field/Phone/Phone.tsx +21 -12
- package/lib/field/RadioButtons/RadioButtons.tsx +57 -28
- package/lib/field/RichText/RichText.tsx +95 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +73 -0
- package/lib/field/ScalarList/config-ext.json +8 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/utils.ts +2 -1
- package/lib/field/TextArea/TextArea.tsx +14 -5
- package/lib/field/TextContent/TextContent.tsx +10 -1
- package/lib/field/TextInput/TextInput.tsx +40 -11
- package/lib/field/Time/Time.tsx +29 -26
- package/lib/field/URL/URL.tsx +24 -8
- package/lib/field/UserReference/UserReference.tsx +52 -60
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
- package/lib/helpers/auth.js +752 -401
- package/lib/helpers/authManager.ts +933 -0
- package/lib/helpers/case-utils.tsx +103 -0
- package/lib/helpers/common-utils.ts +4 -0
- package/lib/helpers/config_access.js +63 -145
- package/lib/helpers/data_page.ts +2 -1
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +10 -11
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
- package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
- package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
- package/lib/helpers/formatters/{common.js → common.ts} +4 -4
- package/lib/helpers/formatters/{index.js → index.ts} +3 -3
- package/lib/helpers/simpleTableHelpers.ts +10 -6
- package/lib/helpers/state-utils.tsx +47 -0
- package/lib/helpers/template-utils.ts +3 -4
- package/lib/helpers/utils.ts +12 -4
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
- package/lib/infra/Assignment/Assignment.tsx +44 -35
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
- package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -25
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -30
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
- package/lib/infra/DashboardFilter/filterUtils.tsx +4 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -20
- package/lib/infra/MultiStep/MultiStep.tsx +24 -24
- package/lib/infra/NavBar/NavBar.tsx +23 -24
- package/lib/infra/Reference/Reference.tsx +14 -18
- package/lib/infra/Region/Region.tsx +8 -6
- package/lib/infra/RootContainer/RootContainer.tsx +32 -39
- package/lib/infra/Stages/Stages.tsx +15 -9
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
- package/lib/infra/View/View.tsx +30 -57
- package/lib/template/AppShell/AppShell.tsx +51 -34
- package/lib/template/BannerPage/BannerPage.tsx +26 -31
- package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
- package/lib/template/CaseView/CaseView.tsx +137 -100
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
- package/lib/template/Confirmation/Confirmation.tsx +29 -52
- package/lib/template/DataReference/DataReference.tsx +51 -53
- package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +16 -17
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +78 -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 -27
- package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +20 -18
- package/lib/template/ListPage/ListPage.tsx +14 -13
- package/lib/template/ListView/ListView.tsx +244 -314
- package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
- package/lib/template/ListView/{utils.js → utils.ts} +172 -23
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
- package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +29 -8
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +33 -36
- package/lib/template/SubTabs/SubTabs.tsx +10 -11
- package/lib/template/SubTabs/tabUtils.ts +0 -2
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
- package/lib/widget/Attachment/Attachment.css +15 -3
- package/lib/widget/Attachment/Attachment.tsx +51 -32
- package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
- package/lib/widget/Followers/Followers.tsx +10 -11
- package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
- package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
- package/lib/widget/SummaryList/SummaryList.tsx +17 -3
- package/lib/widget/ToDo/ToDo.tsx +69 -104
- package/package.json +1 -1
- package/lib/helpers/authManager.js +0 -631
- /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
- /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
- /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
2
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
|
+
|
|
4
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
// ReferenceProps can't be used until getComponentConfig() is NOT private
|
|
7
|
+
interface DataReferenceProps extends PConnProps {
|
|
8
|
+
// If any, enter additional props that only exist on this component
|
|
9
|
+
children: Array<any>;
|
|
10
|
+
label: string;
|
|
11
|
+
showLabel: any;
|
|
12
|
+
displayMode: string;
|
|
13
|
+
allowAndPersistChangesInReviewMode: boolean;
|
|
14
|
+
referenceType: string;
|
|
15
|
+
selectionMode: string;
|
|
16
|
+
displayAs: string;
|
|
17
|
+
ruleClass: string;
|
|
18
|
+
parameters: Array<string>; // need to fix
|
|
19
|
+
hideLabel: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
|
|
6
23
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
7
24
|
|
|
25
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows ~7 errors)
|
|
8
26
|
declare const PCore: any;
|
|
9
27
|
|
|
10
|
-
|
|
28
|
+
|
|
29
|
+
export default function DataReference(props: DataReferenceProps) {
|
|
30
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
31
|
+
const SingleReferenceReadonly = getComponentFromMap('SingleReferenceReadOnly');
|
|
32
|
+
const MultiReferenceReadonly = getComponentFromMap('MultiReferenceReadOnly');
|
|
33
|
+
|
|
11
34
|
const {
|
|
12
35
|
children,
|
|
13
36
|
getPConnect,
|
|
@@ -25,14 +48,14 @@ export default function DataReference(props) {
|
|
|
25
48
|
let childrenToRender = children;
|
|
26
49
|
const pConn = getPConnect();
|
|
27
50
|
const [dropDownDataSource, setDropDownDataSource] = useState(null);
|
|
28
|
-
const propsToUse = { label, showLabel, ...pConn.getInheritedProps() };
|
|
51
|
+
const propsToUse: any = { label, showLabel, ...pConn.getInheritedProps() };
|
|
29
52
|
if (propsToUse.showLabel === false) {
|
|
30
53
|
propsToUse.label = '';
|
|
31
54
|
}
|
|
32
55
|
const rawViewMetadata = pConn.getRawMetadata();
|
|
33
|
-
const viewName = rawViewMetadata
|
|
34
|
-
const [firstChildMeta] = rawViewMetadata
|
|
35
|
-
const refList = rawViewMetadata
|
|
56
|
+
const viewName = rawViewMetadata["name"];
|
|
57
|
+
const [firstChildMeta] = rawViewMetadata["children"];
|
|
58
|
+
const refList = rawViewMetadata["config"].referenceList;
|
|
36
59
|
const canBeChangedInReviewMode = allowAndPersistChangesInReviewMode && (displayAs === 'autocomplete' || displayAs === 'dropdown');
|
|
37
60
|
let propName;
|
|
38
61
|
const isDisplayModeEnabled = ['LABELS_LEFT', 'STACKED_LARGE_VAL'].includes(displayMode);
|
|
@@ -42,7 +65,7 @@ export default function DataReference(props) {
|
|
|
42
65
|
useEffect(() => {
|
|
43
66
|
if (
|
|
44
67
|
firstChildMeta?.type === "Dropdown" &&
|
|
45
|
-
rawViewMetadata
|
|
68
|
+
rawViewMetadata["config"]?.parameters
|
|
46
69
|
) {
|
|
47
70
|
const { value, key, text } = firstChildMeta.config.datasource.fields;
|
|
48
71
|
PCore.getDataApiUtils()
|
|
@@ -76,20 +99,20 @@ export default function DataReference(props) {
|
|
|
76
99
|
}, [firstChildMeta, rawViewMetadata, parameters]);
|
|
77
100
|
|
|
78
101
|
if (firstChildMeta?.type !== 'Region') {
|
|
79
|
-
firstChildPConnect = getPConnect().getChildren()[0].getPConnect;
|
|
102
|
+
firstChildPConnect = getPConnect().getChildren()?.[0].getPConnect;
|
|
80
103
|
/* remove refresh When condition from those old view so that it will not be used for runtime */
|
|
81
104
|
if (firstChildMeta.config?.readOnly) {
|
|
82
105
|
delete firstChildMeta.config.readOnly;
|
|
83
106
|
}
|
|
84
107
|
if (firstChildMeta?.type === 'Dropdown') {
|
|
85
|
-
firstChildMeta.config.datasource.source = rawViewMetadata
|
|
108
|
+
firstChildMeta.config.datasource.source = rawViewMetadata["config"]?.parameters
|
|
86
109
|
? dropDownDataSource
|
|
87
110
|
: '@DATASOURCE '.concat(refList).concat('.pxResults');
|
|
88
111
|
} else if (firstChildMeta?.type === 'AutoComplete') {
|
|
89
112
|
firstChildMeta.config.datasource = refList;
|
|
90
113
|
|
|
91
114
|
/* Insert the parameters to the component only if present */
|
|
92
|
-
if (rawViewMetadata
|
|
115
|
+
if (rawViewMetadata["config"]?.parameters) {
|
|
93
116
|
firstChildMeta.config.parameters = parameters;
|
|
94
117
|
}
|
|
95
118
|
}
|
|
@@ -107,10 +130,10 @@ export default function DataReference(props) {
|
|
|
107
130
|
const handleSelection = event => {
|
|
108
131
|
const caseKey = pConn.getCaseInfo().getKey();
|
|
109
132
|
const refreshOptions = { autoDetectRefresh: true };
|
|
110
|
-
if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName')) {
|
|
133
|
+
if (canBeChangedInReviewMode && pConn.getValue('__currentPageTabViewName', '')) { // 2nd arg empty string until typedef marked correctly
|
|
111
134
|
getPConnect()
|
|
112
135
|
.getActionsApi()
|
|
113
|
-
.refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName'), null, refreshOptions);
|
|
136
|
+
.refreshCaseView(caseKey, pConn.getValue('__currentPageTabViewName', ''), null, refreshOptions); // 2nd arg empty string until typedef marked correctly
|
|
114
137
|
PCore.getDeferLoadManager().refreshActiveComponents(pConn.getContextName());
|
|
115
138
|
} else {
|
|
116
139
|
const pgRef = pConn.getPageReference().replace('caseInfo.content', '');
|
|
@@ -168,8 +191,10 @@ export default function DataReference(props) {
|
|
|
168
191
|
const recreatedFirstChild = useMemo(() => {
|
|
169
192
|
const { type, config } = firstChildMeta;
|
|
170
193
|
if (firstChildMeta?.type !== 'Region') {
|
|
171
|
-
pConn.clearErrorMessages({
|
|
172
|
-
property: propName
|
|
194
|
+
pConn.clearErrorMessages({ // Need to add empty string for category and context to match typdef
|
|
195
|
+
property: propName,
|
|
196
|
+
category: '',
|
|
197
|
+
context: ''
|
|
173
198
|
});
|
|
174
199
|
if (!canBeChangedInReviewMode && isDisplayModeEnabled && selectionMode === SELECTION_MODE.SINGLE) {
|
|
175
200
|
return (
|
|
@@ -184,7 +209,7 @@ export default function DataReference(props) {
|
|
|
184
209
|
referenceType={referenceType}
|
|
185
210
|
hideLabel={hideLabel}
|
|
186
211
|
dataRelationshipContext={
|
|
187
|
-
rawViewMetadata
|
|
212
|
+
rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name ? rawViewMetadata["config"].name : null
|
|
188
213
|
}
|
|
189
214
|
/>
|
|
190
215
|
);
|
|
@@ -204,7 +229,7 @@ export default function DataReference(props) {
|
|
|
204
229
|
// In the case of a datasource with parameters you cannot load the dropdown before the parameters
|
|
205
230
|
if (
|
|
206
231
|
type === 'Dropdown' &&
|
|
207
|
-
rawViewMetadata
|
|
232
|
+
rawViewMetadata["config"]?.parameters &&
|
|
208
233
|
dropDownDataSource === null
|
|
209
234
|
) {
|
|
210
235
|
return null;
|
|
@@ -219,18 +244,19 @@ export default function DataReference(props) {
|
|
|
219
244
|
disabled: propsToUse.disabled,
|
|
220
245
|
label: propsToUse.label,
|
|
221
246
|
viewName: getPConnect().getCurrentView(),
|
|
222
|
-
parameters: rawViewMetadata
|
|
247
|
+
parameters: rawViewMetadata["config"].parameters,
|
|
223
248
|
readOnly: false,
|
|
224
|
-
localeReference: rawViewMetadata
|
|
249
|
+
localeReference: rawViewMetadata["config"].localeReference,
|
|
225
250
|
...(selectionMode === SELECTION_MODE.SINGLE ? { referenceType } : ''),
|
|
226
251
|
dataRelationshipContext:
|
|
227
|
-
rawViewMetadata
|
|
228
|
-
? rawViewMetadata
|
|
252
|
+
rawViewMetadata["config"].contextClass && rawViewMetadata["config"].name
|
|
253
|
+
? rawViewMetadata["config"].name
|
|
229
254
|
: null,
|
|
230
255
|
hideLabel,
|
|
231
256
|
onRecordChange: handleSelection
|
|
232
|
-
}
|
|
233
|
-
}
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
'', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
|
|
234
260
|
}
|
|
235
261
|
}, [
|
|
236
262
|
firstChildMeta.config?.datasource?.source,
|
|
@@ -242,7 +268,7 @@ export default function DataReference(props) {
|
|
|
242
268
|
|
|
243
269
|
// Only include the views region for rendering when it has content
|
|
244
270
|
if (firstChildMeta?.type !== 'Region') {
|
|
245
|
-
const viewsRegion = rawViewMetadata
|
|
271
|
+
const viewsRegion = rawViewMetadata["children"][1];
|
|
246
272
|
if (viewsRegion?.name === 'Views' && viewsRegion.children.length) {
|
|
247
273
|
childrenToRender = [recreatedFirstChild, ...children.slice(1)];
|
|
248
274
|
} else {
|
|
@@ -260,31 +286,3 @@ export default function DataReference(props) {
|
|
|
260
286
|
</div>
|
|
261
287
|
);
|
|
262
288
|
}
|
|
263
|
-
|
|
264
|
-
DataReference.defaultProps = {
|
|
265
|
-
label: undefined,
|
|
266
|
-
showLabel: undefined,
|
|
267
|
-
displayMode: undefined,
|
|
268
|
-
allowAndPersistChangesInReviewMode: false,
|
|
269
|
-
referenceType: '',
|
|
270
|
-
selectionMode: '',
|
|
271
|
-
displayAs: '',
|
|
272
|
-
ruleClass: '',
|
|
273
|
-
parameters: undefined,
|
|
274
|
-
hideLabel: false
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
DataReference.propTypes = {
|
|
278
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
279
|
-
getPConnect: PropTypes.func.isRequired,
|
|
280
|
-
label: PropTypes.string,
|
|
281
|
-
showLabel: PropTypes.func,
|
|
282
|
-
displayMode: PropTypes.string,
|
|
283
|
-
allowAndPersistChangesInReviewMode: PropTypes.bool,
|
|
284
|
-
referenceType: PropTypes.string,
|
|
285
|
-
selectionMode: PropTypes.string,
|
|
286
|
-
displayAs: PropTypes.string,
|
|
287
|
-
ruleClass: PropTypes.string,
|
|
288
|
-
parameters: PropTypes.arrayOf(PropTypes.string), // need to fix
|
|
289
|
-
hideLabel: PropTypes.bool
|
|
290
|
-
};
|
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
2
|
import { getInstructions } from '@pega/react-sdk-components/lib/components/helpers/template-utils';
|
|
5
3
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
4
|
+
import connectToState from '@pega/react-sdk-components/lib/components/helpers/state-utils';
|
|
5
|
+
import { getKeyForMappedField, mapStateToProps } from './utils';
|
|
6
|
+
// import type { PConnProps } from '../../../types/PConnProps';
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
import './DefaultForm.css';
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
// Can't use PConn props until proper props for getPConnect().getChildren()[0].getPConnect;
|
|
13
|
+
// interface DefaultFormProps extends PConnProps {
|
|
14
|
+
// // If any, enter additional props that only exist on this component
|
|
15
|
+
// children: Array<any>,
|
|
16
|
+
// NumCols: string
|
|
17
|
+
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const Child = connectToState(mapStateToProps)(props => {
|
|
22
|
+
const { key, visibility, ...rest } = props;
|
|
23
|
+
|
|
24
|
+
return createElement(createPConnectComponent(), { ...rest, key, visibility });
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default function DefaultForm(props /* : DefaultFormProps */) {
|
|
28
|
+
const { getPConnect, NumCols = '1' } = props;
|
|
11
29
|
const instructions = getInstructions(getPConnect(), props.instructions);
|
|
12
|
-
const instructionText = instructions?.replace(/<\/?[^>]+(>|$)/g, '');
|
|
13
30
|
|
|
14
31
|
let divClass: string;
|
|
15
32
|
|
|
@@ -35,26 +52,18 @@ export default function DefaultForm(props) {
|
|
|
35
52
|
// to take the children and create components for them, put in an array and pass as the
|
|
36
53
|
// defaultForm kids
|
|
37
54
|
const arChildren = getPConnect().getChildren()[0].getPConnect().getChildren();
|
|
38
|
-
const dfChildren = arChildren.map((kid
|
|
39
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
40
|
-
createElement(createPConnectComponent(), { ...kid, key: idx })
|
|
41
|
-
);
|
|
55
|
+
const dfChildren = arChildren.map(kid => <Child key={getKeyForMappedField(kid)} {...kid} />);
|
|
42
56
|
|
|
43
57
|
return (
|
|
44
58
|
<>
|
|
45
|
-
{
|
|
46
|
-
<div className='psdk-default-form-instruction-text'>
|
|
59
|
+
{instructions && (
|
|
60
|
+
<div className='psdk-default-form-instruction-text'>
|
|
61
|
+
{/* server performs sanitization method for instructions html content */}
|
|
62
|
+
{ /* eslint-disable react/no-danger */ }
|
|
63
|
+
<div key="instructions" id="instruction-text" dangerouslySetInnerHTML={{ __html: instructions }} />
|
|
64
|
+
</div>
|
|
47
65
|
)}
|
|
48
66
|
<div className={divClass}>{dfChildren}</div>
|
|
49
67
|
</>
|
|
50
68
|
);
|
|
51
69
|
}
|
|
52
|
-
|
|
53
|
-
DefaultForm.propTypes = {
|
|
54
|
-
// children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
55
|
-
NumCols: PropTypes.string
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
DefaultForm.defaultProps = {
|
|
59
|
-
NumCols: '1'
|
|
60
|
-
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
|
|
3
|
+
export const mapStateToProps: any = (_, ownProps) => {
|
|
4
|
+
const { getPConnect } = ownProps;
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
visibility: getPConnect().getComputedVisibility(),
|
|
8
|
+
getPConnect
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const getKeyForMappedField = field => {
|
|
13
|
+
if (Array.isArray(field)) {
|
|
14
|
+
return field
|
|
15
|
+
.map(item => {
|
|
16
|
+
return getKeyForMappedField(item);
|
|
17
|
+
})
|
|
18
|
+
.join('__');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const pConnect = field?.getPConnect?.();
|
|
22
|
+
|
|
23
|
+
if (pConnect?.meta?.type && pConnect?.meta?.config?.name) {
|
|
24
|
+
return `${pConnect.meta.type}_${pConnect.meta.config.name}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Using label as a fallback if name is not defined.
|
|
28
|
+
if (pConnect?.meta?.type && pConnect?.meta?.config?.label) {
|
|
29
|
+
return `${pConnect.meta.type}_${pConnect.meta.config.label}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return uuidv4();
|
|
33
|
+
};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Grid from '@material-ui/core/Grid';
|
|
4
3
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
5
|
-
import
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
+
|
|
6
|
+
// import type { PConnProps } from '../../../../types/PConnProps';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Can't use PConnProps until getPConnect().getChildren() type is ok
|
|
10
|
+
// interface DetailsProps extends PConnProps {
|
|
11
|
+
// // If any, enter additional props that only exist on this component
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export default function Details(props /* : DetailsProps */) {
|
|
16
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
17
|
+
const FieldGroup = getComponentFromMap('FieldGroup');
|
|
6
18
|
|
|
7
|
-
export default function Details(props) {
|
|
8
19
|
const { label, showLabel, getPConnect, showHighlightedData } = props;
|
|
9
20
|
|
|
10
21
|
// Get the inherited props from the parent to determine label settings
|
|
@@ -37,7 +48,8 @@ export default function Details(props) {
|
|
|
37
48
|
field.config.displayAsStatus = true;
|
|
38
49
|
}
|
|
39
50
|
|
|
40
|
-
return getPConnect().createComponent(field
|
|
51
|
+
return getPConnect().createComponent(field,
|
|
52
|
+
'', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
|
|
41
53
|
});
|
|
42
54
|
}
|
|
43
55
|
|
|
@@ -62,16 +74,3 @@ export default function Details(props) {
|
|
|
62
74
|
</FieldGroup>
|
|
63
75
|
);
|
|
64
76
|
}
|
|
65
|
-
|
|
66
|
-
Details.defaultProps = {
|
|
67
|
-
label: undefined,
|
|
68
|
-
showLabel: true,
|
|
69
|
-
showHighlightedData: false
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Details.propTypes = {
|
|
73
|
-
showLabel: PropTypes.bool,
|
|
74
|
-
label: PropTypes.string,
|
|
75
|
-
getPConnect: PropTypes.func.isRequired,
|
|
76
|
-
showHighlightedData: PropTypes.bool
|
|
77
|
-
};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { useState, useEffect, Fragment } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { getTransientTabs, getVisibleTabs, tabClick } from '@pega/react-sdk-components/lib/components/template/SubTabs/tabUtils';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { Tab, Tabs, TextField } from '@material-ui/core';
|
|
6
5
|
import { TabContext, TabPanel } from '@material-ui/lab';
|
|
6
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
interface DetailsSubTabsProps extends PConnProps {
|
|
10
|
+
// If any, enter additional props that only exist on this component
|
|
11
|
+
children: Array<any>,
|
|
12
|
+
showLabel: boolean,
|
|
13
|
+
label: string
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default function DetailsSubTabs(props: DetailsSubTabsProps) {
|
|
19
|
+
const { children = [], label, showLabel = true, getPConnect } = props;
|
|
10
20
|
// Get the inherited props from the parent to determine label settings
|
|
11
21
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
12
22
|
|
|
@@ -50,16 +60,3 @@ export default function DetailsSubTabs(props) {
|
|
|
50
60
|
</Fragment>
|
|
51
61
|
);
|
|
52
62
|
}
|
|
53
|
-
|
|
54
|
-
DetailsSubTabs.defaultProps = {
|
|
55
|
-
children: [],
|
|
56
|
-
label: undefined,
|
|
57
|
-
showLabel: true
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
DetailsSubTabs.propTypes = {
|
|
61
|
-
children: PropTypes.arrayOf(PropTypes.node),
|
|
62
|
-
showLabel: PropTypes.bool,
|
|
63
|
-
label: PropTypes.string,
|
|
64
|
-
getPConnect: PropTypes.func.isRequired
|
|
65
|
-
};
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Grid from '@material-ui/core/Grid';
|
|
4
3
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
5
|
-
import
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// import type { PConnProps } from '../../../../types/PConnProps';
|
|
7
|
+
|
|
8
|
+
// Can't use PConnProps until getPConnect().getChildren() type is ok
|
|
9
|
+
// interface DetailsThreeColumnProps extends PConnProps {
|
|
10
|
+
// // If any, enter additional props that only exist on this component
|
|
11
|
+
// showLabel: boolean,
|
|
12
|
+
// label: string,
|
|
13
|
+
// showHighlightedData: boolean
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export default function DetailsThreeColumn(props /* : DetailsThreeColumnProps */) {
|
|
18
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
19
|
+
const FieldGroup = getComponentFromMap('FieldGroup');
|
|
20
|
+
|
|
21
|
+
const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
|
|
9
22
|
|
|
10
23
|
// Get the inherited props from the parent to determine label settings
|
|
11
24
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
@@ -37,7 +50,8 @@ export default function DetailsThreeColumn(props) {
|
|
|
37
50
|
field.config.displayAsStatus = true;
|
|
38
51
|
}
|
|
39
52
|
|
|
40
|
-
return getPConnect().createComponent(field
|
|
53
|
+
return getPConnect().createComponent(field,
|
|
54
|
+
'', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional);
|
|
41
55
|
});
|
|
42
56
|
}
|
|
43
57
|
|
|
@@ -62,16 +76,3 @@ export default function DetailsThreeColumn(props) {
|
|
|
62
76
|
</FieldGroup>
|
|
63
77
|
);
|
|
64
78
|
}
|
|
65
|
-
|
|
66
|
-
DetailsThreeColumn.defaultProps = {
|
|
67
|
-
label: undefined,
|
|
68
|
-
showLabel: true,
|
|
69
|
-
showHighlightedData: false
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
DetailsThreeColumn.propTypes = {
|
|
73
|
-
showLabel: PropTypes.bool,
|
|
74
|
-
label: PropTypes.string,
|
|
75
|
-
getPConnect: PropTypes.func.isRequired,
|
|
76
|
-
showHighlightedData: PropTypes.bool
|
|
77
|
-
};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import React, { createElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Grid from '@material-ui/core/Grid';
|
|
4
3
|
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
5
|
-
import
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// import type { PConnProps } from '../../../../types/PConnProps';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Can't use PConnProps until getPConnect().getChildren() type is ok
|
|
10
|
+
// interface DetailsTwoColumnProps extends PConnProps {
|
|
11
|
+
// // If any, enter additional props that only exist on this component
|
|
12
|
+
// showLabel: boolean,
|
|
13
|
+
// label: string,
|
|
14
|
+
// showHighlightedData: boolean
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default function DetailsTwoColumn(props /* : DetailsTwoColumnProps */) {
|
|
19
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
20
|
+
const FieldGroup = getComponentFromMap('FieldGroup');
|
|
21
|
+
|
|
22
|
+
const { label, showLabel = true, getPConnect, showHighlightedData = false } = props;
|
|
9
23
|
|
|
10
24
|
// Get the inherited props from the parent to determine label settings
|
|
11
25
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
@@ -37,7 +51,8 @@ export default function DetailsTwoColumn(props) {
|
|
|
37
51
|
field.config.displayAsStatus = true;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
return getPConnect().createComponent(field
|
|
54
|
+
return getPConnect().createComponent(field,
|
|
55
|
+
'', '', {}); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional
|
|
41
56
|
});
|
|
42
57
|
}
|
|
43
58
|
|
|
@@ -62,16 +77,3 @@ export default function DetailsTwoColumn(props) {
|
|
|
62
77
|
</FieldGroup>
|
|
63
78
|
);
|
|
64
79
|
}
|
|
65
|
-
|
|
66
|
-
DetailsTwoColumn.defaultProps = {
|
|
67
|
-
label: undefined,
|
|
68
|
-
showLabel: true,
|
|
69
|
-
showHighlightedData: false
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
DetailsTwoColumn.propTypes = {
|
|
73
|
-
showLabel: PropTypes.bool,
|
|
74
|
-
label: PropTypes.string,
|
|
75
|
-
getPConnect: PropTypes.func.isRequired,
|
|
76
|
-
showHighlightedData: PropTypes.bool
|
|
77
|
-
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { Children, useState, useMemo } from 'react';
|
|
2
|
+
import { makeStyles, Tab, Tabs } from '@material-ui/core';
|
|
3
|
+
import { TabContext, TabPanel } from '@material-ui/lab';
|
|
4
|
+
import { buildView } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
|
|
5
|
+
// import type { PConnProps } from '../../../../types/PConnProps';
|
|
6
|
+
|
|
7
|
+
const useStyles = makeStyles(() => ({
|
|
8
|
+
tab: {
|
|
9
|
+
minWidth: '72px'
|
|
10
|
+
}
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
// ListViewProps can't be used until getComponentConfig is NOT private
|
|
14
|
+
// interface DynamicTabsProps extends PConnProps {
|
|
15
|
+
// // If any, enter additional props that only exist on this component
|
|
16
|
+
// showLabel: boolean;
|
|
17
|
+
// label: string;
|
|
18
|
+
// referenceList?: Array<any>;
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
function DynamicTabs(props /*: DynamicTabsProps */) {
|
|
22
|
+
const classes = useStyles();
|
|
23
|
+
const { referenceList, showLabel, label, getPConnect } = props;
|
|
24
|
+
const pConnect = getPConnect();
|
|
25
|
+
// Get the inherited props from the parent to determine label settings
|
|
26
|
+
const propsToUse = { label, showLabel, ...pConnect.getInheritedProps() };
|
|
27
|
+
const defaultTabIndex = 0;
|
|
28
|
+
const { tablabel } = pConnect.getComponentConfig();
|
|
29
|
+
const tablabelProp = PCore.getAnnotationUtils().getPropertyName(tablabel);
|
|
30
|
+
const referenceListData = pConnect.getValue(`${referenceList}.pxResults`, ''); // 2nd arg empty string until typedefs properly allow optional
|
|
31
|
+
const memoisedTabViews = useMemo(() => {
|
|
32
|
+
pConnect.setInheritedProp('displayMode', 'LABELS_LEFT');
|
|
33
|
+
pConnect.setInheritedProp('readOnly', true);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
referenceListData &&
|
|
37
|
+
Children.toArray(
|
|
38
|
+
referenceListData.map((item, index) => {
|
|
39
|
+
return <React.Fragment key={item[tablabelProp]}>{buildView(pConnect, index, '')}</React.Fragment>;
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
}, [referenceListData]);
|
|
44
|
+
const [panelShown, changePanel] = useState(defaultTabIndex);
|
|
45
|
+
const handleTabClick = (e, id) => {
|
|
46
|
+
changePanel(parseInt(id, 10));
|
|
47
|
+
};
|
|
48
|
+
// Loop over the tab contents and and pull out the labels for the navigation
|
|
49
|
+
const tabItems =
|
|
50
|
+
referenceListData?.map((item, i) => {
|
|
51
|
+
const currentTabLabel = item[tablabelProp] || PCore.getLocaleUtils().getLocaleValue('No label specified in config', 'Generic');
|
|
52
|
+
return {
|
|
53
|
+
name: currentTabLabel,
|
|
54
|
+
id: i
|
|
55
|
+
};
|
|
56
|
+
}) || [];
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
{propsToUse.label && <h3 id="dynamic-tabs-title">{propsToUse.label}</h3>}
|
|
61
|
+
<TabContext value={panelShown.toString()}>
|
|
62
|
+
<Tabs onChange={handleTabClick} value={panelShown} variant="scrollable" scrollButtons="auto" indicatorColor="primary" id="dynamic-tabs">
|
|
63
|
+
{tabItems.map((tab: any) => (
|
|
64
|
+
<Tab key={tab.id} label={tab.name} value={tab.id} className={classes.tab} />
|
|
65
|
+
))}
|
|
66
|
+
</Tabs>
|
|
67
|
+
|
|
68
|
+
{tabItems.map((tab: any) => (
|
|
69
|
+
<TabPanel key={tab.id} value={tab.id.toString()} tabIndex={+tab.id} id="dynamic-tabpanel">
|
|
70
|
+
<div>{memoisedTabViews[parseInt(tab.id, 10)] || 'No content exists'}</div>
|
|
71
|
+
</TabPanel>
|
|
72
|
+
))}
|
|
73
|
+
</TabContext>
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default DynamicTabs;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "DynamicTabs",
|
|
3
|
+
"label": "Dynamic tabs (list)",
|
|
4
|
+
"description": "Dynamic tabs (list)",
|
|
5
|
+
"type": "Template",
|
|
6
|
+
"subtype": "DETAILS",
|
|
7
|
+
"icon": "DynamicTabs.svg",
|
|
8
|
+
"hideTemplateEdit": true,
|
|
9
|
+
"hideFromTemplatePicker": true,
|
|
10
|
+
"viewHeadingLabel": "Default heading",
|
|
11
|
+
"properties": [
|
|
12
|
+
{
|
|
13
|
+
"name": "referenceList",
|
|
14
|
+
"label": "Data page",
|
|
15
|
+
"format": "CONTENTPICKERSOURCE"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "parameters",
|
|
19
|
+
"label": "Parameters",
|
|
20
|
+
"format": "PARAMETERS",
|
|
21
|
+
"showOverride": false
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "tablabel",
|
|
25
|
+
"label": "Tab label",
|
|
26
|
+
"format": "PROPERTY",
|
|
27
|
+
"ofContextClass": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"format": "VIEWPICKER",
|
|
31
|
+
"name": "Views",
|
|
32
|
+
"label": "Tab content",
|
|
33
|
+
"ofContextClass": true
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DynamicTabs';
|