@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,12 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-plusplus */
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import React, { useState, useEffect, useRef } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
|
|
9
|
-
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
10
8
|
import Table from '@material-ui/core/Table';
|
|
11
9
|
import TableBody from '@material-ui/core/TableBody';
|
|
12
10
|
import TableCell from '@material-ui/core/TableCell';
|
|
@@ -37,17 +35,37 @@ import IconButton from '@material-ui/core/IconButton';
|
|
|
37
35
|
import CloseIcon from '@material-ui/icons/Close';
|
|
38
36
|
import { Radio } from '@material-ui/core';
|
|
39
37
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
38
|
+
|
|
40
39
|
import { filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
40
|
+
|
|
41
41
|
import './ListView.css';
|
|
42
|
-
import
|
|
42
|
+
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
43
|
+
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
44
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
45
|
+
|
|
46
|
+
import useInit from './hooks';
|
|
47
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
48
|
+
|
|
49
|
+
interface ListViewProps extends PConnProps {
|
|
50
|
+
// If any, enter additional props that only exist on this component
|
|
51
|
+
bInForm?: boolean;
|
|
52
|
+
globalSearch?: boolean;
|
|
53
|
+
referenceList?: any[];
|
|
54
|
+
// rowClickAction?: any;
|
|
55
|
+
selectionMode?: string;
|
|
56
|
+
referenceType?: string;
|
|
57
|
+
payload?: any;
|
|
58
|
+
parameters?: any;
|
|
59
|
+
compositeKeys?: any;
|
|
60
|
+
showDynamicFields?: boolean;
|
|
61
|
+
readonlyContextList?: any;
|
|
62
|
+
value: any;
|
|
63
|
+
}
|
|
43
64
|
|
|
44
65
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
let myRows: Array<any>;
|
|
50
|
-
let myDisplayColumnList: Array<any>;
|
|
67
|
+
let myRows: any[];
|
|
68
|
+
let myDisplayColumnList: any[];
|
|
51
69
|
|
|
52
70
|
let menuColumnId = '';
|
|
53
71
|
let menuColumnType = '';
|
|
@@ -55,11 +73,23 @@ let menuColumnLabel = '';
|
|
|
55
73
|
|
|
56
74
|
let sortColumnId: any;
|
|
57
75
|
|
|
58
|
-
const filterByColumns:
|
|
59
|
-
|
|
60
|
-
export default function ListView(props) {
|
|
61
|
-
const { getPConnect, bInForm } = props;
|
|
62
|
-
const {
|
|
76
|
+
const filterByColumns: any[] = [];
|
|
77
|
+
|
|
78
|
+
export default function ListView(props: ListViewProps) {
|
|
79
|
+
const { getPConnect, bInForm = true } = props;
|
|
80
|
+
const {
|
|
81
|
+
globalSearch,
|
|
82
|
+
referenceList,
|
|
83
|
+
/* rowClickAction, */
|
|
84
|
+
selectionMode,
|
|
85
|
+
referenceType,
|
|
86
|
+
payload,
|
|
87
|
+
parameters,
|
|
88
|
+
compositeKeys,
|
|
89
|
+
showDynamicFields,
|
|
90
|
+
readonlyContextList: selectedValues,
|
|
91
|
+
value
|
|
92
|
+
} = props;
|
|
63
93
|
const ref = useRef({}).current;
|
|
64
94
|
const cosmosTableRef = useRef();
|
|
65
95
|
// List component context
|
|
@@ -68,11 +98,19 @@ export default function ListView(props) {
|
|
|
68
98
|
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
69
99
|
const xRayUid = xRayApis.startXRay();
|
|
70
100
|
|
|
71
|
-
useInit({
|
|
101
|
+
useInit({
|
|
102
|
+
...props,
|
|
103
|
+
setListContext,
|
|
104
|
+
ref,
|
|
105
|
+
showDynamicFields,
|
|
106
|
+
xRayUid,
|
|
107
|
+
cosmosTableRef
|
|
108
|
+
});
|
|
72
109
|
|
|
73
110
|
const thePConn = getPConnect();
|
|
111
|
+
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
74
112
|
const componentConfig = thePConn.getComponentConfig();
|
|
75
|
-
const resolvedConfigProps = thePConn.getConfigProps();
|
|
113
|
+
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
76
114
|
|
|
77
115
|
/** By default, pyGUID is used for Data classes and pyID is for Work classes as row-id/key */
|
|
78
116
|
const defRowID = referenceType === 'Case' ? 'pyID' : 'pyGUID';
|
|
@@ -80,9 +118,9 @@ export default function ListView(props) {
|
|
|
80
118
|
/** If compositeKeys is defined, use dynamic value, else fallback to pyID or pyGUID. */
|
|
81
119
|
const rowID = compositeKeys && compositeKeys?.length === 1 ? compositeKeys[0] : defRowID;
|
|
82
120
|
|
|
83
|
-
const [arRows, setRows] = useState<
|
|
84
|
-
const [arColumns, setColumns] = useState<
|
|
85
|
-
const [response, setResponse] = useState<
|
|
121
|
+
const [arRows, setRows] = useState<any[]>([]);
|
|
122
|
+
const [arColumns, setColumns] = useState<any[]>([]);
|
|
123
|
+
const [response, setResponse] = useState<any[]>([]);
|
|
86
124
|
|
|
87
125
|
const [order, setOrder] = useState<Order>('asc');
|
|
88
126
|
const [orderBy, setOrderBy] = useState<keyof any>('');
|
|
@@ -93,19 +131,19 @@ export default function ListView(props) {
|
|
|
93
131
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
94
132
|
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
95
133
|
|
|
96
|
-
const [selectedValue, setSelectedValue] = useState(
|
|
134
|
+
const [selectedValue, setSelectedValue] = useState(value);
|
|
97
135
|
|
|
98
136
|
// This basically will hold the list of all current filters
|
|
99
137
|
const filters = useRef({});
|
|
100
138
|
|
|
101
139
|
// Will contain the list of columns specific for an instance
|
|
102
|
-
|
|
103
|
-
|
|
140
|
+
const columnList: any = useRef([]);
|
|
141
|
+
const filterPayload: any = useRef();
|
|
104
142
|
// Will be sent in the dashboardFilterPayload
|
|
105
|
-
let selectParam:
|
|
143
|
+
let selectParam: any[] = [];
|
|
106
144
|
|
|
107
145
|
// dataview parameters coming from the ListPage
|
|
108
|
-
// This constant will also be used for parameters coming from from other components/utility
|
|
146
|
+
// This constant will also be used for parameters coming from from other components/utility functions in future
|
|
109
147
|
const dataViewParameters = parameters;
|
|
110
148
|
|
|
111
149
|
const useStyles = makeStyles((theme: Theme) =>
|
|
@@ -116,7 +154,8 @@ export default function ListView(props) {
|
|
|
116
154
|
paper: {
|
|
117
155
|
width: '100%',
|
|
118
156
|
marginTop: theme.spacing(2),
|
|
119
|
-
marginBottom: theme.spacing(2)
|
|
157
|
+
marginBottom: theme.spacing(2),
|
|
158
|
+
display: 'grid'
|
|
120
159
|
},
|
|
121
160
|
search: {
|
|
122
161
|
padding: '5px 5px'
|
|
@@ -184,15 +223,11 @@ export default function ListView(props) {
|
|
|
184
223
|
function getComparator<Key extends keyof any>(
|
|
185
224
|
theOrder: Order,
|
|
186
225
|
orderedBy: Key
|
|
187
|
-
// eslint-disable-next-line no-unused-vars
|
|
188
226
|
): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
|
|
189
|
-
return theOrder === 'desc'
|
|
190
|
-
? (a, b) => descendingComparator(a, b, orderedBy)
|
|
191
|
-
: (a, b) => -descendingComparator(a, b, orderedBy);
|
|
227
|
+
return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
|
|
192
228
|
}
|
|
193
229
|
|
|
194
|
-
|
|
195
|
-
function stableSort<T>(array: Array<T>, comparator: (a: T, b: T) => number) {
|
|
230
|
+
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
196
231
|
const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
|
|
197
232
|
stabilizedThis.sort((a, b) => {
|
|
198
233
|
const order = comparator(a[0], b[0]);
|
|
@@ -215,8 +250,8 @@ export default function ListView(props) {
|
|
|
215
250
|
};
|
|
216
251
|
|
|
217
252
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
218
|
-
function getHeaderCells(colFields, fields
|
|
219
|
-
|
|
253
|
+
function getHeaderCells(colFields, fields) {
|
|
254
|
+
return colFields.map((field: any, index) => {
|
|
220
255
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
221
256
|
if (theField.indexOf('.') === 0) {
|
|
222
257
|
theField = theField.substring(1);
|
|
@@ -224,17 +259,12 @@ export default function ListView(props) {
|
|
|
224
259
|
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
225
260
|
const displayAsLink = field.config.displayAsLink;
|
|
226
261
|
const headerRow: any = {};
|
|
227
|
-
headerRow.id =
|
|
262
|
+
headerRow.id = fields[index].id;
|
|
228
263
|
headerRow.type = field.type;
|
|
229
264
|
headerRow.displayAsLink = displayAsLink;
|
|
230
|
-
headerRow.numeric =
|
|
231
|
-
field.type === 'Decimal' ||
|
|
232
|
-
field.type === 'Integer' ||
|
|
233
|
-
field.type === 'Percentage' ||
|
|
234
|
-
field.type === 'Currency' ||
|
|
235
|
-
false;
|
|
265
|
+
headerRow.numeric = field.type === 'Decimal' || field.type === 'Integer' || field.type === 'Percentage' || field.type === 'Currency' || false;
|
|
236
266
|
headerRow.disablePadding = false;
|
|
237
|
-
headerRow.label =
|
|
267
|
+
headerRow.label = fields[index].label;
|
|
238
268
|
if (colIndex > -1) {
|
|
239
269
|
headerRow.classID = fields[colIndex].classID;
|
|
240
270
|
}
|
|
@@ -246,19 +276,9 @@ export default function ListView(props) {
|
|
|
246
276
|
}
|
|
247
277
|
return headerRow;
|
|
248
278
|
});
|
|
249
|
-
return arReturn;
|
|
250
279
|
}
|
|
251
280
|
|
|
252
|
-
function
|
|
253
|
-
const arReturn = arFields.filter(ele => ele.type !== 'reference');
|
|
254
|
-
arReturn.forEach((field, index) => {
|
|
255
|
-
arReturn[index].config.name = theColumns[index].id;
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
return arReturn;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function getUsingData(arTableData): Array<any> {
|
|
281
|
+
function getUsingData(arTableData): any[] {
|
|
262
282
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
263
283
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
264
284
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
@@ -266,64 +286,13 @@ export default function ListView(props) {
|
|
|
266
286
|
console.error('pyGUID or pyID values are mandatory to select the required row from the list');
|
|
267
287
|
}
|
|
268
288
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const row = data;
|
|
272
|
-
|
|
273
|
-
return row;
|
|
289
|
+
return arTableData?.map((data: any) => {
|
|
290
|
+
return data;
|
|
274
291
|
});
|
|
275
|
-
|
|
276
|
-
return arReturn;
|
|
277
292
|
}
|
|
278
293
|
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
listData?.forEach(row => {
|
|
282
|
-
// copy
|
|
283
|
-
const rowData = JSON.parse(JSON.stringify(row));
|
|
284
|
-
|
|
285
|
-
fieldData.forEach(field => {
|
|
286
|
-
const config = field.config;
|
|
287
|
-
let fieldName;
|
|
288
|
-
let formattedDate;
|
|
289
|
-
let myFormat;
|
|
290
|
-
|
|
291
|
-
switch (field.type) {
|
|
292
|
-
case 'Date':
|
|
293
|
-
fieldName = config.name;
|
|
294
|
-
myFormat = config.formatter;
|
|
295
|
-
if (!myFormat) {
|
|
296
|
-
myFormat = 'Date';
|
|
297
|
-
}
|
|
298
|
-
formattedDate = Utils.generateDate(rowData[fieldName], myFormat);
|
|
299
|
-
|
|
300
|
-
rowData[fieldName] = formattedDate;
|
|
301
|
-
break;
|
|
302
|
-
|
|
303
|
-
case 'DateTime':
|
|
304
|
-
fieldName = config.name;
|
|
305
|
-
myFormat = config.formatter;
|
|
306
|
-
if (!myFormat) {
|
|
307
|
-
myFormat = 'DateTime-Long';
|
|
308
|
-
}
|
|
309
|
-
formattedDate = Utils.generateDateTime(rowData[fieldName], myFormat);
|
|
310
|
-
|
|
311
|
-
rowData[fieldName] = formattedDate;
|
|
312
|
-
break;
|
|
313
|
-
|
|
314
|
-
default:
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
returnList.push(rowData);
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
return returnList;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function getMyColumnList(arCols: Array<any>): Array<string> {
|
|
326
|
-
const myColList: Array<string> = [];
|
|
294
|
+
function getMyColumnList(arCols: any[]): string[] {
|
|
295
|
+
const myColList: string[] = [];
|
|
327
296
|
|
|
328
297
|
arCols.forEach(col => {
|
|
329
298
|
myColList.push(col.id);
|
|
@@ -346,7 +315,7 @@ export default function ListView(props) {
|
|
|
346
315
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
347
316
|
function processFilterChange(data) {
|
|
348
317
|
const { filterId, filterExpression } = data;
|
|
349
|
-
dashboardFilterPayload = {
|
|
318
|
+
let dashboardFilterPayload: any = {
|
|
350
319
|
query: {
|
|
351
320
|
filter: {},
|
|
352
321
|
select: []
|
|
@@ -354,22 +323,21 @@ export default function ListView(props) {
|
|
|
354
323
|
};
|
|
355
324
|
|
|
356
325
|
filters.current[filterId] = filterExpression;
|
|
357
|
-
|
|
358
|
-
let isDateRange = data.filterExpression?.AND ? true : false;
|
|
326
|
+
let isDateRange = data.filterExpression?.AND;
|
|
359
327
|
// Will be AND by default but making it dynamic in case we support dynamic relational ops in future
|
|
360
328
|
const relationalOp = 'AND';
|
|
361
329
|
|
|
362
330
|
let field = getFieldFromFilter(filterExpression, isDateRange);
|
|
363
331
|
selectParam = [];
|
|
364
332
|
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
365
|
-
columnList.forEach(col => {
|
|
333
|
+
columnList.current.forEach(col => {
|
|
366
334
|
selectParam.push({
|
|
367
335
|
field: col
|
|
368
336
|
});
|
|
369
337
|
});
|
|
370
338
|
|
|
371
339
|
// Checking if the triggered filter is applicable for this list
|
|
372
|
-
if (data.filterExpression !== null && !(columnList.length && columnList.includes(field))) {
|
|
340
|
+
if (data.filterExpression !== null && !(columnList.current?.length && columnList.current?.includes(field))) {
|
|
373
341
|
return;
|
|
374
342
|
}
|
|
375
343
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
@@ -377,7 +345,7 @@ export default function ListView(props) {
|
|
|
377
345
|
|
|
378
346
|
let index = 1;
|
|
379
347
|
// Iterating over the current filters list to create filter data which will be POSTed
|
|
380
|
-
for (const filterExp
|
|
348
|
+
for (const filterExp of Object.keys(filters.current)) {
|
|
381
349
|
const filter = filters.current[filterExp];
|
|
382
350
|
// If the filter is null then we can skip this iteration
|
|
383
351
|
if (filter === null) {
|
|
@@ -386,11 +354,10 @@ export default function ListView(props) {
|
|
|
386
354
|
}
|
|
387
355
|
|
|
388
356
|
// Checking if the filter is of type- Date Range
|
|
389
|
-
|
|
390
|
-
isDateRange = filter?.AND ? true : false;
|
|
357
|
+
isDateRange = filter?.AND;
|
|
391
358
|
field = getFieldFromFilter(filter, isDateRange);
|
|
392
359
|
|
|
393
|
-
if (!(columnList.length && columnList.includes(field))) {
|
|
360
|
+
if (!(columnList.current.length && columnList.current.includes(field))) {
|
|
394
361
|
// eslint-disable-next-line no-continue
|
|
395
362
|
continue;
|
|
396
363
|
}
|
|
@@ -398,7 +365,7 @@ export default function ListView(props) {
|
|
|
398
365
|
validFilter = true;
|
|
399
366
|
/** Below are the 2 cases for- Text & Date-Range filter types where we'll construct filter data which will be sent in the dashboardFilterPayload
|
|
400
367
|
* In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
|
|
401
|
-
|
|
368
|
+
*/
|
|
402
369
|
if (isDateRange) {
|
|
403
370
|
const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
|
|
404
371
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
@@ -422,9 +389,7 @@ export default function ListView(props) {
|
|
|
422
389
|
};
|
|
423
390
|
|
|
424
391
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
425
|
-
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} T${
|
|
426
|
-
index - 1
|
|
427
|
-
}`;
|
|
392
|
+
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} T${index - 1}`;
|
|
428
393
|
} else {
|
|
429
394
|
dashboardFilterPayload.query.filter.logic = `T${index - 1}`;
|
|
430
395
|
}
|
|
@@ -437,57 +402,39 @@ export default function ListView(props) {
|
|
|
437
402
|
if (!validFilter) {
|
|
438
403
|
dashboardFilterPayload = undefined;
|
|
439
404
|
}
|
|
440
|
-
|
|
405
|
+
filterPayload.current = dashboardFilterPayload;
|
|
441
406
|
fetchDataFromServer();
|
|
442
407
|
}
|
|
443
408
|
|
|
444
409
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CLEAR_ALL fires
|
|
445
410
|
function processFilterClear() {
|
|
446
|
-
|
|
411
|
+
filterPayload.current = undefined;
|
|
447
412
|
fetchDataFromServer();
|
|
448
413
|
}
|
|
449
414
|
|
|
450
|
-
|
|
451
|
-
setTimeout(() => {
|
|
452
|
-
PCore.getPubSubUtils().subscribe(
|
|
453
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
454
|
-
data => {
|
|
455
|
-
processFilterChange(data);
|
|
456
|
-
},
|
|
457
|
-
`dashboard-component-${'id'}`,
|
|
458
|
-
false,
|
|
459
|
-
getPConnect().getContextName()
|
|
460
|
-
);
|
|
461
|
-
PCore.getPubSubUtils().subscribe(
|
|
462
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
463
|
-
() => {
|
|
464
|
-
filters.current = {};
|
|
465
|
-
processFilterClear();
|
|
466
|
-
},
|
|
467
|
-
`dashboard-component-${'id'}`,
|
|
468
|
-
false,
|
|
469
|
-
getPConnect().getContextName()
|
|
470
|
-
);
|
|
471
|
-
}, 0);
|
|
472
|
-
}, []);
|
|
473
|
-
|
|
474
|
-
function fetchAllData(fields) {
|
|
415
|
+
function fetchAllData(fields): any {
|
|
475
416
|
let query: any = null;
|
|
476
417
|
if (payload) {
|
|
477
418
|
query = payload.query;
|
|
478
419
|
} else if (fields?.length && meta.isQueryable) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
420
|
+
if (filterPayload.current) {
|
|
421
|
+
query = {
|
|
422
|
+
select: fields,
|
|
423
|
+
filter: filterPayload.current?.query?.filter
|
|
424
|
+
};
|
|
425
|
+
} else {
|
|
426
|
+
query = { select: fields };
|
|
427
|
+
}
|
|
428
|
+
} else if (filterPayload.current) {
|
|
429
|
+
query = filterPayload.current?.query;
|
|
482
430
|
}
|
|
483
431
|
const context = getPConnect().getContextName();
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
context
|
|
487
|
-
|
|
488
|
-
null
|
|
489
|
-
|
|
490
|
-
);
|
|
432
|
+
// getDataAsync isn't returning correct data for the Page(i.e. ListView within a page) case
|
|
433
|
+
return !bInForm
|
|
434
|
+
? // @ts-ignore - 3rd parameter "context" should be optional in getData method
|
|
435
|
+
PCore.getDataApiUtils().getData(referenceList, payload)
|
|
436
|
+
: // @ts-ignore - Argument of type 'null' is not assignable to parameter of type 'object'
|
|
437
|
+
PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
|
|
491
438
|
}
|
|
492
439
|
|
|
493
440
|
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
@@ -526,18 +473,22 @@ export default function ListView(props) {
|
|
|
526
473
|
return listFields;
|
|
527
474
|
};
|
|
528
475
|
|
|
529
|
-
const addItemKeyInSelect = (
|
|
530
|
-
fieldDefs,
|
|
531
|
-
itemKey,
|
|
532
|
-
select,
|
|
533
|
-
compositeKeys
|
|
534
|
-
) => {
|
|
476
|
+
const addItemKeyInSelect = (fieldDefs, itemKey, select, compositeKeys) => {
|
|
535
477
|
const elementFound = getField(fieldDefs, itemKey);
|
|
536
478
|
|
|
537
|
-
if (
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
479
|
+
if (
|
|
480
|
+
itemKey &&
|
|
481
|
+
!elementFound &&
|
|
482
|
+
Array.isArray(select) &&
|
|
483
|
+
!(compositeKeys !== null && compositeKeys?.length) &&
|
|
484
|
+
!select.find(sel => sel.field === itemKey)
|
|
485
|
+
) {
|
|
486
|
+
return [
|
|
487
|
+
...select,
|
|
488
|
+
{
|
|
489
|
+
field: itemKey
|
|
490
|
+
}
|
|
491
|
+
];
|
|
541
492
|
}
|
|
542
493
|
|
|
543
494
|
return select;
|
|
@@ -563,15 +514,12 @@ export default function ListView(props) {
|
|
|
563
514
|
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
564
515
|
const workListJSON = await fetchAllData(listFields);
|
|
565
516
|
|
|
566
|
-
// don't update these fields until we return from promise
|
|
567
|
-
let fields = presets[0].children[0].children;
|
|
568
|
-
|
|
569
517
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
570
518
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
571
519
|
|
|
572
|
-
const tableDataResults = workListJSON
|
|
520
|
+
const tableDataResults = !bInForm ? workListJSON.data.data : workListJSON.data;
|
|
573
521
|
|
|
574
|
-
const myColumns = getHeaderCells(columnFields, fieldDefs
|
|
522
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs);
|
|
575
523
|
|
|
576
524
|
const selectParams: any = [];
|
|
577
525
|
|
|
@@ -587,16 +535,14 @@ export default function ListView(props) {
|
|
|
587
535
|
colList.push(col.field);
|
|
588
536
|
});
|
|
589
537
|
|
|
590
|
-
columnList = colList;
|
|
591
|
-
|
|
592
|
-
fields = updateFields(fields, myColumns);
|
|
538
|
+
columnList.current = colList;
|
|
593
539
|
|
|
594
540
|
setResponse(tableDataResults);
|
|
595
541
|
|
|
596
542
|
const usingDataResults = getUsingData(tableDataResults);
|
|
597
543
|
|
|
598
544
|
// store globally, so can be searched, filtered, etc.
|
|
599
|
-
myRows =
|
|
545
|
+
myRows = usingDataResults;
|
|
600
546
|
myDisplayColumnList = getMyColumnList(myColumns);
|
|
601
547
|
|
|
602
548
|
// At this point, if we have data ready to render and haven't been asked
|
|
@@ -620,13 +566,47 @@ export default function ListView(props) {
|
|
|
620
566
|
useEffect(() => {
|
|
621
567
|
if (listContext.meta) {
|
|
622
568
|
fetchDataFromServer();
|
|
569
|
+
setTimeout(() => {
|
|
570
|
+
PCore.getPubSubUtils().subscribe(
|
|
571
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
572
|
+
data => {
|
|
573
|
+
processFilterChange(data);
|
|
574
|
+
},
|
|
575
|
+
`dashboard-component-${'id'}`,
|
|
576
|
+
false,
|
|
577
|
+
getPConnect().getContextName()
|
|
578
|
+
);
|
|
579
|
+
PCore.getPubSubUtils().subscribe(
|
|
580
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
581
|
+
() => {
|
|
582
|
+
filters.current = {};
|
|
583
|
+
processFilterClear();
|
|
584
|
+
},
|
|
585
|
+
`dashboard-component-${'id'}`,
|
|
586
|
+
false,
|
|
587
|
+
getPConnect().getContextName()
|
|
588
|
+
);
|
|
589
|
+
}, 0);
|
|
590
|
+
|
|
591
|
+
return function cleanupSubscriptions() {
|
|
592
|
+
PCore.getPubSubUtils().unsubscribe(
|
|
593
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
594
|
+
`dashboard-component-${'id'}`,
|
|
595
|
+
getPConnect().getContextName()
|
|
596
|
+
);
|
|
597
|
+
PCore.getPubSubUtils().unsubscribe(
|
|
598
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
599
|
+
`dashboard-component-${'id'}`,
|
|
600
|
+
getPConnect().getContextName()
|
|
601
|
+
);
|
|
602
|
+
};
|
|
623
603
|
}
|
|
624
604
|
}, [listContext]);
|
|
625
605
|
|
|
626
|
-
function searchFilter(value: string, rows:
|
|
606
|
+
function searchFilter(value: string, rows: any[]) {
|
|
627
607
|
function filterArray(el: any): boolean {
|
|
628
608
|
const bReturn = false;
|
|
629
|
-
for (const key
|
|
609
|
+
for (const key of Object.keys(el)) {
|
|
630
610
|
// only search columsn that are displayed (pzInsKey and pxRefObjectClass are added and may or may not be displayed)
|
|
631
611
|
if (myDisplayColumnList.includes(key)) {
|
|
632
612
|
let myVal = el[key];
|
|
@@ -669,7 +649,7 @@ export default function ListView(props) {
|
|
|
669
649
|
const { pxRefObjectClass, pzInsKey } = row;
|
|
670
650
|
const sTarget = thePConn.getContainerName();
|
|
671
651
|
|
|
672
|
-
const options = { containerName: sTarget };
|
|
652
|
+
const options = { containerName: sTarget, channelName: '' };
|
|
673
653
|
|
|
674
654
|
thePConn
|
|
675
655
|
.getActionsApi()
|
|
@@ -682,17 +662,17 @@ export default function ListView(props) {
|
|
|
682
662
|
});
|
|
683
663
|
}
|
|
684
664
|
|
|
685
|
-
function _rowClick(row: any) {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
665
|
+
// function _rowClick(row: any) {
|
|
666
|
+
// // eslint-disable-next-line sonarjs/no-small-switch
|
|
667
|
+
// switch (rowClickAction) {
|
|
668
|
+
// case 'openAssignment':
|
|
669
|
+
// openAssignment(row);
|
|
670
|
+
// break;
|
|
691
671
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
672
|
+
// default:
|
|
673
|
+
// break;
|
|
674
|
+
// }
|
|
675
|
+
// }
|
|
696
676
|
|
|
697
677
|
function openWork(row) {
|
|
698
678
|
const { pxRefObjectKey } = row;
|
|
@@ -724,10 +704,9 @@ export default function ListView(props) {
|
|
|
724
704
|
const [filterBy, setFilterBy] = useState<string>();
|
|
725
705
|
const [containsDateOrTime, setContainsDateOrTime] = useState<boolean>(false);
|
|
726
706
|
const [filterType, setFilterType] = useState<string>('string');
|
|
727
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
707
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
728
708
|
const [displayDialogFilterName, setDisplayDialogFilterName] = useState<string>('');
|
|
729
|
-
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] =
|
|
730
|
-
useState<string>('contains');
|
|
709
|
+
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] = useState<string>('contains');
|
|
731
710
|
const [displayDialogContainsValue, setDisplayDialogContainsValue] = useState<string>('');
|
|
732
711
|
const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
|
|
733
712
|
const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
|
|
@@ -740,11 +719,7 @@ export default function ListView(props) {
|
|
|
740
719
|
for (const filterObj of filterByColumns) {
|
|
741
720
|
if (filterObj.ref === menuColumnId) {
|
|
742
721
|
setFilterBy(menuColumnLabel);
|
|
743
|
-
if (
|
|
744
|
-
filterObj.type === 'Date' ||
|
|
745
|
-
filterObj.type === 'DateTime' ||
|
|
746
|
-
filterObj.type === 'Time'
|
|
747
|
-
) {
|
|
722
|
+
if (filterObj.type === 'Date' || filterObj.type === 'DateTime' || filterObj.type === 'Time') {
|
|
748
723
|
setContainsDateOrTime(true);
|
|
749
724
|
setFilterType(filterObj.type);
|
|
750
725
|
setDisplayDialogDateFilter(filterObj.containsFilter);
|
|
@@ -793,9 +768,9 @@ export default function ListView(props) {
|
|
|
793
768
|
|
|
794
769
|
function _showFilteredIcon(columnId) {
|
|
795
770
|
for (const filterObj of filterByColumns) {
|
|
796
|
-
if (filterObj
|
|
771
|
+
if (filterObj.ref === columnId) {
|
|
797
772
|
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
798
|
-
if (filterObj
|
|
773
|
+
if (filterObj.containsFilterValue !== '') {
|
|
799
774
|
return true;
|
|
800
775
|
}
|
|
801
776
|
return false;
|
|
@@ -808,14 +783,14 @@ export default function ListView(props) {
|
|
|
808
783
|
function updateFilterWithInfo() {
|
|
809
784
|
let bFound = false;
|
|
810
785
|
for (const filterObj of filterByColumns) {
|
|
811
|
-
if (filterObj
|
|
812
|
-
filterObj
|
|
786
|
+
if (filterObj.ref === menuColumnId) {
|
|
787
|
+
filterObj.type = filterType;
|
|
813
788
|
if (containsDateOrTime) {
|
|
814
|
-
filterObj
|
|
815
|
-
filterObj
|
|
789
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
790
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
816
791
|
} else {
|
|
817
|
-
filterObj
|
|
818
|
-
filterObj
|
|
792
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
793
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
819
794
|
}
|
|
820
795
|
bFound = true;
|
|
821
796
|
break;
|
|
@@ -826,13 +801,13 @@ export default function ListView(props) {
|
|
|
826
801
|
// add in
|
|
827
802
|
const filterObj: any = {};
|
|
828
803
|
filterObj.ref = menuColumnId;
|
|
829
|
-
filterObj
|
|
804
|
+
filterObj.type = filterType;
|
|
830
805
|
if (containsDateOrTime) {
|
|
831
|
-
filterObj
|
|
832
|
-
filterObj
|
|
806
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
807
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
833
808
|
} else {
|
|
834
|
-
filterObj
|
|
835
|
-
filterObj
|
|
809
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
810
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
836
811
|
}
|
|
837
812
|
|
|
838
813
|
filterByColumns.push(filterObj);
|
|
@@ -901,7 +876,7 @@ export default function ListView(props) {
|
|
|
901
876
|
}
|
|
902
877
|
|
|
903
878
|
function _listViewClick(row, column) {
|
|
904
|
-
const name = column.id
|
|
879
|
+
const name = column.id;
|
|
905
880
|
if (column.displayAsLink) {
|
|
906
881
|
const { pxObjClass } = row;
|
|
907
882
|
let { pzInsKey } = row;
|
|
@@ -911,7 +886,8 @@ export default function ListView(props) {
|
|
|
911
886
|
}
|
|
912
887
|
if (column.isAssignmentLink) {
|
|
913
888
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
914
|
-
containerName: 'primary'
|
|
889
|
+
containerName: 'primary',
|
|
890
|
+
channelName: ''
|
|
915
891
|
});
|
|
916
892
|
} else {
|
|
917
893
|
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
@@ -930,12 +906,11 @@ export default function ListView(props) {
|
|
|
930
906
|
break;
|
|
931
907
|
}
|
|
932
908
|
}
|
|
933
|
-
|
|
934
909
|
}
|
|
935
910
|
|
|
936
911
|
function _listTitle() {
|
|
937
912
|
const defaultTitle = 'List';
|
|
938
|
-
let title = resolvedConfigProps.title
|
|
913
|
+
let title = resolvedConfigProps.title || resolvedConfigProps?.label || defaultTitle;
|
|
939
914
|
const inheritedProps = resolvedConfigProps?.inheritedProps;
|
|
940
915
|
|
|
941
916
|
// Let any title in resolvedConfigProps that isn't the default take precedence
|
|
@@ -959,35 +934,56 @@ export default function ListView(props) {
|
|
|
959
934
|
const index = response.findIndex(element => element[rowID] === value);
|
|
960
935
|
const selectedRow = response[index];
|
|
961
936
|
compositeKeys.forEach(element => {
|
|
962
|
-
reqObj[element] = selectedRow[element]
|
|
937
|
+
reqObj[element] = selectedRow[element];
|
|
963
938
|
});
|
|
964
939
|
} else {
|
|
965
940
|
reqObj[rowID] = value;
|
|
966
941
|
}
|
|
967
|
-
getPConnect()
|
|
968
|
-
?.getListActions?.()
|
|
969
|
-
?.setSelectedRows([reqObj]);
|
|
942
|
+
getPConnect()?.getListActions?.()?.setSelectedRows([reqObj]);
|
|
970
943
|
setSelectedValue(value);
|
|
971
944
|
};
|
|
972
945
|
|
|
973
946
|
const onCheckboxClick = event => {
|
|
974
947
|
const value = event?.target?.value;
|
|
975
948
|
const checked = event?.target?.checked;
|
|
976
|
-
const reqObj = {};
|
|
949
|
+
const reqObj: any = {};
|
|
977
950
|
if (compositeKeys?.length > 1) {
|
|
978
951
|
const index = response.findIndex(element => element[rowID] === value);
|
|
979
952
|
const selectedRow = response[index];
|
|
980
953
|
compositeKeys.forEach(element => {
|
|
981
|
-
reqObj[element] = selectedRow[element]
|
|
954
|
+
reqObj[element] = selectedRow[element];
|
|
982
955
|
});
|
|
983
|
-
reqObj
|
|
956
|
+
reqObj.$selected = checked;
|
|
984
957
|
} else {
|
|
985
958
|
reqObj[rowID] = value;
|
|
986
|
-
reqObj
|
|
959
|
+
reqObj.$selected = checked;
|
|
987
960
|
}
|
|
988
|
-
getPConnect()
|
|
989
|
-
|
|
990
|
-
|
|
961
|
+
getPConnect()?.getListActions()?.setSelectedRows([reqObj]);
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
const processColumnValue = (column, value) => {
|
|
965
|
+
let val;
|
|
966
|
+
const type = column.type;
|
|
967
|
+
let theDateFormatInfo;
|
|
968
|
+
let theFormat;
|
|
969
|
+
let theCurrencyOptions;
|
|
970
|
+
switch (type) {
|
|
971
|
+
case 'Date':
|
|
972
|
+
case 'DateTime':
|
|
973
|
+
theDateFormatInfo = getDateFormatInfo();
|
|
974
|
+
theFormat = type === 'DateTime' ? `${theDateFormatInfo.dateFormatStringLong} hh:mm a` : theDateFormatInfo.dateFormatStringLong;
|
|
975
|
+
val = format(value, column.type, { format: theFormat });
|
|
976
|
+
break;
|
|
977
|
+
|
|
978
|
+
case 'Currency':
|
|
979
|
+
theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale() as string);
|
|
980
|
+
val = format(value, column.type, theCurrencyOptions);
|
|
981
|
+
break;
|
|
982
|
+
|
|
983
|
+
default:
|
|
984
|
+
val = column.format && typeof value === 'number' ? column.format(value) : value;
|
|
985
|
+
}
|
|
986
|
+
return val;
|
|
991
987
|
};
|
|
992
988
|
|
|
993
989
|
return (
|
|
@@ -1004,43 +1000,35 @@ export default function ListView(props) {
|
|
|
1004
1000
|
</Grid>
|
|
1005
1001
|
<Grid item>
|
|
1006
1002
|
<TextField
|
|
1007
|
-
label={
|
|
1003
|
+
label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
|
|
1008
1004
|
fullWidth
|
|
1009
1005
|
variant='outlined'
|
|
1010
1006
|
placeholder=''
|
|
1011
1007
|
size='small'
|
|
1012
|
-
id=
|
|
1008
|
+
id='search'
|
|
1013
1009
|
onChange={_onSearch}
|
|
1014
1010
|
/>
|
|
1015
1011
|
</Grid>
|
|
1016
1012
|
</Grid>
|
|
1017
1013
|
)}
|
|
1018
1014
|
<>
|
|
1019
|
-
{bInForm ? (
|
|
1020
|
-
<TableContainer className={classes.tableInForm}>
|
|
1015
|
+
{!bInForm ? (
|
|
1016
|
+
<TableContainer id='list-view' className={classes.tableInForm}>
|
|
1021
1017
|
<Table stickyHeader aria-label='sticky table'>
|
|
1022
1018
|
<TableHead>
|
|
1023
1019
|
<TableRow>
|
|
1024
1020
|
{arColumns.map(column => {
|
|
1025
1021
|
return (
|
|
1026
|
-
<TableCell
|
|
1027
|
-
className={classes.cell}
|
|
1028
|
-
key={column.id}
|
|
1029
|
-
sortDirection={orderBy === column.id ? order : false}
|
|
1030
|
-
>
|
|
1022
|
+
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1031
1023
|
<TableSortLabel
|
|
1032
1024
|
active={orderBy === column.id}
|
|
1033
1025
|
direction={orderBy === column.id ? order : 'asc'}
|
|
1034
1026
|
onClick={createSortHandler(column.id)}
|
|
1035
1027
|
>
|
|
1036
1028
|
{column.label}
|
|
1037
|
-
{_showFilteredIcon(column.id) &&
|
|
1038
|
-
<FilterListIcon className={classes.filteredIcon} />
|
|
1039
|
-
)}
|
|
1029
|
+
{_showFilteredIcon(column.id) && <FilterListIcon className={classes.filteredIcon} />}
|
|
1040
1030
|
{orderBy === column.id ? (
|
|
1041
|
-
<span className={classes.visuallyHidden}>
|
|
1042
|
-
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
1043
|
-
</span>
|
|
1031
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
1044
1032
|
) : null}
|
|
1045
1033
|
</TableSortLabel>
|
|
1046
1034
|
<MoreIcon
|
|
@@ -1059,20 +1047,11 @@ export default function ListView(props) {
|
|
|
1059
1047
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1060
1048
|
.map(row => {
|
|
1061
1049
|
return (
|
|
1062
|
-
<TableRow
|
|
1063
|
-
key={row.pxRefObjectInsName || row.pyID}
|
|
1064
|
-
onClick={() => {
|
|
1065
|
-
_rowClick(row);
|
|
1066
|
-
}}
|
|
1067
|
-
>
|
|
1050
|
+
<TableRow key={row.pxRefObjectInsName || row.pyID}>
|
|
1068
1051
|
{arColumns.map(column => {
|
|
1069
1052
|
const value = row[column.id];
|
|
1070
1053
|
return (
|
|
1071
|
-
<TableCell
|
|
1072
|
-
key={column.id}
|
|
1073
|
-
align={column.align}
|
|
1074
|
-
className={classes.cell}
|
|
1075
|
-
>
|
|
1054
|
+
<TableCell key={column.id} align={column.align} className={classes.cell}>
|
|
1076
1055
|
{_showButton(column.id, row) || column.displayAsLink ? (
|
|
1077
1056
|
<Link
|
|
1078
1057
|
component='button'
|
|
@@ -1080,16 +1059,10 @@ export default function ListView(props) {
|
|
|
1080
1059
|
_listViewClick(row, column);
|
|
1081
1060
|
}}
|
|
1082
1061
|
>
|
|
1083
|
-
{column.format && typeof value === 'number'
|
|
1084
|
-
? column.format(value)
|
|
1085
|
-
: value}
|
|
1062
|
+
{column.format && typeof value === 'number' ? column.format(value) : value}
|
|
1086
1063
|
</Link>
|
|
1087
1064
|
) : (
|
|
1088
|
-
<>
|
|
1089
|
-
{column.format && typeof value === 'number'
|
|
1090
|
-
? column.format(value)
|
|
1091
|
-
: value}
|
|
1092
|
-
</>
|
|
1065
|
+
<>{column.format && typeof value === 'number' ? column.format(value) : value}</>
|
|
1093
1066
|
)}
|
|
1094
1067
|
</TableCell>
|
|
1095
1068
|
);
|
|
@@ -1101,19 +1074,14 @@ export default function ListView(props) {
|
|
|
1101
1074
|
</Table>
|
|
1102
1075
|
</TableContainer>
|
|
1103
1076
|
) : (
|
|
1104
|
-
<TableContainer>
|
|
1077
|
+
<TableContainer id='list-view'>
|
|
1105
1078
|
<Table>
|
|
1106
1079
|
<TableHead>
|
|
1107
1080
|
<TableRow>
|
|
1108
|
-
{(selectionMode === SELECTION_MODE.SINGLE ||
|
|
1109
|
-
selectionMode === SELECTION_MODE.MULTI) && <TableCell></TableCell>}
|
|
1081
|
+
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
|
|
1110
1082
|
{arColumns.map(column => {
|
|
1111
1083
|
return (
|
|
1112
|
-
<TableCell
|
|
1113
|
-
className={classes.cell}
|
|
1114
|
-
key={column.id}
|
|
1115
|
-
sortDirection={orderBy === column.id ? order : false}
|
|
1116
|
-
>
|
|
1084
|
+
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1117
1085
|
<TableSortLabel
|
|
1118
1086
|
active={orderBy === column.id}
|
|
1119
1087
|
direction={orderBy === column.id ? order : 'asc'}
|
|
@@ -1121,9 +1089,7 @@ export default function ListView(props) {
|
|
|
1121
1089
|
>
|
|
1122
1090
|
{column.label}
|
|
1123
1091
|
{orderBy === column.id ? (
|
|
1124
|
-
<span className={classes.visuallyHidden}>
|
|
1125
|
-
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
1126
|
-
</span>
|
|
1092
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
1127
1093
|
) : null}
|
|
1128
1094
|
</TableSortLabel>
|
|
1129
1095
|
</TableCell>
|
|
@@ -1138,12 +1104,7 @@ export default function ListView(props) {
|
|
|
1138
1104
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1139
1105
|
.map(row => {
|
|
1140
1106
|
return (
|
|
1141
|
-
<TableRow
|
|
1142
|
-
key={row[rowID]}
|
|
1143
|
-
onClick={() => {
|
|
1144
|
-
_rowClick(row);
|
|
1145
|
-
}}
|
|
1146
|
-
>
|
|
1107
|
+
<TableRow key={row[rowID]}>
|
|
1147
1108
|
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1148
1109
|
<TableCell>
|
|
1149
1110
|
<Radio
|
|
@@ -1152,28 +1113,23 @@ export default function ListView(props) {
|
|
|
1152
1113
|
name='radio-buttons'
|
|
1153
1114
|
inputProps={{ 'aria-label': 'A' }}
|
|
1154
1115
|
checked={selectedValue === row[rowID]}
|
|
1155
|
-
|
|
1116
|
+
/>
|
|
1156
1117
|
</TableCell>
|
|
1157
1118
|
)}
|
|
1158
1119
|
{selectionMode === SELECTION_MODE.MULTI && (
|
|
1159
1120
|
<TableCell>
|
|
1160
1121
|
<Checkbox
|
|
1161
1122
|
onChange={onCheckboxClick}
|
|
1123
|
+
checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
|
|
1162
1124
|
value={row[rowID]}
|
|
1163
|
-
|
|
1125
|
+
/>
|
|
1164
1126
|
</TableCell>
|
|
1165
1127
|
)}
|
|
1166
1128
|
{arColumns.map(column => {
|
|
1167
1129
|
const value = row[column.id];
|
|
1168
1130
|
return (
|
|
1169
|
-
<TableCell
|
|
1170
|
-
|
|
1171
|
-
key={column.id}
|
|
1172
|
-
align={column.align}
|
|
1173
|
-
>
|
|
1174
|
-
{column.format && typeof value === 'number'
|
|
1175
|
-
? column.format(value)
|
|
1176
|
-
: value}
|
|
1131
|
+
<TableCell className={classes.cell} key={column.id} align={column.align}>
|
|
1132
|
+
{processColumnValue(column, value)}
|
|
1177
1133
|
</TableCell>
|
|
1178
1134
|
);
|
|
1179
1135
|
})}
|
|
@@ -1182,14 +1138,13 @@ export default function ListView(props) {
|
|
|
1182
1138
|
})}
|
|
1183
1139
|
</TableBody>
|
|
1184
1140
|
</Table>
|
|
1185
|
-
{arRows && arRows.length === 0 &&
|
|
1186
|
-
<div className='no-records'>No records found.</div>
|
|
1187
|
-
)}
|
|
1141
|
+
{arRows && arRows.length === 0 && <div className='no-records'>No records found.</div>}
|
|
1188
1142
|
</TableContainer>
|
|
1189
1143
|
)}
|
|
1190
1144
|
</>
|
|
1191
1145
|
{arRows && arRows.length > 0 && (
|
|
1192
1146
|
<TablePagination
|
|
1147
|
+
id='pagination'
|
|
1193
1148
|
rowsPerPageOptions={[10, 25, 100]}
|
|
1194
1149
|
component='div'
|
|
1195
1150
|
count={arRows.length}
|
|
@@ -1201,13 +1156,7 @@ export default function ListView(props) {
|
|
|
1201
1156
|
)}
|
|
1202
1157
|
</Paper>
|
|
1203
1158
|
)}
|
|
1204
|
-
<Menu
|
|
1205
|
-
id='simple-menu'
|
|
1206
|
-
anchorEl={anchorEl}
|
|
1207
|
-
keepMounted
|
|
1208
|
-
open={Boolean(anchorEl)}
|
|
1209
|
-
onClose={_menuClose}
|
|
1210
|
-
>
|
|
1159
|
+
<Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={_menuClose}>
|
|
1211
1160
|
<MenuItem onClick={_filterMenu}>
|
|
1212
1161
|
<FilterListIcon /> Filter
|
|
1213
1162
|
</MenuItem>
|
|
@@ -1263,11 +1212,7 @@ export default function ListView(props) {
|
|
|
1263
1212
|
</>
|
|
1264
1213
|
) : (
|
|
1265
1214
|
<>
|
|
1266
|
-
<Select
|
|
1267
|
-
fullWidth
|
|
1268
|
-
onChange={_dialogContainsFilter}
|
|
1269
|
-
value={displayDialogContainsFilter}
|
|
1270
|
-
>
|
|
1215
|
+
<Select fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1271
1216
|
<MenuItem value='contains'>Contains</MenuItem>
|
|
1272
1217
|
<MenuItem value='equals'>Equals</MenuItem>
|
|
1273
1218
|
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
@@ -1308,10 +1253,3 @@ export default function ListView(props) {
|
|
|
1308
1253
|
</>
|
|
1309
1254
|
);
|
|
1310
1255
|
}
|
|
1311
|
-
|
|
1312
|
-
ListView.defaultProps = {
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
|
-
ListView.propTypes = {
|
|
1316
|
-
getPConnect: PropTypes.func.isRequired
|
|
1317
|
-
};
|