@pega/react-sdk-overrides 23.1.10 → 23.1.12
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 +6 -14
- package/lib/designSystemExtension/Banner/Banner.tsx +14 -11
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +27 -22
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +14 -20
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +44 -19
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +7 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +21 -32
- package/lib/designSystemExtension/Operator/Operator.tsx +94 -82
- package/lib/designSystemExtension/Pulse/Pulse.tsx +14 -16
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +6 -5
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +14 -14
- package/lib/field/AutoComplete/AutoComplete.tsx +24 -26
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +98 -84
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +120 -63
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +25 -50
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +9 -16
- package/lib/field/Date/Date.tsx +15 -11
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +9 -9
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +33 -44
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +122 -31
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +11 -10
- 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 +8 -7
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/MultiSelect/Multiselect.tsx +244 -0
- package/lib/field/MultiSelect/index.tsx +1 -0
- package/lib/field/MultiSelect/utils.ts +230 -0
- package/lib/field/Percentage/Percentage.tsx +46 -41
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +13 -12
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +20 -18
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +8 -7
- package/lib/field/ScalarList/ScalarList.tsx +3 -13
- package/lib/field/ScalarList/config-ext.json +1 -2
- package/lib/field/SemanticLink/SemanticLink.tsx +7 -7
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -11
- package/lib/field/TextArea/TextArea.tsx +7 -6
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +4 -6
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +9 -7
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +11 -11
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +9 -8
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +18 -16
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/attachmentHelpers.ts +13 -8
- package/lib/helpers/case-utils.tsx +4 -8
- package/lib/helpers/common-utils.ts +5 -1
- package/lib/helpers/data_page.ts +3 -7
- package/lib/helpers/date-format-utils.ts +3 -3
- package/lib/helpers/event-utils.ts +3 -3
- package/lib/helpers/field-group-utils.ts +1 -1
- package/lib/helpers/formatters/Boolean.ts +9 -26
- package/lib/helpers/formatters/Currency.ts +15 -21
- package/lib/helpers/formatters/CurrencyMap.ts +505 -501
- package/lib/helpers/formatters/Date.ts +20 -26
- package/lib/helpers/formatters/common.ts +1 -2
- package/lib/helpers/formatters/index.ts +26 -19
- package/lib/helpers/instructions-utils.ts +38 -0
- package/lib/helpers/reactContextHelpers.ts +2 -2
- package/lib/helpers/simpleTableHelpers.ts +59 -83
- package/lib/helpers/state-utils.tsx +5 -9
- package/lib/helpers/template-utils.ts +3 -6
- package/lib/helpers/utils.ts +5 -5
- package/lib/helpers/versionHelpers.ts +1 -4
- package/lib/infra/ActionButtons/ActionButtons.tsx +38 -29
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -79
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +13 -16
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -213
- package/lib/infra/Containers/FlowContainer/helpers.ts +34 -45
- 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 +227 -218
- 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 +36 -46
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -42
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -43
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -28
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +16 -30
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +176 -212
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +19 -31
- package/lib/infra/Reference/Reference.tsx +16 -18
- package/lib/infra/Region/Region.tsx +4 -6
- package/lib/infra/RootContainer/RootContainer.tsx +75 -111
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +32 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +11 -11
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +21 -28
- package/lib/infra/View/View.tsx +17 -21
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +39 -74
- package/lib/template/BannerPage/BannerPage.tsx +12 -14
- package/lib/template/CaseSummary/CaseSummary.tsx +58 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +34 -63
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +63 -19
- package/lib/template/Confirmation/Confirmation.tsx +12 -17
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +95 -121
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +13 -16
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/Details/Details/Details.tsx +19 -22
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +9 -13
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -24
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +19 -25
- 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 +15 -14
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +15 -22
- package/lib/template/InlineDashboard/InlineDashboard.tsx +12 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +12 -16
- package/lib/template/ListPage/ListPage.tsx +5 -10
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/DefaultViewMeta.ts +1 -3
- package/lib/template/ListView/ListView.tsx +185 -175
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/hooks.ts +24 -26
- package/lib/template/ListView/utils.ts +51 -87
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +20 -20
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +25 -38
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +20 -25
- 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 +14 -24
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +9 -19
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +14 -15
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +3 -10
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +6 -10
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +32 -28
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +37 -33
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -121
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +24 -25
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +30 -30
- package/lib/template/SubTabs/SubTabs.tsx +22 -40
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -5
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +30 -28
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +3 -10
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +30 -28
- 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 +22 -34
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +24 -28
- 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 +13 -21
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +8 -16
- 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 +18 -21
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +29 -28
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +60 -1
- package/lib/widget/Attachment/Attachment.tsx +378 -405
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +64 -66
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +16 -18
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +310 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +23 -20
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +68 -42
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +58 -58
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +7 -10
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +52 -53
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -834
- package/lib/helpers/authManager.ts +0 -933
- package/lib/helpers/config_access.js +0 -186
|
@@ -1,8 +1,8 @@
|
|
|
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
7
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
|
|
8
8
|
import Table from '@material-ui/core/Table';
|
|
@@ -35,37 +35,37 @@ import IconButton from '@material-ui/core/IconButton';
|
|
|
35
35
|
import CloseIcon from '@material-ui/icons/Close';
|
|
36
36
|
import { Radio } from '@material-ui/core';
|
|
37
37
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
38
|
+
|
|
38
39
|
import { filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
40
|
+
|
|
39
41
|
import './ListView.css';
|
|
40
|
-
import useInit from './hooks';
|
|
41
42
|
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
42
43
|
import { getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
43
|
-
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters
|
|
44
|
-
// import type { PConnProps } from '../../../types/PConnProps';
|
|
45
|
-
|
|
46
|
-
// ListViewProps can't be used until getComponentConfig is NOT private
|
|
47
|
-
// interface ListViewProps extends PConnProps {
|
|
48
|
-
// // If any, enter additional props that only exist on this component
|
|
49
|
-
// bInForm?: boolean,
|
|
50
|
-
// globalSearch?: boolean,
|
|
51
|
-
// referenceList?: Array<any>,
|
|
52
|
-
// rowClickAction?: any,
|
|
53
|
-
// selectionMode?: string,
|
|
54
|
-
// referenceType?: string,
|
|
55
|
-
// payload?: any,
|
|
56
|
-
// parameters?: any,
|
|
57
|
-
// compositeKeys?: any,
|
|
58
|
-
// showDynamicFields?: boolean,
|
|
59
|
-
// presets?: any
|
|
60
|
-
// }
|
|
44
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
61
45
|
|
|
62
|
-
|
|
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
|
+
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
declare const PCore: any;
|
|
65
|
+
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
66
66
|
|
|
67
|
-
let myRows:
|
|
68
|
-
let myDisplayColumnList:
|
|
67
|
+
let myRows: any[];
|
|
68
|
+
let myDisplayColumnList: any[];
|
|
69
69
|
|
|
70
70
|
let menuColumnId = '';
|
|
71
71
|
let menuColumnType = '';
|
|
@@ -73,9 +73,9 @@ let menuColumnLabel = '';
|
|
|
73
73
|
|
|
74
74
|
let sortColumnId: any;
|
|
75
75
|
|
|
76
|
-
const filterByColumns:
|
|
76
|
+
const filterByColumns: any[] = [];
|
|
77
77
|
|
|
78
|
-
export default function ListView(props
|
|
78
|
+
export default function ListView(props: ListViewProps) {
|
|
79
79
|
const { getPConnect, bInForm = true } = props;
|
|
80
80
|
const {
|
|
81
81
|
globalSearch,
|
|
@@ -86,7 +86,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
86
86
|
payload,
|
|
87
87
|
parameters,
|
|
88
88
|
compositeKeys,
|
|
89
|
-
showDynamicFields
|
|
89
|
+
showDynamicFields,
|
|
90
|
+
readonlyContextList: selectedValues,
|
|
91
|
+
value
|
|
90
92
|
} = props;
|
|
91
93
|
const ref = useRef({}).current;
|
|
92
94
|
const cosmosTableRef = useRef();
|
|
@@ -96,11 +98,19 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
96
98
|
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
97
99
|
const xRayUid = xRayApis.startXRay();
|
|
98
100
|
|
|
99
|
-
useInit({
|
|
101
|
+
useInit({
|
|
102
|
+
...props,
|
|
103
|
+
setListContext,
|
|
104
|
+
ref,
|
|
105
|
+
showDynamicFields,
|
|
106
|
+
xRayUid,
|
|
107
|
+
cosmosTableRef
|
|
108
|
+
});
|
|
100
109
|
|
|
101
110
|
const thePConn = getPConnect();
|
|
111
|
+
// @ts-ignore - Property 'getComponentConfig' is private and only accessible within class 'C11nEnv'.
|
|
102
112
|
const componentConfig = thePConn.getComponentConfig();
|
|
103
|
-
const resolvedConfigProps = thePConn.getConfigProps();
|
|
113
|
+
const resolvedConfigProps: any = thePConn.getConfigProps() as ListViewProps;
|
|
104
114
|
|
|
105
115
|
/** By default, pyGUID is used for Data classes and pyID is for Work classes as row-id/key */
|
|
106
116
|
const defRowID = referenceType === 'Case' ? 'pyID' : 'pyGUID';
|
|
@@ -108,9 +118,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
108
118
|
/** If compositeKeys is defined, use dynamic value, else fallback to pyID or pyGUID. */
|
|
109
119
|
const rowID = compositeKeys && compositeKeys?.length === 1 ? compositeKeys[0] : defRowID;
|
|
110
120
|
|
|
111
|
-
const [arRows, setRows] = useState<
|
|
112
|
-
const [arColumns, setColumns] = useState<
|
|
113
|
-
const [response, setResponse] = useState<
|
|
121
|
+
const [arRows, setRows] = useState<any[]>([]);
|
|
122
|
+
const [arColumns, setColumns] = useState<any[]>([]);
|
|
123
|
+
const [response, setResponse] = useState<any[]>([]);
|
|
114
124
|
|
|
115
125
|
const [order, setOrder] = useState<Order>('asc');
|
|
116
126
|
const [orderBy, setOrderBy] = useState<keyof any>('');
|
|
@@ -121,7 +131,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
121
131
|
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
122
132
|
const [snackbarMessage, setSnackbarMessage] = useState('');
|
|
123
133
|
|
|
124
|
-
const [selectedValue, setSelectedValue] = useState(
|
|
134
|
+
const [selectedValue, setSelectedValue] = useState(value);
|
|
125
135
|
|
|
126
136
|
// This basically will hold the list of all current filters
|
|
127
137
|
const filters = useRef({});
|
|
@@ -130,10 +140,10 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
130
140
|
const columnList: any = useRef([]);
|
|
131
141
|
const filterPayload: any = useRef();
|
|
132
142
|
// Will be sent in the dashboardFilterPayload
|
|
133
|
-
let selectParam:
|
|
143
|
+
let selectParam: any[] = [];
|
|
134
144
|
|
|
135
145
|
// dataview parameters coming from the ListPage
|
|
136
|
-
// 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
|
|
137
147
|
const dataViewParameters = parameters;
|
|
138
148
|
|
|
139
149
|
const useStyles = makeStyles((theme: Theme) =>
|
|
@@ -144,7 +154,8 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
144
154
|
paper: {
|
|
145
155
|
width: '100%',
|
|
146
156
|
marginTop: theme.spacing(2),
|
|
147
|
-
marginBottom: theme.spacing(2)
|
|
157
|
+
marginBottom: theme.spacing(2),
|
|
158
|
+
display: 'grid'
|
|
148
159
|
},
|
|
149
160
|
search: {
|
|
150
161
|
padding: '5px 5px'
|
|
@@ -198,10 +209,10 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
198
209
|
};
|
|
199
210
|
|
|
200
211
|
function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
|
|
201
|
-
if (b[orderedBy] < a[orderedBy]) {
|
|
212
|
+
if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
|
|
202
213
|
return -1;
|
|
203
214
|
}
|
|
204
|
-
if (b[orderedBy] > a[orderedBy]) {
|
|
215
|
+
if (!a[orderedBy] || b[orderedBy] > a[orderedBy]) {
|
|
205
216
|
return 1;
|
|
206
217
|
}
|
|
207
218
|
return 0;
|
|
@@ -212,20 +223,18 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
212
223
|
function getComparator<Key extends keyof any>(
|
|
213
224
|
theOrder: Order,
|
|
214
225
|
orderedBy: Key
|
|
215
|
-
// eslint-disable-next-line no-unused-vars
|
|
216
226
|
): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
|
|
217
227
|
return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
|
|
218
228
|
}
|
|
219
229
|
|
|
220
|
-
|
|
221
|
-
function stableSort<T>(array: Array<T>, comparator: (a: T, b: T) => number) {
|
|
230
|
+
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
222
231
|
const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
|
|
223
232
|
stabilizedThis.sort((a, b) => {
|
|
224
233
|
const order = comparator(a[0], b[0]);
|
|
225
234
|
if (order !== 0) return order;
|
|
226
235
|
return a[1] - b[1];
|
|
227
236
|
});
|
|
228
|
-
return stabilizedThis.map(
|
|
237
|
+
return stabilizedThis.map(el => el[0]);
|
|
229
238
|
}
|
|
230
239
|
|
|
231
240
|
const [page, setPage] = useState(0);
|
|
@@ -242,12 +251,12 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
242
251
|
|
|
243
252
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
244
253
|
function getHeaderCells(colFields, fields) {
|
|
245
|
-
|
|
254
|
+
return colFields.map((field: any, index) => {
|
|
246
255
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
247
256
|
if (theField.indexOf('.') === 0) {
|
|
248
257
|
theField = theField.substring(1);
|
|
249
258
|
}
|
|
250
|
-
const colIndex = fields.findIndex(
|
|
259
|
+
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
251
260
|
const displayAsLink = field.config.displayAsLink;
|
|
252
261
|
const headerRow: any = {};
|
|
253
262
|
headerRow.id = fields[index].id;
|
|
@@ -267,10 +276,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
267
276
|
}
|
|
268
277
|
return headerRow;
|
|
269
278
|
});
|
|
270
|
-
return arReturn;
|
|
271
279
|
}
|
|
272
280
|
|
|
273
|
-
function getUsingData(arTableData):
|
|
281
|
+
function getUsingData(arTableData): any[] {
|
|
274
282
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
275
283
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
276
284
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
@@ -278,19 +286,15 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
278
286
|
console.error('pyGUID or pyID values are mandatory to select the required row from the list');
|
|
279
287
|
}
|
|
280
288
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return row;
|
|
289
|
+
return arTableData?.map((data: any) => {
|
|
290
|
+
return data;
|
|
285
291
|
});
|
|
286
|
-
|
|
287
|
-
return arReturn;
|
|
288
292
|
}
|
|
289
293
|
|
|
290
|
-
function getMyColumnList(arCols:
|
|
291
|
-
const myColList:
|
|
294
|
+
function getMyColumnList(arCols: any[]): string[] {
|
|
295
|
+
const myColList: string[] = [];
|
|
292
296
|
|
|
293
|
-
arCols.forEach(
|
|
297
|
+
arCols.forEach(col => {
|
|
294
298
|
myColList.push(col.id);
|
|
295
299
|
});
|
|
296
300
|
|
|
@@ -319,15 +323,14 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
319
323
|
};
|
|
320
324
|
|
|
321
325
|
filters.current[filterId] = filterExpression;
|
|
322
|
-
|
|
323
|
-
let isDateRange = data.filterExpression?.AND ? true : false;
|
|
326
|
+
let isDateRange = data.filterExpression?.AND;
|
|
324
327
|
// Will be AND by default but making it dynamic in case we support dynamic relational ops in future
|
|
325
328
|
const relationalOp = 'AND';
|
|
326
329
|
|
|
327
330
|
let field = getFieldFromFilter(filterExpression, isDateRange);
|
|
328
331
|
selectParam = [];
|
|
329
332
|
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
330
|
-
columnList.current.forEach(
|
|
333
|
+
columnList.current.forEach(col => {
|
|
331
334
|
selectParam.push({
|
|
332
335
|
field: col
|
|
333
336
|
});
|
|
@@ -342,7 +345,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
342
345
|
|
|
343
346
|
let index = 1;
|
|
344
347
|
// Iterating over the current filters list to create filter data which will be POSTed
|
|
345
|
-
for (const filterExp
|
|
348
|
+
for (const filterExp of Object.keys(filters.current)) {
|
|
346
349
|
const filter = filters.current[filterExp];
|
|
347
350
|
// If the filter is null then we can skip this iteration
|
|
348
351
|
if (filter === null) {
|
|
@@ -351,8 +354,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
351
354
|
}
|
|
352
355
|
|
|
353
356
|
// Checking if the filter is of type- Date Range
|
|
354
|
-
|
|
355
|
-
isDateRange = filter?.AND ? true : false;
|
|
357
|
+
isDateRange = filter?.AND;
|
|
356
358
|
field = getFieldFromFilter(filter, isDateRange);
|
|
357
359
|
|
|
358
360
|
if (!(columnList.current.length && columnList.current.includes(field))) {
|
|
@@ -410,13 +412,16 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
410
412
|
fetchDataFromServer();
|
|
411
413
|
}
|
|
412
414
|
|
|
413
|
-
function fetchAllData(fields) {
|
|
415
|
+
function fetchAllData(fields): any {
|
|
414
416
|
let query: any = null;
|
|
415
417
|
if (payload) {
|
|
416
418
|
query = payload.query;
|
|
417
419
|
} else if (fields?.length && meta.isQueryable) {
|
|
418
420
|
if (filterPayload.current) {
|
|
419
|
-
query = {
|
|
421
|
+
query = {
|
|
422
|
+
select: fields,
|
|
423
|
+
filter: filterPayload.current?.query?.filter
|
|
424
|
+
};
|
|
420
425
|
} else {
|
|
421
426
|
query = { select: fields };
|
|
422
427
|
}
|
|
@@ -426,8 +431,10 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
426
431
|
const context = getPConnect().getContextName();
|
|
427
432
|
// getDataAsync isn't returning correct data for the Page(i.e. ListView within a page) case
|
|
428
433
|
return !bInForm
|
|
429
|
-
?
|
|
430
|
-
|
|
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);
|
|
431
438
|
}
|
|
432
439
|
|
|
433
440
|
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
@@ -440,15 +447,15 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
440
447
|
} else {
|
|
441
448
|
// NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields
|
|
442
449
|
// corresponding to `state.groups` are set up. Needed in Client-mode grouping/pagination.
|
|
443
|
-
fieldDefs.forEach(
|
|
444
|
-
if (!listFields.find(
|
|
450
|
+
fieldDefs.forEach(field => {
|
|
451
|
+
if (!listFields.find(f => f.field === field.name)) {
|
|
445
452
|
listFields.push({
|
|
446
453
|
field: field.name
|
|
447
454
|
});
|
|
448
455
|
}
|
|
449
456
|
});
|
|
450
|
-
patchQueryFields.forEach(
|
|
451
|
-
if (!listFields.find(
|
|
457
|
+
patchQueryFields.forEach(k => {
|
|
458
|
+
if (!listFields.find(f => f.field === k)) {
|
|
452
459
|
listFields.push({
|
|
453
460
|
field: k
|
|
454
461
|
});
|
|
@@ -456,8 +463,8 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
456
463
|
});
|
|
457
464
|
}
|
|
458
465
|
|
|
459
|
-
compositeKeys.forEach(
|
|
460
|
-
if (!listFields.find(
|
|
466
|
+
compositeKeys.forEach(k => {
|
|
467
|
+
if (!listFields.find(f => f.field === k)) {
|
|
461
468
|
listFields.push({
|
|
462
469
|
field: k
|
|
463
470
|
});
|
|
@@ -474,7 +481,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
474
481
|
!elementFound &&
|
|
475
482
|
Array.isArray(select) &&
|
|
476
483
|
!(compositeKeys !== null && compositeKeys?.length) &&
|
|
477
|
-
!select.find(
|
|
484
|
+
!select.find(sel => sel.field === itemKey)
|
|
478
485
|
) {
|
|
479
486
|
return [
|
|
480
487
|
...select,
|
|
@@ -492,9 +499,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
492
499
|
return fieldsMap.get(columnId);
|
|
493
500
|
};
|
|
494
501
|
|
|
495
|
-
const getFieldsMap =
|
|
502
|
+
const getFieldsMap = fieldDefs => {
|
|
496
503
|
const fieldsMap = new Map();
|
|
497
|
-
fieldDefs.forEach(
|
|
504
|
+
fieldDefs.forEach(element => {
|
|
498
505
|
fieldsMap.set(element.id, element);
|
|
499
506
|
});
|
|
500
507
|
return fieldsMap;
|
|
@@ -510,13 +517,13 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
510
517
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
511
518
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
512
519
|
|
|
513
|
-
const tableDataResults = !bInForm ? workListJSON
|
|
520
|
+
const tableDataResults = !bInForm ? workListJSON.data.data : workListJSON.data;
|
|
514
521
|
|
|
515
522
|
const myColumns = getHeaderCells(columnFields, fieldDefs);
|
|
516
523
|
|
|
517
524
|
const selectParams: any = [];
|
|
518
525
|
|
|
519
|
-
myColumns.forEach(
|
|
526
|
+
myColumns.forEach(column => {
|
|
520
527
|
selectParams.push({
|
|
521
528
|
field: column.id
|
|
522
529
|
});
|
|
@@ -524,7 +531,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
524
531
|
|
|
525
532
|
const colList: any = [];
|
|
526
533
|
|
|
527
|
-
selectParams.forEach(
|
|
534
|
+
selectParams.forEach(col => {
|
|
528
535
|
colList.push(col.field);
|
|
529
536
|
});
|
|
530
537
|
|
|
@@ -562,7 +569,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
562
569
|
setTimeout(() => {
|
|
563
570
|
PCore.getPubSubUtils().subscribe(
|
|
564
571
|
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
565
|
-
|
|
572
|
+
data => {
|
|
566
573
|
processFilterChange(data);
|
|
567
574
|
},
|
|
568
575
|
`dashboard-component-${'id'}`,
|
|
@@ -580,28 +587,26 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
580
587
|
getPConnect().getContextName()
|
|
581
588
|
);
|
|
582
589
|
}, 0);
|
|
583
|
-
}
|
|
584
590
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
};
|
|
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
|
+
};
|
|
603
|
+
}
|
|
599
604
|
}, [listContext]);
|
|
600
605
|
|
|
601
|
-
function searchFilter(value: string, rows:
|
|
606
|
+
function searchFilter(value: string, rows: any[]) {
|
|
602
607
|
function filterArray(el: any): boolean {
|
|
603
608
|
const bReturn = false;
|
|
604
|
-
for (const key
|
|
609
|
+
for (const key of Object.keys(el)) {
|
|
605
610
|
// only search columsn that are displayed (pzInsKey and pxRefObjectClass are added and may or may not be displayed)
|
|
606
611
|
if (myDisplayColumnList.includes(key)) {
|
|
607
612
|
let myVal = el[key];
|
|
@@ -699,7 +704,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
699
704
|
const [filterBy, setFilterBy] = useState<string>();
|
|
700
705
|
const [containsDateOrTime, setContainsDateOrTime] = useState<boolean>(false);
|
|
701
706
|
const [filterType, setFilterType] = useState<string>('string');
|
|
702
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
707
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
703
708
|
const [displayDialogFilterName, setDisplayDialogFilterName] = useState<string>('');
|
|
704
709
|
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] = useState<string>('contains');
|
|
705
710
|
const [displayDialogContainsValue, setDisplayDialogContainsValue] = useState<string>('');
|
|
@@ -763,9 +768,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
763
768
|
|
|
764
769
|
function _showFilteredIcon(columnId) {
|
|
765
770
|
for (const filterObj of filterByColumns) {
|
|
766
|
-
if (filterObj
|
|
771
|
+
if (filterObj.ref === columnId) {
|
|
767
772
|
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
768
|
-
if (filterObj
|
|
773
|
+
if (filterObj.containsFilterValue !== '') {
|
|
769
774
|
return true;
|
|
770
775
|
}
|
|
771
776
|
return false;
|
|
@@ -778,14 +783,14 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
778
783
|
function updateFilterWithInfo() {
|
|
779
784
|
let bFound = false;
|
|
780
785
|
for (const filterObj of filterByColumns) {
|
|
781
|
-
if (filterObj
|
|
782
|
-
filterObj
|
|
786
|
+
if (filterObj.ref === menuColumnId) {
|
|
787
|
+
filterObj.type = filterType;
|
|
783
788
|
if (containsDateOrTime) {
|
|
784
|
-
filterObj
|
|
785
|
-
filterObj
|
|
789
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
790
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
786
791
|
} else {
|
|
787
|
-
filterObj
|
|
788
|
-
filterObj
|
|
792
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
793
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
789
794
|
}
|
|
790
795
|
bFound = true;
|
|
791
796
|
break;
|
|
@@ -796,13 +801,13 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
796
801
|
// add in
|
|
797
802
|
const filterObj: any = {};
|
|
798
803
|
filterObj.ref = menuColumnId;
|
|
799
|
-
filterObj
|
|
804
|
+
filterObj.type = filterType;
|
|
800
805
|
if (containsDateOrTime) {
|
|
801
|
-
filterObj
|
|
802
|
-
filterObj
|
|
806
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
807
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
803
808
|
} else {
|
|
804
|
-
filterObj
|
|
805
|
-
filterObj
|
|
809
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
810
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
806
811
|
}
|
|
807
812
|
|
|
808
813
|
filterByColumns.push(filterObj);
|
|
@@ -906,7 +911,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
906
911
|
function _listTitle() {
|
|
907
912
|
const defaultTitle = 'List';
|
|
908
913
|
let title = resolvedConfigProps.title || resolvedConfigProps?.label || defaultTitle;
|
|
909
|
-
const inheritedProps = resolvedConfigProps?.
|
|
914
|
+
const inheritedProps = resolvedConfigProps?.inheritedProps;
|
|
910
915
|
|
|
911
916
|
// Let any title in resolvedConfigProps that isn't the default take precedence
|
|
912
917
|
// but only look in inheritedProps if they exist
|
|
@@ -926,9 +931,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
926
931
|
const value = event.target.value;
|
|
927
932
|
const reqObj = {};
|
|
928
933
|
if (compositeKeys?.length > 1) {
|
|
929
|
-
const index = response.findIndex(
|
|
934
|
+
const index = response.findIndex(element => element[rowID] === value);
|
|
930
935
|
const selectedRow = response[index];
|
|
931
|
-
compositeKeys.forEach(
|
|
936
|
+
compositeKeys.forEach(element => {
|
|
932
937
|
reqObj[element] = selectedRow[element];
|
|
933
938
|
});
|
|
934
939
|
} else {
|
|
@@ -938,20 +943,20 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
938
943
|
setSelectedValue(value);
|
|
939
944
|
};
|
|
940
945
|
|
|
941
|
-
const onCheckboxClick =
|
|
946
|
+
const onCheckboxClick = event => {
|
|
942
947
|
const value = event?.target?.value;
|
|
943
948
|
const checked = event?.target?.checked;
|
|
944
|
-
const reqObj = {};
|
|
949
|
+
const reqObj: any = {};
|
|
945
950
|
if (compositeKeys?.length > 1) {
|
|
946
|
-
const index = response.findIndex(
|
|
951
|
+
const index = response.findIndex(element => element[rowID] === value);
|
|
947
952
|
const selectedRow = response[index];
|
|
948
|
-
compositeKeys.forEach(
|
|
953
|
+
compositeKeys.forEach(element => {
|
|
949
954
|
reqObj[element] = selectedRow[element];
|
|
950
955
|
});
|
|
951
|
-
reqObj
|
|
956
|
+
reqObj.$selected = checked;
|
|
952
957
|
} else {
|
|
953
958
|
reqObj[rowID] = value;
|
|
954
|
-
reqObj
|
|
959
|
+
reqObj.$selected = checked;
|
|
955
960
|
}
|
|
956
961
|
getPConnect()?.getListActions()?.setSelectedRows([reqObj]);
|
|
957
962
|
};
|
|
@@ -971,12 +976,12 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
971
976
|
break;
|
|
972
977
|
|
|
973
978
|
case 'Currency':
|
|
974
|
-
theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale());
|
|
979
|
+
theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale() as string);
|
|
975
980
|
val = format(value, column.type, theCurrencyOptions);
|
|
976
981
|
break;
|
|
977
982
|
|
|
978
983
|
default:
|
|
979
|
-
val = column.format && typeof value === 'number' ? column.format(value) : value;
|
|
984
|
+
val = column.format && typeof value === 'number' ? column.format(value) : value || '---';
|
|
980
985
|
}
|
|
981
986
|
return val;
|
|
982
987
|
};
|
|
@@ -985,11 +990,11 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
985
990
|
<>
|
|
986
991
|
{arColumns && arColumns.length > 0 && (
|
|
987
992
|
<Paper className={classes.paper}>
|
|
988
|
-
<Typography className={classes.title} variant=
|
|
993
|
+
<Typography className={classes.title} variant='h6' color='textPrimary' gutterBottom>
|
|
989
994
|
{_listTitle()}
|
|
990
995
|
</Typography>
|
|
991
996
|
{globalSearch && (
|
|
992
|
-
<Grid container spacing={1} alignItems=
|
|
997
|
+
<Grid container spacing={1} alignItems='flex-end' className={classes.search}>
|
|
993
998
|
<Grid item>
|
|
994
999
|
<SearchIcon />
|
|
995
1000
|
</Grid>
|
|
@@ -997,10 +1002,10 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
997
1002
|
<TextField
|
|
998
1003
|
label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
|
|
999
1004
|
fullWidth
|
|
1000
|
-
variant=
|
|
1001
|
-
placeholder=
|
|
1002
|
-
size=
|
|
1003
|
-
id=
|
|
1005
|
+
variant='outlined'
|
|
1006
|
+
placeholder=''
|
|
1007
|
+
size='small'
|
|
1008
|
+
id='search'
|
|
1004
1009
|
onChange={_onSearch}
|
|
1005
1010
|
/>
|
|
1006
1011
|
</Grid>
|
|
@@ -1008,11 +1013,11 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1008
1013
|
)}
|
|
1009
1014
|
<>
|
|
1010
1015
|
{!bInForm ? (
|
|
1011
|
-
<TableContainer id=
|
|
1012
|
-
<Table stickyHeader aria-label=
|
|
1016
|
+
<TableContainer id='list-view' className={classes.tableInForm}>
|
|
1017
|
+
<Table stickyHeader aria-label='sticky table'>
|
|
1013
1018
|
<TableHead>
|
|
1014
1019
|
<TableRow>
|
|
1015
|
-
{arColumns.map(
|
|
1020
|
+
{arColumns.map(column => {
|
|
1016
1021
|
return (
|
|
1017
1022
|
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1018
1023
|
<TableSortLabel
|
|
@@ -1028,7 +1033,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1028
1033
|
</TableSortLabel>
|
|
1029
1034
|
<MoreIcon
|
|
1030
1035
|
className={classes.moreIcon}
|
|
1031
|
-
onClick={
|
|
1036
|
+
onClick={event => {
|
|
1032
1037
|
_menuClick(event, column.id, column.type, column.label);
|
|
1033
1038
|
}}
|
|
1034
1039
|
/>
|
|
@@ -1040,16 +1045,16 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1040
1045
|
<TableBody>
|
|
1041
1046
|
{stableSort(arRows, getComparator(order, orderBy))
|
|
1042
1047
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1043
|
-
.map(
|
|
1048
|
+
.map(row => {
|
|
1044
1049
|
return (
|
|
1045
|
-
<TableRow key={row.pxRefObjectInsName || row.pyID}>
|
|
1046
|
-
{arColumns.map(
|
|
1050
|
+
<TableRow key={row.pxRefObjectInsName || row.pyID || row.pyGUID}>
|
|
1051
|
+
{arColumns.map(column => {
|
|
1047
1052
|
const value = row[column.id];
|
|
1048
1053
|
return (
|
|
1049
1054
|
<TableCell key={column.id} align={column.align} className={classes.cell}>
|
|
1050
1055
|
{_showButton(column.id, row) || column.displayAsLink ? (
|
|
1051
1056
|
<Link
|
|
1052
|
-
component=
|
|
1057
|
+
component='button'
|
|
1053
1058
|
onClick={() => {
|
|
1054
1059
|
_listViewClick(row, column);
|
|
1055
1060
|
}}
|
|
@@ -1057,7 +1062,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1057
1062
|
{column.format && typeof value === 'number' ? column.format(value) : value}
|
|
1058
1063
|
</Link>
|
|
1059
1064
|
) : (
|
|
1060
|
-
<>{column.format && typeof value === 'number' ? column.format(value) : value}</>
|
|
1065
|
+
<>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
|
|
1061
1066
|
)}
|
|
1062
1067
|
</TableCell>
|
|
1063
1068
|
);
|
|
@@ -1069,12 +1074,12 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1069
1074
|
</Table>
|
|
1070
1075
|
</TableContainer>
|
|
1071
1076
|
) : (
|
|
1072
|
-
<TableContainer id=
|
|
1077
|
+
<TableContainer id='list-view'>
|
|
1073
1078
|
<Table>
|
|
1074
1079
|
<TableHead>
|
|
1075
1080
|
<TableRow>
|
|
1076
|
-
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell
|
|
1077
|
-
{arColumns.map(
|
|
1081
|
+
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
|
|
1082
|
+
{arColumns.map(column => {
|
|
1078
1083
|
return (
|
|
1079
1084
|
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1080
1085
|
<TableSortLabel
|
|
@@ -1097,26 +1102,30 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1097
1102
|
arRows.length > 0 &&
|
|
1098
1103
|
stableSort(arRows, getComparator(order, orderBy))
|
|
1099
1104
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1100
|
-
.map(
|
|
1105
|
+
.map(row => {
|
|
1101
1106
|
return (
|
|
1102
|
-
<TableRow key={row
|
|
1107
|
+
<TableRow key={row.pxRefObjectInsName || row.pyGUID || row.pyID}>
|
|
1103
1108
|
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1104
1109
|
<TableCell>
|
|
1105
1110
|
<Radio
|
|
1106
1111
|
onChange={handleChange}
|
|
1107
1112
|
value={row[rowID]}
|
|
1108
|
-
name=
|
|
1113
|
+
name='radio-buttons'
|
|
1109
1114
|
inputProps={{ 'aria-label': 'A' }}
|
|
1110
1115
|
checked={selectedValue === row[rowID]}
|
|
1111
|
-
|
|
1116
|
+
/>
|
|
1112
1117
|
</TableCell>
|
|
1113
1118
|
)}
|
|
1114
1119
|
{selectionMode === SELECTION_MODE.MULTI && (
|
|
1115
1120
|
<TableCell>
|
|
1116
|
-
<Checkbox
|
|
1121
|
+
<Checkbox
|
|
1122
|
+
onChange={onCheckboxClick}
|
|
1123
|
+
checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
|
|
1124
|
+
value={row[rowID]}
|
|
1125
|
+
/>
|
|
1117
1126
|
</TableCell>
|
|
1118
1127
|
)}
|
|
1119
|
-
{arColumns.map(
|
|
1128
|
+
{arColumns.map(column => {
|
|
1120
1129
|
const value = row[column.id];
|
|
1121
1130
|
return (
|
|
1122
1131
|
<TableCell className={classes.cell} key={column.id} align={column.align}>
|
|
@@ -1129,14 +1138,15 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1129
1138
|
})}
|
|
1130
1139
|
</TableBody>
|
|
1131
1140
|
</Table>
|
|
1132
|
-
{arRows && arRows.length === 0 && <div className=
|
|
1141
|
+
{arRows && arRows.length === 0 && <div className='no-records'>No records found.</div>}
|
|
1133
1142
|
</TableContainer>
|
|
1134
1143
|
)}
|
|
1135
1144
|
</>
|
|
1136
1145
|
{arRows && arRows.length > 0 && (
|
|
1137
1146
|
<TablePagination
|
|
1147
|
+
id='pagination'
|
|
1138
1148
|
rowsPerPageOptions={[10, 25, 100]}
|
|
1139
|
-
component=
|
|
1149
|
+
component='div'
|
|
1140
1150
|
count={arRows.length}
|
|
1141
1151
|
rowsPerPage={rowsPerPage}
|
|
1142
1152
|
page={page}
|
|
@@ -1146,7 +1156,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1146
1156
|
)}
|
|
1147
1157
|
</Paper>
|
|
1148
1158
|
)}
|
|
1149
|
-
<Menu id=
|
|
1159
|
+
<Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={_menuClose}>
|
|
1150
1160
|
<MenuItem onClick={_filterMenu}>
|
|
1151
1161
|
<FilterListIcon /> Filter
|
|
1152
1162
|
</MenuItem>
|
|
@@ -1154,24 +1164,24 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1154
1164
|
<SubjectIcon /> Group
|
|
1155
1165
|
</MenuItem>
|
|
1156
1166
|
</Menu>
|
|
1157
|
-
<Dialog open={open} onClose={_closeDialog} aria-labelledby=
|
|
1158
|
-
<DialogTitle id=
|
|
1167
|
+
<Dialog open={open} onClose={_closeDialog} aria-labelledby='form-dialog-title'>
|
|
1168
|
+
<DialogTitle id='form-dialog-title'>Filter: {filterBy}</DialogTitle>
|
|
1159
1169
|
<DialogContent>
|
|
1160
1170
|
{containsDateOrTime ? (
|
|
1161
1171
|
<>
|
|
1162
1172
|
<Select value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
|
|
1163
|
-
<MenuItem value=
|
|
1164
|
-
<MenuItem value=
|
|
1165
|
-
<MenuItem value=
|
|
1166
|
-
<MenuItem value=
|
|
1167
|
-
<MenuItem value=
|
|
1173
|
+
<MenuItem value='notequal'>is not equal to</MenuItem>
|
|
1174
|
+
<MenuItem value='after'>after</MenuItem>
|
|
1175
|
+
<MenuItem value='before'>before</MenuItem>
|
|
1176
|
+
<MenuItem value='null'>is null</MenuItem>
|
|
1177
|
+
<MenuItem value='notnull'>is not null</MenuItem>
|
|
1168
1178
|
</Select>
|
|
1169
1179
|
{filterType === 'Date' && (
|
|
1170
1180
|
<TextField
|
|
1171
1181
|
autoFocus
|
|
1172
|
-
margin=
|
|
1173
|
-
id=
|
|
1174
|
-
type=
|
|
1182
|
+
margin='dense'
|
|
1183
|
+
id='containsFilter'
|
|
1184
|
+
type='date'
|
|
1175
1185
|
fullWidth
|
|
1176
1186
|
value={displayDialogDateValue}
|
|
1177
1187
|
onChange={_dialogDateValue}
|
|
@@ -1180,9 +1190,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1180
1190
|
{filterType === 'DateTime' && (
|
|
1181
1191
|
<TextField
|
|
1182
1192
|
autoFocus
|
|
1183
|
-
margin=
|
|
1184
|
-
id=
|
|
1185
|
-
type=
|
|
1193
|
+
margin='dense'
|
|
1194
|
+
id='containsFilter'
|
|
1195
|
+
type='datetime-local'
|
|
1186
1196
|
fullWidth
|
|
1187
1197
|
value={displayDialogDateValue}
|
|
1188
1198
|
onChange={_dialogDateValue}
|
|
@@ -1191,9 +1201,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1191
1201
|
{filterType === 'Time' && (
|
|
1192
1202
|
<TextField
|
|
1193
1203
|
autoFocus
|
|
1194
|
-
margin=
|
|
1195
|
-
id=
|
|
1196
|
-
type=
|
|
1204
|
+
margin='dense'
|
|
1205
|
+
id='containsFilter'
|
|
1206
|
+
type='time'
|
|
1197
1207
|
fullWidth
|
|
1198
1208
|
value={displayDialogDateValue}
|
|
1199
1209
|
onChange={_dialogDateValue}
|
|
@@ -1203,15 +1213,15 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1203
1213
|
) : (
|
|
1204
1214
|
<>
|
|
1205
1215
|
<Select fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1206
|
-
<MenuItem value=
|
|
1207
|
-
<MenuItem value=
|
|
1208
|
-
<MenuItem value=
|
|
1216
|
+
<MenuItem value='contains'>Contains</MenuItem>
|
|
1217
|
+
<MenuItem value='equals'>Equals</MenuItem>
|
|
1218
|
+
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
1209
1219
|
</Select>
|
|
1210
1220
|
<TextField
|
|
1211
1221
|
autoFocus
|
|
1212
|
-
margin=
|
|
1213
|
-
id=
|
|
1214
|
-
type=
|
|
1222
|
+
margin='dense'
|
|
1223
|
+
id='containsFilter'
|
|
1224
|
+
type='text'
|
|
1215
1225
|
fullWidth
|
|
1216
1226
|
value={displayDialogContainsValue}
|
|
1217
1227
|
onChange={_dialogContainsValue}
|
|
@@ -1220,10 +1230,10 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1220
1230
|
)}
|
|
1221
1231
|
</DialogContent>
|
|
1222
1232
|
<DialogActions>
|
|
1223
|
-
<Button onClick={_closeDialog} color=
|
|
1233
|
+
<Button onClick={_closeDialog} color='secondary'>
|
|
1224
1234
|
Cancel
|
|
1225
1235
|
</Button>
|
|
1226
|
-
<Button onClick={_submitFilter} color=
|
|
1236
|
+
<Button onClick={_submitFilter} color='primary'>
|
|
1227
1237
|
Submit
|
|
1228
1238
|
</Button>
|
|
1229
1239
|
</DialogActions>
|
|
@@ -1235,8 +1245,8 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1235
1245
|
onClose={handleSnackbarClose}
|
|
1236
1246
|
message={snackbarMessage}
|
|
1237
1247
|
action={
|
|
1238
|
-
<IconButton size=
|
|
1239
|
-
<CloseIcon fontSize=
|
|
1248
|
+
<IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>
|
|
1249
|
+
<CloseIcon fontSize='small' />
|
|
1240
1250
|
</IconButton>
|
|
1241
1251
|
}
|
|
1242
1252
|
/>
|