@pega/react-sdk-overrides 0.23.6
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/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
- package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
- package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
- package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
- package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
- package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
- package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
- package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
- package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
- package/lib/designSystemExtensions/Operator/index.tsx +1 -0
- package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
- package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
- package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
- package/lib/forms/AutoComplete/index.tsx +1 -0
- package/lib/forms/CancelAlert/CancelAlert.css +24 -0
- package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
- package/lib/forms/CancelAlert/index.tsx +1 -0
- package/lib/forms/Checkbox/Checkbox.tsx +68 -0
- package/lib/forms/Checkbox/index.tsx +1 -0
- package/lib/forms/Currency/Currency.tsx +89 -0
- package/lib/forms/Currency/index.tsx +1 -0
- package/lib/forms/Date/Date.tsx +79 -0
- package/lib/forms/Date/index.tsx +1 -0
- package/lib/forms/DateTime/DateTime.tsx +75 -0
- package/lib/forms/DateTime/index.tsx +1 -0
- package/lib/forms/Decimal/Decimal.tsx +51 -0
- package/lib/forms/Decimal/index.tsx +1 -0
- package/lib/forms/Dropdown/Dropdown.tsx +82 -0
- package/lib/forms/Dropdown/index.tsx +1 -0
- package/lib/forms/Email/Email.tsx +68 -0
- package/lib/forms/Email/index.tsx +1 -0
- package/lib/forms/Integer/Integer.tsx +77 -0
- package/lib/forms/Integer/index.tsx +1 -0
- package/lib/forms/Percentage/Percentage.tsx +82 -0
- package/lib/forms/Percentage/index.tsx +1 -0
- package/lib/forms/Phone/Phone.tsx +90 -0
- package/lib/forms/Phone/index.tsx +1 -0
- package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
- package/lib/forms/RadioButtons/index.tsx +1 -0
- package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
- package/lib/forms/SemanticLink/index.tsx +1 -0
- package/lib/forms/SemanticLink/utils.ts +51 -0
- package/lib/forms/TextArea/TextArea.tsx +66 -0
- package/lib/forms/TextArea/index.tsx +1 -0
- package/lib/forms/TextContent/TextContent.tsx +40 -0
- package/lib/forms/TextContent/index.tsx +1 -0
- package/lib/forms/TextInput/TextInput.tsx +61 -0
- package/lib/forms/TextInput/index.tsx +1 -0
- package/lib/forms/Time/Time.tsx +71 -0
- package/lib/forms/Time/index.tsx +1 -0
- package/lib/forms/URL/URL.tsx +53 -0
- package/lib/forms/URL/index.tsx +1 -0
- package/lib/forms/UserReference/UserReference.tsx +197 -0
- package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
- package/lib/forms/UserReference/index.tsx +1 -0
- package/lib/helpers/auth.js +483 -0
- package/lib/helpers/authManager.js +630 -0
- package/lib/helpers/config_access.js +268 -0
- package/lib/helpers/data_page.ts +24 -0
- package/lib/helpers/event-utils.js +20 -0
- package/lib/helpers/field-group-utils.js +61 -0
- package/lib/helpers/formatters/Boolean.js +38 -0
- package/lib/helpers/formatters/Currency.js +74 -0
- package/lib/helpers/formatters/CurrencyMap.js +908 -0
- package/lib/helpers/formatters/Date.js +77 -0
- package/lib/helpers/formatters/common.js +10 -0
- package/lib/helpers/formatters/index.js +120 -0
- package/lib/helpers/utils.ts +334 -0
- package/lib/helpers/versionHelpers.ts +50 -0
- package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
- package/lib/infra/ActionButtons/index.tsx +1 -0
- package/lib/infra/Assignment/Assignment.tsx +301 -0
- package/lib/infra/Assignment/index.tsx +1 -0
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
- package/lib/infra/AssignmentCard/index.tsx +1 -0
- package/lib/infra/Attachment/Attachment.css +18 -0
- package/lib/infra/Attachment/Attachment.tsx +404 -0
- package/lib/infra/Attachment/AttachmentUtils.js +71 -0
- package/lib/infra/Attachment/index.tsx +1 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
- package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
- package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
- package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
- package/lib/infra/DashboardFilter/index.tsx +1 -0
- package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
- package/lib/infra/DeferLoad/index.tsx +1 -0
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
- package/lib/infra/ErrorBoundary/index.tsx +1 -0
- package/lib/infra/MultiStep/MultiStep.css +261 -0
- package/lib/infra/MultiStep/MultiStep.tsx +225 -0
- package/lib/infra/MultiStep/index.tsx +1 -0
- package/lib/infra/NavBar/NavBar.css +170 -0
- package/lib/infra/NavBar/NavBar.tsx +393 -0
- package/lib/infra/NavBar/index.tsx +1 -0
- package/lib/infra/Reference/Reference.tsx +58 -0
- package/lib/infra/Reference/index.tsx +1 -0
- package/lib/infra/Region/Region.tsx +17 -0
- package/lib/infra/Region/index.tsx +1 -0
- package/lib/infra/RootContainer/RootContainer.tsx +336 -0
- package/lib/infra/RootContainer/index.tsx +1 -0
- package/lib/infra/Stages/Stages.tsx +120 -0
- package/lib/infra/Stages/index.tsx +1 -0
- package/lib/infra/ToDo/ToDo.css +87 -0
- package/lib/infra/ToDo/ToDo.tsx +285 -0
- package/lib/infra/ToDo/index.tsx +1 -0
- package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
- package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
- package/lib/infra/VerticalTabs/index.tsx +1 -0
- package/lib/infra/View/View.css +8 -0
- package/lib/infra/View/View.tsx +175 -0
- package/lib/infra/View/index.tsx +1 -0
- package/lib/templates/AppShell/AppShell.css +40 -0
- package/lib/templates/AppShell/AppShell.tsx +439 -0
- package/lib/templates/AppShell/index.tsx +1 -0
- package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
- package/lib/templates/CaseSummary/index.tsx +1 -0
- package/lib/templates/CaseView/CaseView.tsx +261 -0
- package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
- package/lib/templates/CaseView/index.tsx +1 -0
- package/lib/templates/DataReference/DataReference.tsx +290 -0
- package/lib/templates/DataReference/index.tsx +1 -0
- package/lib/templates/DefaultForm/DefaultForm.css +25 -0
- package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
- package/lib/templates/DefaultForm/index.tsx +1 -0
- package/lib/templates/Details/Details/Details.tsx +35 -0
- package/lib/templates/Details/Details/index.tsx +1 -0
- package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
- package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
- package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
- package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
- package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
- package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
- package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
- package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
- package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
- package/lib/templates/InlineDashboard/index.tsx +1 -0
- package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
- package/lib/templates/InlineDashboardPage/index.tsx +1 -0
- package/lib/templates/ListPage/ListPage.tsx +20 -0
- package/lib/templates/ListPage/index.tsx +1 -0
- package/lib/templates/ListView/ListView.css +10 -0
- package/lib/templates/ListView/ListView.tsx +1230 -0
- package/lib/templates/ListView/index.tsx +1 -0
- package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
- package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
- package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
- package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
- package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
- package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
- package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
- package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
- package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
- package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
- package/lib/templates/PromotedFilters/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
- package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
- package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
- package/lib/templates/SimpleTable/helpers.ts +360 -0
- package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
- package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/SubTabs/SubTabs.tsx +65 -0
- package/lib/templates/SubTabs/index.tsx +1 -0
- package/lib/templates/SubTabs/tabUtils.ts +73 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
- package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
- package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
- package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
- package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
- package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
- package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
- package/lib/templates/utils.ts +23 -0
- package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
- package/lib/widgets/AppAnnouncement/index.tsx +1 -0
- package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
- package/lib/widgets/CaseHistory/index.tsx +1 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
- package/lib/widgets/FileUtility/FileUtility.css +117 -0
- package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
- package/lib/widgets/FileUtility/index.tsx +0 -0
- package/lib/widgets/Followers/Followers.tsx +43 -0
- package/lib/widgets/Followers/index.tsx +1 -0
- package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
- package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
- package/lib/widgets/SummaryItem/index.tsx +1 -0
- package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
- package/lib/widgets/SummaryList/index.tsx +1 -0
- package/package.json +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SimpleTableManual';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React from "react";
|
|
3
|
+
import ListView from '@pega/react-sdk-components/lib/components/templates/ListView';
|
|
4
|
+
import SimpleTable from '@pega/react-sdk-components/lib/components/templates/SimpleTable';
|
|
5
|
+
|
|
6
|
+
import PromotedFilters from '@pega/react-sdk-components/lib/components/templates/PromotedFilters';
|
|
7
|
+
|
|
8
|
+
const isSelfReferencedProperty = (param, referenceProp) => {
|
|
9
|
+
const [, parentPropName] = param.split('.');
|
|
10
|
+
return parentPropName === referenceProp;
|
|
11
|
+
};
|
|
12
|
+
declare const PCore;
|
|
13
|
+
/**
|
|
14
|
+
* SimpleTable react component
|
|
15
|
+
* @param {*} props - props
|
|
16
|
+
*/
|
|
17
|
+
export default function SimpleTableSelect(props) {
|
|
18
|
+
const { label, getPConnect, renderMode, showLabel, viewName, parameters, dataRelationshipContext } = props;
|
|
19
|
+
|
|
20
|
+
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
21
|
+
if (propsToUse.showLabel === false) {
|
|
22
|
+
propsToUse.label = '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const pConn = getPConnect();
|
|
26
|
+
const { MULTI } = PCore.getConstants().LIST_SELECTION_MODE;
|
|
27
|
+
const { selectionMode, selectionList } = pConn.getConfigProps();
|
|
28
|
+
const isMultiSelectMode = selectionMode === MULTI;
|
|
29
|
+
|
|
30
|
+
if (isMultiSelectMode && renderMode === 'ReadOnly') {
|
|
31
|
+
return <SimpleTable {...props} showLabel={propsToUse.showLabel} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const pageReference = pConn.getPageReference();
|
|
35
|
+
let referenceProp = isMultiSelectMode ? selectionList.substring(1) : pageReference.substring(pageReference.lastIndexOf('.') + 1);
|
|
36
|
+
// Replace here to use the context name instead
|
|
37
|
+
let contextPageReference = null;
|
|
38
|
+
if (props.dataRelationshipContext !== null && selectionMode === 'single') {
|
|
39
|
+
referenceProp = dataRelationshipContext;
|
|
40
|
+
contextPageReference = pageReference.concat('.').concat(referenceProp);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = isMultiSelectMode
|
|
44
|
+
? pConn.getFieldMetadata(`@P .${referenceProp}`)
|
|
45
|
+
: pConn.getCurrentPageFieldMetadata(contextPageReference);
|
|
46
|
+
|
|
47
|
+
const compositeKeys: Array<any> = [];
|
|
48
|
+
Object.values(fieldParameters).forEach((param: any) => {
|
|
49
|
+
if (isSelfReferencedProperty(param, referenceProp)) {
|
|
50
|
+
compositeKeys.push(param.substring(param.lastIndexOf('.') + 1));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// setting default row height for select table
|
|
55
|
+
const defaultRowHeight = '2';
|
|
56
|
+
|
|
57
|
+
const additionalTableConfig = {
|
|
58
|
+
rowDensity: false,
|
|
59
|
+
enableFreezeColumns: false,
|
|
60
|
+
autoSizeColumns: false,
|
|
61
|
+
resetColumnWidths: false,
|
|
62
|
+
defaultFieldDef: {
|
|
63
|
+
showMenu: false,
|
|
64
|
+
noContextMenu: true,
|
|
65
|
+
grouping: false
|
|
66
|
+
},
|
|
67
|
+
itemKey: '$key',
|
|
68
|
+
defaultRowHeight
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const listViewProps = {
|
|
72
|
+
...props,
|
|
73
|
+
title: propsToUse.label,
|
|
74
|
+
personalization: false,
|
|
75
|
+
grouping: false,
|
|
76
|
+
expandGroups: false,
|
|
77
|
+
reorderFields: false,
|
|
78
|
+
showHeaderIcons: false,
|
|
79
|
+
editing: false,
|
|
80
|
+
globalSearch: true,
|
|
81
|
+
toggleFieldVisibility: false,
|
|
82
|
+
basicMode: true,
|
|
83
|
+
additionalTableConfig,
|
|
84
|
+
compositeKeys,
|
|
85
|
+
viewName,
|
|
86
|
+
parameters
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const filters = getPConnect().getRawMetadata().config.promotedFilters ?? [];
|
|
90
|
+
|
|
91
|
+
const isSearchable = filters.length > 0;
|
|
92
|
+
|
|
93
|
+
if (isSearchable) {
|
|
94
|
+
return (
|
|
95
|
+
<PromotedFilters
|
|
96
|
+
getPConnect={getPConnect}
|
|
97
|
+
viewName={viewName}
|
|
98
|
+
filters={filters}
|
|
99
|
+
listViewProps={listViewProps}
|
|
100
|
+
pageClass={pageClass}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return <ListView {...listViewProps} />;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
SimpleTableSelect.defaultProps = {
|
|
108
|
+
label: undefined,
|
|
109
|
+
renderMode: '',
|
|
110
|
+
showLabel: true,
|
|
111
|
+
promptedFilters: [],
|
|
112
|
+
viewName: '',
|
|
113
|
+
parameters: undefined,
|
|
114
|
+
readonlyContextList: [],
|
|
115
|
+
dataRelationshipContext: null
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
SimpleTableSelect.propTypes = {
|
|
119
|
+
label: PropTypes.string,
|
|
120
|
+
getPConnect: PropTypes.func.isRequired,
|
|
121
|
+
referenceList: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.string]).isRequired,
|
|
122
|
+
renderMode: PropTypes.string,
|
|
123
|
+
showLabel: PropTypes.bool,
|
|
124
|
+
promptedFilters: PropTypes.arrayOf(PropTypes.object),
|
|
125
|
+
viewName: PropTypes.string,
|
|
126
|
+
parameters: PropTypes.objectOf(PropTypes.any),
|
|
127
|
+
readonlyContextList: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.string]),
|
|
128
|
+
dataRelationshipContext: PropTypes.string
|
|
129
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SimpleTableSelect';
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
2
|
+
|
|
3
|
+
declare const PCore;
|
|
4
|
+
|
|
5
|
+
export const TABLE_CELL = "SdkRenderer";
|
|
6
|
+
export const DELETE_ICON = "DeleteIcon";
|
|
7
|
+
|
|
8
|
+
// BUG-615253: Workaround for autosize in table with lazy loading components
|
|
9
|
+
/* istanbul ignore next */
|
|
10
|
+
function getFieldWidth(field, label) {
|
|
11
|
+
let width;
|
|
12
|
+
switch (field.type) {
|
|
13
|
+
case "Time":
|
|
14
|
+
width = 150;
|
|
15
|
+
break;
|
|
16
|
+
case "Date":
|
|
17
|
+
width = 160;
|
|
18
|
+
break;
|
|
19
|
+
case "DateTime":
|
|
20
|
+
width = 205;
|
|
21
|
+
break;
|
|
22
|
+
case "AutoComplete":
|
|
23
|
+
case "TextArea":
|
|
24
|
+
width = 190;
|
|
25
|
+
break;
|
|
26
|
+
case "Currency":
|
|
27
|
+
case "TextInput":
|
|
28
|
+
width = 182;
|
|
29
|
+
break;
|
|
30
|
+
case "Checkbox":
|
|
31
|
+
// eslint-disable-next-line no-case-declarations
|
|
32
|
+
const text = document.createElement("span");
|
|
33
|
+
document.body.appendChild(text);
|
|
34
|
+
text.style.fontSize = "13px";
|
|
35
|
+
text.style.position = "absolute";
|
|
36
|
+
text.innerHTML = label;
|
|
37
|
+
width = Math.ceil(text.clientWidth) + 30;
|
|
38
|
+
document.body.removeChild(text);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
width = 180;
|
|
42
|
+
}
|
|
43
|
+
return width;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const getContext = (thePConn) => {
|
|
47
|
+
const contextName = thePConn.getContextName();
|
|
48
|
+
const pageReference = thePConn.getPageReference();
|
|
49
|
+
let { referenceList } = thePConn.getStateProps().config;
|
|
50
|
+
const pageReferenceForRows = referenceList.startsWith(".")
|
|
51
|
+
? `${pageReference}.${referenceList.substring(1)}`
|
|
52
|
+
: referenceList;
|
|
53
|
+
|
|
54
|
+
// removing "caseInfo.content" prefix to avoid setting it as a target while preparing pageInstructions
|
|
55
|
+
referenceList = pageReferenceForRows.replace(
|
|
56
|
+
PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT,
|
|
57
|
+
""
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
contextName,
|
|
62
|
+
referenceListStr: referenceList,
|
|
63
|
+
pageReferenceForRows
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const populateRowKey = (rawData) => {
|
|
68
|
+
return rawData.map((row, index) => {
|
|
69
|
+
return { ...row, index };
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const getApiContext = (processedData, pConnect, reorderCB) => {
|
|
74
|
+
return {
|
|
75
|
+
fetchData: () => {
|
|
76
|
+
return new Promise((resolve) => {
|
|
77
|
+
resolve({
|
|
78
|
+
data: processedData,
|
|
79
|
+
filteredRecordCount: processedData.length,
|
|
80
|
+
totalRecordCount: processedData.length
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
fetchPersonalizations: () => {
|
|
85
|
+
return Promise.resolve({});
|
|
86
|
+
},
|
|
87
|
+
applyRowReorder: (sourceKey, destinationKey) => {
|
|
88
|
+
// indexes are keys for simple table so, it should work.
|
|
89
|
+
reorderCB();
|
|
90
|
+
return Promise.resolve(
|
|
91
|
+
pConnect
|
|
92
|
+
.getListActions()
|
|
93
|
+
.reorder(parseInt(sourceKey, 10), parseInt(destinationKey, 10))
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const buildMetaForListView = (
|
|
100
|
+
fieldMetadata,
|
|
101
|
+
fields,
|
|
102
|
+
type,
|
|
103
|
+
ruleClass,
|
|
104
|
+
name,
|
|
105
|
+
propertyLabel,
|
|
106
|
+
parameters
|
|
107
|
+
) => {
|
|
108
|
+
return {
|
|
109
|
+
name,
|
|
110
|
+
config: {
|
|
111
|
+
type,
|
|
112
|
+
referenceList: fieldMetadata.datasource.name,
|
|
113
|
+
parameters: parameters ?? fieldMetadata.datasource.parameters,
|
|
114
|
+
personalization: false,
|
|
115
|
+
grouping: true,
|
|
116
|
+
globalSearch: true,
|
|
117
|
+
reorderFields: true,
|
|
118
|
+
toggleFieldVisibility: true,
|
|
119
|
+
personalizationId: "" /* TODO */,
|
|
120
|
+
template: "ListView",
|
|
121
|
+
presets: [
|
|
122
|
+
{
|
|
123
|
+
name: "presets",
|
|
124
|
+
template: "Table",
|
|
125
|
+
config: {},
|
|
126
|
+
children: [
|
|
127
|
+
{
|
|
128
|
+
name: "Columns",
|
|
129
|
+
type: "Region",
|
|
130
|
+
children: fields
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
label: propertyLabel,
|
|
134
|
+
id: "P_" /* TODO */
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
ruleClass
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const buildFieldsForTable = (configFields, fields, showDeleteButton) => {
|
|
143
|
+
const fieldDefs = configFields.map((field, index) => {
|
|
144
|
+
return {
|
|
145
|
+
type: "text",
|
|
146
|
+
label: fields[index].config.label || fields[index].config.caption,
|
|
147
|
+
fillAvailableSpace: !!field.config.fillAvailableSpace,
|
|
148
|
+
id: index,
|
|
149
|
+
name: field.config.value.substr(4),
|
|
150
|
+
cellRenderer: TABLE_CELL,
|
|
151
|
+
sort: false,
|
|
152
|
+
noContextMenu: true,
|
|
153
|
+
showMenu: false,
|
|
154
|
+
meta: {
|
|
155
|
+
...field
|
|
156
|
+
},
|
|
157
|
+
// BUG-615253: Workaround for autosize in table with lazy loading components
|
|
158
|
+
width: getFieldWidth(field, fields[index].config.label)
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// ONLY add DELETE_ICON to fields when the table is requested as EDITABLE
|
|
163
|
+
if (showDeleteButton) {
|
|
164
|
+
fieldDefs.push({
|
|
165
|
+
type: "text",
|
|
166
|
+
id: fieldDefs.length,
|
|
167
|
+
cellRenderer: DELETE_ICON,
|
|
168
|
+
sort: false,
|
|
169
|
+
noContextMenu: true,
|
|
170
|
+
showMenu: false,
|
|
171
|
+
// BUG-615253: Workaround for autosize in table with lazy loading components
|
|
172
|
+
width: 46
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return fieldDefs;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const createMetaForTable = (fields, renderMode) => {
|
|
180
|
+
return {
|
|
181
|
+
height: {
|
|
182
|
+
minHeight: "auto",
|
|
183
|
+
fitHeightToElement: "fitHeightToElement",
|
|
184
|
+
deltaAdjustment: "deltaAdjustment",
|
|
185
|
+
autoSize: true
|
|
186
|
+
},
|
|
187
|
+
fieldDefs: fields,
|
|
188
|
+
itemKey: "index",
|
|
189
|
+
grouping: false,
|
|
190
|
+
reorderFields: false,
|
|
191
|
+
reorderItems: renderMode === "Editable",
|
|
192
|
+
dragHandle: renderMode === "Editable",
|
|
193
|
+
globalSearch: false,
|
|
194
|
+
personalization: false,
|
|
195
|
+
toggleFieldVisibility: false,
|
|
196
|
+
toolbar: false,
|
|
197
|
+
footer: false,
|
|
198
|
+
filterExpression: null,
|
|
199
|
+
editing: false,
|
|
200
|
+
timezone: PCore.getEnvironmentInfo().getTimeZone()
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* This method returns a callBack function for Add action.
|
|
206
|
+
* @param {object} pConnect - PConnect object
|
|
207
|
+
* @param {number} index - index of the page list to add
|
|
208
|
+
*/
|
|
209
|
+
export const getAddRowCallback = (pConnect, index) => {
|
|
210
|
+
return () => pConnect.getListActions().insert({}, index);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* This method creates a PConnect object with proper options for Add and Delete actions
|
|
215
|
+
* @param {string} contextName - contextName
|
|
216
|
+
* @param {string} referenceList - referenceList
|
|
217
|
+
* @param {string} pageReference - pageReference
|
|
218
|
+
*/
|
|
219
|
+
export const createPConnect = (contextName, referenceList, pageReference) => {
|
|
220
|
+
const options = {
|
|
221
|
+
context: contextName,
|
|
222
|
+
pageReference,
|
|
223
|
+
referenceList
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// create PConnect object
|
|
227
|
+
const config = { meta: {}, options };
|
|
228
|
+
const { getPConnect } = PCore.createPConnect(config);
|
|
229
|
+
|
|
230
|
+
return getPConnect();
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const filterData = (filterByColumns) => {
|
|
234
|
+
return function filteringData(item) {
|
|
235
|
+
let bKeep = true;
|
|
236
|
+
for (const filterObj of filterByColumns) {
|
|
237
|
+
if (
|
|
238
|
+
filterObj.containsFilterValue !== '' ||
|
|
239
|
+
filterObj.containsFilter === 'null' ||
|
|
240
|
+
filterObj.containsFilter === 'notnull'
|
|
241
|
+
) {
|
|
242
|
+
let value: any;
|
|
243
|
+
let filterValue: any;
|
|
244
|
+
|
|
245
|
+
switch (filterObj.type) {
|
|
246
|
+
case 'Date':
|
|
247
|
+
case 'DateTime':
|
|
248
|
+
case 'Time':
|
|
249
|
+
value =
|
|
250
|
+
item[filterObj.ref] !== null ?? item[filterObj.ref] !== ''
|
|
251
|
+
? Utils.getSeconds(item[filterObj.ref])
|
|
252
|
+
: null;
|
|
253
|
+
filterValue =
|
|
254
|
+
filterObj.containsFilterValue !== null && filterObj.containsFilterValue !== ''
|
|
255
|
+
? Utils.getSeconds(filterObj.containsFilterValue)
|
|
256
|
+
: null;
|
|
257
|
+
|
|
258
|
+
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
259
|
+
switch (filterObj.containsFilter) {
|
|
260
|
+
case 'notequal':
|
|
261
|
+
// becasue filterValue is in minutes, need to have a range of less than 60 secons
|
|
262
|
+
|
|
263
|
+
if (value !== null && filterValue !== null) {
|
|
264
|
+
// get rid of milliseconds
|
|
265
|
+
value /= 1000;
|
|
266
|
+
filterValue /= 1000;
|
|
267
|
+
|
|
268
|
+
const diff = value - filterValue;
|
|
269
|
+
if (diff >= 0 && diff < 60) {
|
|
270
|
+
bKeep = false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
break;
|
|
275
|
+
|
|
276
|
+
case 'equal':
|
|
277
|
+
// becasue filterValue is in minutes, need to have a range of less than 60 secons
|
|
278
|
+
|
|
279
|
+
if (value !== null && filterValue !== null) {
|
|
280
|
+
// get rid of milliseconds
|
|
281
|
+
value /= 1000;
|
|
282
|
+
filterValue /= 1000;
|
|
283
|
+
|
|
284
|
+
const diff = value - filterValue;
|
|
285
|
+
if (diff !== 0) {
|
|
286
|
+
bKeep = false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
break;
|
|
291
|
+
|
|
292
|
+
case 'after':
|
|
293
|
+
if (value < filterValue) {
|
|
294
|
+
bKeep = false;
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
|
|
298
|
+
case 'before':
|
|
299
|
+
if (value > filterValue) {
|
|
300
|
+
bKeep = false;
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
|
|
304
|
+
case 'null':
|
|
305
|
+
if (value !== null) {
|
|
306
|
+
bKeep = false;
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
|
|
310
|
+
case 'notnull':
|
|
311
|
+
if (value === null) {
|
|
312
|
+
bKeep = false;
|
|
313
|
+
}
|
|
314
|
+
break;
|
|
315
|
+
|
|
316
|
+
default:
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
break;
|
|
320
|
+
|
|
321
|
+
default:
|
|
322
|
+
value = item[filterObj.ref].toLowerCase();
|
|
323
|
+
filterValue = filterObj.containsFilterValue.toLowerCase();
|
|
324
|
+
|
|
325
|
+
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
326
|
+
switch (filterObj.containsFilter) {
|
|
327
|
+
case 'contains':
|
|
328
|
+
if (value.indexOf(filterValue) < 0) {
|
|
329
|
+
bKeep = false;
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
|
|
333
|
+
case 'equals':
|
|
334
|
+
if (value !== filterValue) {
|
|
335
|
+
bKeep = false;
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
|
|
339
|
+
case 'startswith':
|
|
340
|
+
if (value.indexOf(filterValue) !== 0) {
|
|
341
|
+
bKeep = false;
|
|
342
|
+
}
|
|
343
|
+
break;
|
|
344
|
+
|
|
345
|
+
default:
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// if don't keep stop filtering
|
|
354
|
+
if (!bKeep) {
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return bKeep;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
|
|
3
|
+
export default function SingleReferenceReadOnly(props) {
|
|
4
|
+
const {
|
|
5
|
+
getPConnect,
|
|
6
|
+
displayAs,
|
|
7
|
+
ruleClass,
|
|
8
|
+
label,
|
|
9
|
+
type,
|
|
10
|
+
displayMode,
|
|
11
|
+
referenceType,
|
|
12
|
+
hideLabel,
|
|
13
|
+
dataRelationshipContext,
|
|
14
|
+
config
|
|
15
|
+
} = props;
|
|
16
|
+
const editableComponents = ["AutoComplete", "SimpleTableSelect", "Dropdown"];
|
|
17
|
+
|
|
18
|
+
if (editableComponents.includes(type)) {
|
|
19
|
+
config.caseClass = ruleClass;
|
|
20
|
+
config.text = config.primaryField;
|
|
21
|
+
config.caseID = config.value;
|
|
22
|
+
config.contextPage = `@P .${dataRelationshipContext}`;
|
|
23
|
+
config.resourceParams = {
|
|
24
|
+
"workID": displayAs === "table" ? config.selectionKey : config.value
|
|
25
|
+
};
|
|
26
|
+
config.resourcePayload = {
|
|
27
|
+
"caseClassName": ruleClass
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return getPConnect().createComponent({
|
|
32
|
+
type: 'SemanticLink',
|
|
33
|
+
config: {
|
|
34
|
+
...config,
|
|
35
|
+
label,
|
|
36
|
+
displayMode,
|
|
37
|
+
referenceType,
|
|
38
|
+
hideLabel,
|
|
39
|
+
dataRelationshipContext
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
SingleReferenceReadOnly.defaultProps = {
|
|
45
|
+
displayAs: "",
|
|
46
|
+
ruleClass: "",
|
|
47
|
+
label: "",
|
|
48
|
+
displayMode: "",
|
|
49
|
+
type: "",
|
|
50
|
+
referenceType: "",
|
|
51
|
+
hideLabel: false,
|
|
52
|
+
dataRelationshipContext: null
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
SingleReferenceReadOnly.propTypes = {
|
|
56
|
+
config: PropTypes.object,
|
|
57
|
+
getPConnect: PropTypes.func.isRequired,
|
|
58
|
+
displayAs: PropTypes.string,
|
|
59
|
+
ruleClass: PropTypes.string,
|
|
60
|
+
label: PropTypes.string,
|
|
61
|
+
displayMode: PropTypes.string,
|
|
62
|
+
type: PropTypes.string,
|
|
63
|
+
referenceType: PropTypes.string,
|
|
64
|
+
hideLabel: PropTypes.bool,
|
|
65
|
+
dataRelationshipContext: PropTypes.string
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SingleReferenceReadOnly';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { Fragment, useEffect, useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { Tab, Tabs } from "@material-ui/core";
|
|
4
|
+
import { TabContext, TabPanel } from '@material-ui/lab';
|
|
5
|
+
import { getTransientTabs, getVisibleTabs, tabClick } from './tabUtils';
|
|
6
|
+
|
|
7
|
+
export default function SubTabs(props) {
|
|
8
|
+
const { children } = props;
|
|
9
|
+
|
|
10
|
+
const defaultTabIndex = 0;
|
|
11
|
+
const deferLoadedTabs = children[0];
|
|
12
|
+
const availableTabs = getVisibleTabs(deferLoadedTabs, "tabsSubs");
|
|
13
|
+
const [currentTabId, setCurrentTabId] = useState(defaultTabIndex.toString());
|
|
14
|
+
|
|
15
|
+
const [tabItems, setTabitem] = useState<Array<any>>([]);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const tempTabItems = getTransientTabs(
|
|
18
|
+
availableTabs,
|
|
19
|
+
currentTabId,
|
|
20
|
+
tabItems
|
|
21
|
+
);
|
|
22
|
+
setTabitem(tempTabItems);
|
|
23
|
+
}, [currentTabId]);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const handleTabClick = (id, index: string) => {
|
|
27
|
+
setCurrentTabId(index);
|
|
28
|
+
tabClick(index, availableTabs, currentTabId, setCurrentTabId, tabItems);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Fragment>
|
|
33
|
+
<TabContext value={currentTabId.toString()}>
|
|
34
|
+
<Tabs
|
|
35
|
+
onChange={handleTabClick}
|
|
36
|
+
value={currentTabId}
|
|
37
|
+
variant="scrollable"
|
|
38
|
+
>
|
|
39
|
+
{tabItems.map((tab:any) =>
|
|
40
|
+
<Tab
|
|
41
|
+
key={tab.id}
|
|
42
|
+
label={tab.name}
|
|
43
|
+
value={tab.id}
|
|
44
|
+
/>
|
|
45
|
+
)}
|
|
46
|
+
</Tabs>
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
tabItems.map((tab:any) => (
|
|
50
|
+
<TabPanel key={tab.id} value={tab.id} tabIndex={+tab.id}>
|
|
51
|
+
<div>{tab.content ? tab.content : "No content exists"}</div>
|
|
52
|
+
</TabPanel>
|
|
53
|
+
))}
|
|
54
|
+
</TabContext>
|
|
55
|
+
</Fragment>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
SubTabs.defaultProps = {
|
|
60
|
+
children: []
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
SubTabs.propTypes = {
|
|
64
|
+
children: PropTypes.arrayOf(PropTypes.node)
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SubTabs';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
declare const PCore;
|
|
3
|
+
|
|
4
|
+
export const getDeferFriendlyTabs = allTabs => {
|
|
5
|
+
return allTabs.map(tab => {
|
|
6
|
+
const theTabCompConfig = tab.getPConnect().getConfigProps();
|
|
7
|
+
return { type: 'DeferLoad', config: theTabCompConfig };
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const getVisibleTabs = (allTabs, uuid) => {
|
|
12
|
+
let index = 0;
|
|
13
|
+
return allTabs.props
|
|
14
|
+
.getPConnect()
|
|
15
|
+
.getChildren()
|
|
16
|
+
?.filter(child => {
|
|
17
|
+
// US-402838: Filter out tab entries if the config object does not contain the visibility attribute or it evaluates to the boolean true,
|
|
18
|
+
const config = child.getPConnect().getConfigProps();
|
|
19
|
+
|
|
20
|
+
// BUG-642335 - adding isChildDeferLoad prop
|
|
21
|
+
if (child.getPConnect().getComponentName() === 'DeferLoad') {
|
|
22
|
+
const { name: viewName, deferLoadId = `${viewName}_${uuid}_${index}` } = config;
|
|
23
|
+
child.getPConnect().registerAdditionalProps({
|
|
24
|
+
deferLoadId,
|
|
25
|
+
isChildDeferLoad: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
index += 1;
|
|
29
|
+
return !('visibility' in config) || config.visibility === true;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const getTransientTabs = (availableTabs, currentTabId, tabItems) => {
|
|
34
|
+
return (
|
|
35
|
+
availableTabs?.map((child, i) => {
|
|
36
|
+
const config = child.getPConnect().getConfigProps();
|
|
37
|
+
const tabLabel =
|
|
38
|
+
config.label ||
|
|
39
|
+
config.inheritedProps?.find(obj => obj.prop === 'label')?.value ||
|
|
40
|
+
PCore.getLocaleUtils().getLocaleValue('No label specified in config', 'Generic');
|
|
41
|
+
const tabContent = () => {
|
|
42
|
+
if (i.toString() === currentTabId) {
|
|
43
|
+
return tabItems?.[i.toString()]?.content
|
|
44
|
+
? tabItems?.[i.toString()]?.content
|
|
45
|
+
: child.getPConnect().getComponent();
|
|
46
|
+
}
|
|
47
|
+
return tabItems?.[i.toString()]?.content;
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
name: tabLabel,
|
|
51
|
+
id: i.toString(),
|
|
52
|
+
content: tabContent()
|
|
53
|
+
};
|
|
54
|
+
}) || []
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const tabClick = (id, availableTabs, currentTabId, setCurrentTabId, tabItems) => {
|
|
59
|
+
const currentPConn = availableTabs[currentTabId].getPConnect();
|
|
60
|
+
const { deferLoadId } = currentPConn.getConfigProps();
|
|
61
|
+
PCore.getDeferLoadManager().deactivate(deferLoadId, currentPConn.getContextName());
|
|
62
|
+
|
|
63
|
+
setCurrentTabId(id);
|
|
64
|
+
const index = parseInt(id, 10);
|
|
65
|
+
if (tabItems[index]?.content === null) {
|
|
66
|
+
tabItems[index].content = availableTabs[index].getPConnect().getComponent();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const nextPConn = availableTabs[id].getPConnect();
|
|
70
|
+
const { deferLoadId: activeId } = nextPConn?.getConfigProps();
|
|
71
|
+
PCore.getDeferLoadManager().activate(activeId, nextPConn?.getContextName());
|
|
72
|
+
PCore.getDeferLoadManager().refreshComponent(activeId, nextPConn?.getContextName());
|
|
73
|
+
};
|