@pega/react-sdk-overrides 8.23.11 → 23.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +12 -16
- 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 +14 -11
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +100 -84
- 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 +100 -81
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +27 -16
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +30 -47
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -21
- package/lib/field/Date/Date.tsx +24 -13
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +21 -10
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +31 -40
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +128 -31
- 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 +39 -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 +52 -39
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +15 -6
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +26 -34
- 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 -11
- 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 +18 -7
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +14 -19
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +15 -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 -60
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/attachmentHelpers.ts +15 -10
- package/lib/helpers/case-utils.tsx +5 -10
- package/lib/helpers/common-utils.ts +6 -2
- package/lib/helpers/data_page.ts +3 -7
- package/lib/helpers/date-format-utils.ts +4 -4
- package/lib/helpers/event-utils.ts +4 -4
- package/lib/helpers/field-group-utils.ts +6 -8
- package/lib/helpers/formatters/Boolean.ts +9 -26
- package/lib/helpers/formatters/Currency.ts +22 -28
- package/lib/helpers/formatters/CurrencyMap.ts +512 -505
- package/lib/helpers/formatters/Date.ts +20 -26
- package/lib/helpers/formatters/common.ts +2 -7
- package/lib/helpers/formatters/index.ts +29 -22
- package/lib/helpers/reactContextHelpers.ts +2 -2
- package/lib/helpers/simpleTableHelpers.ts +63 -87
- package/lib/helpers/state-utils.tsx +5 -12
- package/lib/helpers/template-utils.ts +4 -10
- package/lib/helpers/utils.ts +5 -5
- package/lib/helpers/versionHelpers.ts +1 -7
- package/lib/infra/ActionButtons/ActionButtons.tsx +44 -45
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +102 -86
- 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 +93 -240
- package/lib/infra/Containers/FlowContainer/helpers.ts +34 -48
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +229 -223
- 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 +47 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +25 -54
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -42
- package/lib/infra/DeferLoad/DeferLoad.tsx +21 -33
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -39
- 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 +26 -45
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +75 -120
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +36 -41
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +25 -29
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +47 -71
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +66 -19
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +44 -74
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +66 -31
- package/lib/template/Confirmation/Confirmation.tsx +24 -55
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -142
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +15 -16
- package/lib/template/DefaultForm/config-ext.json +1 -2
- 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 +22 -35
- 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.ts +1 -3
- package/lib/template/ListView/ListView.tsx +247 -309
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/hooks.ts +24 -26
- package/lib/template/ListView/utils.ts +205 -94
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -34
- 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 +39 -33
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +113 -15
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -104
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -44
- 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 -9
- 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 +24 -10
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +60 -1
- package/lib/widget/Attachment/Attachment.tsx +379 -394
- 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 +322 -245
- 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 +71 -39
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -52
- 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 +72 -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 -634
- package/lib/helpers/config_access.js +0 -259
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { getContext, readContextResponse } from './utils';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
declare const PCore: any;
|
|
3
|
+
import { getContext, readContextResponse } from './utils';
|
|
6
4
|
|
|
7
5
|
export default function useInit(props) {
|
|
8
6
|
const {
|
|
@@ -29,21 +27,22 @@ export default function useInit(props) {
|
|
|
29
27
|
|
|
30
28
|
(async function init() {
|
|
31
29
|
// promise to fetch metadata
|
|
32
|
-
|
|
30
|
+
// @ts-ignore - 3rd parameter "associationFilter" should be optional for getDataViewMetadata method
|
|
31
|
+
const metaDataPromise: Promise<any> = PCore.getAnalyticsUtils().getDataViewMetadata(referenceList, showDynamicFields);
|
|
33
32
|
|
|
34
33
|
const promisesArray = [metaDataPromise];
|
|
35
34
|
|
|
36
35
|
// promise to fetch report configured columns
|
|
37
|
-
const reportColumnsPromise =
|
|
38
|
-
.getFieldsForDataSource(referenceList, false, getPConnect().getContextName())
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
36
|
+
const reportColumnsPromise = (
|
|
37
|
+
PCore.getAnalyticsUtils().getFieldsForDataSource(referenceList, false, getPConnect().getContextName()) as Promise<any>
|
|
38
|
+
).catch(() => {
|
|
39
|
+
return Promise.resolve({
|
|
40
|
+
data: { data: [] }
|
|
43
41
|
});
|
|
42
|
+
});
|
|
44
43
|
promisesArray.push(reportColumnsPromise);
|
|
45
44
|
|
|
46
|
-
const fetchEditDetails = async
|
|
45
|
+
const fetchEditDetails = async metadata => {
|
|
47
46
|
const {
|
|
48
47
|
data: { isQueryable }
|
|
49
48
|
} = metadata;
|
|
@@ -64,7 +63,7 @@ export default function useInit(props) {
|
|
|
64
63
|
return Promise.resolve();
|
|
65
64
|
};
|
|
66
65
|
|
|
67
|
-
const editPromise = metaDataPromise.then(
|
|
66
|
+
const editPromise = metaDataPromise.then(metadata => fetchEditDetails(metadata));
|
|
68
67
|
promisesArray.push(editPromise);
|
|
69
68
|
getContext({
|
|
70
69
|
tableSource: referenceList,
|
|
@@ -76,20 +75,19 @@ export default function useInit(props) {
|
|
|
76
75
|
isSearchable,
|
|
77
76
|
isCacheable: true,
|
|
78
77
|
xRayUid
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
78
|
+
}).then(async context => {
|
|
79
|
+
if (isCompStillMounted) {
|
|
80
|
+
return readContextResponse(context, {
|
|
81
|
+
...props,
|
|
82
|
+
editing,
|
|
83
|
+
selectionCountThreshold,
|
|
84
|
+
ref,
|
|
85
|
+
selectionMode,
|
|
86
|
+
xRayUid,
|
|
87
|
+
cosmosTableRef
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
93
91
|
})();
|
|
94
92
|
|
|
95
93
|
return () => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import getDefaultViewMeta from './DefaultViewMeta';
|
|
2
2
|
|
|
3
|
-
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 5 errors)
|
|
4
|
-
declare const PCore: any;
|
|
5
|
-
|
|
6
3
|
const USER_REFERENCE = 'UserReference';
|
|
7
4
|
const PAGE = '!P!';
|
|
8
5
|
const PAGELIST = '!PL!';
|
|
@@ -10,16 +7,51 @@ const PAGELIST = '!PL!';
|
|
|
10
7
|
export const formatConstants = {
|
|
11
8
|
WorkStatus: 'WorkStatus',
|
|
12
9
|
Integer: 'Integer',
|
|
13
|
-
WorkLink: 'WorkLink'
|
|
10
|
+
WorkLink: 'WorkLink'
|
|
14
11
|
};
|
|
15
12
|
|
|
13
|
+
class DataApi {
|
|
14
|
+
mappedPropertyToOriginalProperty: any;
|
|
15
|
+
originalPropertyToMappedProperty: any;
|
|
16
|
+
constructor() {
|
|
17
|
+
this.originalPropertyToMappedProperty = {};
|
|
18
|
+
this.mappedPropertyToOriginalProperty = {};
|
|
19
|
+
this.setPropertyMaps = this.setPropertyMaps.bind(this);
|
|
20
|
+
this.getMappedProperty = this.getMappedProperty.bind(this);
|
|
21
|
+
this.getOriginalProperty = this.getOriginalProperty.bind(this);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setPropertyMaps(originalToMappedPropertyObj = {}, mappedToOriginalPropertyObj = {}) {
|
|
25
|
+
this.originalPropertyToMappedProperty = {
|
|
26
|
+
...this.originalPropertyToMappedProperty,
|
|
27
|
+
...originalToMappedPropertyObj
|
|
28
|
+
};
|
|
29
|
+
this.mappedPropertyToOriginalProperty = {
|
|
30
|
+
...this.mappedPropertyToOriginalProperty,
|
|
31
|
+
...mappedToOriginalPropertyObj
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getMappedProperty(propertyName) {
|
|
36
|
+
return this.originalPropertyToMappedProperty[propertyName] ?? propertyName;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getOriginalProperty(propertyName) {
|
|
40
|
+
return this.mappedPropertyToOriginalProperty[propertyName] ?? propertyName;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
export async function getContext(componentConfig) {
|
|
17
45
|
const {
|
|
18
|
-
promisesArray = []
|
|
46
|
+
promisesArray = [] // array of promises which can be invoked paralelly,
|
|
19
47
|
} = componentConfig;
|
|
20
48
|
const promisesResponseArray = await Promise.all(promisesArray);
|
|
49
|
+
const dataApi = new DataApi();
|
|
21
50
|
return {
|
|
22
51
|
promisesResponseArray,
|
|
52
|
+
setPropertyMaps: dataApi.setPropertyMaps,
|
|
53
|
+
getMappedProperty: dataApi.getMappedProperty,
|
|
54
|
+
getOriginalProperty: dataApi.getOriginalProperty
|
|
23
55
|
};
|
|
24
56
|
}
|
|
25
57
|
|
|
@@ -34,7 +66,7 @@ export async function getContext(componentConfig) {
|
|
|
34
66
|
* getFieldNameFromEmbeddedFieldName('!P!Organisation:Name') return 'Organisation.Name'
|
|
35
67
|
* getFieldNameFromEmbeddedFieldName('!PL!Employees:Name') return 'Employees.Name'
|
|
36
68
|
*/
|
|
37
|
-
|
|
69
|
+
export function getFieldNameFromEmbeddedFieldName(propertyName) {
|
|
38
70
|
let value = propertyName;
|
|
39
71
|
if (value.startsWith(PAGE) || value.startsWith(PAGELIST)) {
|
|
40
72
|
value = value.substring(value.lastIndexOf('!') + 1);
|
|
@@ -49,15 +81,15 @@ export async function getContext(componentConfig) {
|
|
|
49
81
|
* @ignore
|
|
50
82
|
* @param {Array} metaFields Fields metadata Array. Contains metadata of all the fields.
|
|
51
83
|
*/
|
|
52
|
-
|
|
53
|
-
return metaFields.forEach(
|
|
84
|
+
export function updateMetaEmbeddedFieldID(metaFields) {
|
|
85
|
+
return metaFields.forEach(metaField => {
|
|
54
86
|
if (metaField.fieldID?.startsWith(PAGE) || metaField.fieldID?.startsWith(PAGELIST)) {
|
|
55
87
|
metaField.fieldID = getFieldNameFromEmbeddedFieldName(metaField.fieldID);
|
|
56
88
|
}
|
|
57
89
|
});
|
|
58
90
|
}
|
|
59
91
|
|
|
60
|
-
export const isEmbeddedField =
|
|
92
|
+
export const isEmbeddedField = field => {
|
|
61
93
|
if (field?.startsWith('@')) {
|
|
62
94
|
field = field.substring(field.indexOf(' ') + 1);
|
|
63
95
|
if (field[0] === '.') field = field.substring(1);
|
|
@@ -65,6 +97,94 @@ export const isEmbeddedField = (field) => {
|
|
|
65
97
|
return field?.indexOf('.') > 0;
|
|
66
98
|
};
|
|
67
99
|
|
|
100
|
+
/**
|
|
101
|
+
* [isPageListProperty]
|
|
102
|
+
* Description - checking if propertyName is pageList or not
|
|
103
|
+
* @ignore
|
|
104
|
+
* @param {string} propertyName PropertyName
|
|
105
|
+
* @returns {boolean} true if property is pageList else false
|
|
106
|
+
*
|
|
107
|
+
* @example <caption>Example for isPageListProperty </caption>
|
|
108
|
+
* isPageListProperty('!PL!Employees.Name') return true
|
|
109
|
+
* isPageListProperty('!P!Employees.Name') return false
|
|
110
|
+
* isPageListProperty('Name') return false
|
|
111
|
+
*/
|
|
112
|
+
export function isPageListProperty(propertyName) {
|
|
113
|
+
return propertyName.startsWith(PAGELIST);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const isPageListInPath = (propertyName, currentClassID) => {
|
|
117
|
+
if (!propertyName.includes('.')) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
const [first, ...rest] = propertyName.split('.');
|
|
121
|
+
const metadata: any = PCore.getMetadataUtils().getPropertyMetadata(first, currentClassID);
|
|
122
|
+
if (metadata?.type === 'Page List') {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return isPageListInPath(rest.join('.'), metadata?.pageClass);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* [getEmbeddedFieldName]
|
|
130
|
+
* Description - converting normal field name to embedded field starting with !P! or !PL!
|
|
131
|
+
* @ignore
|
|
132
|
+
* @param {string} propertyName Field name
|
|
133
|
+
* @param {string} classID classID of datapage
|
|
134
|
+
* @returns {string} returns converted string with !P! or !PL! and :
|
|
135
|
+
*
|
|
136
|
+
* @example <caption>Example for getEmbeddedFieldName </caption>
|
|
137
|
+
* For page property, getEmbeddedFieldName('Organisation.Name') return '!P!Organisation:Name'
|
|
138
|
+
* For pageList property, getEmbeddedFieldName('Employees.Name') return '!PL!Employees:Name'
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
export function getEmbeddedFieldName(propertyName, classID) {
|
|
142
|
+
let value = propertyName;
|
|
143
|
+
if (isPageListInPath(value, classID)) {
|
|
144
|
+
value = `!PL!${value.replace(/\./g, ':')}`;
|
|
145
|
+
} else {
|
|
146
|
+
value = `!P!${value.replace(/\./g, ':')}`;
|
|
147
|
+
}
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* [preparePropertyMaps]
|
|
153
|
+
* Description - preparing maps for property names and set it in dataApi context
|
|
154
|
+
* @ignore
|
|
155
|
+
* @param {Array} fields fields array
|
|
156
|
+
* @param {string} classID classID of datapage
|
|
157
|
+
* @param {string} context dataApi context
|
|
158
|
+
* @returns {boolean} true if pageListProperty is present
|
|
159
|
+
*/
|
|
160
|
+
export function preparePropertyMaps(fields, classID, context) {
|
|
161
|
+
const { setPropertyMaps } = context;
|
|
162
|
+
const maps = fields.reduce(
|
|
163
|
+
(acc, field) => {
|
|
164
|
+
let { value } = field.config;
|
|
165
|
+
if (value.startsWith('@')) {
|
|
166
|
+
value = value.substring(value.indexOf(' ') + 1);
|
|
167
|
+
if (value[0] === '.') value = value.substring(1);
|
|
168
|
+
}
|
|
169
|
+
let name = value;
|
|
170
|
+
// Preparing name for embedded property
|
|
171
|
+
if (isEmbeddedField(name)) {
|
|
172
|
+
name = getEmbeddedFieldName(name, classID);
|
|
173
|
+
}
|
|
174
|
+
if (isPageListProperty(name) && !acc[2]) {
|
|
175
|
+
acc[2] = true;
|
|
176
|
+
}
|
|
177
|
+
acc[0][value] = name;
|
|
178
|
+
acc[1][name] = value;
|
|
179
|
+
|
|
180
|
+
return acc;
|
|
181
|
+
},
|
|
182
|
+
[{}, {}, false]
|
|
183
|
+
);
|
|
184
|
+
setPropertyMaps(maps[0], maps[1]);
|
|
185
|
+
return maps[2];
|
|
186
|
+
}
|
|
187
|
+
|
|
68
188
|
/**
|
|
69
189
|
* [getConfigEmbeddedFieldsMeta]
|
|
70
190
|
* Description - Get the metadata for configured embedded fields
|
|
@@ -74,15 +194,16 @@ export const isEmbeddedField = (field) => {
|
|
|
74
194
|
* @returns {Array} Metadata of configured embedded fields
|
|
75
195
|
*/
|
|
76
196
|
export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
77
|
-
const configEmbeddedFieldsMeta:
|
|
78
|
-
configFields.forEach(
|
|
197
|
+
const configEmbeddedFieldsMeta: any[] = [];
|
|
198
|
+
configFields.forEach(field => {
|
|
79
199
|
let value = field;
|
|
80
200
|
if (isEmbeddedField(value)) {
|
|
81
201
|
// conversion Page.PageList[].property => Page.PageList.property
|
|
82
202
|
if (value.includes('[')) {
|
|
83
203
|
value = value.substring(0, value.indexOf('[')) + value.substring(value.indexOf(']') + 1);
|
|
84
204
|
}
|
|
85
|
-
|
|
205
|
+
// @ts-ignore - Expected 3 arguments, but got 2.
|
|
206
|
+
const meta: any = PCore.getMetadataUtils().getEmbeddedPropertyMetadata(value, classID);
|
|
86
207
|
meta.fieldID = field;
|
|
87
208
|
configEmbeddedFieldsMeta.push(meta);
|
|
88
209
|
}
|
|
@@ -99,8 +220,8 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
|
99
220
|
*/
|
|
100
221
|
export function mergeConfigEmbeddedFieldsMeta(configEmbeddedFieldsMeta, metaFields) {
|
|
101
222
|
const mergedMetaFields = [...metaFields];
|
|
102
|
-
configEmbeddedFieldsMeta.forEach(
|
|
103
|
-
const fieldMeta = metaFields.find(
|
|
223
|
+
configEmbeddedFieldsMeta.forEach(configFieldMeta => {
|
|
224
|
+
const fieldMeta = metaFields.find(metaField => metaField.fieldID === configFieldMeta.fieldID);
|
|
104
225
|
if (!fieldMeta) mergedMetaFields.push(configFieldMeta);
|
|
105
226
|
});
|
|
106
227
|
return mergedMetaFields;
|
|
@@ -117,8 +238,8 @@ const oldToNewFieldTypeMapping = {
|
|
|
117
238
|
* @ignore
|
|
118
239
|
* @param {Array} metaFields Fields metadata Array. Contains metadata of all the fields.
|
|
119
240
|
*/
|
|
120
|
-
|
|
121
|
-
metaFields.forEach(
|
|
241
|
+
function updateFieldType(metaFields) {
|
|
242
|
+
metaFields.forEach(metaField => {
|
|
122
243
|
if (metaField.type) metaField.type = oldToNewFieldTypeMapping[metaField.type] || metaField.type;
|
|
123
244
|
});
|
|
124
245
|
}
|
|
@@ -143,8 +264,8 @@ function getPresetMetaAttribute(attribute) {
|
|
|
143
264
|
* @param {string} classID Class ID from the response
|
|
144
265
|
* @returns {Array} List of fields with updated meta objects.
|
|
145
266
|
*/
|
|
146
|
-
|
|
147
|
-
return rawFields.map(
|
|
267
|
+
function generateViewMetaData(rawFields, classID, showField) {
|
|
268
|
+
return rawFields.map(item => getDefaultViewMeta(item, classID, showField));
|
|
148
269
|
}
|
|
149
270
|
|
|
150
271
|
/**
|
|
@@ -157,9 +278,9 @@ function getPresetMetaAttribute(attribute) {
|
|
|
157
278
|
* @param {string} classID Class ID from the response
|
|
158
279
|
* @returns {Array} List of all fields with their meta updated.
|
|
159
280
|
*/
|
|
160
|
-
|
|
281
|
+
function getConfigFields(configFields, primaryFields, metaFields, classID) {
|
|
161
282
|
const presetConfigFields = configFields;
|
|
162
|
-
const primaryFieldsViewIndex = presetConfigFields.findIndex(
|
|
283
|
+
const primaryFieldsViewIndex = presetConfigFields.findIndex(field => field.config.value === 'pyPrimaryFields');
|
|
163
284
|
if (!primaryFields || !primaryFields.length) {
|
|
164
285
|
if (primaryFieldsViewIndex < 0) return presetConfigFields;
|
|
165
286
|
|
|
@@ -171,12 +292,11 @@ function getPresetMetaAttribute(attribute) {
|
|
|
171
292
|
if (primaryFieldsViewIndex > -1) {
|
|
172
293
|
// list of uncommon fields - non overlap of primary fields grouped view and independent entity columns of primary type
|
|
173
294
|
const uncommonFieldsList = primaryFields.filter(
|
|
174
|
-
(primaryField)
|
|
175
|
-
!presetConfigFields.some((presetConfigField) => presetConfigField.config.value.split('.')[1] === primaryField)
|
|
295
|
+
primaryField => !presetConfigFields.some(presetConfigField => presetConfigField.config.value.split('.')[1] === primaryField)
|
|
176
296
|
);
|
|
177
|
-
const uncommonFieldsRawMeta:
|
|
178
|
-
uncommonFieldsList.forEach(
|
|
179
|
-
const uncommonFieldMeta= metaFields.find(
|
|
297
|
+
const uncommonFieldsRawMeta: any[] = [];
|
|
298
|
+
uncommonFieldsList.forEach(uncommonField => {
|
|
299
|
+
const uncommonFieldMeta = metaFields.find(metaField => metaField.fieldID === uncommonField);
|
|
180
300
|
if (uncommonFieldMeta) uncommonFieldsRawMeta.push(uncommonFieldMeta);
|
|
181
301
|
});
|
|
182
302
|
const uncommonFieldsConfigMeta = generateViewMetaData(uncommonFieldsRawMeta, classID, true);
|
|
@@ -198,14 +318,7 @@ function getPresetMetaAttribute(attribute) {
|
|
|
198
318
|
* @param {Array} metaFields List of all metafields
|
|
199
319
|
* @returns {object} Table config object
|
|
200
320
|
*/
|
|
201
|
-
|
|
202
|
-
presetMeta,
|
|
203
|
-
isMetaWithPresets,
|
|
204
|
-
getPConnect,
|
|
205
|
-
classID,
|
|
206
|
-
primaryFields,
|
|
207
|
-
metaFields
|
|
208
|
-
) {
|
|
321
|
+
export function getTableConfigFromPresetMeta(presetMeta, isMetaWithPresets, getPConnect, classID, primaryFields, metaFields) {
|
|
209
322
|
let presetId;
|
|
210
323
|
let presetName;
|
|
211
324
|
let cardHeader;
|
|
@@ -230,7 +343,7 @@ function getPresetMetaAttribute(attribute) {
|
|
|
230
343
|
[fieldsMeta] = presetMeta.children;
|
|
231
344
|
if (
|
|
232
345
|
presetMeta.timelineTitle &&
|
|
233
|
-
!fieldsMeta.children.find(
|
|
346
|
+
!fieldsMeta.children.find(fieldMeta => {
|
|
234
347
|
return fieldMeta?.config?.value === presetMeta.timelineTitle?.config?.value;
|
|
235
348
|
})
|
|
236
349
|
) {
|
|
@@ -239,7 +352,7 @@ function getPresetMetaAttribute(attribute) {
|
|
|
239
352
|
}
|
|
240
353
|
if (
|
|
241
354
|
presetMeta.timelineDate &&
|
|
242
|
-
!fieldsMeta.children.find(
|
|
355
|
+
!fieldsMeta.children.find(fieldMeta => {
|
|
243
356
|
return fieldMeta?.config?.value === presetMeta.timelineDate?.config?.value;
|
|
244
357
|
})
|
|
245
358
|
) {
|
|
@@ -253,7 +366,7 @@ function getPresetMetaAttribute(attribute) {
|
|
|
253
366
|
fieldsMeta
|
|
254
367
|
.getPConnect()
|
|
255
368
|
.getChildren()
|
|
256
|
-
?.map(
|
|
369
|
+
?.map(child => {
|
|
257
370
|
return child.getPConnect().getRawMetadata();
|
|
258
371
|
}),
|
|
259
372
|
primaryFields,
|
|
@@ -283,12 +396,12 @@ function getPresetMetaAttribute(attribute) {
|
|
|
283
396
|
* @param {object} response -
|
|
284
397
|
* @returns {Set} Set of columns from the report response
|
|
285
398
|
*/
|
|
286
|
-
|
|
399
|
+
function getReportColumns(response) {
|
|
287
400
|
const {
|
|
288
401
|
data: { data: reportColumns }
|
|
289
402
|
} = response;
|
|
290
403
|
const reportColumnsSet = new Set();
|
|
291
|
-
reportColumns?.forEach(
|
|
404
|
+
reportColumns?.forEach(item => {
|
|
292
405
|
let val = item.pyFieldName;
|
|
293
406
|
// Remove '.' from index 0 only, if '.' is present
|
|
294
407
|
if (val[0] === '.') {
|
|
@@ -307,7 +420,7 @@ function getPresetMetaAttribute(attribute) {
|
|
|
307
420
|
* config.value - Raw value
|
|
308
421
|
* @returns {string} value - Value with out any annotations or "."
|
|
309
422
|
*/
|
|
310
|
-
|
|
423
|
+
function getConfigFieldValue(config) {
|
|
311
424
|
let { value } = config;
|
|
312
425
|
if (value.startsWith('@')) {
|
|
313
426
|
value = value.substring(value.indexOf(' ') + 1);
|
|
@@ -326,7 +439,7 @@ function getPresetMetaAttribute(attribute) {
|
|
|
326
439
|
*/
|
|
327
440
|
function prepareConfigFields(configFields, pushToComponentsList) {
|
|
328
441
|
const configFieldSet = new Set();
|
|
329
|
-
configFields.forEach(
|
|
442
|
+
configFields.forEach(item => {
|
|
330
443
|
pushToComponentsList(item.type);
|
|
331
444
|
const val = getConfigFieldValue(item.config);
|
|
332
445
|
configFieldSet.add(val);
|
|
@@ -342,8 +455,8 @@ function prepareConfigFields(configFields, pushToComponentsList) {
|
|
|
342
455
|
* @param {string} fieldID Filter
|
|
343
456
|
* @returns {object} config with its field value equal to fieldID, which means an authored field
|
|
344
457
|
*/
|
|
345
|
-
|
|
346
|
-
return configFields.find(
|
|
458
|
+
function findAuthoredField(configFields, fieldID) {
|
|
459
|
+
return configFields.find(configField => {
|
|
347
460
|
const val = getConfigFieldValue(configField.config);
|
|
348
461
|
return val === fieldID;
|
|
349
462
|
});
|
|
@@ -357,7 +470,7 @@ function prepareConfigFields(configFields, pushToComponentsList) {
|
|
|
357
470
|
* @param {object} item Field item to copy displayAs and category information
|
|
358
471
|
* @param {string} classId classID from the response
|
|
359
472
|
*/
|
|
360
|
-
|
|
473
|
+
function findAndUpdateAuthoredFieldConfig(configFields, item, classId) {
|
|
361
474
|
const authoredField = findAuthoredField(configFields, item.fieldID);
|
|
362
475
|
if (authoredField?.config) {
|
|
363
476
|
if (item.displayAs) {
|
|
@@ -389,7 +502,7 @@ function prepareConfigFields(configFields, pushToComponentsList) {
|
|
|
389
502
|
* @param {boolean} showDynamicFields Flag indicating whether fields are fetched dynamically at runtime
|
|
390
503
|
* @returns {boolean} true If the field is an extra field else false.
|
|
391
504
|
*/
|
|
392
|
-
|
|
505
|
+
function isAnExtraField(configFields, configFieldSet, reportColumnsSet, item, classId, showDynamicFields) {
|
|
393
506
|
// Is the field already present in authoring metadata?
|
|
394
507
|
// Mutates config fields to copy displayAs and category information
|
|
395
508
|
if (configFieldSet.has(item.fieldID)) {
|
|
@@ -413,16 +526,9 @@ function prepareConfigFields(configFields, pushToComponentsList) {
|
|
|
413
526
|
* @param {boolean} showDynamicFields Flag indicating whether fields are fetched dynamically at runtime
|
|
414
527
|
* @returns {Array} List of extra fields with their meta updated.
|
|
415
528
|
*/
|
|
416
|
-
|
|
417
|
-
metaFields,
|
|
418
|
-
configFields,
|
|
419
|
-
configFieldSet,
|
|
420
|
-
reportColumnsSet,
|
|
421
|
-
classID,
|
|
422
|
-
showDynamicFields
|
|
423
|
-
) {
|
|
529
|
+
function prepareExtraFields(metaFields, configFields, configFieldSet, reportColumnsSet, classID, showDynamicFields) {
|
|
424
530
|
// Filter all the extra fields
|
|
425
|
-
const extraFileds = metaFields.filter(
|
|
531
|
+
const extraFileds = metaFields.filter(item => {
|
|
426
532
|
return isAnExtraField(configFields, configFieldSet, reportColumnsSet, item, classID, showDynamicFields);
|
|
427
533
|
});
|
|
428
534
|
return generateViewMetaData(extraFileds, classID, false);
|
|
@@ -445,10 +551,7 @@ function populateRenderingOptions(name, config, field) {
|
|
|
445
551
|
config.cellRenderer = formatConstants.Integer;
|
|
446
552
|
}
|
|
447
553
|
}
|
|
448
|
-
export function initializeColumns(
|
|
449
|
-
fields:Array<any> = [],
|
|
450
|
-
getMappedProperty:any = null
|
|
451
|
-
) {
|
|
554
|
+
export function initializeColumns(fields: any[] = [], getMappedProperty: any = null) {
|
|
452
555
|
return fields.map((field, originalColIndex) => {
|
|
453
556
|
let name = field.config.value;
|
|
454
557
|
|
|
@@ -477,7 +580,7 @@ export function initializeColumns(
|
|
|
477
580
|
fieldType: field.config.fieldType,
|
|
478
581
|
meta: {
|
|
479
582
|
...field
|
|
480
|
-
}
|
|
583
|
+
}
|
|
481
584
|
};
|
|
482
585
|
|
|
483
586
|
populateRenderingOptions(name, config, field);
|
|
@@ -486,9 +589,9 @@ export function initializeColumns(
|
|
|
486
589
|
});
|
|
487
590
|
}
|
|
488
591
|
|
|
489
|
-
export const getItemKey =
|
|
592
|
+
export const getItemKey = fields => {
|
|
490
593
|
let itemKey;
|
|
491
|
-
if (fields.findIndex(
|
|
594
|
+
if (fields.findIndex(field => field.id === 'pyGUID') > -1) {
|
|
492
595
|
itemKey = 'pyGUID';
|
|
493
596
|
} else {
|
|
494
597
|
itemKey = 'pzInsKey';
|
|
@@ -497,9 +600,9 @@ export const getItemKey = (fields) => {
|
|
|
497
600
|
};
|
|
498
601
|
|
|
499
602
|
export function preparePatchQueryFields(fields, isDataObject = false, classID = '') {
|
|
500
|
-
const queryFields:
|
|
501
|
-
fields.forEach(
|
|
502
|
-
const patchFields:
|
|
603
|
+
const queryFields: any[] = [];
|
|
604
|
+
fields.forEach(field => {
|
|
605
|
+
const patchFields: any[] = [];
|
|
503
606
|
if (field.cellRenderer === 'WorkLink') {
|
|
504
607
|
if (field.customObject && field.customObject.isAssignmentLink) {
|
|
505
608
|
const associationName = field.name.includes(':') ? `${field.name.split(':')[0]}:` : '';
|
|
@@ -513,17 +616,15 @@ export function preparePatchQueryFields(fields, isDataObject = false, classID =
|
|
|
513
616
|
} else if (isDataObject) {
|
|
514
617
|
const dataViewName = PCore.getDataTypeUtils().getSavableDataPage(classID);
|
|
515
618
|
const dataPageKeys = PCore.getDataTypeUtils().getDataPageKeys(dataViewName);
|
|
516
|
-
dataPageKeys?.forEach((item)
|
|
517
|
-
item.isAlternateKeyStorage ? patchFields.push(item.linkedField) : patchFields.push(item.keyName)
|
|
518
|
-
);
|
|
619
|
+
dataPageKeys?.forEach(item => (item.isAlternateKeyStorage ? patchFields.push(item.linkedField) : patchFields.push(item.keyName)));
|
|
519
620
|
} else {
|
|
520
621
|
patchFields.push('pyID');
|
|
521
622
|
patchFields.push('pzInsKey');
|
|
522
623
|
patchFields.push('pxObjClass');
|
|
523
624
|
}
|
|
524
625
|
}
|
|
525
|
-
patchFields.forEach(
|
|
526
|
-
if (!queryFields.find(
|
|
626
|
+
patchFields.forEach(k => {
|
|
627
|
+
if (!queryFields.find(q => q === k)) {
|
|
527
628
|
queryFields.push(k);
|
|
528
629
|
}
|
|
529
630
|
});
|
|
@@ -532,19 +633,28 @@ export function preparePatchQueryFields(fields, isDataObject = false, classID =
|
|
|
532
633
|
return queryFields;
|
|
533
634
|
}
|
|
534
635
|
|
|
636
|
+
/**
|
|
637
|
+
* Update the renderer type for the properties of type Page.
|
|
638
|
+
*/
|
|
639
|
+
export function updatePageFieldsConfig(configFields, parentClassID) {
|
|
640
|
+
return configFields.forEach(item => {
|
|
641
|
+
const {
|
|
642
|
+
type,
|
|
643
|
+
config: { value }
|
|
644
|
+
} = item;
|
|
645
|
+
const propertyName = PCore.getAnnotationUtils().getPropertyName(value);
|
|
646
|
+
if (isEmbeddedField(value) && !isPageListInPath(propertyName, parentClassID)) {
|
|
647
|
+
item.config.componentType = type;
|
|
648
|
+
item.type = 'PagePropertyRenderer';
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
|
|
535
653
|
export const readContextResponse = async (context, params) => {
|
|
536
|
-
const {
|
|
537
|
-
getPConnect,
|
|
538
|
-
apiContext,
|
|
539
|
-
setListContext,
|
|
540
|
-
children,
|
|
541
|
-
showDynamicFields,
|
|
542
|
-
referenceList,
|
|
543
|
-
isDataObject
|
|
544
|
-
} = params;
|
|
654
|
+
const { getPConnect, apiContext, setListContext, children, showDynamicFields, referenceList, isDataObject } = params;
|
|
545
655
|
const { promisesResponseArray, apiContext: otherContext } = context;
|
|
546
656
|
// eslint-disable-next-line sonarjs/no-unused-collection
|
|
547
|
-
const listOfComponents:
|
|
657
|
+
const listOfComponents: any[] = [];
|
|
548
658
|
const {
|
|
549
659
|
data: { fields: metaFields, classID, isQueryable }
|
|
550
660
|
} = promisesResponseArray[0];
|
|
@@ -553,7 +663,7 @@ export const readContextResponse = async (context, params) => {
|
|
|
553
663
|
} = promisesResponseArray[0];
|
|
554
664
|
// When list is configured with Include all class fields configuration, provide support for Primary fields column
|
|
555
665
|
if (showDynamicFields) {
|
|
556
|
-
const sourceMetadata = PCore.getMetadataUtils().getDataPageMetadata(referenceList);
|
|
666
|
+
const sourceMetadata: any = PCore.getMetadataUtils().getDataPageMetadata(referenceList);
|
|
557
667
|
if (sourceMetadata?.primaryFields) {
|
|
558
668
|
primaryFields = sourceMetadata.primaryFields;
|
|
559
669
|
}
|
|
@@ -562,18 +672,17 @@ export const readContextResponse = async (context, params) => {
|
|
|
562
672
|
}
|
|
563
673
|
updateFieldType(metaFields);
|
|
564
674
|
|
|
565
|
-
|
|
566
675
|
if (isDataObject) {
|
|
567
|
-
const compositeKeys:
|
|
676
|
+
const compositeKeys: any[] = [];
|
|
568
677
|
const dataViewName = PCore.getDataTypeUtils().getSavableDataPage(classID);
|
|
569
678
|
const dataPageKeys = PCore.getDataTypeUtils().getDataPageKeys(dataViewName);
|
|
570
|
-
dataPageKeys?.forEach((item)
|
|
571
|
-
item.isAlternateKeyStorage ? compositeKeys.push(item.linkedField) : compositeKeys.push(item.keyName)
|
|
572
|
-
);
|
|
679
|
+
dataPageKeys?.forEach(item => (item.isAlternateKeyStorage ? compositeKeys.push(item.linkedField) : compositeKeys.push(item.keyName)));
|
|
573
680
|
if (compositeKeys.length) {
|
|
574
681
|
otherContext.setCompositeKeys(compositeKeys);
|
|
575
682
|
}
|
|
576
|
-
otherContext
|
|
683
|
+
if (otherContext) {
|
|
684
|
+
otherContext.fetchRowActionDetails = null;
|
|
685
|
+
}
|
|
577
686
|
}
|
|
578
687
|
|
|
579
688
|
const presetArray = [];
|
|
@@ -585,9 +694,7 @@ export const readContextResponse = async (context, params) => {
|
|
|
585
694
|
let fields;
|
|
586
695
|
let tableConfig;
|
|
587
696
|
childrenIterator?.forEach((presetMeta, index) => {
|
|
588
|
-
const {
|
|
589
|
-
configFields
|
|
590
|
-
} = getTableConfigFromPresetMeta(
|
|
697
|
+
const { configFields } = getTableConfigFromPresetMeta(
|
|
591
698
|
{ ...presetMeta, label: resolvedPresets[index].label },
|
|
592
699
|
isMetaWithPresets,
|
|
593
700
|
getPConnect,
|
|
@@ -595,7 +702,7 @@ export const readContextResponse = async (context, params) => {
|
|
|
595
702
|
primaryFields,
|
|
596
703
|
metaFields
|
|
597
704
|
);
|
|
598
|
-
const pushToComponentsList =
|
|
705
|
+
const pushToComponentsList = fieldType => {
|
|
599
706
|
listOfComponents.push(fieldType);
|
|
600
707
|
};
|
|
601
708
|
// read report columns response - in case of nonqueryable ignore the response and rely only on the fields configured at authoing time in presets
|
|
@@ -619,20 +726,24 @@ export const readContextResponse = async (context, params) => {
|
|
|
619
726
|
showDynamicFields
|
|
620
727
|
);
|
|
621
728
|
|
|
729
|
+
if (isQueryable) {
|
|
730
|
+
updatePageFieldsConfig(configFields, classID);
|
|
731
|
+
preparePropertyMaps([...configFields, ...extraFields], classID, context);
|
|
732
|
+
}
|
|
622
733
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
);
|
|
734
|
+
const { getMappedProperty } = context;
|
|
735
|
+
|
|
736
|
+
fields = initializeColumns([...configFields, ...extraFields], getMappedProperty);
|
|
626
737
|
const patchQueryFields = preparePatchQueryFields(fields, isDataObject, classID);
|
|
627
738
|
const itemKey = getItemKey(fields);
|
|
628
|
-
tableConfig = { fieldDefs: fields, patchQueryFields, itemKey, isQueryable}
|
|
739
|
+
tableConfig = { fieldDefs: fields, patchQueryFields, itemKey, isQueryable };
|
|
629
740
|
});
|
|
630
741
|
const meta = tableConfig;
|
|
631
742
|
setListContext({
|
|
632
743
|
meta,
|
|
633
744
|
presets: presetArray,
|
|
634
745
|
apiContext: {
|
|
635
|
-
...apiContext
|
|
746
|
+
...apiContext
|
|
636
747
|
}
|
|
637
748
|
});
|
|
638
749
|
};
|