@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,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import React, { PropsWithChildren, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import Table from '@material-ui/core/Table';
|
|
4
4
|
import TableBody from '@material-ui/core/TableBody';
|
|
5
5
|
import TableCell from '@material-ui/core/TableCell';
|
|
@@ -8,15 +8,8 @@ import TableHead from '@material-ui/core/TableHead';
|
|
|
8
8
|
import TableRow from '@material-ui/core/TableRow';
|
|
9
9
|
import Paper from '@material-ui/core/Paper';
|
|
10
10
|
import { makeStyles } from '@material-ui/core/styles';
|
|
11
|
-
import { buildFieldsForTable, filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
12
|
-
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
13
11
|
import Link from '@material-ui/core/Link';
|
|
14
|
-
import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
|
|
15
|
-
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
16
12
|
import { createElement } from 'react';
|
|
17
|
-
|
|
18
|
-
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
19
|
-
|
|
20
13
|
import TableSortLabel from '@material-ui/core/TableSortLabel';
|
|
21
14
|
import MoreIcon from '@material-ui/icons/MoreVert';
|
|
22
15
|
import Menu from '@material-ui/core/Menu';
|
|
@@ -31,24 +24,34 @@ import Select from '@material-ui/core/Select';
|
|
|
31
24
|
import Button from '@material-ui/core/Button';
|
|
32
25
|
import TextField from '@material-ui/core/TextField';
|
|
33
26
|
|
|
34
|
-
import
|
|
27
|
+
import createPConnectComponent from '@pega/react-sdk-components/lib/bridge/react_pconnect';
|
|
28
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
29
|
+
import { getReferenceList } from '@pega/react-sdk-components/lib/components/helpers/field-group-utils';
|
|
30
|
+
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
31
|
+
import { buildFieldsForTable, filterData, getContext } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
32
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
33
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
35
34
|
|
|
36
35
|
interface SimpleTableManualProps extends PConnProps {
|
|
37
36
|
// If any, enter additional props that only exist on this component
|
|
38
|
-
hideAddRow?: boolean
|
|
39
|
-
hideDeleteRow?: boolean
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
hideAddRow?: boolean;
|
|
38
|
+
hideDeleteRow?: boolean;
|
|
39
|
+
referenceList?: any[];
|
|
40
|
+
renderMode?: string;
|
|
41
|
+
presets?: any[];
|
|
42
|
+
label?: string;
|
|
43
|
+
showLabel?: boolean;
|
|
44
|
+
dataPageName?: string;
|
|
45
|
+
contextClass?: string;
|
|
46
|
+
propertyLabel?: string;
|
|
47
|
+
fieldMetadata?: any;
|
|
48
|
+
editMode?: string;
|
|
49
|
+
addAndEditRowsWithin?: any;
|
|
50
|
+
viewForAddAndEditModal?: any;
|
|
51
|
+
editModeConfig?: any;
|
|
52
|
+
displayMode?: string;
|
|
53
|
+
useSeparateViewForEdit: any;
|
|
54
|
+
viewForEditModal: any;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
const useStyles = makeStyles((/* theme */) => ({
|
|
@@ -78,16 +81,14 @@ const useStyles = makeStyles((/* theme */) => ({
|
|
|
78
81
|
}
|
|
79
82
|
}));
|
|
80
83
|
|
|
81
|
-
|
|
82
84
|
let menuColumnId = '';
|
|
83
85
|
let menuColumnType = '';
|
|
84
86
|
let menuColumnLabel = '';
|
|
85
87
|
|
|
86
|
-
const filterByColumns:
|
|
87
|
-
let myRows:
|
|
88
|
-
|
|
88
|
+
const filterByColumns: any[] = [];
|
|
89
|
+
let myRows: any[];
|
|
89
90
|
|
|
90
|
-
export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
91
|
+
export default function SimpleTableManual(props: PropsWithChildren<SimpleTableManualProps>) {
|
|
91
92
|
const classes = useStyles();
|
|
92
93
|
const {
|
|
93
94
|
getPConnect,
|
|
@@ -102,7 +103,14 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
102
103
|
hideAddRow,
|
|
103
104
|
hideDeleteRow,
|
|
104
105
|
propertyLabel,
|
|
105
|
-
fieldMetadata
|
|
106
|
+
fieldMetadata,
|
|
107
|
+
editMode,
|
|
108
|
+
addAndEditRowsWithin,
|
|
109
|
+
viewForAddAndEditModal,
|
|
110
|
+
editModeConfig,
|
|
111
|
+
displayMode,
|
|
112
|
+
useSeparateViewForEdit,
|
|
113
|
+
viewForEditModal
|
|
106
114
|
} = props;
|
|
107
115
|
const pConn = getPConnect();
|
|
108
116
|
const [rowData, setRowData] = useState([]);
|
|
@@ -110,20 +118,21 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
110
118
|
const [order, setOrder] = useState<Order>('asc');
|
|
111
119
|
const [orderBy, setOrderBy] = useState<keyof any>('');
|
|
112
120
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
121
|
+
const [editAnchorEl, setEditAnchorEl] = useState<null | HTMLElement>(null);
|
|
113
122
|
const [open, setOpen] = useState(false);
|
|
114
123
|
const [filterBy, setFilterBy] = useState<string>();
|
|
115
124
|
const [containsDateOrTime, setContainsDateOrTime] = useState<boolean>(false);
|
|
116
125
|
const [filterType, setFilterType] = useState<string>('string');
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
118
127
|
const [displayDialogFilterName, setDisplayDialogFilterName] = useState<string>('');
|
|
119
|
-
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] =
|
|
120
|
-
useState<string>('contains');
|
|
128
|
+
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] = useState<string>('contains');
|
|
121
129
|
const [displayDialogContainsValue, setDisplayDialogContainsValue] = useState<string>('');
|
|
122
130
|
const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
|
|
123
131
|
const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
|
|
132
|
+
const selectedRowIndex: any = useRef(null);
|
|
124
133
|
|
|
125
134
|
const parameters = fieldMetadata?.datasource?.parameters;
|
|
126
|
-
|
|
135
|
+
const { referenceListStr } = getContext(getPConnect());
|
|
127
136
|
const label = labelProp || propertyLabel;
|
|
128
137
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
129
138
|
if (propsToUse.showLabel === false) {
|
|
@@ -132,7 +141,6 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
132
141
|
// Getting current context
|
|
133
142
|
const context = getPConnect().getContextName();
|
|
134
143
|
const resolvedList = getReferenceList(pConn);
|
|
135
|
-
const pageReference = `${pConn.getPageReference()}${resolvedList}`;
|
|
136
144
|
pConn.setReferenceList(resolvedList);
|
|
137
145
|
const menuIconOverride$ = Utils.getImageSrc('trash', Utils.getSDKStaticConentUrl());
|
|
138
146
|
|
|
@@ -141,7 +149,7 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
141
149
|
// but getRawMetadata() has each child.config with datasource and value showing their unresolved values (ex: "@P thePropName")
|
|
142
150
|
// We need to use the prop name as the "glue" to tie the table dataSource, displayColumns and data together.
|
|
143
151
|
// So, in the code below, we'll use the unresolved config.value (but replacing the space with an underscore to keep things happy)
|
|
144
|
-
const rawMetadata = getPConnect().getRawMetadata();
|
|
152
|
+
const rawMetadata: any = getPConnect().getRawMetadata();
|
|
145
153
|
|
|
146
154
|
// get raw config since @P and other annotations are processed and don't appear in the resolved config.
|
|
147
155
|
// Destructure "raw" children into array var: "rawFields"
|
|
@@ -150,23 +158,36 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
150
158
|
// config.datasource (ex: "@ASSOCIATED .DeclarantChoice")
|
|
151
159
|
// Neither of these appear in the resolved props
|
|
152
160
|
|
|
153
|
-
const rawConfig = rawMetadata?.
|
|
154
|
-
const rawFields =
|
|
155
|
-
|
|
156
|
-
|
|
161
|
+
const rawConfig = rawMetadata?.config;
|
|
162
|
+
const rawFields = rawConfig?.children?.[0]?.children || rawConfig?.presets?.[0].children?.[0]?.children;
|
|
163
|
+
const isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
|
|
157
164
|
const readOnlyMode = renderMode === 'ReadOnly';
|
|
158
165
|
const editableMode = renderMode === 'Editable';
|
|
159
166
|
const showAddRowButton = !readOnlyMode && !hideAddRow;
|
|
160
|
-
const
|
|
167
|
+
const allowEditingInModal =
|
|
168
|
+
(editMode ? editMode === 'modal' : addAndEditRowsWithin === 'modal') && !(renderMode === 'ReadOnly' || isDisplayModeEnabled);
|
|
169
|
+
const showDeleteButton = editableMode && !hideDeleteRow;
|
|
170
|
+
const defaultView = editModeConfig ? editModeConfig.defaultView : viewForAddAndEditModal;
|
|
171
|
+
const bUseSeparateViewForEdit = editModeConfig ? editModeConfig.useSeparateViewForEdit : useSeparateViewForEdit;
|
|
172
|
+
const editView = editModeConfig ? editModeConfig.editView : viewForEditModal;
|
|
173
|
+
|
|
174
|
+
const fieldsWithPropNames = rawFields.map((field, index) => {
|
|
175
|
+
return { ...resolvedFields[index], propName: field.config.value.replace('@P .', '') };
|
|
176
|
+
});
|
|
177
|
+
|
|
161
178
|
useEffect(() => {
|
|
162
|
-
if (editableMode) {
|
|
179
|
+
if (editableMode && !allowEditingInModal) {
|
|
163
180
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
164
181
|
buildElementsForTable();
|
|
165
|
-
}
|
|
182
|
+
}
|
|
183
|
+
}, [referenceList.length]);
|
|
184
|
+
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (readOnlyMode || allowEditingInModal) {
|
|
166
187
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
167
188
|
generateRowsData();
|
|
168
189
|
}
|
|
169
|
-
}, [referenceList
|
|
190
|
+
}, [referenceList]);
|
|
170
191
|
|
|
171
192
|
// fieldDefs will be an array where each entry will have a "name" which will be the
|
|
172
193
|
// "resolved" property name (that we can use as the colId) though it's not really
|
|
@@ -176,10 +197,37 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
176
197
|
// Constellation DX Components.
|
|
177
198
|
const fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
|
|
178
199
|
|
|
200
|
+
useLayoutEffect(() => {
|
|
201
|
+
if (allowEditingInModal) {
|
|
202
|
+
getPConnect()
|
|
203
|
+
.getListActions()
|
|
204
|
+
.initDefaultPageInstructions(
|
|
205
|
+
getPConnect().getReferenceList(),
|
|
206
|
+
fieldDefs.filter(item => item.name).map(item => item.name)
|
|
207
|
+
);
|
|
208
|
+
} else {
|
|
209
|
+
// @ts-ignore - An argument for 'fields' was not provided
|
|
210
|
+
getPConnect().getListActions().initDefaultPageInstructions(getPConnect().getReferenceList());
|
|
211
|
+
}
|
|
212
|
+
}, []);
|
|
213
|
+
|
|
179
214
|
const displayedColumns = fieldDefs.map(field => {
|
|
180
215
|
return field.name ? field.name : field.cellRenderer;
|
|
181
216
|
});
|
|
182
217
|
|
|
218
|
+
const getFormattedValue = (val, key) => {
|
|
219
|
+
const rawField = fieldsWithPropNames.find(item => item.propName === key);
|
|
220
|
+
let options = {};
|
|
221
|
+
if (rawField && ['Boolean', 'Checkbox'].includes(rawField.type)) {
|
|
222
|
+
const { trueLabel, falseLabel } = rawField.config;
|
|
223
|
+
options = {
|
|
224
|
+
trueLabel,
|
|
225
|
+
falseLabel
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return rawField ? format(val, rawField.type, options) : val;
|
|
229
|
+
};
|
|
230
|
+
|
|
183
231
|
// console.log(`SimpleTable displayedColumns:`);
|
|
184
232
|
// console.log(displayedColumns);
|
|
185
233
|
|
|
@@ -187,16 +235,16 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
187
235
|
// of the given row field
|
|
188
236
|
function getRowValue(inRowData: Object, inColKey: string): any {
|
|
189
237
|
// See what data (if any) we have to display
|
|
190
|
-
const refKeys:
|
|
238
|
+
const refKeys: string[] = inColKey?.split('.');
|
|
191
239
|
let valBuilder = inRowData;
|
|
192
240
|
for (const key of refKeys) {
|
|
193
241
|
valBuilder = valBuilder[key];
|
|
194
242
|
}
|
|
195
|
-
return valBuilder;
|
|
243
|
+
return getFormattedValue(valBuilder, inColKey);
|
|
196
244
|
}
|
|
197
245
|
|
|
198
246
|
const formatRowsData = data => {
|
|
199
|
-
if(!data) return {};
|
|
247
|
+
if (!data) return {};
|
|
200
248
|
|
|
201
249
|
return data.map(item => {
|
|
202
250
|
return displayedColumns.reduce((dataForRow, colKey) => {
|
|
@@ -249,35 +297,55 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
249
297
|
// console.log(JSON.stringify(rowData));
|
|
250
298
|
|
|
251
299
|
const addRecord = () => {
|
|
252
|
-
if (
|
|
253
|
-
pConn
|
|
300
|
+
if (allowEditingInModal && defaultView) {
|
|
301
|
+
pConn
|
|
302
|
+
.getActionsApi()
|
|
303
|
+
.openEmbeddedDataModal(defaultView, pConn, referenceListStr, referenceList.length, PCore.getConstants().RESOURCE_STATUS.CREATE);
|
|
254
304
|
} else {
|
|
255
|
-
pConn.getListActions().insert({ classID: contextClass }, referenceList.length
|
|
305
|
+
pConn.getListActions().insert({ classID: contextClass }, referenceList.length);
|
|
256
306
|
}
|
|
307
|
+
|
|
308
|
+
getPConnect().clearErrorMessages({
|
|
309
|
+
property: (getPConnect().getStateProps() as any)?.referenceList?.substring(1)
|
|
310
|
+
} as any);
|
|
257
311
|
};
|
|
258
312
|
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
313
|
+
const editRecord = () => {
|
|
314
|
+
setEditAnchorEl(null);
|
|
315
|
+
if (typeof selectedRowIndex.current === 'number') {
|
|
316
|
+
pConn
|
|
317
|
+
.getActionsApi()
|
|
318
|
+
.openEmbeddedDataModal(
|
|
319
|
+
bUseSeparateViewForEdit ? editView : defaultView,
|
|
320
|
+
pConn,
|
|
321
|
+
referenceListStr,
|
|
322
|
+
selectedRowIndex.current,
|
|
323
|
+
PCore.getConstants().RESOURCE_STATUS.UPDATE
|
|
324
|
+
);
|
|
264
325
|
}
|
|
265
326
|
};
|
|
266
327
|
|
|
328
|
+
const deleteRecord = () => {
|
|
329
|
+
setEditAnchorEl(null);
|
|
330
|
+
pConn.getListActions().deleteEntry(selectedRowIndex.current);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const deleteRecordFromInlineEditable = (index: number) => {
|
|
334
|
+
pConn.getListActions().deleteEntry(index);
|
|
335
|
+
};
|
|
336
|
+
|
|
267
337
|
function buildElementsForTable() {
|
|
268
338
|
const eleData: any = [];
|
|
269
339
|
referenceList.forEach((element, index) => {
|
|
270
340
|
const data: any = [];
|
|
271
341
|
rawFields.forEach(item => {
|
|
272
342
|
// removing label field from config to hide title in the table cell
|
|
273
|
-
item = {...item, config: {...item.config, label: ''}};
|
|
343
|
+
item = { ...item, config: { ...item.config, label: '' } };
|
|
274
344
|
const referenceListData = getReferenceList(pConn);
|
|
275
345
|
const isDatapage = referenceListData.startsWith('D_');
|
|
276
346
|
const pageReferenceValue = isDatapage
|
|
277
347
|
? `${referenceListData}[${index}]`
|
|
278
|
-
: `${pConn.getPageReference()}${referenceListData.substring(
|
|
279
|
-
referenceListData.lastIndexOf('.')
|
|
280
|
-
)}[${index}]`;
|
|
348
|
+
: `${pConn.getPageReference()}${referenceListData.substring(referenceListData.lastIndexOf('.'))}[${index}]`;
|
|
281
349
|
const config = {
|
|
282
350
|
meta: item,
|
|
283
351
|
options: {
|
|
@@ -306,10 +374,10 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
306
374
|
};
|
|
307
375
|
|
|
308
376
|
function descendingComparator<T>(a: T, b: T, orderedBy: keyof T) {
|
|
309
|
-
if (b[orderedBy] < a[orderedBy]) {
|
|
377
|
+
if (!b[orderedBy] || b[orderedBy] < a[orderedBy]) {
|
|
310
378
|
return -1;
|
|
311
379
|
}
|
|
312
|
-
if (b[orderedBy] > a[orderedBy]) {
|
|
380
|
+
if (!a[orderedBy] || b[orderedBy] > a[orderedBy]) {
|
|
313
381
|
return 1;
|
|
314
382
|
}
|
|
315
383
|
return 0;
|
|
@@ -320,18 +388,14 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
320
388
|
function getComparator<Key extends keyof any>(
|
|
321
389
|
theOrder: Order,
|
|
322
390
|
orderedBy: Key
|
|
323
|
-
// eslint-disable-next-line no-unused-vars
|
|
324
391
|
): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
|
|
325
|
-
return theOrder === 'desc'
|
|
326
|
-
? (a, b) => descendingComparator(a, b, orderedBy)
|
|
327
|
-
: (a, b) => -descendingComparator(a, b, orderedBy);
|
|
392
|
+
return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
|
|
328
393
|
}
|
|
329
394
|
|
|
330
|
-
|
|
331
|
-
function stableSort<T>(array: Array<T>, comparator: (a: T, b: T) => number) {
|
|
395
|
+
function stableSort<T>(array: T[], comparator: (a: T, b: T) => number) {
|
|
332
396
|
const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
|
|
333
397
|
stabilizedThis.sort((a, b) => {
|
|
334
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
398
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
335
399
|
const order = comparator(a[0], b[0]);
|
|
336
400
|
if (order !== 0) return order;
|
|
337
401
|
return a[1] - b[1];
|
|
@@ -348,8 +412,14 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
348
412
|
setAnchorEl(event.currentTarget);
|
|
349
413
|
}
|
|
350
414
|
|
|
415
|
+
function editMenuClick(event, index) {
|
|
416
|
+
selectedRowIndex.current = index;
|
|
417
|
+
setEditAnchorEl(event.currentTarget);
|
|
418
|
+
}
|
|
419
|
+
|
|
351
420
|
function _menuClose() {
|
|
352
421
|
setAnchorEl(null);
|
|
422
|
+
setEditAnchorEl(null);
|
|
353
423
|
}
|
|
354
424
|
|
|
355
425
|
function _filterMenu() {
|
|
@@ -360,11 +430,7 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
360
430
|
for (const filterObj of filterByColumns) {
|
|
361
431
|
if (filterObj.ref === menuColumnId) {
|
|
362
432
|
setFilterBy(menuColumnLabel);
|
|
363
|
-
if (
|
|
364
|
-
filterObj.type === 'Date' ||
|
|
365
|
-
filterObj.type === 'DateTime' ||
|
|
366
|
-
filterObj.type === 'Time'
|
|
367
|
-
) {
|
|
433
|
+
if (filterObj.type === 'Date' || filterObj.type === 'DateTime' || filterObj.type === 'Time') {
|
|
368
434
|
setContainsDateOrTime(true);
|
|
369
435
|
setFilterType(filterObj.type);
|
|
370
436
|
setDisplayDialogDateFilter(filterObj.containsFilter);
|
|
@@ -439,14 +505,14 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
439
505
|
function updateFilterWithInfo() {
|
|
440
506
|
let bFound = false;
|
|
441
507
|
for (const filterObj of filterByColumns) {
|
|
442
|
-
if (filterObj
|
|
443
|
-
filterObj
|
|
508
|
+
if (filterObj.ref === menuColumnId) {
|
|
509
|
+
filterObj.type = filterType;
|
|
444
510
|
if (containsDateOrTime) {
|
|
445
|
-
filterObj
|
|
446
|
-
filterObj
|
|
511
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
512
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
447
513
|
} else {
|
|
448
|
-
filterObj
|
|
449
|
-
filterObj
|
|
514
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
515
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
450
516
|
}
|
|
451
517
|
bFound = true;
|
|
452
518
|
break;
|
|
@@ -457,13 +523,13 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
457
523
|
// add in
|
|
458
524
|
const filterObj: any = {};
|
|
459
525
|
filterObj.ref = menuColumnId;
|
|
460
|
-
filterObj
|
|
526
|
+
filterObj.type = filterType;
|
|
461
527
|
if (containsDateOrTime) {
|
|
462
|
-
filterObj
|
|
463
|
-
filterObj
|
|
528
|
+
filterObj.containsFilter = displayDialogDateFilter;
|
|
529
|
+
filterObj.containsFilterValue = displayDialogDateValue;
|
|
464
530
|
} else {
|
|
465
|
-
filterObj
|
|
466
|
-
filterObj
|
|
531
|
+
filterObj.containsFilter = displayDialogContainsFilter;
|
|
532
|
+
filterObj.containsFilterValue = displayDialogContainsValue;
|
|
467
533
|
}
|
|
468
534
|
|
|
469
535
|
filterByColumns.push(filterObj);
|
|
@@ -479,9 +545,9 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
479
545
|
|
|
480
546
|
function _showFilteredIcon(columnId) {
|
|
481
547
|
for (const filterObj of filterByColumns) {
|
|
482
|
-
if (filterObj
|
|
548
|
+
if (filterObj.ref === columnId) {
|
|
483
549
|
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
484
|
-
if (filterObj
|
|
550
|
+
if (filterObj.containsFilterValue !== '') {
|
|
485
551
|
return true;
|
|
486
552
|
}
|
|
487
553
|
return false;
|
|
@@ -502,8 +568,8 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
502
568
|
}
|
|
503
569
|
|
|
504
570
|
return (
|
|
505
|
-
|
|
506
|
-
<TableContainer component={Paper} style={{ margin: '4px 0px' }} id=
|
|
571
|
+
<>
|
|
572
|
+
<TableContainer component={Paper} style={{ margin: '4px 0px' }} id='simple-table-manual'>
|
|
507
573
|
{propsToUse.label && (
|
|
508
574
|
<h3 className={classes.label}>
|
|
509
575
|
{propsToUse.label} {results()}
|
|
@@ -522,14 +588,10 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
522
588
|
direction={orderBy === displayedColumns[index] ? order : 'asc'}
|
|
523
589
|
onClick={createSortHandler(displayedColumns[index])}
|
|
524
590
|
>
|
|
525
|
-
{field.label}
|
|
526
|
-
{_showFilteredIcon(field.name) &&
|
|
527
|
-
<FilterListIcon className={classes.moreIcon} />
|
|
528
|
-
)}
|
|
591
|
+
{field.label || '---'}
|
|
592
|
+
{_showFilteredIcon(field.name) && <FilterListIcon className={classes.moreIcon} />}
|
|
529
593
|
{orderBy === displayedColumns[index] ? (
|
|
530
|
-
<span className={classes.visuallyHidden}>
|
|
531
|
-
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
532
|
-
</span>
|
|
594
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
533
595
|
) : null}
|
|
534
596
|
</TableSortLabel>
|
|
535
597
|
<MoreIcon
|
|
@@ -568,34 +630,49 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
568
630
|
type='button'
|
|
569
631
|
className='psdk-utility-button'
|
|
570
632
|
id='delete-button'
|
|
571
|
-
|
|
633
|
+
aria-label='Delete Cell'
|
|
634
|
+
onClick={() => deleteRecordFromInlineEditable(index)}
|
|
572
635
|
>
|
|
573
|
-
<img
|
|
574
|
-
className='psdk-utility-card-action-svg-icon'
|
|
575
|
-
src={menuIconOverride$}
|
|
576
|
-
></img>
|
|
636
|
+
<img className='psdk-utility-card-action-svg-icon' src={menuIconOverride$} />
|
|
577
637
|
</button>
|
|
578
638
|
</TableCell>
|
|
579
639
|
)}
|
|
580
640
|
</TableRow>
|
|
581
641
|
);
|
|
582
642
|
})}
|
|
583
|
-
{readOnlyMode &&
|
|
643
|
+
{(readOnlyMode || allowEditingInModal) &&
|
|
584
644
|
rowData &&
|
|
585
645
|
rowData.length > 0 &&
|
|
586
646
|
stableSort(rowData, getComparator(order, orderBy))
|
|
587
647
|
.slice(0)
|
|
588
|
-
.map(row => {
|
|
648
|
+
.map((row, index) => {
|
|
589
649
|
return (
|
|
590
|
-
|
|
650
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
651
|
+
<TableRow key={index}>
|
|
591
652
|
{displayedColumns.map(colKey => {
|
|
592
653
|
return (
|
|
593
654
|
<TableCell key={colKey} className={classes.tableCell}>
|
|
594
|
-
{
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
655
|
+
{showDeleteButton && colKey === 'DeleteIcon' ? (
|
|
656
|
+
<div>
|
|
657
|
+
<MoreIcon
|
|
658
|
+
id='table-edit-menu-icon'
|
|
659
|
+
className={classes.moreIcon}
|
|
660
|
+
onClick={event => {
|
|
661
|
+
editMenuClick(event, index);
|
|
662
|
+
}}
|
|
663
|
+
/>
|
|
664
|
+
<Menu id='table-edit-menu' anchorEl={editAnchorEl} keepMounted open={Boolean(editAnchorEl)} onClose={_menuClose}>
|
|
665
|
+
<MenuItem onClick={() => editRecord()}>Edit</MenuItem>
|
|
666
|
+
<MenuItem onClick={() => deleteRecord()}>Delete</MenuItem>
|
|
667
|
+
</Menu>
|
|
668
|
+
</div>
|
|
669
|
+
) : typeof row[colKey] === 'boolean' && !row[colKey] ? (
|
|
670
|
+
'False'
|
|
671
|
+
) : typeof row[colKey] === 'boolean' && row[colKey] ? (
|
|
672
|
+
'True'
|
|
673
|
+
) : (
|
|
674
|
+
row[colKey] || '---'
|
|
675
|
+
)}
|
|
599
676
|
</TableCell>
|
|
600
677
|
);
|
|
601
678
|
})}
|
|
@@ -622,13 +699,7 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
622
699
|
</Link>
|
|
623
700
|
</div>
|
|
624
701
|
)}
|
|
625
|
-
<Menu
|
|
626
|
-
id='simple-menu'
|
|
627
|
-
anchorEl={anchorEl}
|
|
628
|
-
keepMounted
|
|
629
|
-
open={Boolean(anchorEl)}
|
|
630
|
-
onClose={_menuClose}
|
|
631
|
-
>
|
|
702
|
+
<Menu id='simple-menu' anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={_menuClose}>
|
|
632
703
|
<MenuItem onClick={_filterMenu}>
|
|
633
704
|
<FilterListIcon /> Filter
|
|
634
705
|
</MenuItem>
|
|
@@ -685,12 +756,7 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
685
756
|
</>
|
|
686
757
|
) : (
|
|
687
758
|
<>
|
|
688
|
-
<Select
|
|
689
|
-
id='filter'
|
|
690
|
-
fullWidth
|
|
691
|
-
onChange={_dialogContainsFilter}
|
|
692
|
-
value={displayDialogContainsFilter}
|
|
693
|
-
>
|
|
759
|
+
<Select id='filter' fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
694
760
|
<MenuItem value='contains'>Contains</MenuItem>
|
|
695
761
|
<MenuItem value='equals'>Equals</MenuItem>
|
|
696
762
|
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
@@ -716,6 +782,6 @@ export default function SimpleTableManual(props: SimpleTableManualProps) {
|
|
|
716
782
|
</Button>
|
|
717
783
|
</DialogActions>
|
|
718
784
|
</Dialog>
|
|
719
|
-
|
|
785
|
+
</>
|
|
720
786
|
);
|
|
721
787
|
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// }
|
|
19
|
-
|
|
3
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
4
|
+
|
|
5
|
+
interface SimpleTableSelectProps extends PConnProps {
|
|
6
|
+
// If any, enter additional props that only exist on this component
|
|
7
|
+
label: string;
|
|
8
|
+
referenceList: object[] | string;
|
|
9
|
+
renderMode: string;
|
|
10
|
+
showLabel: boolean;
|
|
11
|
+
promptedFilters: object[];
|
|
12
|
+
viewName: string;
|
|
13
|
+
parameters: any;
|
|
14
|
+
readonlyContextList: object[] | string;
|
|
15
|
+
dataRelationshipContext: string;
|
|
16
|
+
}
|
|
20
17
|
|
|
21
18
|
const isSelfReferencedProperty = (param, referenceProp) => {
|
|
22
19
|
const [, parentPropName] = param.split('.');
|
|
@@ -27,7 +24,7 @@ const isSelfReferencedProperty = (param, referenceProp) => {
|
|
|
27
24
|
* SimpleTable react component
|
|
28
25
|
* @param {*} props - props
|
|
29
26
|
*/
|
|
30
|
-
export default function SimpleTableSelect(props
|
|
27
|
+
export default function SimpleTableSelect(props: SimpleTableSelectProps) {
|
|
31
28
|
// Get emitted components from map (so we can get any override that may exist)
|
|
32
29
|
const ListView = getComponentFromMap('ListView');
|
|
33
30
|
const SimpleTable = getComponentFromMap('SimpleTable');
|
|
@@ -42,7 +39,7 @@ export default function SimpleTableSelect(props /* : SimpleTableSelectProps */)
|
|
|
42
39
|
|
|
43
40
|
const pConn = getPConnect();
|
|
44
41
|
const { MULTI } = PCore.getConstants().LIST_SELECTION_MODE;
|
|
45
|
-
const { selectionMode, selectionList } = pConn.getConfigProps();
|
|
42
|
+
const { selectionMode, selectionList } = pConn.getConfigProps() as any;
|
|
46
43
|
const isMultiSelectMode = selectionMode === MULTI;
|
|
47
44
|
|
|
48
45
|
if (isMultiSelectMode && renderMode === 'ReadOnly') {
|
|
@@ -52,7 +49,7 @@ export default function SimpleTableSelect(props /* : SimpleTableSelectProps */)
|
|
|
52
49
|
const pageReference = pConn.getPageReference();
|
|
53
50
|
let referenceProp = isMultiSelectMode ? selectionList.substring(1) : pageReference.substring(pageReference.lastIndexOf('.') + 1);
|
|
54
51
|
// Replace here to use the context name instead
|
|
55
|
-
let contextPageReference = null;
|
|
52
|
+
let contextPageReference: string | null = null;
|
|
56
53
|
if (props.dataRelationshipContext !== null && selectionMode === 'single') {
|
|
57
54
|
referenceProp = dataRelationshipContext;
|
|
58
55
|
contextPageReference = pageReference.concat('.').concat(referenceProp);
|
|
@@ -60,13 +57,15 @@ export default function SimpleTableSelect(props /* : SimpleTableSelectProps */)
|
|
|
60
57
|
|
|
61
58
|
// Need to get this written so typedefs work
|
|
62
59
|
const { datasource: { parameters: fieldParameters = {} } = {}, pageClass } = isMultiSelectMode
|
|
63
|
-
?
|
|
64
|
-
|
|
60
|
+
? // @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
|
|
61
|
+
pConn.getFieldMetadata(`@P .${referenceProp}`)
|
|
62
|
+
: // @ts-ignore - Property 'getCurrentPageFieldMetadata' is private and only accessible within class 'C11nEnv'.
|
|
63
|
+
pConn.getCurrentPageFieldMetadata(contextPageReference);
|
|
65
64
|
|
|
66
|
-
const compositeKeys:
|
|
65
|
+
const compositeKeys: any[] = [];
|
|
67
66
|
Object.values(fieldParameters).forEach((param: any) => {
|
|
68
67
|
if (isSelfReferencedProperty(param, referenceProp)) {
|
|
69
|
-
|
|
68
|
+
compositeKeys.push(param.substring(param.lastIndexOf('.') + 1));
|
|
70
69
|
}
|
|
71
70
|
});
|
|
72
71
|
|
|
@@ -105,7 +104,7 @@ export default function SimpleTableSelect(props /* : SimpleTableSelectProps */)
|
|
|
105
104
|
parameters
|
|
106
105
|
};
|
|
107
106
|
|
|
108
|
-
const filters = getPConnect().getRawMetadata().config.promotedFilters ?? [];
|
|
107
|
+
const filters = (getPConnect().getRawMetadata() as any).config.promotedFilters ?? [];
|
|
109
108
|
|
|
110
109
|
const isSearchable = filters.length > 0;
|
|
111
110
|
|