@pega/react-sdk-overrides 8.23.10 → 23.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +12 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
- package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
- package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
- package/lib/field/AutoComplete/AutoComplete.tsx +38 -19
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
- package/lib/field/Checkbox/Checkbox.tsx +42 -9
- package/lib/field/Currency/Currency.tsx +24 -16
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +32 -18
- package/lib/field/DateTime/DateTime.tsx +27 -16
- package/lib/field/Decimal/Decimal.tsx +82 -19
- package/lib/field/Dropdown/Dropdown.tsx +60 -15
- package/lib/field/Email/Email.tsx +17 -9
- package/lib/field/Integer/Integer.tsx +15 -7
- package/lib/field/Percentage/Percentage.tsx +15 -7
- package/lib/field/Phone/Phone.tsx +21 -12
- package/lib/field/RadioButtons/RadioButtons.tsx +57 -28
- package/lib/field/RichText/RichText.tsx +95 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +73 -0
- package/lib/field/ScalarList/config-ext.json +8 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/utils.ts +2 -1
- package/lib/field/TextArea/TextArea.tsx +14 -5
- package/lib/field/TextContent/TextContent.tsx +10 -1
- package/lib/field/TextInput/TextInput.tsx +40 -11
- package/lib/field/Time/Time.tsx +29 -26
- package/lib/field/URL/URL.tsx +24 -8
- package/lib/field/UserReference/UserReference.tsx +52 -60
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
- package/lib/helpers/auth.js +752 -401
- package/lib/helpers/authManager.ts +933 -0
- package/lib/helpers/case-utils.tsx +103 -0
- package/lib/helpers/common-utils.ts +4 -0
- package/lib/helpers/config_access.js +63 -145
- package/lib/helpers/data_page.ts +2 -1
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +10 -11
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
- package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
- package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
- package/lib/helpers/formatters/{common.js → common.ts} +4 -4
- package/lib/helpers/formatters/{index.js → index.ts} +3 -3
- package/lib/helpers/simpleTableHelpers.ts +10 -6
- package/lib/helpers/state-utils.tsx +47 -0
- package/lib/helpers/template-utils.ts +3 -4
- package/lib/helpers/utils.ts +12 -4
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
- package/lib/infra/Assignment/Assignment.tsx +44 -35
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
- package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -25
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -30
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
- package/lib/infra/DashboardFilter/filterUtils.tsx +4 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -20
- package/lib/infra/MultiStep/MultiStep.tsx +24 -24
- package/lib/infra/NavBar/NavBar.tsx +23 -24
- package/lib/infra/Reference/Reference.tsx +14 -18
- package/lib/infra/Region/Region.tsx +8 -6
- package/lib/infra/RootContainer/RootContainer.tsx +32 -39
- package/lib/infra/Stages/Stages.tsx +15 -9
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
- package/lib/infra/View/View.tsx +30 -57
- package/lib/template/AppShell/AppShell.tsx +51 -34
- package/lib/template/BannerPage/BannerPage.tsx +26 -31
- package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
- package/lib/template/CaseView/CaseView.tsx +137 -100
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
- package/lib/template/Confirmation/Confirmation.tsx +29 -52
- package/lib/template/DataReference/DataReference.tsx +51 -53
- package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +16 -17
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +78 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
- package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +20 -18
- package/lib/template/ListPage/ListPage.tsx +14 -13
- package/lib/template/ListView/ListView.tsx +244 -314
- package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
- package/lib/template/ListView/{utils.js → utils.ts} +172 -23
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
- package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +29 -8
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +33 -36
- package/lib/template/SubTabs/SubTabs.tsx +10 -11
- package/lib/template/SubTabs/tabUtils.ts +0 -2
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -3
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
- package/lib/widget/Attachment/Attachment.css +15 -3
- package/lib/widget/Attachment/Attachment.tsx +51 -32
- package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
- package/lib/widget/Followers/Followers.tsx +10 -11
- package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
- package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
- package/lib/widget/SummaryList/SummaryList.tsx +17 -3
- package/lib/widget/ToDo/ToDo.tsx +69 -104
- package/package.json +1 -1
- package/lib/helpers/authManager.js +0 -631
- /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
- /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
- /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
5
5
|
/* eslint-disable no-shadow */
|
|
6
6
|
import React, { useState, useEffect, useRef } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
7
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
|
|
9
|
-
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
10
8
|
import Table from '@material-ui/core/Table';
|
|
11
9
|
import TableBody from '@material-ui/core/TableBody';
|
|
12
10
|
import TableCell from '@material-ui/core/TableCell';
|
|
@@ -39,9 +37,31 @@ import { Radio } from '@material-ui/core';
|
|
|
39
37
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
40
38
|
import { filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
41
39
|
import './ListView.css';
|
|
42
|
-
import useInit from './hooks'
|
|
40
|
+
import useInit from './hooks';
|
|
41
|
+
import { getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
42
|
+
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
|
+
// }
|
|
43
61
|
|
|
44
62
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
63
|
+
|
|
64
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 3 errors)
|
|
45
65
|
declare const PCore: any;
|
|
46
66
|
|
|
47
67
|
let myRows: Array<any>;
|
|
@@ -55,9 +75,19 @@ let sortColumnId: any;
|
|
|
55
75
|
|
|
56
76
|
const filterByColumns: Array<any> = [];
|
|
57
77
|
|
|
58
|
-
export default function ListView(props) {
|
|
59
|
-
const { getPConnect, bInForm } = props;
|
|
60
|
-
const {
|
|
78
|
+
export default function ListView(props /* : ListViewProps */) {
|
|
79
|
+
const { getPConnect, bInForm = true } = props;
|
|
80
|
+
const {
|
|
81
|
+
globalSearch,
|
|
82
|
+
referenceList,
|
|
83
|
+
/* rowClickAction, */
|
|
84
|
+
selectionMode,
|
|
85
|
+
referenceType,
|
|
86
|
+
payload,
|
|
87
|
+
parameters,
|
|
88
|
+
compositeKeys,
|
|
89
|
+
showDynamicFields
|
|
90
|
+
} = props;
|
|
61
91
|
const ref = useRef({}).current;
|
|
62
92
|
const cosmosTableRef = useRef();
|
|
63
93
|
// List component context
|
|
@@ -97,8 +127,8 @@ export default function ListView(props) {
|
|
|
97
127
|
const filters = useRef({});
|
|
98
128
|
|
|
99
129
|
// Will contain the list of columns specific for an instance
|
|
100
|
-
|
|
101
|
-
|
|
130
|
+
const columnList: any = useRef([]);
|
|
131
|
+
const filterPayload: any = useRef();
|
|
102
132
|
// Will be sent in the dashboardFilterPayload
|
|
103
133
|
let selectParam: Array<any> = [];
|
|
104
134
|
|
|
@@ -184,9 +214,7 @@ export default function ListView(props) {
|
|
|
184
214
|
orderedBy: Key
|
|
185
215
|
// eslint-disable-next-line no-unused-vars
|
|
186
216
|
): (a: { [key in Key]: number | string }, b: { [key in Key]: number | string }) => number {
|
|
187
|
-
return theOrder === 'desc'
|
|
188
|
-
? (a, b) => descendingComparator(a, b, orderedBy)
|
|
189
|
-
: (a, b) => -descendingComparator(a, b, orderedBy);
|
|
217
|
+
return theOrder === 'desc' ? (a, b) => descendingComparator(a, b, orderedBy) : (a, b) => -descendingComparator(a, b, orderedBy);
|
|
190
218
|
}
|
|
191
219
|
|
|
192
220
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -197,7 +225,7 @@ export default function ListView(props) {
|
|
|
197
225
|
if (order !== 0) return order;
|
|
198
226
|
return a[1] - b[1];
|
|
199
227
|
});
|
|
200
|
-
return stabilizedThis.map(el => el[0]);
|
|
228
|
+
return stabilizedThis.map((el) => el[0]);
|
|
201
229
|
}
|
|
202
230
|
|
|
203
231
|
const [page, setPage] = useState(0);
|
|
@@ -213,26 +241,21 @@ export default function ListView(props) {
|
|
|
213
241
|
};
|
|
214
242
|
|
|
215
243
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
216
|
-
function getHeaderCells(colFields, fields
|
|
244
|
+
function getHeaderCells(colFields, fields) {
|
|
217
245
|
const arReturn = colFields.map((field: any, index) => {
|
|
218
246
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
219
247
|
if (theField.indexOf('.') === 0) {
|
|
220
248
|
theField = theField.substring(1);
|
|
221
249
|
}
|
|
222
|
-
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
250
|
+
const colIndex = fields.findIndex((ele) => ele.name === theField);
|
|
223
251
|
const displayAsLink = field.config.displayAsLink;
|
|
224
252
|
const headerRow: any = {};
|
|
225
|
-
headerRow.id =
|
|
253
|
+
headerRow.id = fields[index].id;
|
|
226
254
|
headerRow.type = field.type;
|
|
227
255
|
headerRow.displayAsLink = displayAsLink;
|
|
228
|
-
headerRow.numeric =
|
|
229
|
-
field.type === 'Decimal' ||
|
|
230
|
-
field.type === 'Integer' ||
|
|
231
|
-
field.type === 'Percentage' ||
|
|
232
|
-
field.type === 'Currency' ||
|
|
233
|
-
false;
|
|
256
|
+
headerRow.numeric = field.type === 'Decimal' || field.type === 'Integer' || field.type === 'Percentage' || field.type === 'Currency' || false;
|
|
234
257
|
headerRow.disablePadding = false;
|
|
235
|
-
headerRow.label =
|
|
258
|
+
headerRow.label = fields[index].label;
|
|
236
259
|
if (colIndex > -1) {
|
|
237
260
|
headerRow.classID = fields[colIndex].classID;
|
|
238
261
|
}
|
|
@@ -247,15 +270,6 @@ export default function ListView(props) {
|
|
|
247
270
|
return arReturn;
|
|
248
271
|
}
|
|
249
272
|
|
|
250
|
-
function updateFields(arFields, theColumns): Array<any> {
|
|
251
|
-
const arReturn = arFields.filter(ele => ele.type !== 'reference');
|
|
252
|
-
arReturn.forEach((field, index) => {
|
|
253
|
-
arReturn[index].config.name = theColumns[index].id;
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
return arReturn;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
273
|
function getUsingData(arTableData): Array<any> {
|
|
260
274
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
261
275
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
@@ -265,7 +279,6 @@ export default function ListView(props) {
|
|
|
265
279
|
}
|
|
266
280
|
}
|
|
267
281
|
const arReturn = arTableData?.map((data: any) => {
|
|
268
|
-
|
|
269
282
|
const row = data;
|
|
270
283
|
|
|
271
284
|
return row;
|
|
@@ -274,56 +287,10 @@ export default function ListView(props) {
|
|
|
274
287
|
return arReturn;
|
|
275
288
|
}
|
|
276
289
|
|
|
277
|
-
function updateData(listData: Array<any>, fieldData: Array<any>): Array<any> {
|
|
278
|
-
const returnList: Array<any> = new Array<any>();
|
|
279
|
-
listData?.forEach(row => {
|
|
280
|
-
// copy
|
|
281
|
-
const rowData = JSON.parse(JSON.stringify(row));
|
|
282
|
-
|
|
283
|
-
fieldData.forEach(field => {
|
|
284
|
-
const config = field.config;
|
|
285
|
-
let fieldName;
|
|
286
|
-
let formattedDate;
|
|
287
|
-
let myFormat;
|
|
288
|
-
|
|
289
|
-
switch (field.type) {
|
|
290
|
-
case 'Date':
|
|
291
|
-
fieldName = config.name;
|
|
292
|
-
myFormat = config.formatter;
|
|
293
|
-
if (!myFormat) {
|
|
294
|
-
myFormat = 'Date';
|
|
295
|
-
}
|
|
296
|
-
formattedDate = Utils.generateDate(rowData[fieldName], myFormat);
|
|
297
|
-
|
|
298
|
-
rowData[fieldName] = formattedDate;
|
|
299
|
-
break;
|
|
300
|
-
|
|
301
|
-
case 'DateTime':
|
|
302
|
-
fieldName = config.name;
|
|
303
|
-
myFormat = config.formatter;
|
|
304
|
-
if (!myFormat) {
|
|
305
|
-
myFormat = 'DateTime-Long';
|
|
306
|
-
}
|
|
307
|
-
formattedDate = Utils.generateDateTime(rowData[fieldName], myFormat);
|
|
308
|
-
|
|
309
|
-
rowData[fieldName] = formattedDate;
|
|
310
|
-
break;
|
|
311
|
-
|
|
312
|
-
default:
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
returnList.push(rowData);
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
return returnList;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
290
|
function getMyColumnList(arCols: Array<any>): Array<string> {
|
|
324
291
|
const myColList: Array<string> = [];
|
|
325
292
|
|
|
326
|
-
arCols.forEach(col => {
|
|
293
|
+
arCols.forEach((col) => {
|
|
327
294
|
myColList.push(col.id);
|
|
328
295
|
});
|
|
329
296
|
|
|
@@ -344,7 +311,7 @@ export default function ListView(props) {
|
|
|
344
311
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
345
312
|
function processFilterChange(data) {
|
|
346
313
|
const { filterId, filterExpression } = data;
|
|
347
|
-
dashboardFilterPayload = {
|
|
314
|
+
let dashboardFilterPayload: any = {
|
|
348
315
|
query: {
|
|
349
316
|
filter: {},
|
|
350
317
|
select: []
|
|
@@ -360,14 +327,14 @@ export default function ListView(props) {
|
|
|
360
327
|
let field = getFieldFromFilter(filterExpression, isDateRange);
|
|
361
328
|
selectParam = [];
|
|
362
329
|
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
363
|
-
columnList.forEach(col => {
|
|
330
|
+
columnList.current.forEach((col) => {
|
|
364
331
|
selectParam.push({
|
|
365
332
|
field: col
|
|
366
333
|
});
|
|
367
334
|
});
|
|
368
335
|
|
|
369
336
|
// Checking if the triggered filter is applicable for this list
|
|
370
|
-
if (data.filterExpression !== null && !(columnList.length && columnList.includes(field))) {
|
|
337
|
+
if (data.filterExpression !== null && !(columnList.current?.length && columnList.current?.includes(field))) {
|
|
371
338
|
return;
|
|
372
339
|
}
|
|
373
340
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
@@ -388,7 +355,7 @@ export default function ListView(props) {
|
|
|
388
355
|
isDateRange = filter?.AND ? true : false;
|
|
389
356
|
field = getFieldFromFilter(filter, isDateRange);
|
|
390
357
|
|
|
391
|
-
if (!(columnList.length && columnList.includes(field))) {
|
|
358
|
+
if (!(columnList.current.length && columnList.current.includes(field))) {
|
|
392
359
|
// eslint-disable-next-line no-continue
|
|
393
360
|
continue;
|
|
394
361
|
}
|
|
@@ -396,7 +363,7 @@ export default function ListView(props) {
|
|
|
396
363
|
validFilter = true;
|
|
397
364
|
/** Below are the 2 cases for- Text & Date-Range filter types where we'll construct filter data which will be sent in the dashboardFilterPayload
|
|
398
365
|
* In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
|
|
399
|
-
|
|
366
|
+
*/
|
|
400
367
|
if (isDateRange) {
|
|
401
368
|
const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
|
|
402
369
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
@@ -420,9 +387,7 @@ export default function ListView(props) {
|
|
|
420
387
|
};
|
|
421
388
|
|
|
422
389
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
423
|
-
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} T${
|
|
424
|
-
index - 1
|
|
425
|
-
}`;
|
|
390
|
+
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} T${index - 1}`;
|
|
426
391
|
} else {
|
|
427
392
|
dashboardFilterPayload.query.filter.logic = `T${index - 1}`;
|
|
428
393
|
}
|
|
@@ -435,57 +400,34 @@ export default function ListView(props) {
|
|
|
435
400
|
if (!validFilter) {
|
|
436
401
|
dashboardFilterPayload = undefined;
|
|
437
402
|
}
|
|
438
|
-
|
|
403
|
+
filterPayload.current = dashboardFilterPayload;
|
|
439
404
|
fetchDataFromServer();
|
|
440
405
|
}
|
|
441
406
|
|
|
442
407
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CLEAR_ALL fires
|
|
443
408
|
function processFilterClear() {
|
|
444
|
-
|
|
409
|
+
filterPayload.current = undefined;
|
|
445
410
|
fetchDataFromServer();
|
|
446
411
|
}
|
|
447
412
|
|
|
448
|
-
useEffect(() => {
|
|
449
|
-
setTimeout(() => {
|
|
450
|
-
PCore.getPubSubUtils().subscribe(
|
|
451
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
452
|
-
data => {
|
|
453
|
-
processFilterChange(data);
|
|
454
|
-
},
|
|
455
|
-
`dashboard-component-${'id'}`,
|
|
456
|
-
false,
|
|
457
|
-
getPConnect().getContextName()
|
|
458
|
-
);
|
|
459
|
-
PCore.getPubSubUtils().subscribe(
|
|
460
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
461
|
-
() => {
|
|
462
|
-
filters.current = {};
|
|
463
|
-
processFilterClear();
|
|
464
|
-
},
|
|
465
|
-
`dashboard-component-${'id'}`,
|
|
466
|
-
false,
|
|
467
|
-
getPConnect().getContextName()
|
|
468
|
-
);
|
|
469
|
-
}, 0);
|
|
470
|
-
}, []);
|
|
471
|
-
|
|
472
413
|
function fetchAllData(fields) {
|
|
473
414
|
let query: any = null;
|
|
474
415
|
if (payload) {
|
|
475
416
|
query = payload.query;
|
|
476
417
|
} else if (fields?.length && meta.isQueryable) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
418
|
+
if (filterPayload.current) {
|
|
419
|
+
query = { select: fields, filter: filterPayload.current?.query?.filter };
|
|
420
|
+
} else {
|
|
421
|
+
query = { select: fields };
|
|
422
|
+
}
|
|
423
|
+
} else if (filterPayload.current) {
|
|
424
|
+
query = filterPayload.current?.query;
|
|
480
425
|
}
|
|
481
426
|
const context = getPConnect().getContextName();
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
payload ? payload.dataViewParameters : dataViewParameters,
|
|
486
|
-
null,
|
|
487
|
-
query
|
|
488
|
-
);
|
|
427
|
+
// getDataAsync isn't returning correct data for the Page(i.e. ListView within a page) case
|
|
428
|
+
return !bInForm
|
|
429
|
+
? PCore.getDataApiUtils().getData(referenceList, payload)
|
|
430
|
+
: PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
|
|
489
431
|
}
|
|
490
432
|
|
|
491
433
|
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
@@ -498,15 +440,15 @@ export default function ListView(props) {
|
|
|
498
440
|
} else {
|
|
499
441
|
// NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields
|
|
500
442
|
// corresponding to `state.groups` are set up. Needed in Client-mode grouping/pagination.
|
|
501
|
-
fieldDefs.forEach(field => {
|
|
502
|
-
if (!listFields.find(f => f.field === field.name)) {
|
|
443
|
+
fieldDefs.forEach((field) => {
|
|
444
|
+
if (!listFields.find((f) => f.field === field.name)) {
|
|
503
445
|
listFields.push({
|
|
504
446
|
field: field.name
|
|
505
447
|
});
|
|
506
448
|
}
|
|
507
449
|
});
|
|
508
|
-
patchQueryFields.forEach(k => {
|
|
509
|
-
if (!listFields.find(f => f.field === k)) {
|
|
450
|
+
patchQueryFields.forEach((k) => {
|
|
451
|
+
if (!listFields.find((f) => f.field === k)) {
|
|
510
452
|
listFields.push({
|
|
511
453
|
field: k
|
|
512
454
|
});
|
|
@@ -514,8 +456,8 @@ export default function ListView(props) {
|
|
|
514
456
|
});
|
|
515
457
|
}
|
|
516
458
|
|
|
517
|
-
compositeKeys.forEach(k => {
|
|
518
|
-
if (!listFields.find(f => f.field === k)) {
|
|
459
|
+
compositeKeys.forEach((k) => {
|
|
460
|
+
if (!listFields.find((f) => f.field === k)) {
|
|
519
461
|
listFields.push({
|
|
520
462
|
field: k
|
|
521
463
|
});
|
|
@@ -524,18 +466,22 @@ export default function ListView(props) {
|
|
|
524
466
|
return listFields;
|
|
525
467
|
};
|
|
526
468
|
|
|
527
|
-
const addItemKeyInSelect = (
|
|
528
|
-
fieldDefs,
|
|
529
|
-
itemKey,
|
|
530
|
-
select,
|
|
531
|
-
compositeKeys
|
|
532
|
-
) => {
|
|
469
|
+
const addItemKeyInSelect = (fieldDefs, itemKey, select, compositeKeys) => {
|
|
533
470
|
const elementFound = getField(fieldDefs, itemKey);
|
|
534
471
|
|
|
535
|
-
if (
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
472
|
+
if (
|
|
473
|
+
itemKey &&
|
|
474
|
+
!elementFound &&
|
|
475
|
+
Array.isArray(select) &&
|
|
476
|
+
!(compositeKeys !== null && compositeKeys?.length) &&
|
|
477
|
+
!select.find((sel) => sel.field === itemKey)
|
|
478
|
+
) {
|
|
479
|
+
return [
|
|
480
|
+
...select,
|
|
481
|
+
{
|
|
482
|
+
field: itemKey
|
|
483
|
+
}
|
|
484
|
+
];
|
|
539
485
|
}
|
|
540
486
|
|
|
541
487
|
return select;
|
|
@@ -546,9 +492,9 @@ export default function ListView(props) {
|
|
|
546
492
|
return fieldsMap.get(columnId);
|
|
547
493
|
};
|
|
548
494
|
|
|
549
|
-
const getFieldsMap = fieldDefs => {
|
|
495
|
+
const getFieldsMap = (fieldDefs) => {
|
|
550
496
|
const fieldsMap = new Map();
|
|
551
|
-
fieldDefs.forEach(element => {
|
|
497
|
+
fieldDefs.forEach((element) => {
|
|
552
498
|
fieldsMap.set(element.id, element);
|
|
553
499
|
});
|
|
554
500
|
return fieldsMap;
|
|
@@ -561,19 +507,16 @@ export default function ListView(props) {
|
|
|
561
507
|
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
562
508
|
const workListJSON = await fetchAllData(listFields);
|
|
563
509
|
|
|
564
|
-
// don't update these fields until we return from promise
|
|
565
|
-
let fields = presets[0].children[0].children;
|
|
566
|
-
|
|
567
510
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
568
511
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
569
512
|
|
|
570
|
-
const tableDataResults = workListJSON['data'];
|
|
513
|
+
const tableDataResults = !bInForm ? workListJSON['data'].data : workListJSON['data'];
|
|
571
514
|
|
|
572
|
-
const myColumns = getHeaderCells(columnFields, fieldDefs
|
|
515
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs);
|
|
573
516
|
|
|
574
517
|
const selectParams: any = [];
|
|
575
518
|
|
|
576
|
-
myColumns.forEach(column => {
|
|
519
|
+
myColumns.forEach((column) => {
|
|
577
520
|
selectParams.push({
|
|
578
521
|
field: column.id
|
|
579
522
|
});
|
|
@@ -581,20 +524,18 @@ export default function ListView(props) {
|
|
|
581
524
|
|
|
582
525
|
const colList: any = [];
|
|
583
526
|
|
|
584
|
-
selectParams.forEach(col => {
|
|
527
|
+
selectParams.forEach((col) => {
|
|
585
528
|
colList.push(col.field);
|
|
586
529
|
});
|
|
587
530
|
|
|
588
|
-
columnList = colList;
|
|
589
|
-
|
|
590
|
-
fields = updateFields(fields, myColumns);
|
|
531
|
+
columnList.current = colList;
|
|
591
532
|
|
|
592
533
|
setResponse(tableDataResults);
|
|
593
534
|
|
|
594
535
|
const usingDataResults = getUsingData(tableDataResults);
|
|
595
536
|
|
|
596
537
|
// store globally, so can be searched, filtered, etc.
|
|
597
|
-
myRows =
|
|
538
|
+
myRows = usingDataResults;
|
|
598
539
|
myDisplayColumnList = getMyColumnList(myColumns);
|
|
599
540
|
|
|
600
541
|
// At this point, if we have data ready to render and haven't been asked
|
|
@@ -618,7 +559,43 @@ export default function ListView(props) {
|
|
|
618
559
|
useEffect(() => {
|
|
619
560
|
if (listContext.meta) {
|
|
620
561
|
fetchDataFromServer();
|
|
562
|
+
setTimeout(() => {
|
|
563
|
+
PCore.getPubSubUtils().subscribe(
|
|
564
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
565
|
+
(data) => {
|
|
566
|
+
processFilterChange(data);
|
|
567
|
+
},
|
|
568
|
+
`dashboard-component-${'id'}`,
|
|
569
|
+
false,
|
|
570
|
+
getPConnect().getContextName()
|
|
571
|
+
);
|
|
572
|
+
PCore.getPubSubUtils().subscribe(
|
|
573
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
574
|
+
() => {
|
|
575
|
+
filters.current = {};
|
|
576
|
+
processFilterClear();
|
|
577
|
+
},
|
|
578
|
+
`dashboard-component-${'id'}`,
|
|
579
|
+
false,
|
|
580
|
+
getPConnect().getContextName()
|
|
581
|
+
);
|
|
582
|
+
}, 0);
|
|
621
583
|
}
|
|
584
|
+
|
|
585
|
+
return function cleanupSubscriptions() {
|
|
586
|
+
PCore.getPubSubUtils().unsubscribe(
|
|
587
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
588
|
+
`dashboard-component-${'id'}`,
|
|
589
|
+
false,
|
|
590
|
+
getPConnect().getContextName()
|
|
591
|
+
);
|
|
592
|
+
PCore.getPubSubUtils().unsubscribe(
|
|
593
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
594
|
+
`dashboard-component-${'id'}`,
|
|
595
|
+
false,
|
|
596
|
+
getPConnect().getContextName()
|
|
597
|
+
);
|
|
598
|
+
};
|
|
622
599
|
}, [listContext]);
|
|
623
600
|
|
|
624
601
|
function searchFilter(value: string, rows: Array<any>) {
|
|
@@ -667,7 +644,7 @@ export default function ListView(props) {
|
|
|
667
644
|
const { pxRefObjectClass, pzInsKey } = row;
|
|
668
645
|
const sTarget = thePConn.getContainerName();
|
|
669
646
|
|
|
670
|
-
const options = { containerName: sTarget };
|
|
647
|
+
const options = { containerName: sTarget, channelName: '' };
|
|
671
648
|
|
|
672
649
|
thePConn
|
|
673
650
|
.getActionsApi()
|
|
@@ -680,17 +657,17 @@ export default function ListView(props) {
|
|
|
680
657
|
});
|
|
681
658
|
}
|
|
682
659
|
|
|
683
|
-
function _rowClick(row: any) {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
660
|
+
// function _rowClick(row: any) {
|
|
661
|
+
// // eslint-disable-next-line sonarjs/no-small-switch
|
|
662
|
+
// switch (rowClickAction) {
|
|
663
|
+
// case 'openAssignment':
|
|
664
|
+
// openAssignment(row);
|
|
665
|
+
// break;
|
|
689
666
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
667
|
+
// default:
|
|
668
|
+
// break;
|
|
669
|
+
// }
|
|
670
|
+
// }
|
|
694
671
|
|
|
695
672
|
function openWork(row) {
|
|
696
673
|
const { pxRefObjectKey } = row;
|
|
@@ -724,8 +701,7 @@ export default function ListView(props) {
|
|
|
724
701
|
const [filterType, setFilterType] = useState<string>('string');
|
|
725
702
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
|
|
726
703
|
const [displayDialogFilterName, setDisplayDialogFilterName] = useState<string>('');
|
|
727
|
-
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] =
|
|
728
|
-
useState<string>('contains');
|
|
704
|
+
const [displayDialogContainsFilter, setDisplayDialogContainsFilter] = useState<string>('contains');
|
|
729
705
|
const [displayDialogContainsValue, setDisplayDialogContainsValue] = useState<string>('');
|
|
730
706
|
const [displayDialogDateFilter, setDisplayDialogDateFilter] = useState<string>('notequal');
|
|
731
707
|
const [displayDialogDateValue, setDisplayDialogDateValue] = useState<string>('');
|
|
@@ -738,11 +714,7 @@ export default function ListView(props) {
|
|
|
738
714
|
for (const filterObj of filterByColumns) {
|
|
739
715
|
if (filterObj.ref === menuColumnId) {
|
|
740
716
|
setFilterBy(menuColumnLabel);
|
|
741
|
-
if (
|
|
742
|
-
filterObj.type === 'Date' ||
|
|
743
|
-
filterObj.type === 'DateTime' ||
|
|
744
|
-
filterObj.type === 'Time'
|
|
745
|
-
) {
|
|
717
|
+
if (filterObj.type === 'Date' || filterObj.type === 'DateTime' || filterObj.type === 'Time') {
|
|
746
718
|
setContainsDateOrTime(true);
|
|
747
719
|
setFilterType(filterObj.type);
|
|
748
720
|
setDisplayDialogDateFilter(filterObj.containsFilter);
|
|
@@ -899,7 +871,7 @@ export default function ListView(props) {
|
|
|
899
871
|
}
|
|
900
872
|
|
|
901
873
|
function _listViewClick(row, column) {
|
|
902
|
-
const name = column.id
|
|
874
|
+
const name = column.id;
|
|
903
875
|
if (column.displayAsLink) {
|
|
904
876
|
const { pxObjClass } = row;
|
|
905
877
|
let { pzInsKey } = row;
|
|
@@ -909,7 +881,8 @@ export default function ListView(props) {
|
|
|
909
881
|
}
|
|
910
882
|
if (column.isAssignmentLink) {
|
|
911
883
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
912
|
-
containerName: 'primary'
|
|
884
|
+
containerName: 'primary',
|
|
885
|
+
channelName: ''
|
|
913
886
|
});
|
|
914
887
|
} else {
|
|
915
888
|
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
@@ -928,13 +901,12 @@ export default function ListView(props) {
|
|
|
928
901
|
break;
|
|
929
902
|
}
|
|
930
903
|
}
|
|
931
|
-
|
|
932
904
|
}
|
|
933
905
|
|
|
934
906
|
function _listTitle() {
|
|
935
907
|
const defaultTitle = 'List';
|
|
936
|
-
let title = resolvedConfigProps.title
|
|
937
|
-
const inheritedProps = resolvedConfigProps?.inheritedProps;
|
|
908
|
+
let title = resolvedConfigProps.title || resolvedConfigProps?.label || defaultTitle;
|
|
909
|
+
const inheritedProps = resolvedConfigProps?.['inheritedProps'];
|
|
938
910
|
|
|
939
911
|
// Let any title in resolvedConfigProps that isn't the default take precedence
|
|
940
912
|
// but only look in inheritedProps if they exist
|
|
@@ -954,59 +926,80 @@ export default function ListView(props) {
|
|
|
954
926
|
const value = event.target.value;
|
|
955
927
|
const reqObj = {};
|
|
956
928
|
if (compositeKeys?.length > 1) {
|
|
957
|
-
const index = response.findIndex(element => element[rowID] === value);
|
|
929
|
+
const index = response.findIndex((element) => element[rowID] === value);
|
|
958
930
|
const selectedRow = response[index];
|
|
959
|
-
compositeKeys.forEach(element => {
|
|
960
|
-
reqObj[element] = selectedRow[element]
|
|
931
|
+
compositeKeys.forEach((element) => {
|
|
932
|
+
reqObj[element] = selectedRow[element];
|
|
961
933
|
});
|
|
962
934
|
} else {
|
|
963
935
|
reqObj[rowID] = value;
|
|
964
936
|
}
|
|
965
|
-
getPConnect()
|
|
966
|
-
?.getListActions?.()
|
|
967
|
-
?.setSelectedRows([reqObj]);
|
|
937
|
+
getPConnect()?.getListActions?.()?.setSelectedRows([reqObj]);
|
|
968
938
|
setSelectedValue(value);
|
|
969
939
|
};
|
|
970
940
|
|
|
971
|
-
const onCheckboxClick = event => {
|
|
941
|
+
const onCheckboxClick = (event) => {
|
|
972
942
|
const value = event?.target?.value;
|
|
973
943
|
const checked = event?.target?.checked;
|
|
974
944
|
const reqObj = {};
|
|
975
945
|
if (compositeKeys?.length > 1) {
|
|
976
|
-
const index = response.findIndex(element => element[rowID] === value);
|
|
946
|
+
const index = response.findIndex((element) => element[rowID] === value);
|
|
977
947
|
const selectedRow = response[index];
|
|
978
|
-
compositeKeys.forEach(element => {
|
|
979
|
-
reqObj[element] = selectedRow[element]
|
|
948
|
+
compositeKeys.forEach((element) => {
|
|
949
|
+
reqObj[element] = selectedRow[element];
|
|
980
950
|
});
|
|
981
951
|
reqObj['$selected'] = checked;
|
|
982
952
|
} else {
|
|
983
953
|
reqObj[rowID] = value;
|
|
984
954
|
reqObj['$selected'] = checked;
|
|
985
955
|
}
|
|
986
|
-
getPConnect()
|
|
987
|
-
|
|
988
|
-
|
|
956
|
+
getPConnect()?.getListActions()?.setSelectedRows([reqObj]);
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
const processColumnValue = (column, value) => {
|
|
960
|
+
let val;
|
|
961
|
+
const type = column.type;
|
|
962
|
+
let theDateFormatInfo;
|
|
963
|
+
let theFormat;
|
|
964
|
+
let theCurrencyOptions;
|
|
965
|
+
switch (type) {
|
|
966
|
+
case 'Date':
|
|
967
|
+
case 'DateTime':
|
|
968
|
+
theDateFormatInfo = getDateFormatInfo();
|
|
969
|
+
theFormat = type === 'DateTime' ? `${theDateFormatInfo.dateFormatStringLong} hh:mm a` : theDateFormatInfo.dateFormatStringLong;
|
|
970
|
+
val = format(value, column.type, { format: theFormat });
|
|
971
|
+
break;
|
|
972
|
+
|
|
973
|
+
case 'Currency':
|
|
974
|
+
theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale());
|
|
975
|
+
val = format(value, column.type, theCurrencyOptions);
|
|
976
|
+
break;
|
|
977
|
+
|
|
978
|
+
default:
|
|
979
|
+
val = column.format && typeof value === 'number' ? column.format(value) : value;
|
|
980
|
+
}
|
|
981
|
+
return val;
|
|
989
982
|
};
|
|
990
983
|
|
|
991
984
|
return (
|
|
992
985
|
<>
|
|
993
986
|
{arColumns && arColumns.length > 0 && (
|
|
994
987
|
<Paper className={classes.paper}>
|
|
995
|
-
<Typography className={classes.title} variant=
|
|
988
|
+
<Typography className={classes.title} variant="h6" color="textPrimary" gutterBottom>
|
|
996
989
|
{_listTitle()}
|
|
997
990
|
</Typography>
|
|
998
991
|
{globalSearch && (
|
|
999
|
-
<Grid container spacing={1} alignItems=
|
|
992
|
+
<Grid container spacing={1} alignItems="flex-end" className={classes.search}>
|
|
1000
993
|
<Grid item>
|
|
1001
994
|
<SearchIcon />
|
|
1002
995
|
</Grid>
|
|
1003
996
|
<Grid item>
|
|
1004
997
|
<TextField
|
|
1005
|
-
label='Search'
|
|
998
|
+
label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
|
|
1006
999
|
fullWidth
|
|
1007
|
-
variant=
|
|
1008
|
-
placeholder=
|
|
1009
|
-
size=
|
|
1000
|
+
variant="outlined"
|
|
1001
|
+
placeholder=""
|
|
1002
|
+
size="small"
|
|
1010
1003
|
id="search"
|
|
1011
1004
|
onChange={_onSearch}
|
|
1012
1005
|
/>
|
|
@@ -1014,36 +1007,28 @@ export default function ListView(props) {
|
|
|
1014
1007
|
</Grid>
|
|
1015
1008
|
)}
|
|
1016
1009
|
<>
|
|
1017
|
-
{bInForm ? (
|
|
1018
|
-
<TableContainer className={classes.tableInForm}>
|
|
1019
|
-
<Table stickyHeader aria-label=
|
|
1010
|
+
{!bInForm ? (
|
|
1011
|
+
<TableContainer id="list-view" className={classes.tableInForm}>
|
|
1012
|
+
<Table stickyHeader aria-label="sticky table">
|
|
1020
1013
|
<TableHead>
|
|
1021
1014
|
<TableRow>
|
|
1022
|
-
{arColumns.map(column => {
|
|
1015
|
+
{arColumns.map((column) => {
|
|
1023
1016
|
return (
|
|
1024
|
-
<TableCell
|
|
1025
|
-
className={classes.cell}
|
|
1026
|
-
key={column.id}
|
|
1027
|
-
sortDirection={orderBy === column.id ? order : false}
|
|
1028
|
-
>
|
|
1017
|
+
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1029
1018
|
<TableSortLabel
|
|
1030
1019
|
active={orderBy === column.id}
|
|
1031
1020
|
direction={orderBy === column.id ? order : 'asc'}
|
|
1032
1021
|
onClick={createSortHandler(column.id)}
|
|
1033
1022
|
>
|
|
1034
1023
|
{column.label}
|
|
1035
|
-
{_showFilteredIcon(column.id) &&
|
|
1036
|
-
<FilterListIcon className={classes.filteredIcon} />
|
|
1037
|
-
)}
|
|
1024
|
+
{_showFilteredIcon(column.id) && <FilterListIcon className={classes.filteredIcon} />}
|
|
1038
1025
|
{orderBy === column.id ? (
|
|
1039
|
-
<span className={classes.visuallyHidden}>
|
|
1040
|
-
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
1041
|
-
</span>
|
|
1026
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
1042
1027
|
) : null}
|
|
1043
1028
|
</TableSortLabel>
|
|
1044
1029
|
<MoreIcon
|
|
1045
1030
|
className={classes.moreIcon}
|
|
1046
|
-
onClick={event => {
|
|
1031
|
+
onClick={(event) => {
|
|
1047
1032
|
_menuClick(event, column.id, column.type, column.label);
|
|
1048
1033
|
}}
|
|
1049
1034
|
/>
|
|
@@ -1055,39 +1040,24 @@ export default function ListView(props) {
|
|
|
1055
1040
|
<TableBody>
|
|
1056
1041
|
{stableSort(arRows, getComparator(order, orderBy))
|
|
1057
1042
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1058
|
-
.map(row => {
|
|
1043
|
+
.map((row) => {
|
|
1059
1044
|
return (
|
|
1060
|
-
<TableRow
|
|
1061
|
-
|
|
1062
|
-
onClick={() => {
|
|
1063
|
-
_rowClick(row);
|
|
1064
|
-
}}
|
|
1065
|
-
>
|
|
1066
|
-
{arColumns.map(column => {
|
|
1045
|
+
<TableRow key={row.pxRefObjectInsName || row.pyID}>
|
|
1046
|
+
{arColumns.map((column) => {
|
|
1067
1047
|
const value = row[column.id];
|
|
1068
1048
|
return (
|
|
1069
|
-
<TableCell
|
|
1070
|
-
key={column.id}
|
|
1071
|
-
align={column.align}
|
|
1072
|
-
className={classes.cell}
|
|
1073
|
-
>
|
|
1049
|
+
<TableCell key={column.id} align={column.align} className={classes.cell}>
|
|
1074
1050
|
{_showButton(column.id, row) || column.displayAsLink ? (
|
|
1075
1051
|
<Link
|
|
1076
|
-
component=
|
|
1052
|
+
component="button"
|
|
1077
1053
|
onClick={() => {
|
|
1078
1054
|
_listViewClick(row, column);
|
|
1079
1055
|
}}
|
|
1080
1056
|
>
|
|
1081
|
-
{column.format && typeof value === 'number'
|
|
1082
|
-
? column.format(value)
|
|
1083
|
-
: value}
|
|
1057
|
+
{column.format && typeof value === 'number' ? column.format(value) : value}
|
|
1084
1058
|
</Link>
|
|
1085
1059
|
) : (
|
|
1086
|
-
<>
|
|
1087
|
-
{column.format && typeof value === 'number'
|
|
1088
|
-
? column.format(value)
|
|
1089
|
-
: value}
|
|
1090
|
-
</>
|
|
1060
|
+
<>{column.format && typeof value === 'number' ? column.format(value) : value}</>
|
|
1091
1061
|
)}
|
|
1092
1062
|
</TableCell>
|
|
1093
1063
|
);
|
|
@@ -1099,19 +1069,14 @@ export default function ListView(props) {
|
|
|
1099
1069
|
</Table>
|
|
1100
1070
|
</TableContainer>
|
|
1101
1071
|
) : (
|
|
1102
|
-
<TableContainer>
|
|
1072
|
+
<TableContainer id="list-view">
|
|
1103
1073
|
<Table>
|
|
1104
1074
|
<TableHead>
|
|
1105
1075
|
<TableRow>
|
|
1106
|
-
{(selectionMode === SELECTION_MODE.SINGLE ||
|
|
1107
|
-
|
|
1108
|
-
{arColumns.map(column => {
|
|
1076
|
+
{(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell></TableCell>}
|
|
1077
|
+
{arColumns.map((column) => {
|
|
1109
1078
|
return (
|
|
1110
|
-
<TableCell
|
|
1111
|
-
className={classes.cell}
|
|
1112
|
-
key={column.id}
|
|
1113
|
-
sortDirection={orderBy === column.id ? order : false}
|
|
1114
|
-
>
|
|
1079
|
+
<TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
|
|
1115
1080
|
<TableSortLabel
|
|
1116
1081
|
active={orderBy === column.id}
|
|
1117
1082
|
direction={orderBy === column.id ? order : 'asc'}
|
|
@@ -1119,9 +1084,7 @@ export default function ListView(props) {
|
|
|
1119
1084
|
>
|
|
1120
1085
|
{column.label}
|
|
1121
1086
|
{orderBy === column.id ? (
|
|
1122
|
-
<span className={classes.visuallyHidden}>
|
|
1123
|
-
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
|
|
1124
|
-
</span>
|
|
1087
|
+
<span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
|
|
1125
1088
|
) : null}
|
|
1126
1089
|
</TableSortLabel>
|
|
1127
1090
|
</TableCell>
|
|
@@ -1134,20 +1097,15 @@ export default function ListView(props) {
|
|
|
1134
1097
|
arRows.length > 0 &&
|
|
1135
1098
|
stableSort(arRows, getComparator(order, orderBy))
|
|
1136
1099
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1137
|
-
.map(row => {
|
|
1100
|
+
.map((row) => {
|
|
1138
1101
|
return (
|
|
1139
|
-
<TableRow
|
|
1140
|
-
key={row[rowID]}
|
|
1141
|
-
onClick={() => {
|
|
1142
|
-
_rowClick(row);
|
|
1143
|
-
}}
|
|
1144
|
-
>
|
|
1102
|
+
<TableRow key={row[rowID]}>
|
|
1145
1103
|
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1146
1104
|
<TableCell>
|
|
1147
1105
|
<Radio
|
|
1148
1106
|
onChange={handleChange}
|
|
1149
1107
|
value={row[rowID]}
|
|
1150
|
-
name=
|
|
1108
|
+
name="radio-buttons"
|
|
1151
1109
|
inputProps={{ 'aria-label': 'A' }}
|
|
1152
1110
|
checked={selectedValue === row[rowID]}
|
|
1153
1111
|
></Radio>
|
|
@@ -1155,23 +1113,14 @@ export default function ListView(props) {
|
|
|
1155
1113
|
)}
|
|
1156
1114
|
{selectionMode === SELECTION_MODE.MULTI && (
|
|
1157
1115
|
<TableCell>
|
|
1158
|
-
<Checkbox
|
|
1159
|
-
onChange={onCheckboxClick}
|
|
1160
|
-
value={row[rowID]}
|
|
1161
|
-
></Checkbox>
|
|
1116
|
+
<Checkbox onChange={onCheckboxClick} value={row[rowID]}></Checkbox>
|
|
1162
1117
|
</TableCell>
|
|
1163
1118
|
)}
|
|
1164
|
-
{arColumns.map(column => {
|
|
1119
|
+
{arColumns.map((column) => {
|
|
1165
1120
|
const value = row[column.id];
|
|
1166
1121
|
return (
|
|
1167
|
-
<TableCell
|
|
1168
|
-
|
|
1169
|
-
key={column.id}
|
|
1170
|
-
align={column.align}
|
|
1171
|
-
>
|
|
1172
|
-
{column.format && typeof value === 'number'
|
|
1173
|
-
? column.format(value)
|
|
1174
|
-
: value}
|
|
1122
|
+
<TableCell className={classes.cell} key={column.id} align={column.align}>
|
|
1123
|
+
{processColumnValue(column, value)}
|
|
1175
1124
|
</TableCell>
|
|
1176
1125
|
);
|
|
1177
1126
|
})}
|
|
@@ -1180,16 +1129,14 @@ export default function ListView(props) {
|
|
|
1180
1129
|
})}
|
|
1181
1130
|
</TableBody>
|
|
1182
1131
|
</Table>
|
|
1183
|
-
{arRows && arRows.length === 0 &&
|
|
1184
|
-
<div className='no-records'>No records found.</div>
|
|
1185
|
-
)}
|
|
1132
|
+
{arRows && arRows.length === 0 && <div className="no-records">No records found.</div>}
|
|
1186
1133
|
</TableContainer>
|
|
1187
1134
|
)}
|
|
1188
1135
|
</>
|
|
1189
1136
|
{arRows && arRows.length > 0 && (
|
|
1190
1137
|
<TablePagination
|
|
1191
1138
|
rowsPerPageOptions={[10, 25, 100]}
|
|
1192
|
-
component=
|
|
1139
|
+
component="div"
|
|
1193
1140
|
count={arRows.length}
|
|
1194
1141
|
rowsPerPage={rowsPerPage}
|
|
1195
1142
|
page={page}
|
|
@@ -1199,13 +1146,7 @@ export default function ListView(props) {
|
|
|
1199
1146
|
)}
|
|
1200
1147
|
</Paper>
|
|
1201
1148
|
)}
|
|
1202
|
-
<Menu
|
|
1203
|
-
id='simple-menu'
|
|
1204
|
-
anchorEl={anchorEl}
|
|
1205
|
-
keepMounted
|
|
1206
|
-
open={Boolean(anchorEl)}
|
|
1207
|
-
onClose={_menuClose}
|
|
1208
|
-
>
|
|
1149
|
+
<Menu id="simple-menu" anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={_menuClose}>
|
|
1209
1150
|
<MenuItem onClick={_filterMenu}>
|
|
1210
1151
|
<FilterListIcon /> Filter
|
|
1211
1152
|
</MenuItem>
|
|
@@ -1213,24 +1154,24 @@ export default function ListView(props) {
|
|
|
1213
1154
|
<SubjectIcon /> Group
|
|
1214
1155
|
</MenuItem>
|
|
1215
1156
|
</Menu>
|
|
1216
|
-
<Dialog open={open} onClose={_closeDialog} aria-labelledby=
|
|
1217
|
-
<DialogTitle id=
|
|
1157
|
+
<Dialog open={open} onClose={_closeDialog} aria-labelledby="form-dialog-title">
|
|
1158
|
+
<DialogTitle id="form-dialog-title">Filter: {filterBy}</DialogTitle>
|
|
1218
1159
|
<DialogContent>
|
|
1219
1160
|
{containsDateOrTime ? (
|
|
1220
1161
|
<>
|
|
1221
1162
|
<Select value={displayDialogDateFilter} onChange={_dialogDateFilter} fullWidth>
|
|
1222
|
-
<MenuItem value=
|
|
1223
|
-
<MenuItem value=
|
|
1224
|
-
<MenuItem value=
|
|
1225
|
-
<MenuItem value=
|
|
1226
|
-
<MenuItem value=
|
|
1163
|
+
<MenuItem value="notequal">is not equal to</MenuItem>
|
|
1164
|
+
<MenuItem value="after">after</MenuItem>
|
|
1165
|
+
<MenuItem value="before">before</MenuItem>
|
|
1166
|
+
<MenuItem value="null">is null</MenuItem>
|
|
1167
|
+
<MenuItem value="notnull">is not null</MenuItem>
|
|
1227
1168
|
</Select>
|
|
1228
1169
|
{filterType === 'Date' && (
|
|
1229
1170
|
<TextField
|
|
1230
1171
|
autoFocus
|
|
1231
|
-
margin=
|
|
1232
|
-
id=
|
|
1233
|
-
type=
|
|
1172
|
+
margin="dense"
|
|
1173
|
+
id="containsFilter"
|
|
1174
|
+
type="date"
|
|
1234
1175
|
fullWidth
|
|
1235
1176
|
value={displayDialogDateValue}
|
|
1236
1177
|
onChange={_dialogDateValue}
|
|
@@ -1239,9 +1180,9 @@ export default function ListView(props) {
|
|
|
1239
1180
|
{filterType === 'DateTime' && (
|
|
1240
1181
|
<TextField
|
|
1241
1182
|
autoFocus
|
|
1242
|
-
margin=
|
|
1243
|
-
id=
|
|
1244
|
-
type=
|
|
1183
|
+
margin="dense"
|
|
1184
|
+
id="containsFilter"
|
|
1185
|
+
type="datetime-local"
|
|
1245
1186
|
fullWidth
|
|
1246
1187
|
value={displayDialogDateValue}
|
|
1247
1188
|
onChange={_dialogDateValue}
|
|
@@ -1250,9 +1191,9 @@ export default function ListView(props) {
|
|
|
1250
1191
|
{filterType === 'Time' && (
|
|
1251
1192
|
<TextField
|
|
1252
1193
|
autoFocus
|
|
1253
|
-
margin=
|
|
1254
|
-
id=
|
|
1255
|
-
type=
|
|
1194
|
+
margin="dense"
|
|
1195
|
+
id="containsFilter"
|
|
1196
|
+
type="time"
|
|
1256
1197
|
fullWidth
|
|
1257
1198
|
value={displayDialogDateValue}
|
|
1258
1199
|
onChange={_dialogDateValue}
|
|
@@ -1261,20 +1202,16 @@ export default function ListView(props) {
|
|
|
1261
1202
|
</>
|
|
1262
1203
|
) : (
|
|
1263
1204
|
<>
|
|
1264
|
-
<Select
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
value=
|
|
1268
|
-
>
|
|
1269
|
-
<MenuItem value='contains'>Contains</MenuItem>
|
|
1270
|
-
<MenuItem value='equals'>Equals</MenuItem>
|
|
1271
|
-
<MenuItem value='startswith'>Starts with</MenuItem>
|
|
1205
|
+
<Select fullWidth onChange={_dialogContainsFilter} value={displayDialogContainsFilter}>
|
|
1206
|
+
<MenuItem value="contains">Contains</MenuItem>
|
|
1207
|
+
<MenuItem value="equals">Equals</MenuItem>
|
|
1208
|
+
<MenuItem value="startswith">Starts with</MenuItem>
|
|
1272
1209
|
</Select>
|
|
1273
1210
|
<TextField
|
|
1274
1211
|
autoFocus
|
|
1275
|
-
margin=
|
|
1276
|
-
id=
|
|
1277
|
-
type=
|
|
1212
|
+
margin="dense"
|
|
1213
|
+
id="containsFilter"
|
|
1214
|
+
type="text"
|
|
1278
1215
|
fullWidth
|
|
1279
1216
|
value={displayDialogContainsValue}
|
|
1280
1217
|
onChange={_dialogContainsValue}
|
|
@@ -1283,10 +1220,10 @@ export default function ListView(props) {
|
|
|
1283
1220
|
)}
|
|
1284
1221
|
</DialogContent>
|
|
1285
1222
|
<DialogActions>
|
|
1286
|
-
<Button onClick={_closeDialog} color=
|
|
1223
|
+
<Button onClick={_closeDialog} color="secondary">
|
|
1287
1224
|
Cancel
|
|
1288
1225
|
</Button>
|
|
1289
|
-
<Button onClick={_submitFilter} color=
|
|
1226
|
+
<Button onClick={_submitFilter} color="primary">
|
|
1290
1227
|
Submit
|
|
1291
1228
|
</Button>
|
|
1292
1229
|
</DialogActions>
|
|
@@ -1298,18 +1235,11 @@ export default function ListView(props) {
|
|
|
1298
1235
|
onClose={handleSnackbarClose}
|
|
1299
1236
|
message={snackbarMessage}
|
|
1300
1237
|
action={
|
|
1301
|
-
<IconButton size=
|
|
1302
|
-
<CloseIcon fontSize=
|
|
1238
|
+
<IconButton size="small" aria-label="close" color="inherit" onClick={handleSnackbarClose}>
|
|
1239
|
+
<CloseIcon fontSize="small" />
|
|
1303
1240
|
</IconButton>
|
|
1304
1241
|
}
|
|
1305
1242
|
/>
|
|
1306
1243
|
</>
|
|
1307
1244
|
);
|
|
1308
1245
|
}
|
|
1309
|
-
|
|
1310
|
-
ListView.defaultProps = {
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
ListView.propTypes = {
|
|
1314
|
-
getPConnect: PropTypes.func.isRequired
|
|
1315
|
-
};
|