@pega/react-sdk-overrides 8.8.21 → 8.23.11-debug
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 +9 -13
- package/lib/designSystemExtension/Banner/Banner.tsx +1 -12
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +10 -15
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +11 -10
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +3 -10
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +3 -11
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +3 -11
- package/lib/designSystemExtension/Operator/Operator.tsx +12 -16
- package/lib/designSystemExtension/Pulse/Pulse.tsx +7 -11
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +1 -10
- package/lib/field/AutoComplete/AutoComplete.tsx +18 -37
- package/lib/field/CancelAlert/CancelAlert.tsx +4 -9
- package/lib/field/Checkbox/Checkbox.tsx +16 -39
- package/lib/field/Currency/Currency.tsx +15 -23
- package/lib/field/Currency/currency-utils.ts +5 -1
- package/lib/field/Date/Date.tsx +15 -22
- package/lib/field/DateTime/DateTime.tsx +14 -25
- package/lib/field/Decimal/Decimal.tsx +14 -25
- package/lib/field/Dropdown/Dropdown.tsx +26 -30
- package/lib/field/Email/Email.tsx +9 -17
- package/lib/field/Integer/Integer.tsx +7 -15
- package/lib/field/Percentage/Percentage.tsx +7 -15
- package/lib/field/Phone/Phone.tsx +11 -19
- package/lib/field/RadioButtons/RadioButtons.tsx +37 -25
- package/lib/field/SemanticLink/SemanticLink.tsx +25 -26
- package/lib/field/TextArea/TextArea.tsx +5 -14
- package/lib/field/TextContent/TextContent.tsx +1 -10
- package/lib/field/TextInput/TextInput.tsx +6 -15
- package/lib/field/Time/Time.tsx +27 -22
- package/lib/field/URL/URL.tsx +8 -16
- package/lib/field/UserReference/UserReference.tsx +60 -50
- package/lib/helpers/attachmentHelpers.ts +4 -4
- package/lib/helpers/auth.js +397 -741
- package/lib/helpers/authManager.js +634 -0
- package/lib/helpers/case-utils.tsx +9 -8
- package/lib/helpers/common-utils.ts +1 -1
- package/lib/helpers/config_access.js +73 -0
- package/lib/helpers/date-format-utils.ts +1 -1
- package/lib/helpers/event-utils.ts +1 -1
- package/lib/helpers/formatters/Currency.ts +11 -11
- package/lib/helpers/formatters/CurrencyMap.ts +5 -8
- package/lib/helpers/formatters/Date.ts +1 -1
- package/lib/helpers/formatters/common.ts +6 -2
- package/lib/helpers/formatters/index.ts +3 -3
- package/lib/helpers/simpleTableHelpers.ts +7 -7
- package/lib/helpers/state-utils.tsx +3 -0
- package/lib/helpers/template-utils.ts +6 -3
- package/lib/helpers/versionHelpers.ts +3 -0
- package/lib/infra/ActionButtons/ActionButtons.tsx +19 -9
- package/lib/infra/Assignment/Assignment.tsx +28 -21
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -15
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +58 -57
- package/lib/infra/Containers/FlowContainer/helpers.ts +3 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +19 -14
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +25 -14
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +21 -13
- package/lib/infra/DashboardFilter/filterUtils.tsx +1 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +20 -14
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +14 -10
- package/lib/infra/MultiStep/MultiStep.tsx +22 -22
- package/lib/infra/NavBar/NavBar.tsx +21 -14
- package/lib/infra/Reference/Reference.tsx +18 -13
- package/lib/infra/Region/Region.tsx +6 -8
- package/lib/infra/RootContainer/RootContainer.tsx +25 -16
- package/lib/infra/Stages/Stages.tsx +8 -10
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +1 -8
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
- package/lib/infra/View/View.tsx +22 -21
- package/lib/template/AppShell/AppShell.tsx +25 -36
- package/lib/template/BannerPage/BannerPage.tsx +31 -26
- package/lib/template/CaseSummary/CaseSummary.tsx +8 -15
- package/lib/template/CaseView/CaseView.tsx +25 -24
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +19 -10
- package/lib/template/Confirmation/Confirmation.tsx +53 -27
- package/lib/template/DataReference/DataReference.tsx +52 -48
- package/lib/template/DefaultForm/DefaultForm.tsx +12 -14
- package/lib/template/Details/Details/Details.tsx +17 -16
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +16 -13
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +18 -19
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +18 -20
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +28 -22
- package/lib/template/InlineDashboard/InlineDashboard.tsx +7 -11
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +17 -19
- package/lib/template/ListPage/ListPage.tsx +13 -14
- package/lib/template/ListView/ListView.tsx +186 -189
- package/lib/template/ListView/utils.ts +23 -170
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +19 -10
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +1 -16
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +18 -19
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +1 -9
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +7 -8
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +7 -5
- package/lib/template/PromotedFilters/PromotedFilters.tsx +14 -16
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +8 -102
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +7 -24
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -23
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +36 -34
- package/lib/template/SubTabs/SubTabs.tsx +11 -10
- package/lib/template/SubTabs/tabUtils.ts +4 -0
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +15 -10
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +12 -10
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +3 -17
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +25 -35
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +1 -7
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +17 -15
- package/lib/template/WssNavBar/WssNavBar.tsx +1 -18
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +21 -13
- package/lib/widget/Attachment/Attachment.tsx +16 -28
- package/lib/widget/CaseHistory/CaseHistory.tsx +10 -12
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +1 -13
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +22 -35
- package/lib/widget/Followers/Followers.tsx +11 -10
- package/lib/widget/QuickCreate/QuickCreate.tsx +5 -11
- package/lib/widget/SummaryItem/SummaryItem.tsx +1 -11
- package/lib/widget/SummaryList/SummaryList.tsx +3 -17
- package/lib/widget/ToDo/ToDo.tsx +105 -62
- package/package.json +1 -1
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +0 -121
- package/lib/designSystemExtension/RichTextEditor/index.tsx +0 -1
- package/lib/field/RichText/RichText.tsx +0 -93
- package/lib/field/RichText/index.tsx +0 -1
- package/lib/field/ScalarList/ScalarList.tsx +0 -64
- package/lib/field/ScalarList/config-ext.json +0 -8
- package/lib/field/ScalarList/index.tsx +0 -1
- package/lib/helpers/authManager.ts +0 -933
|
@@ -4,7 +4,9 @@
|
|
|
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';
|
|
7
8
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
|
|
9
|
+
import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
8
10
|
import Table from '@material-ui/core/Table';
|
|
9
11
|
import TableBody from '@material-ui/core/TableBody';
|
|
10
12
|
import TableCell from '@material-ui/core/TableCell';
|
|
@@ -37,27 +39,7 @@ import { Radio } from '@material-ui/core';
|
|
|
37
39
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
38
40
|
import { filterData } from '@pega/react-sdk-components/lib/components/helpers/simpleTableHelpers';
|
|
39
41
|
import './ListView.css';
|
|
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
|
-
// }
|
|
42
|
+
import useInit from './hooks'
|
|
61
43
|
|
|
62
44
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
63
45
|
|
|
@@ -75,19 +57,9 @@ let sortColumnId: any;
|
|
|
75
57
|
|
|
76
58
|
const filterByColumns: Array<any> = [];
|
|
77
59
|
|
|
78
|
-
export default function ListView(props
|
|
79
|
-
const { getPConnect, bInForm
|
|
80
|
-
const {
|
|
81
|
-
globalSearch,
|
|
82
|
-
referenceList,
|
|
83
|
-
/* rowClickAction, */
|
|
84
|
-
selectionMode,
|
|
85
|
-
referenceType,
|
|
86
|
-
payload,
|
|
87
|
-
parameters,
|
|
88
|
-
compositeKeys,
|
|
89
|
-
showDynamicFields
|
|
90
|
-
} = props;
|
|
60
|
+
export default function ListView(props) {
|
|
61
|
+
const { getPConnect, bInForm } = props;
|
|
62
|
+
const { globalSearch, referenceList, rowClickAction, selectionMode, referenceType, payload, parameters, compositeKeys, showDynamicFields, presets } = props;
|
|
91
63
|
const ref = useRef({}).current;
|
|
92
64
|
const cosmosTableRef = useRef();
|
|
93
65
|
// List component context
|
|
@@ -127,8 +99,8 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
127
99
|
const filters = useRef({});
|
|
128
100
|
|
|
129
101
|
// Will contain the list of columns specific for an instance
|
|
130
|
-
|
|
131
|
-
|
|
102
|
+
let columnList: any = useRef([]);
|
|
103
|
+
let dashboardFilterPayload: any ;
|
|
132
104
|
// Will be sent in the dashboardFilterPayload
|
|
133
105
|
let selectParam: Array<any> = [];
|
|
134
106
|
|
|
@@ -243,7 +215,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
243
215
|
};
|
|
244
216
|
|
|
245
217
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
246
|
-
function getHeaderCells(colFields, fields) {
|
|
218
|
+
function getHeaderCells(colFields, fields, presetFields) {
|
|
247
219
|
const arReturn = colFields.map((field: any, index) => {
|
|
248
220
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
249
221
|
if (theField.indexOf('.') === 0) {
|
|
@@ -252,7 +224,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
252
224
|
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
253
225
|
const displayAsLink = field.config.displayAsLink;
|
|
254
226
|
const headerRow: any = {};
|
|
255
|
-
headerRow.id =
|
|
227
|
+
headerRow.id = theField;
|
|
256
228
|
headerRow.type = field.type;
|
|
257
229
|
headerRow.displayAsLink = displayAsLink;
|
|
258
230
|
headerRow.numeric =
|
|
@@ -262,7 +234,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
262
234
|
field.type === 'Currency' ||
|
|
263
235
|
false;
|
|
264
236
|
headerRow.disablePadding = false;
|
|
265
|
-
headerRow.label =
|
|
237
|
+
headerRow.label = presetFields[index].config.label;
|
|
266
238
|
if (colIndex > -1) {
|
|
267
239
|
headerRow.classID = fields[colIndex].classID;
|
|
268
240
|
}
|
|
@@ -277,18 +249,25 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
277
249
|
return arReturn;
|
|
278
250
|
}
|
|
279
251
|
|
|
252
|
+
function updateFields(arFields, theColumns): Array<any> {
|
|
253
|
+
const arReturn = arFields.filter(ele => ele.type !== 'reference');
|
|
254
|
+
arReturn.forEach((field, index) => {
|
|
255
|
+
arReturn[index].config.name = theColumns[index].id;
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
return arReturn;
|
|
259
|
+
}
|
|
280
260
|
|
|
281
261
|
function getUsingData(arTableData): Array<any> {
|
|
282
262
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
283
263
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
284
264
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
285
265
|
// eslint-disable-next-line no-console
|
|
286
|
-
console.error(
|
|
287
|
-
'pyGUID or pyID values are mandatory to select the required row from the list'
|
|
288
|
-
);
|
|
266
|
+
console.error('pyGUID or pyID values are mandatory to select the required row from the list');
|
|
289
267
|
}
|
|
290
268
|
}
|
|
291
269
|
const arReturn = arTableData?.map((data: any) => {
|
|
270
|
+
|
|
292
271
|
const row = data;
|
|
293
272
|
|
|
294
273
|
return row;
|
|
@@ -297,6 +276,52 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
297
276
|
return arReturn;
|
|
298
277
|
}
|
|
299
278
|
|
|
279
|
+
function updateData(listData: Array<any>, fieldData: Array<any>): Array<any> {
|
|
280
|
+
const returnList: Array<any> = new Array<any>();
|
|
281
|
+
listData?.forEach(row => {
|
|
282
|
+
// copy
|
|
283
|
+
const rowData = JSON.parse(JSON.stringify(row));
|
|
284
|
+
|
|
285
|
+
fieldData.forEach(field => {
|
|
286
|
+
const config = field.config;
|
|
287
|
+
let fieldName;
|
|
288
|
+
let formattedDate;
|
|
289
|
+
let myFormat;
|
|
290
|
+
|
|
291
|
+
switch (field.type) {
|
|
292
|
+
case 'Date':
|
|
293
|
+
fieldName = config.name;
|
|
294
|
+
myFormat = config.formatter;
|
|
295
|
+
if (!myFormat) {
|
|
296
|
+
myFormat = 'Date';
|
|
297
|
+
}
|
|
298
|
+
formattedDate = Utils.generateDate(rowData[fieldName], myFormat);
|
|
299
|
+
|
|
300
|
+
rowData[fieldName] = formattedDate;
|
|
301
|
+
break;
|
|
302
|
+
|
|
303
|
+
case 'DateTime':
|
|
304
|
+
fieldName = config.name;
|
|
305
|
+
myFormat = config.formatter;
|
|
306
|
+
if (!myFormat) {
|
|
307
|
+
myFormat = 'DateTime-Long';
|
|
308
|
+
}
|
|
309
|
+
formattedDate = Utils.generateDateTime(rowData[fieldName], myFormat);
|
|
310
|
+
|
|
311
|
+
rowData[fieldName] = formattedDate;
|
|
312
|
+
break;
|
|
313
|
+
|
|
314
|
+
default:
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
returnList.push(rowData);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
return returnList;
|
|
323
|
+
}
|
|
324
|
+
|
|
300
325
|
function getMyColumnList(arCols: Array<any>): Array<string> {
|
|
301
326
|
const myColList: Array<string> = [];
|
|
302
327
|
|
|
@@ -321,7 +346,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
321
346
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CHANGE fires
|
|
322
347
|
function processFilterChange(data) {
|
|
323
348
|
const { filterId, filterExpression } = data;
|
|
324
|
-
|
|
349
|
+
dashboardFilterPayload = {
|
|
325
350
|
query: {
|
|
326
351
|
filter: {},
|
|
327
352
|
select: []
|
|
@@ -337,14 +362,14 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
337
362
|
let field = getFieldFromFilter(filterExpression, isDateRange);
|
|
338
363
|
selectParam = [];
|
|
339
364
|
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
340
|
-
columnList.
|
|
365
|
+
columnList.forEach(col => {
|
|
341
366
|
selectParam.push({
|
|
342
367
|
field: col
|
|
343
368
|
});
|
|
344
369
|
});
|
|
345
370
|
|
|
346
371
|
// Checking if the triggered filter is applicable for this list
|
|
347
|
-
if (data.filterExpression !== null && !(columnList.
|
|
372
|
+
if (data.filterExpression !== null && !(columnList.length && columnList.includes(field))) {
|
|
348
373
|
return;
|
|
349
374
|
}
|
|
350
375
|
// This is a flag which will be used to reset dashboardFilterPayload in case we don't find any valid filters
|
|
@@ -365,7 +390,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
365
390
|
isDateRange = filter?.AND ? true : false;
|
|
366
391
|
field = getFieldFromFilter(filter, isDateRange);
|
|
367
392
|
|
|
368
|
-
if (!(columnList.
|
|
393
|
+
if (!(columnList.length && columnList.includes(field))) {
|
|
369
394
|
// eslint-disable-next-line no-continue
|
|
370
395
|
continue;
|
|
371
396
|
}
|
|
@@ -373,7 +398,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
373
398
|
validFilter = true;
|
|
374
399
|
/** Below are the 2 cases for- Text & Date-Range filter types where we'll construct filter data which will be sent in the dashboardFilterPayload
|
|
375
400
|
* In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
|
|
376
|
-
|
|
401
|
+
*/
|
|
377
402
|
if (isDateRange) {
|
|
378
403
|
const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
|
|
379
404
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
@@ -382,13 +407,11 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
382
407
|
[`T${index++}`]: { ...filter[relationalOp][1].condition }
|
|
383
408
|
};
|
|
384
409
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
385
|
-
dashboardFilterPayload.query.filter.logic = `${
|
|
386
|
-
|
|
387
|
-
} ${
|
|
410
|
+
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} (T${
|
|
411
|
+
index - 2
|
|
412
|
+
} ${dateRelationalOp} T${index - 1})`;
|
|
388
413
|
} else {
|
|
389
|
-
dashboardFilterPayload.query.filter.logic = `(T${index - 2} ${relationalOp} T${
|
|
390
|
-
index - 1
|
|
391
|
-
})`;
|
|
414
|
+
dashboardFilterPayload.query.filter.logic = `(T${index - 2} ${relationalOp} T${index - 1})`;
|
|
392
415
|
}
|
|
393
416
|
|
|
394
417
|
dashboardFilterPayload.query.select = selectParam;
|
|
@@ -399,9 +422,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
399
422
|
};
|
|
400
423
|
|
|
401
424
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
402
|
-
dashboardFilterPayload.query.filter.logic = `${
|
|
403
|
-
|
|
404
|
-
}
|
|
425
|
+
dashboardFilterPayload.query.filter.logic = `${dashboardFilterPayload.query.filter.logic} ${relationalOp} T${
|
|
426
|
+
index - 1
|
|
427
|
+
}`;
|
|
405
428
|
} else {
|
|
406
429
|
dashboardFilterPayload.query.filter.logic = `T${index - 1}`;
|
|
407
430
|
}
|
|
@@ -414,40 +437,57 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
414
437
|
if (!validFilter) {
|
|
415
438
|
dashboardFilterPayload = undefined;
|
|
416
439
|
}
|
|
417
|
-
|
|
440
|
+
|
|
418
441
|
fetchDataFromServer();
|
|
419
442
|
}
|
|
420
443
|
|
|
421
444
|
// Will be triggered when EVENT_DASHBOARD_FILTER_CLEAR_ALL fires
|
|
422
445
|
function processFilterClear() {
|
|
423
|
-
|
|
446
|
+
dashboardFilterPayload = undefined;
|
|
424
447
|
fetchDataFromServer();
|
|
425
448
|
}
|
|
426
449
|
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
setTimeout(() => {
|
|
452
|
+
PCore.getPubSubUtils().subscribe(
|
|
453
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
454
|
+
data => {
|
|
455
|
+
processFilterChange(data);
|
|
456
|
+
},
|
|
457
|
+
`dashboard-component-${'id'}`,
|
|
458
|
+
false,
|
|
459
|
+
getPConnect().getContextName()
|
|
460
|
+
);
|
|
461
|
+
PCore.getPubSubUtils().subscribe(
|
|
462
|
+
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
463
|
+
() => {
|
|
464
|
+
filters.current = {};
|
|
465
|
+
processFilterClear();
|
|
466
|
+
},
|
|
467
|
+
`dashboard-component-${'id'}`,
|
|
468
|
+
false,
|
|
469
|
+
getPConnect().getContextName()
|
|
470
|
+
);
|
|
471
|
+
}, 0);
|
|
472
|
+
}, []);
|
|
473
|
+
|
|
427
474
|
function fetchAllData(fields) {
|
|
428
475
|
let query: any = null;
|
|
429
476
|
if (payload) {
|
|
430
477
|
query = payload.query;
|
|
431
478
|
} else if (fields?.length && meta.isQueryable) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
query = { select: fields };
|
|
436
|
-
}
|
|
437
|
-
} else if (filterPayload.current) {
|
|
438
|
-
query = filterPayload.current?.query;
|
|
479
|
+
query = {select: fields};
|
|
480
|
+
} else if (dashboardFilterPayload) {
|
|
481
|
+
query = dashboardFilterPayload.query;
|
|
439
482
|
}
|
|
440
483
|
const context = getPConnect().getContextName();
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
:
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
null,
|
|
449
|
-
query
|
|
450
|
-
);
|
|
484
|
+
return PCore.getDataPageUtils().getDataAsync(
|
|
485
|
+
referenceList,
|
|
486
|
+
context,
|
|
487
|
+
payload ? payload.dataViewParameters : dataViewParameters,
|
|
488
|
+
null,
|
|
489
|
+
query
|
|
490
|
+
);
|
|
451
491
|
}
|
|
452
492
|
|
|
453
493
|
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
@@ -486,22 +526,18 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
486
526
|
return listFields;
|
|
487
527
|
};
|
|
488
528
|
|
|
489
|
-
const addItemKeyInSelect = (
|
|
529
|
+
const addItemKeyInSelect = (
|
|
530
|
+
fieldDefs,
|
|
531
|
+
itemKey,
|
|
532
|
+
select,
|
|
533
|
+
compositeKeys
|
|
534
|
+
) => {
|
|
490
535
|
const elementFound = getField(fieldDefs, itemKey);
|
|
491
536
|
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
!(compositeKeys !== null && compositeKeys?.length) &&
|
|
497
|
-
!select.find(sel => sel.field === itemKey)
|
|
498
|
-
) {
|
|
499
|
-
return [
|
|
500
|
-
...select,
|
|
501
|
-
{
|
|
502
|
-
field: itemKey
|
|
503
|
-
}
|
|
504
|
-
];
|
|
537
|
+
if (itemKey && !elementFound && Array.isArray(select) && !(compositeKeys !== null && compositeKeys?.length) && !select.find(sel => sel.field === itemKey)) {
|
|
538
|
+
return [...select, {
|
|
539
|
+
field: itemKey
|
|
540
|
+
}];
|
|
505
541
|
}
|
|
506
542
|
|
|
507
543
|
return select;
|
|
@@ -523,18 +559,19 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
523
559
|
async function fetchDataFromServer() {
|
|
524
560
|
let bCallSetRowsColumns = true;
|
|
525
561
|
const { fieldDefs, itemKey, patchQueryFields } = meta;
|
|
526
|
-
let listFields = fieldDefs
|
|
527
|
-
? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys)
|
|
528
|
-
: [];
|
|
562
|
+
let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
|
|
529
563
|
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
530
564
|
const workListJSON = await fetchAllData(listFields);
|
|
531
565
|
|
|
566
|
+
// don't update these fields until we return from promise
|
|
567
|
+
let fields = presets[0].children[0].children;
|
|
568
|
+
|
|
532
569
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
533
570
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
534
571
|
|
|
535
|
-
const tableDataResults =
|
|
572
|
+
const tableDataResults = workListJSON['data'];
|
|
536
573
|
|
|
537
|
-
const myColumns = getHeaderCells(columnFields, fieldDefs);
|
|
574
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs, fields);
|
|
538
575
|
|
|
539
576
|
const selectParams: any = [];
|
|
540
577
|
|
|
@@ -550,14 +587,16 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
550
587
|
colList.push(col.field);
|
|
551
588
|
});
|
|
552
589
|
|
|
553
|
-
columnList
|
|
590
|
+
columnList = colList;
|
|
591
|
+
|
|
592
|
+
fields = updateFields(fields, myColumns);
|
|
554
593
|
|
|
555
594
|
setResponse(tableDataResults);
|
|
556
595
|
|
|
557
596
|
const usingDataResults = getUsingData(tableDataResults);
|
|
558
597
|
|
|
559
598
|
// store globally, so can be searched, filtered, etc.
|
|
560
|
-
myRows = usingDataResults;
|
|
599
|
+
myRows = updateData(usingDataResults, fields);
|
|
561
600
|
myDisplayColumnList = getMyColumnList(myColumns);
|
|
562
601
|
|
|
563
602
|
// At this point, if we have data ready to render and haven't been asked
|
|
@@ -581,43 +620,6 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
581
620
|
useEffect(() => {
|
|
582
621
|
if (listContext.meta) {
|
|
583
622
|
fetchDataFromServer();
|
|
584
|
-
setTimeout(() => {
|
|
585
|
-
PCore.getPubSubUtils().subscribe(
|
|
586
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
587
|
-
data => {
|
|
588
|
-
processFilterChange(data);
|
|
589
|
-
},
|
|
590
|
-
`dashboard-component-${'id'}`,
|
|
591
|
-
false,
|
|
592
|
-
getPConnect().getContextName()
|
|
593
|
-
);
|
|
594
|
-
PCore.getPubSubUtils().subscribe(
|
|
595
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
596
|
-
() => {
|
|
597
|
-
filters.current = {};
|
|
598
|
-
processFilterClear();
|
|
599
|
-
},
|
|
600
|
-
`dashboard-component-${'id'}`,
|
|
601
|
-
false,
|
|
602
|
-
getPConnect().getContextName()
|
|
603
|
-
);
|
|
604
|
-
}, 0);
|
|
605
|
-
}
|
|
606
|
-
return function cleanupSubscriptions() {
|
|
607
|
-
|
|
608
|
-
PCore.getPubSubUtils().unsubscribe(
|
|
609
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE,
|
|
610
|
-
`dashboard-component-${'id'}`,
|
|
611
|
-
false,
|
|
612
|
-
getPConnect().getContextName()
|
|
613
|
-
);
|
|
614
|
-
PCore.getPubSubUtils().unsubscribe(
|
|
615
|
-
PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CLEAR_ALL,
|
|
616
|
-
`dashboard-component-${'id'}`,
|
|
617
|
-
false,
|
|
618
|
-
getPConnect().getContextName()
|
|
619
|
-
);
|
|
620
|
-
|
|
621
623
|
}
|
|
622
624
|
}, [listContext]);
|
|
623
625
|
|
|
@@ -667,7 +669,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
667
669
|
const { pxRefObjectClass, pzInsKey } = row;
|
|
668
670
|
const sTarget = thePConn.getContainerName();
|
|
669
671
|
|
|
670
|
-
const options = { containerName: sTarget
|
|
672
|
+
const options = { containerName: sTarget };
|
|
671
673
|
|
|
672
674
|
thePConn
|
|
673
675
|
.getActionsApi()
|
|
@@ -680,17 +682,17 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
680
682
|
});
|
|
681
683
|
}
|
|
682
684
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
685
|
+
function _rowClick(row: any) {
|
|
686
|
+
// eslint-disable-next-line sonarjs/no-small-switch
|
|
687
|
+
switch (rowClickAction) {
|
|
688
|
+
case 'openAssignment':
|
|
689
|
+
openAssignment(row);
|
|
690
|
+
break;
|
|
689
691
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
default:
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
694
696
|
|
|
695
697
|
function openWork(row) {
|
|
696
698
|
const { pxRefObjectKey } = row;
|
|
@@ -899,7 +901,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
899
901
|
}
|
|
900
902
|
|
|
901
903
|
function _listViewClick(row, column) {
|
|
902
|
-
const name = column.id
|
|
904
|
+
const name = column.id
|
|
903
905
|
if (column.displayAsLink) {
|
|
904
906
|
const { pxObjClass } = row;
|
|
905
907
|
let { pzInsKey } = row;
|
|
@@ -909,8 +911,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
909
911
|
}
|
|
910
912
|
if (column.isAssignmentLink) {
|
|
911
913
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
912
|
-
containerName: 'primary'
|
|
913
|
-
channelName: ''
|
|
914
|
+
containerName: 'primary'
|
|
914
915
|
});
|
|
915
916
|
} else {
|
|
916
917
|
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
@@ -929,12 +930,13 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
929
930
|
break;
|
|
930
931
|
}
|
|
931
932
|
}
|
|
933
|
+
|
|
932
934
|
}
|
|
933
935
|
|
|
934
936
|
function _listTitle() {
|
|
935
937
|
const defaultTitle = 'List';
|
|
936
|
-
let title = resolvedConfigProps.title
|
|
937
|
-
const inheritedProps = resolvedConfigProps?.
|
|
938
|
+
let title = resolvedConfigProps.title ? resolvedConfigProps.title : defaultTitle;
|
|
939
|
+
const inheritedProps = resolvedConfigProps?.inheritedProps;
|
|
938
940
|
|
|
939
941
|
// Let any title in resolvedConfigProps that isn't the default take precedence
|
|
940
942
|
// but only look in inheritedProps if they exist
|
|
@@ -957,12 +959,14 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
957
959
|
const index = response.findIndex(element => element[rowID] === value);
|
|
958
960
|
const selectedRow = response[index];
|
|
959
961
|
compositeKeys.forEach(element => {
|
|
960
|
-
reqObj[element] = selectedRow[element]
|
|
962
|
+
reqObj[element] = selectedRow[element]
|
|
961
963
|
});
|
|
962
964
|
} else {
|
|
963
965
|
reqObj[rowID] = value;
|
|
964
966
|
}
|
|
965
|
-
getPConnect()
|
|
967
|
+
getPConnect()
|
|
968
|
+
?.getListActions?.()
|
|
969
|
+
?.setSelectedRows([reqObj]);
|
|
966
970
|
setSelectedValue(value);
|
|
967
971
|
};
|
|
968
972
|
|
|
@@ -974,42 +978,16 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
974
978
|
const index = response.findIndex(element => element[rowID] === value);
|
|
975
979
|
const selectedRow = response[index];
|
|
976
980
|
compositeKeys.forEach(element => {
|
|
977
|
-
reqObj[element] = selectedRow[element]
|
|
981
|
+
reqObj[element] = selectedRow[element]
|
|
978
982
|
});
|
|
979
983
|
reqObj['$selected'] = checked;
|
|
980
984
|
} else {
|
|
981
985
|
reqObj[rowID] = value;
|
|
982
986
|
reqObj['$selected'] = checked;
|
|
983
987
|
}
|
|
984
|
-
getPConnect()
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
const processColumnValue = (column, value) => {
|
|
988
|
-
let val;
|
|
989
|
-
const type = column.type;
|
|
990
|
-
let theDateFormatInfo;
|
|
991
|
-
let theFormat;
|
|
992
|
-
let theCurrencyOptions;
|
|
993
|
-
switch (type) {
|
|
994
|
-
case 'Date':
|
|
995
|
-
case 'DateTime':
|
|
996
|
-
theDateFormatInfo = getDateFormatInfo();
|
|
997
|
-
theFormat =
|
|
998
|
-
type === 'DateTime'
|
|
999
|
-
? `${theDateFormatInfo.dateFormatStringLong} hh:mm a`
|
|
1000
|
-
: theDateFormatInfo.dateFormatStringLong;
|
|
1001
|
-
val = format(value, column.type, { format: theFormat });
|
|
1002
|
-
break;
|
|
1003
|
-
|
|
1004
|
-
case 'Currency':
|
|
1005
|
-
theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale());
|
|
1006
|
-
val = format(value, column.type, theCurrencyOptions);
|
|
1007
|
-
break;
|
|
1008
|
-
|
|
1009
|
-
default:
|
|
1010
|
-
val = column.format && typeof value === 'number' ? column.format(value) : value;
|
|
1011
|
-
}
|
|
1012
|
-
return val;
|
|
988
|
+
getPConnect()
|
|
989
|
+
?.getListActions()
|
|
990
|
+
?.setSelectedRows([reqObj]);
|
|
1013
991
|
};
|
|
1014
992
|
|
|
1015
993
|
return (
|
|
@@ -1026,20 +1004,20 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1026
1004
|
</Grid>
|
|
1027
1005
|
<Grid item>
|
|
1028
1006
|
<TextField
|
|
1029
|
-
label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
|
|
1007
|
+
label={ PCore.getLocaleUtils().getLocaleValue('Search', 'Search') }
|
|
1030
1008
|
fullWidth
|
|
1031
1009
|
variant='outlined'
|
|
1032
1010
|
placeholder=''
|
|
1033
1011
|
size='small'
|
|
1034
|
-
id=
|
|
1012
|
+
id="search"
|
|
1035
1013
|
onChange={_onSearch}
|
|
1036
1014
|
/>
|
|
1037
1015
|
</Grid>
|
|
1038
1016
|
</Grid>
|
|
1039
1017
|
)}
|
|
1040
1018
|
<>
|
|
1041
|
-
{
|
|
1042
|
-
<TableContainer
|
|
1019
|
+
{bInForm ? (
|
|
1020
|
+
<TableContainer className={classes.tableInForm}>
|
|
1043
1021
|
<Table stickyHeader aria-label='sticky table'>
|
|
1044
1022
|
<TableHead>
|
|
1045
1023
|
<TableRow>
|
|
@@ -1081,7 +1059,12 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1081
1059
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1082
1060
|
.map(row => {
|
|
1083
1061
|
return (
|
|
1084
|
-
<TableRow
|
|
1062
|
+
<TableRow
|
|
1063
|
+
key={row.pxRefObjectInsName || row.pyID}
|
|
1064
|
+
onClick={() => {
|
|
1065
|
+
_rowClick(row);
|
|
1066
|
+
}}
|
|
1067
|
+
>
|
|
1085
1068
|
{arColumns.map(column => {
|
|
1086
1069
|
const value = row[column.id];
|
|
1087
1070
|
return (
|
|
@@ -1118,7 +1101,7 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1118
1101
|
</Table>
|
|
1119
1102
|
</TableContainer>
|
|
1120
1103
|
) : (
|
|
1121
|
-
<TableContainer
|
|
1104
|
+
<TableContainer>
|
|
1122
1105
|
<Table>
|
|
1123
1106
|
<TableHead>
|
|
1124
1107
|
<TableRow>
|
|
@@ -1155,7 +1138,12 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1155
1138
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1156
1139
|
.map(row => {
|
|
1157
1140
|
return (
|
|
1158
|
-
<TableRow
|
|
1141
|
+
<TableRow
|
|
1142
|
+
key={row[rowID]}
|
|
1143
|
+
onClick={() => {
|
|
1144
|
+
_rowClick(row);
|
|
1145
|
+
}}
|
|
1146
|
+
>
|
|
1159
1147
|
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1160
1148
|
<TableCell>
|
|
1161
1149
|
<Radio
|
|
@@ -1183,7 +1171,9 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1183
1171
|
key={column.id}
|
|
1184
1172
|
align={column.align}
|
|
1185
1173
|
>
|
|
1186
|
-
{
|
|
1174
|
+
{column.format && typeof value === 'number'
|
|
1175
|
+
? column.format(value)
|
|
1176
|
+
: value}
|
|
1187
1177
|
</TableCell>
|
|
1188
1178
|
);
|
|
1189
1179
|
})}
|
|
@@ -1318,3 +1308,10 @@ export default function ListView(props /* : ListViewProps */) {
|
|
|
1318
1308
|
</>
|
|
1319
1309
|
);
|
|
1320
1310
|
}
|
|
1311
|
+
|
|
1312
|
+
ListView.defaultProps = {
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
ListView.propTypes = {
|
|
1316
|
+
getPConnect: PropTypes.func.isRequired
|
|
1317
|
+
};
|