@pega/react-sdk-overrides 0.23.25 → 8.8.20
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.css +4 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +25 -11
- 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.css +6 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
- package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
- package/lib/field/Checkbox/Checkbox.tsx +41 -17
- package/lib/field/Currency/Currency.tsx +23 -15
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +31 -17
- package/lib/field/DateTime/DateTime.tsx +26 -15
- package/lib/field/Decimal/Decimal.tsx +82 -19
- package/lib/field/Dropdown/Dropdown.tsx +57 -14
- 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 +54 -27
- package/lib/field/RichText/RichText.tsx +93 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +64 -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 +741 -390
- 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} +4 -3
- 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 +38 -32
- 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 -27
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
- package/lib/infra/MultiStep/MultiStep.tsx +24 -24
- package/lib/infra/NavBar/NavBar.tsx +23 -24
- package/lib/infra/Reference/Reference.tsx +13 -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 -58
- 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 +50 -52
- 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/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
- package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
- package/lib/template/ListPage/ListPage.tsx +14 -13
- package/lib/template/ListView/ListView.tsx +140 -152
- 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 +28 -7
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -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 +36 -14
- 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
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface ListPageProps extends PConnProps {
|
|
7
|
+
// If any, enter additional props that only exist on this component
|
|
8
|
+
parameters: object
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export default function ListPage(props: ListPageProps) {
|
|
13
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
14
|
+
const ListView = getComponentFromMap('ListView');
|
|
7
15
|
|
|
16
|
+
// special case for ListView - add in a prop
|
|
17
|
+
const listViewProps = {...props, bInForm: false};
|
|
8
18
|
return (
|
|
9
|
-
<ListView {...
|
|
19
|
+
<ListView {...listViewProps}></ListView>
|
|
10
20
|
)
|
|
11
21
|
}
|
|
12
|
-
|
|
13
|
-
ListPage.defaultProps = {
|
|
14
|
-
parameters: undefined
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
ListPage.propTypes = {
|
|
18
|
-
getPConnect: PropTypes.func.isRequired,
|
|
19
|
-
parameters: PropTypes.objectOf(PropTypes.any)
|
|
20
|
-
};
|
|
@@ -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
|
|
@@ -98,7 +128,7 @@ export default function ListView(props) {
|
|
|
98
128
|
|
|
99
129
|
// Will contain the list of columns specific for an instance
|
|
100
130
|
let columnList: any = useRef([]);
|
|
101
|
-
let dashboardFilterPayload: any
|
|
131
|
+
let dashboardFilterPayload: any;
|
|
102
132
|
// Will be sent in the dashboardFilterPayload
|
|
103
133
|
let selectParam: Array<any> = [];
|
|
104
134
|
|
|
@@ -213,7 +243,7 @@ export default function ListView(props) {
|
|
|
213
243
|
};
|
|
214
244
|
|
|
215
245
|
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
216
|
-
function getHeaderCells(colFields, fields
|
|
246
|
+
function getHeaderCells(colFields, fields) {
|
|
217
247
|
const arReturn = colFields.map((field: any, index) => {
|
|
218
248
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
219
249
|
if (theField.indexOf('.') === 0) {
|
|
@@ -222,7 +252,7 @@ export default function ListView(props) {
|
|
|
222
252
|
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
223
253
|
const displayAsLink = field.config.displayAsLink;
|
|
224
254
|
const headerRow: any = {};
|
|
225
|
-
headerRow.id =
|
|
255
|
+
headerRow.id = fields[index].id;
|
|
226
256
|
headerRow.type = field.type;
|
|
227
257
|
headerRow.displayAsLink = displayAsLink;
|
|
228
258
|
headerRow.numeric =
|
|
@@ -232,7 +262,7 @@ export default function ListView(props) {
|
|
|
232
262
|
field.type === 'Currency' ||
|
|
233
263
|
false;
|
|
234
264
|
headerRow.disablePadding = false;
|
|
235
|
-
headerRow.label =
|
|
265
|
+
headerRow.label = fields[index].label;
|
|
236
266
|
if (colIndex > -1) {
|
|
237
267
|
headerRow.classID = fields[colIndex].classID;
|
|
238
268
|
}
|
|
@@ -247,25 +277,18 @@ export default function ListView(props) {
|
|
|
247
277
|
return arReturn;
|
|
248
278
|
}
|
|
249
279
|
|
|
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
280
|
|
|
259
281
|
function getUsingData(arTableData): Array<any> {
|
|
260
282
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
261
283
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
262
284
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
263
285
|
// eslint-disable-next-line no-console
|
|
264
|
-
console.error(
|
|
286
|
+
console.error(
|
|
287
|
+
'pyGUID or pyID values are mandatory to select the required row from the list'
|
|
288
|
+
);
|
|
265
289
|
}
|
|
266
290
|
}
|
|
267
291
|
const arReturn = arTableData?.map((data: any) => {
|
|
268
|
-
|
|
269
292
|
const row = data;
|
|
270
293
|
|
|
271
294
|
return row;
|
|
@@ -274,52 +297,6 @@ export default function ListView(props) {
|
|
|
274
297
|
return arReturn;
|
|
275
298
|
}
|
|
276
299
|
|
|
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
300
|
function getMyColumnList(arCols: Array<any>): Array<string> {
|
|
324
301
|
const myColList: Array<string> = [];
|
|
325
302
|
|
|
@@ -396,7 +373,7 @@ export default function ListView(props) {
|
|
|
396
373
|
validFilter = true;
|
|
397
374
|
/** 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
375
|
* In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
|
|
399
|
-
|
|
376
|
+
*/
|
|
400
377
|
if (isDateRange) {
|
|
401
378
|
const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
|
|
402
379
|
dashboardFilterPayload.query.filter.filterConditions = {
|
|
@@ -405,11 +382,13 @@ export default function ListView(props) {
|
|
|
405
382
|
[`T${index++}`]: { ...filter[relationalOp][1].condition }
|
|
406
383
|
};
|
|
407
384
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
408
|
-
dashboardFilterPayload.query.filter.logic = `${
|
|
409
|
-
|
|
410
|
-
} ${dateRelationalOp} T${index - 1})`;
|
|
385
|
+
dashboardFilterPayload.query.filter.logic = `${
|
|
386
|
+
dashboardFilterPayload.query.filter.logic
|
|
387
|
+
} ${relationalOp} (T${index - 2} ${dateRelationalOp} T${index - 1})`;
|
|
411
388
|
} else {
|
|
412
|
-
dashboardFilterPayload.query.filter.logic = `(T${index - 2} ${relationalOp} T${
|
|
389
|
+
dashboardFilterPayload.query.filter.logic = `(T${index - 2} ${relationalOp} T${
|
|
390
|
+
index - 1
|
|
391
|
+
})`;
|
|
413
392
|
}
|
|
414
393
|
|
|
415
394
|
dashboardFilterPayload.query.select = selectParam;
|
|
@@ -420,9 +399,9 @@ export default function ListView(props) {
|
|
|
420
399
|
};
|
|
421
400
|
|
|
422
401
|
if (dashboardFilterPayload.query.filter.logic) {
|
|
423
|
-
dashboardFilterPayload.query.filter.logic = `${
|
|
424
|
-
|
|
425
|
-
}`;
|
|
402
|
+
dashboardFilterPayload.query.filter.logic = `${
|
|
403
|
+
dashboardFilterPayload.query.filter.logic
|
|
404
|
+
} ${relationalOp} T${index - 1}`;
|
|
426
405
|
} else {
|
|
427
406
|
dashboardFilterPayload.query.filter.logic = `T${index - 1}`;
|
|
428
407
|
}
|
|
@@ -474,18 +453,21 @@ export default function ListView(props) {
|
|
|
474
453
|
if (payload) {
|
|
475
454
|
query = payload.query;
|
|
476
455
|
} else if (fields?.length && meta.isQueryable) {
|
|
477
|
-
query = {select: fields};
|
|
456
|
+
query = { select: fields };
|
|
478
457
|
} else if (dashboardFilterPayload) {
|
|
479
458
|
query = dashboardFilterPayload.query;
|
|
480
459
|
}
|
|
481
460
|
const context = getPConnect().getContextName();
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
461
|
+
// getDataAsync isn't returning correct data for the Page(i.e. ListView within a page) case
|
|
462
|
+
return !bInForm
|
|
463
|
+
? PCore.getDataApiUtils().getData(referenceList, payload)
|
|
464
|
+
: PCore.getDataPageUtils().getDataAsync(
|
|
465
|
+
referenceList,
|
|
466
|
+
context,
|
|
467
|
+
payload ? payload.dataViewParameters : dataViewParameters,
|
|
468
|
+
null,
|
|
469
|
+
query
|
|
470
|
+
);
|
|
489
471
|
}
|
|
490
472
|
|
|
491
473
|
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
@@ -524,18 +506,22 @@ export default function ListView(props) {
|
|
|
524
506
|
return listFields;
|
|
525
507
|
};
|
|
526
508
|
|
|
527
|
-
const addItemKeyInSelect = (
|
|
528
|
-
fieldDefs,
|
|
529
|
-
itemKey,
|
|
530
|
-
select,
|
|
531
|
-
compositeKeys
|
|
532
|
-
) => {
|
|
509
|
+
const addItemKeyInSelect = (fieldDefs, itemKey, select, compositeKeys) => {
|
|
533
510
|
const elementFound = getField(fieldDefs, itemKey);
|
|
534
511
|
|
|
535
|
-
if (
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
512
|
+
if (
|
|
513
|
+
itemKey &&
|
|
514
|
+
!elementFound &&
|
|
515
|
+
Array.isArray(select) &&
|
|
516
|
+
!(compositeKeys !== null && compositeKeys?.length) &&
|
|
517
|
+
!select.find(sel => sel.field === itemKey)
|
|
518
|
+
) {
|
|
519
|
+
return [
|
|
520
|
+
...select,
|
|
521
|
+
{
|
|
522
|
+
field: itemKey
|
|
523
|
+
}
|
|
524
|
+
];
|
|
539
525
|
}
|
|
540
526
|
|
|
541
527
|
return select;
|
|
@@ -557,19 +543,18 @@ export default function ListView(props) {
|
|
|
557
543
|
async function fetchDataFromServer() {
|
|
558
544
|
let bCallSetRowsColumns = true;
|
|
559
545
|
const { fieldDefs, itemKey, patchQueryFields } = meta;
|
|
560
|
-
let listFields = fieldDefs
|
|
546
|
+
let listFields = fieldDefs
|
|
547
|
+
? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys)
|
|
548
|
+
: [];
|
|
561
549
|
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
562
550
|
const workListJSON = await fetchAllData(listFields);
|
|
563
551
|
|
|
564
|
-
// don't update these fields until we return from promise
|
|
565
|
-
let fields = presets[0].children[0].children;
|
|
566
|
-
|
|
567
552
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
568
553
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
569
554
|
|
|
570
|
-
const tableDataResults = workListJSON['data'];
|
|
555
|
+
const tableDataResults = !bInForm ? workListJSON['data'].data : workListJSON['data'];
|
|
571
556
|
|
|
572
|
-
const myColumns = getHeaderCells(columnFields, fieldDefs
|
|
557
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs);
|
|
573
558
|
|
|
574
559
|
const selectParams: any = [];
|
|
575
560
|
|
|
@@ -587,14 +572,12 @@ export default function ListView(props) {
|
|
|
587
572
|
|
|
588
573
|
columnList = colList;
|
|
589
574
|
|
|
590
|
-
fields = updateFields(fields, myColumns);
|
|
591
|
-
|
|
592
575
|
setResponse(tableDataResults);
|
|
593
576
|
|
|
594
577
|
const usingDataResults = getUsingData(tableDataResults);
|
|
595
578
|
|
|
596
579
|
// store globally, so can be searched, filtered, etc.
|
|
597
|
-
myRows =
|
|
580
|
+
myRows = usingDataResults;
|
|
598
581
|
myDisplayColumnList = getMyColumnList(myColumns);
|
|
599
582
|
|
|
600
583
|
// At this point, if we have data ready to render and haven't been asked
|
|
@@ -667,7 +650,7 @@ export default function ListView(props) {
|
|
|
667
650
|
const { pxRefObjectClass, pzInsKey } = row;
|
|
668
651
|
const sTarget = thePConn.getContainerName();
|
|
669
652
|
|
|
670
|
-
const options = { containerName: sTarget };
|
|
653
|
+
const options = { containerName: sTarget, channelName: '' };
|
|
671
654
|
|
|
672
655
|
thePConn
|
|
673
656
|
.getActionsApi()
|
|
@@ -680,17 +663,17 @@ export default function ListView(props) {
|
|
|
680
663
|
});
|
|
681
664
|
}
|
|
682
665
|
|
|
683
|
-
function _rowClick(row: any) {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
666
|
+
// function _rowClick(row: any) {
|
|
667
|
+
// // eslint-disable-next-line sonarjs/no-small-switch
|
|
668
|
+
// switch (rowClickAction) {
|
|
669
|
+
// case 'openAssignment':
|
|
670
|
+
// openAssignment(row);
|
|
671
|
+
// break;
|
|
689
672
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
673
|
+
// default:
|
|
674
|
+
// break;
|
|
675
|
+
// }
|
|
676
|
+
// }
|
|
694
677
|
|
|
695
678
|
function openWork(row) {
|
|
696
679
|
const { pxRefObjectKey } = row;
|
|
@@ -899,7 +882,7 @@ export default function ListView(props) {
|
|
|
899
882
|
}
|
|
900
883
|
|
|
901
884
|
function _listViewClick(row, column) {
|
|
902
|
-
const name = column.id
|
|
885
|
+
const name = column.id;
|
|
903
886
|
if (column.displayAsLink) {
|
|
904
887
|
const { pxObjClass } = row;
|
|
905
888
|
let { pzInsKey } = row;
|
|
@@ -909,7 +892,8 @@ export default function ListView(props) {
|
|
|
909
892
|
}
|
|
910
893
|
if (column.isAssignmentLink) {
|
|
911
894
|
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
912
|
-
containerName: 'primary'
|
|
895
|
+
containerName: 'primary',
|
|
896
|
+
channelName: ''
|
|
913
897
|
});
|
|
914
898
|
} else {
|
|
915
899
|
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
@@ -928,13 +912,12 @@ export default function ListView(props) {
|
|
|
928
912
|
break;
|
|
929
913
|
}
|
|
930
914
|
}
|
|
931
|
-
|
|
932
915
|
}
|
|
933
916
|
|
|
934
917
|
function _listTitle() {
|
|
935
918
|
const defaultTitle = 'List';
|
|
936
|
-
let title = resolvedConfigProps.title
|
|
937
|
-
const inheritedProps = resolvedConfigProps?.inheritedProps;
|
|
919
|
+
let title = resolvedConfigProps.title || resolvedConfigProps?.label || defaultTitle;
|
|
920
|
+
const inheritedProps = resolvedConfigProps?.['inheritedProps'];
|
|
938
921
|
|
|
939
922
|
// Let any title in resolvedConfigProps that isn't the default take precedence
|
|
940
923
|
// but only look in inheritedProps if they exist
|
|
@@ -957,14 +940,12 @@ export default function ListView(props) {
|
|
|
957
940
|
const index = response.findIndex(element => element[rowID] === value);
|
|
958
941
|
const selectedRow = response[index];
|
|
959
942
|
compositeKeys.forEach(element => {
|
|
960
|
-
reqObj[element] = selectedRow[element]
|
|
943
|
+
reqObj[element] = selectedRow[element];
|
|
961
944
|
});
|
|
962
945
|
} else {
|
|
963
946
|
reqObj[rowID] = value;
|
|
964
947
|
}
|
|
965
|
-
getPConnect()
|
|
966
|
-
?.getListActions?.()
|
|
967
|
-
?.setSelectedRows([reqObj]);
|
|
948
|
+
getPConnect()?.getListActions?.()?.setSelectedRows([reqObj]);
|
|
968
949
|
setSelectedValue(value);
|
|
969
950
|
};
|
|
970
951
|
|
|
@@ -976,16 +957,42 @@ export default function ListView(props) {
|
|
|
976
957
|
const index = response.findIndex(element => element[rowID] === value);
|
|
977
958
|
const selectedRow = response[index];
|
|
978
959
|
compositeKeys.forEach(element => {
|
|
979
|
-
reqObj[element] = selectedRow[element]
|
|
960
|
+
reqObj[element] = selectedRow[element];
|
|
980
961
|
});
|
|
981
962
|
reqObj['$selected'] = checked;
|
|
982
963
|
} else {
|
|
983
964
|
reqObj[rowID] = value;
|
|
984
965
|
reqObj['$selected'] = checked;
|
|
985
966
|
}
|
|
986
|
-
getPConnect()
|
|
987
|
-
|
|
988
|
-
|
|
967
|
+
getPConnect()?.getListActions()?.setSelectedRows([reqObj]);
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
const processColumnValue = (column, value) => {
|
|
971
|
+
let val;
|
|
972
|
+
const type = column.type;
|
|
973
|
+
let theDateFormatInfo;
|
|
974
|
+
let theFormat;
|
|
975
|
+
let theCurrencyOptions;
|
|
976
|
+
switch (type) {
|
|
977
|
+
case 'Date':
|
|
978
|
+
case 'DateTime':
|
|
979
|
+
theDateFormatInfo = getDateFormatInfo();
|
|
980
|
+
theFormat =
|
|
981
|
+
type === 'DateTime'
|
|
982
|
+
? `${theDateFormatInfo.dateFormatStringLong} hh:mm a`
|
|
983
|
+
: theDateFormatInfo.dateFormatStringLong;
|
|
984
|
+
val = format(value, column.type, { format: theFormat });
|
|
985
|
+
break;
|
|
986
|
+
|
|
987
|
+
case 'Currency':
|
|
988
|
+
theCurrencyOptions = getCurrencyOptions(PCore?.getEnvironmentInfo()?.getLocale());
|
|
989
|
+
val = format(value, column.type, theCurrencyOptions);
|
|
990
|
+
break;
|
|
991
|
+
|
|
992
|
+
default:
|
|
993
|
+
val = column.format && typeof value === 'number' ? column.format(value) : value;
|
|
994
|
+
}
|
|
995
|
+
return val;
|
|
989
996
|
};
|
|
990
997
|
|
|
991
998
|
return (
|
|
@@ -1002,20 +1009,20 @@ export default function ListView(props) {
|
|
|
1002
1009
|
</Grid>
|
|
1003
1010
|
<Grid item>
|
|
1004
1011
|
<TextField
|
|
1005
|
-
label='Search'
|
|
1012
|
+
label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
|
|
1006
1013
|
fullWidth
|
|
1007
1014
|
variant='outlined'
|
|
1008
1015
|
placeholder=''
|
|
1009
1016
|
size='small'
|
|
1010
|
-
id=
|
|
1017
|
+
id='search'
|
|
1011
1018
|
onChange={_onSearch}
|
|
1012
1019
|
/>
|
|
1013
1020
|
</Grid>
|
|
1014
1021
|
</Grid>
|
|
1015
1022
|
)}
|
|
1016
1023
|
<>
|
|
1017
|
-
{bInForm ? (
|
|
1018
|
-
<TableContainer className={classes.tableInForm}>
|
|
1024
|
+
{!bInForm ? (
|
|
1025
|
+
<TableContainer id="list-view" className={classes.tableInForm}>
|
|
1019
1026
|
<Table stickyHeader aria-label='sticky table'>
|
|
1020
1027
|
<TableHead>
|
|
1021
1028
|
<TableRow>
|
|
@@ -1057,12 +1064,7 @@ export default function ListView(props) {
|
|
|
1057
1064
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1058
1065
|
.map(row => {
|
|
1059
1066
|
return (
|
|
1060
|
-
<TableRow
|
|
1061
|
-
key={row.pxRefObjectInsName || row.pyID}
|
|
1062
|
-
onClick={() => {
|
|
1063
|
-
_rowClick(row);
|
|
1064
|
-
}}
|
|
1065
|
-
>
|
|
1067
|
+
<TableRow key={row.pxRefObjectInsName || row.pyID}>
|
|
1066
1068
|
{arColumns.map(column => {
|
|
1067
1069
|
const value = row[column.id];
|
|
1068
1070
|
return (
|
|
@@ -1099,7 +1101,7 @@ export default function ListView(props) {
|
|
|
1099
1101
|
</Table>
|
|
1100
1102
|
</TableContainer>
|
|
1101
1103
|
) : (
|
|
1102
|
-
<TableContainer>
|
|
1104
|
+
<TableContainer id="list-view">
|
|
1103
1105
|
<Table>
|
|
1104
1106
|
<TableHead>
|
|
1105
1107
|
<TableRow>
|
|
@@ -1136,12 +1138,7 @@ export default function ListView(props) {
|
|
|
1136
1138
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
|
1137
1139
|
.map(row => {
|
|
1138
1140
|
return (
|
|
1139
|
-
<TableRow
|
|
1140
|
-
key={row[rowID]}
|
|
1141
|
-
onClick={() => {
|
|
1142
|
-
_rowClick(row);
|
|
1143
|
-
}}
|
|
1144
|
-
>
|
|
1141
|
+
<TableRow key={row[rowID]}>
|
|
1145
1142
|
{selectionMode === SELECTION_MODE.SINGLE && (
|
|
1146
1143
|
<TableCell>
|
|
1147
1144
|
<Radio
|
|
@@ -1169,9 +1166,7 @@ export default function ListView(props) {
|
|
|
1169
1166
|
key={column.id}
|
|
1170
1167
|
align={column.align}
|
|
1171
1168
|
>
|
|
1172
|
-
{column
|
|
1173
|
-
? column.format(value)
|
|
1174
|
-
: value}
|
|
1169
|
+
{processColumnValue(column, value)}
|
|
1175
1170
|
</TableCell>
|
|
1176
1171
|
);
|
|
1177
1172
|
})}
|
|
@@ -1306,10 +1301,3 @@ export default function ListView(props) {
|
|
|
1306
1301
|
</>
|
|
1307
1302
|
);
|
|
1308
1303
|
}
|
|
1309
|
-
|
|
1310
|
-
ListView.defaultProps = {
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
ListView.propTypes = {
|
|
1314
|
-
getPConnect: PropTypes.func.isRequired
|
|
1315
|
-
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { getContext, readContextResponse } from './utils';
|
|
3
3
|
|
|
4
|
+
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 error)
|
|
5
|
+
declare const PCore: any;
|
|
6
|
+
|
|
4
7
|
export default function useInit(props) {
|
|
5
|
-
const PCore = window.PCore;
|
|
6
8
|
const {
|
|
7
9
|
referenceList,
|
|
8
10
|
getPConnect,
|