@pega/react-sdk-overrides 0.23.17 → 0.23.19
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/CaseSummaryFields/CaseSummaryFields.tsx +37 -3
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -2
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +38 -56
- package/lib/field/AutoComplete/AutoComplete.tsx +6 -4
- package/lib/field/Checkbox/Checkbox.tsx +7 -5
- package/lib/field/Currency/Currency.tsx +31 -6
- package/lib/field/Currency/currency-utils.ts +76 -0
- package/lib/field/Date/Date.tsx +25 -9
- package/lib/field/DateTime/DateTime.tsx +24 -10
- package/lib/field/Decimal/Decimal.tsx +8 -6
- package/lib/field/Dropdown/Dropdown.tsx +6 -4
- package/lib/field/Email/Email.tsx +8 -8
- package/lib/field/Integer/Integer.tsx +8 -6
- package/lib/field/Percentage/Percentage.tsx +8 -6
- package/lib/field/Phone/Phone.tsx +8 -7
- package/lib/field/RadioButtons/RadioButtons.tsx +7 -5
- package/lib/field/SemanticLink/SemanticLink.tsx +6 -0
- package/lib/field/TextArea/TextArea.tsx +8 -6
- package/lib/field/TextInput/TextInput.tsx +8 -6
- package/lib/field/Time/Time.tsx +7 -5
- package/lib/field/URL/URL.tsx +8 -6
- package/lib/helpers/authManager.js +1 -0
- package/lib/helpers/date-format-utils.ts +66 -0
- package/lib/helpers/event-utils.js +1 -1
- package/lib/helpers/formatters/Currency.js +13 -5
- package/lib/helpers/formatters/common.js +5 -1
- package/lib/helpers/formatters/index.js +5 -0
- package/lib/helpers/template-utils.ts +80 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +67 -72
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +0 -44
- package/lib/infra/MultiStep/MultiStep.css +4 -18
- package/lib/infra/NavBar/NavBar.tsx +129 -219
- package/lib/infra/RootContainer/RootContainer.tsx +2 -54
- package/lib/infra/Stages/Stages.tsx +1 -2
- package/lib/infra/View/View.tsx +28 -21
- package/lib/template/AppShell/AppShell.tsx +2 -343
- package/lib/template/CaseSummary/CaseSummary.tsx +1 -1
- package/lib/template/CaseView/CaseView.tsx +2 -5
- package/lib/template/DefaultForm/DefaultForm.tsx +4 -0
- package/lib/template/Details/Details/Details.tsx +52 -21
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +63 -31
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +64 -30
- package/lib/template/ListView/DefaultViewMeta.js +222 -0
- package/lib/template/ListView/ListView.tsx +155 -94
- package/lib/template/ListView/hooks.js +97 -0
- package/lib/template/ListView/utils.js +636 -0
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +69 -42
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +3 -24
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +69 -43
- package/lib/widget/Attachment/Attachment.css +7 -0
- package/lib/widget/Attachment/Attachment.tsx +37 -3
- package/lib/widget/SummaryItem/SummaryItem.tsx +1 -1
- package/package.json +1 -1
- package/lib/.DS_Store +0 -0
- package/lib/field/AutoComplete/.DS_Store +0 -0
- package/lib/field/Checkbox/.DS_Store +0 -0
- package/lib/field/Currency/.DS_Store +0 -0
- package/lib/field/Date/.DS_Store +0 -0
- package/lib/field/TextContent/.DS_Store +0 -0
- package/lib/infra/.DS_Store +0 -0
- package/lib/template/.DS_Store +0 -0
- package/lib/template/CaseView/.DS_Store +0 -0
- package/lib/template/SimpleTable/.DS_Store +0 -0
- package/lib/template/SimpleTable/SimpleTable/.DS_Store +0 -0
- package/lib/template/utils.ts +0 -23
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-plusplus */
|
|
2
2
|
/* eslint-disable guard-for-in */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
5
|
+
/* eslint-disable no-shadow */
|
|
4
6
|
import React, { useState, useEffect, useRef } from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
|
|
@@ -37,6 +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';
|
|
42
|
+
import useInit from './hooks'
|
|
40
43
|
|
|
41
44
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
42
45
|
declare const PCore: any;
|
|
@@ -50,16 +53,20 @@ let menuColumnLabel = '';
|
|
|
50
53
|
|
|
51
54
|
let sortColumnId: any;
|
|
52
55
|
|
|
53
|
-
// let dialogContainsFilter: string = "contains";
|
|
54
|
-
// let dialogContainsValue: string = "";
|
|
55
|
-
// let dialogDateFilter: string = "notequal";
|
|
56
|
-
// let dialogDateValue: string = "";
|
|
57
|
-
|
|
58
56
|
const filterByColumns: Array<any> = [];
|
|
59
57
|
|
|
60
58
|
export default function ListView(props) {
|
|
61
59
|
const { getPConnect, bInForm } = props;
|
|
62
|
-
const { globalSearch,
|
|
60
|
+
const { globalSearch, referenceList, rowClickAction, selectionMode, referenceType, payload, parameters, compositeKeys, showDynamicFields, presets } = props;
|
|
61
|
+
const ref = useRef({}).current;
|
|
62
|
+
const cosmosTableRef = useRef();
|
|
63
|
+
// List component context
|
|
64
|
+
const [listContext, setListContext] = useState<any>({});
|
|
65
|
+
const { meta } = listContext;
|
|
66
|
+
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
67
|
+
const xRayUid = xRayApis.startXRay();
|
|
68
|
+
|
|
69
|
+
useInit({ ...props, setListContext, ref, showDynamicFields, xRayUid, cosmosTableRef });
|
|
63
70
|
|
|
64
71
|
const thePConn = getPConnect();
|
|
65
72
|
const componentConfig = thePConn.getComponentConfig();
|
|
@@ -74,6 +81,7 @@ export default function ListView(props) {
|
|
|
74
81
|
const [arRows, setRows] = useState<Array<any>>([]);
|
|
75
82
|
const [arColumns, setColumns] = useState<Array<any>>([]);
|
|
76
83
|
const [response, setResponse] = useState<Array<any>>([]);
|
|
84
|
+
|
|
77
85
|
const [order, setOrder] = useState<Order>('asc');
|
|
78
86
|
const [orderBy, setOrderBy] = useState<keyof any>('');
|
|
79
87
|
|
|
@@ -185,7 +193,6 @@ export default function ListView(props) {
|
|
|
185
193
|
function stableSort<T>(array: Array<T>, comparator: (a: T, b: T) => number) {
|
|
186
194
|
const stabilizedThis = array.map((el, index) => [el, index] as [T, number]);
|
|
187
195
|
stabilizedThis.sort((a, b) => {
|
|
188
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow, no-shadow
|
|
189
196
|
const order = comparator(a[0], b[0]);
|
|
190
197
|
if (order !== 0) return order;
|
|
191
198
|
return a[1] - b[1];
|
|
@@ -205,29 +212,19 @@ export default function ListView(props) {
|
|
|
205
212
|
setPage(0);
|
|
206
213
|
};
|
|
207
214
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// if (theField.indexOf(".") == 0) {
|
|
212
|
-
// theField = theField.substring(1);
|
|
213
|
-
// }
|
|
214
|
-
|
|
215
|
-
// return theField;
|
|
216
|
-
// });
|
|
217
|
-
// return arReturn;
|
|
218
|
-
|
|
219
|
-
// }
|
|
220
|
-
|
|
221
|
-
function getHeaderCells(colFields, fields) {
|
|
222
|
-
const arReturn = colFields.map((field: any, colIndex) => {
|
|
215
|
+
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
216
|
+
function getHeaderCells(colFields, fields, presetFields) {
|
|
217
|
+
const arReturn = colFields.map((field: any, index) => {
|
|
223
218
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
224
219
|
if (theField.indexOf('.') === 0) {
|
|
225
220
|
theField = theField.substring(1);
|
|
226
221
|
}
|
|
227
|
-
|
|
222
|
+
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
223
|
+
const displayAsLink = field.config.displayAsLink;
|
|
228
224
|
const headerRow: any = {};
|
|
229
225
|
headerRow.id = theField;
|
|
230
226
|
headerRow.type = field.type;
|
|
227
|
+
headerRow.displayAsLink = displayAsLink;
|
|
231
228
|
headerRow.numeric =
|
|
232
229
|
field.type === 'Decimal' ||
|
|
233
230
|
field.type === 'Integer' ||
|
|
@@ -235,23 +232,31 @@ export default function ListView(props) {
|
|
|
235
232
|
field.type === 'Currency' ||
|
|
236
233
|
false;
|
|
237
234
|
headerRow.disablePadding = false;
|
|
238
|
-
headerRow.label =
|
|
239
|
-
|
|
235
|
+
headerRow.label = presetFields[index].config.label;
|
|
236
|
+
if (colIndex > -1) {
|
|
237
|
+
headerRow.classID = fields[colIndex].classID;
|
|
238
|
+
}
|
|
239
|
+
if (displayAsLink) {
|
|
240
|
+
headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
|
|
241
|
+
if (field.config.value?.startsWith('@CA')) {
|
|
242
|
+
headerRow.isAssociation = true;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
240
245
|
return headerRow;
|
|
241
246
|
});
|
|
242
247
|
return arReturn;
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
function updateFields(arFields, theColumns): Array<any> {
|
|
246
|
-
const arReturn = arFields;
|
|
247
|
-
|
|
251
|
+
const arReturn = arFields.filter(ele => ele.type !== 'reference');
|
|
252
|
+
arReturn.forEach((field, index) => {
|
|
248
253
|
arReturn[index].config.name = theColumns[index].id;
|
|
249
254
|
});
|
|
250
255
|
|
|
251
256
|
return arReturn;
|
|
252
257
|
}
|
|
253
258
|
|
|
254
|
-
function getUsingData(arTableData
|
|
259
|
+
function getUsingData(arTableData): Array<any> {
|
|
255
260
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
256
261
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
257
262
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
@@ -260,24 +265,8 @@ export default function ListView(props) {
|
|
|
260
265
|
}
|
|
261
266
|
}
|
|
262
267
|
const arReturn = arTableData?.map((data: any) => {
|
|
263
|
-
const row: any = {};
|
|
264
|
-
|
|
265
|
-
theColumns.forEach(col => {
|
|
266
|
-
row[col.id] = data[col.id];
|
|
267
|
-
});
|
|
268
|
-
row[rowID] = data[rowID];
|
|
269
|
-
// for (const field of theColumns) {
|
|
270
|
-
// row[field.id] = data[field.id];
|
|
271
|
-
// }
|
|
272
|
-
|
|
273
|
-
// add in pxRefObjectClass and pzInsKey
|
|
274
|
-
if (data['pxRefObjectClass']) {
|
|
275
|
-
row['pxRefObjectClass'] = data['pxRefObjectClass'];
|
|
276
|
-
}
|
|
277
268
|
|
|
278
|
-
|
|
279
|
-
row['pzInsKey'] = data['pzInsKey'];
|
|
280
|
-
}
|
|
269
|
+
const row = data;
|
|
281
270
|
|
|
282
271
|
return row;
|
|
283
272
|
});
|
|
@@ -338,10 +327,6 @@ export default function ListView(props) {
|
|
|
338
327
|
myColList.push(col.id);
|
|
339
328
|
});
|
|
340
329
|
|
|
341
|
-
// for (const col of arCols) {
|
|
342
|
-
// myColList.push(col.id);
|
|
343
|
-
// }
|
|
344
|
-
|
|
345
330
|
return myColList;
|
|
346
331
|
}
|
|
347
332
|
|
|
@@ -374,7 +359,7 @@ export default function ListView(props) {
|
|
|
374
359
|
|
|
375
360
|
let field = getFieldFromFilter(filterExpression, isDateRange);
|
|
376
361
|
selectParam = [];
|
|
377
|
-
// Constructing the select parameters list(
|
|
362
|
+
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
378
363
|
columnList.forEach(col => {
|
|
379
364
|
selectParam.push({
|
|
380
365
|
field: col
|
|
@@ -410,7 +395,7 @@ export default function ListView(props) {
|
|
|
410
395
|
// If we reach here that implies we've at least one valid filter, hence setting the flag
|
|
411
396
|
validFilter = true;
|
|
412
397
|
/** Below are the 2 cases for- Text & Date-Range filter types where we'll construct filter data which will be sent in the dashboardFilterPayload
|
|
413
|
-
* In
|
|
398
|
+
* In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
|
|
414
399
|
*/
|
|
415
400
|
if (isDateRange) {
|
|
416
401
|
const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
|
|
@@ -484,20 +469,97 @@ export default function ListView(props) {
|
|
|
484
469
|
}, 0);
|
|
485
470
|
}, []);
|
|
486
471
|
|
|
487
|
-
function fetchAllData() {
|
|
472
|
+
function fetchAllData(fields) {
|
|
473
|
+
let query: any = null;
|
|
474
|
+
if (payload) {
|
|
475
|
+
query = payload.query;
|
|
476
|
+
} else if (fields?.length && meta.isQueryable) {
|
|
477
|
+
query = {select: fields};
|
|
478
|
+
} else if (dashboardFilterPayload) {
|
|
479
|
+
query = dashboardFilterPayload.query;
|
|
480
|
+
}
|
|
488
481
|
const context = getPConnect().getContextName();
|
|
489
482
|
return PCore.getDataPageUtils().getDataAsync(
|
|
490
483
|
referenceList,
|
|
491
484
|
context,
|
|
492
485
|
payload ? payload.dataViewParameters : dataViewParameters,
|
|
493
486
|
null,
|
|
494
|
-
|
|
487
|
+
query
|
|
495
488
|
);
|
|
496
489
|
}
|
|
497
490
|
|
|
491
|
+
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
492
|
+
const listFields: any = [];
|
|
493
|
+
if (colId) {
|
|
494
|
+
const field = getField(fieldDefs, colId);
|
|
495
|
+
listFields.push({
|
|
496
|
+
field: field.name
|
|
497
|
+
});
|
|
498
|
+
} else {
|
|
499
|
+
// NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields
|
|
500
|
+
// 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)) {
|
|
503
|
+
listFields.push({
|
|
504
|
+
field: field.name
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
patchQueryFields.forEach(k => {
|
|
509
|
+
if (!listFields.find(f => f.field === k)) {
|
|
510
|
+
listFields.push({
|
|
511
|
+
field: k
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
compositeKeys.forEach(k => {
|
|
518
|
+
if (!listFields.find(f => f.field === k)) {
|
|
519
|
+
listFields.push({
|
|
520
|
+
field: k
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
return listFields;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const addItemKeyInSelect = (
|
|
528
|
+
fieldDefs,
|
|
529
|
+
itemKey,
|
|
530
|
+
select,
|
|
531
|
+
compositeKeys
|
|
532
|
+
) => {
|
|
533
|
+
const elementFound = getField(fieldDefs, itemKey);
|
|
534
|
+
|
|
535
|
+
if (itemKey && !elementFound && Array.isArray(select) && !(compositeKeys !== null && compositeKeys?.length) && !select.find(sel => sel.field === itemKey)) {
|
|
536
|
+
return [...select, {
|
|
537
|
+
field: itemKey
|
|
538
|
+
}];
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return select;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
const getField = (fieldDefs, columnId) => {
|
|
545
|
+
const fieldsMap = getFieldsMap(fieldDefs);
|
|
546
|
+
return fieldsMap.get(columnId);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
const getFieldsMap = fieldDefs => {
|
|
550
|
+
const fieldsMap = new Map();
|
|
551
|
+
fieldDefs.forEach(element => {
|
|
552
|
+
fieldsMap.set(element.id, element);
|
|
553
|
+
});
|
|
554
|
+
return fieldsMap;
|
|
555
|
+
};
|
|
556
|
+
|
|
498
557
|
async function fetchDataFromServer() {
|
|
499
558
|
let bCallSetRowsColumns = true;
|
|
500
|
-
const
|
|
559
|
+
const { fieldDefs, itemKey, patchQueryFields } = meta;
|
|
560
|
+
let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
|
|
561
|
+
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
562
|
+
const workListJSON = await fetchAllData(listFields);
|
|
501
563
|
|
|
502
564
|
// don't update these fields until we return from promise
|
|
503
565
|
let fields = presets[0].children[0].children;
|
|
@@ -507,7 +569,7 @@ export default function ListView(props) {
|
|
|
507
569
|
|
|
508
570
|
const tableDataResults = workListJSON['data'];
|
|
509
571
|
|
|
510
|
-
const myColumns = getHeaderCells(columnFields, fields);
|
|
572
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs, fields);
|
|
511
573
|
|
|
512
574
|
const selectParams: any = [];
|
|
513
575
|
|
|
@@ -529,7 +591,7 @@ export default function ListView(props) {
|
|
|
529
591
|
|
|
530
592
|
setResponse(tableDataResults);
|
|
531
593
|
|
|
532
|
-
const usingDataResults = getUsingData(tableDataResults
|
|
594
|
+
const usingDataResults = getUsingData(tableDataResults);
|
|
533
595
|
|
|
534
596
|
// store globally, so can be searched, filtered, etc.
|
|
535
597
|
myRows = updateData(usingDataResults, fields);
|
|
@@ -554,8 +616,10 @@ export default function ListView(props) {
|
|
|
554
616
|
}
|
|
555
617
|
|
|
556
618
|
useEffect(() => {
|
|
557
|
-
|
|
558
|
-
|
|
619
|
+
if (listContext.meta) {
|
|
620
|
+
fetchDataFromServer();
|
|
621
|
+
}
|
|
622
|
+
}, [listContext]);
|
|
559
623
|
|
|
560
624
|
function searchFilter(value: string, rows: Array<any>) {
|
|
561
625
|
function filterArray(el: any): boolean {
|
|
@@ -629,8 +693,8 @@ export default function ListView(props) {
|
|
|
629
693
|
}
|
|
630
694
|
|
|
631
695
|
function openWork(row) {
|
|
632
|
-
const {
|
|
633
|
-
|
|
696
|
+
const { pxRefObjectKey } = row;
|
|
697
|
+
const pxRefObjectClass = row.pxRefObjectClass || row.pxObjClass;
|
|
634
698
|
if (pxRefObjectClass !== '' && pxRefObjectKey !== '') {
|
|
635
699
|
thePConn.getActionsApi().openWorkByHandle(pxRefObjectKey, pxRefObjectClass);
|
|
636
700
|
}
|
|
@@ -783,26 +847,6 @@ export default function ListView(props) {
|
|
|
783
847
|
// move data to array and then sort
|
|
784
848
|
setRows(theData);
|
|
785
849
|
createSortHandler(sortColumnId);
|
|
786
|
-
|
|
787
|
-
// grouping here
|
|
788
|
-
|
|
789
|
-
// let reGroupData = this.addGroups(theData, this.groupByColumns$);
|
|
790
|
-
|
|
791
|
-
// this.repeatList$.data = [];
|
|
792
|
-
// this.repeatList$.data.push( ...reGroupData);
|
|
793
|
-
|
|
794
|
-
// if (this.searchFilter && this.searchFilter != "") {
|
|
795
|
-
// this.repeatList$.filter = this.searchFilter;
|
|
796
|
-
// }
|
|
797
|
-
// else {
|
|
798
|
-
// this.perfFilter = performance.now().toString();
|
|
799
|
-
// this.repeatList$.filter = this.perfFilter;
|
|
800
|
-
// }
|
|
801
|
-
// this.repeatList$.filter = "";
|
|
802
|
-
|
|
803
|
-
// if (this.repeatList$.paginator) {
|
|
804
|
-
// this.repeatList$.paginator.firstPage();
|
|
805
|
-
// }
|
|
806
850
|
}
|
|
807
851
|
|
|
808
852
|
function _dialogContainsFilter(event) {
|
|
@@ -854,19 +898,37 @@ export default function ListView(props) {
|
|
|
854
898
|
return bReturn;
|
|
855
899
|
}
|
|
856
900
|
|
|
857
|
-
function _listViewClick(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
901
|
+
function _listViewClick(row, column) {
|
|
902
|
+
const name = column.id
|
|
903
|
+
if (column.displayAsLink) {
|
|
904
|
+
const { pxObjClass } = row;
|
|
905
|
+
let { pzInsKey } = row;
|
|
906
|
+
if (column.isAssociation) {
|
|
907
|
+
const associationCategory = name.split(':')[0];
|
|
908
|
+
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
909
|
+
}
|
|
910
|
+
if (column.isAssignmentLink) {
|
|
911
|
+
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
912
|
+
containerName: 'primary'
|
|
913
|
+
});
|
|
914
|
+
} else {
|
|
915
|
+
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
916
|
+
}
|
|
917
|
+
} else {
|
|
918
|
+
switch (name) {
|
|
919
|
+
case 'pxTaskLabel':
|
|
920
|
+
openAssignment(row);
|
|
921
|
+
break;
|
|
862
922
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
923
|
+
case 'pxRefObjectInsName':
|
|
924
|
+
openWork(row);
|
|
925
|
+
break;
|
|
866
926
|
|
|
867
|
-
|
|
868
|
-
|
|
927
|
+
default:
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
869
930
|
}
|
|
931
|
+
|
|
870
932
|
}
|
|
871
933
|
|
|
872
934
|
function _listTitle() {
|
|
@@ -945,6 +1007,7 @@ export default function ListView(props) {
|
|
|
945
1007
|
variant='outlined'
|
|
946
1008
|
placeholder=''
|
|
947
1009
|
size='small'
|
|
1010
|
+
id="search"
|
|
948
1011
|
onChange={_onSearch}
|
|
949
1012
|
/>
|
|
950
1013
|
</Grid>
|
|
@@ -1008,11 +1071,11 @@ export default function ListView(props) {
|
|
|
1008
1071
|
align={column.align}
|
|
1009
1072
|
className={classes.cell}
|
|
1010
1073
|
>
|
|
1011
|
-
{_showButton(column.id, row) ? (
|
|
1074
|
+
{_showButton(column.id, row) || column.displayAsLink ? (
|
|
1012
1075
|
<Link
|
|
1013
1076
|
component='button'
|
|
1014
1077
|
onClick={() => {
|
|
1015
|
-
_listViewClick(
|
|
1078
|
+
_listViewClick(row, column);
|
|
1016
1079
|
}}
|
|
1017
1080
|
>
|
|
1018
1081
|
{column.format && typeof value === 'number'
|
|
@@ -1245,10 +1308,8 @@ export default function ListView(props) {
|
|
|
1245
1308
|
}
|
|
1246
1309
|
|
|
1247
1310
|
ListView.defaultProps = {
|
|
1248
|
-
// parameters: undefined
|
|
1249
1311
|
};
|
|
1250
1312
|
|
|
1251
1313
|
ListView.propTypes = {
|
|
1252
1314
|
getPConnect: PropTypes.func.isRequired
|
|
1253
|
-
// parameters: PropTypes.objectOf(PropTypes.any)
|
|
1254
1315
|
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { getContext, readContextResponse } from './utils';
|
|
3
|
+
|
|
4
|
+
export default function useInit(props) {
|
|
5
|
+
const PCore = window.PCore;
|
|
6
|
+
const {
|
|
7
|
+
referenceList,
|
|
8
|
+
getPConnect,
|
|
9
|
+
personalizationId,
|
|
10
|
+
parameters,
|
|
11
|
+
compositeKeys,
|
|
12
|
+
isSearchable,
|
|
13
|
+
allowBulkActions,
|
|
14
|
+
ref,
|
|
15
|
+
showDynamicFields,
|
|
16
|
+
isDataObject,
|
|
17
|
+
xRayUid,
|
|
18
|
+
cosmosTableRef
|
|
19
|
+
} = props;
|
|
20
|
+
let { editing, selectionMode } = props;
|
|
21
|
+
|
|
22
|
+
const runtimeParams = PCore.getRuntimeParamsAPI().getRuntimeParams();
|
|
23
|
+
|
|
24
|
+
let selectionCountThreshold;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
let isCompStillMounted = true; // react hooks cleanup function will toggle this flag and use it before setting a state variable
|
|
27
|
+
|
|
28
|
+
(async function init() {
|
|
29
|
+
// promise to fetch metadata
|
|
30
|
+
const metaDataPromise = PCore.getAnalyticsUtils().getDataViewMetadata(referenceList, showDynamicFields);
|
|
31
|
+
|
|
32
|
+
const promisesArray = [metaDataPromise];
|
|
33
|
+
|
|
34
|
+
// promise to fetch report configured columns
|
|
35
|
+
const reportColumnsPromise = PCore.getAnalyticsUtils()
|
|
36
|
+
.getFieldsForDataSource(referenceList, false, getPConnect().getContextName())
|
|
37
|
+
.catch(() => {
|
|
38
|
+
return Promise.resolve({
|
|
39
|
+
data: { data: [] }
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
promisesArray.push(reportColumnsPromise);
|
|
43
|
+
|
|
44
|
+
const fetchEditDetails = async (metadata) => {
|
|
45
|
+
const {
|
|
46
|
+
data: { isQueryable }
|
|
47
|
+
} = metadata;
|
|
48
|
+
if (!isDataObject) {
|
|
49
|
+
if (!isQueryable) {
|
|
50
|
+
editing = false; /* Force editing to false if DP is non queryable */
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const { MULTI_ON_HOVER, MULTI } = PCore.getConstants().LIST_SELECTION_MODE;
|
|
54
|
+
if (allowBulkActions && isQueryable) {
|
|
55
|
+
/** enable bulk actions only if DP is queryable */
|
|
56
|
+
selectionMode = MULTI_ON_HOVER;
|
|
57
|
+
}
|
|
58
|
+
if ([MULTI_ON_HOVER, MULTI].includes(selectionMode)) {
|
|
59
|
+
selectionCountThreshold = 250; // Results count should not be greater than threshold to display SelectAll checkbox.
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return Promise.resolve();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const editPromise = metaDataPromise.then((metadata) => fetchEditDetails(metadata));
|
|
66
|
+
promisesArray.push(editPromise);
|
|
67
|
+
getContext({
|
|
68
|
+
tableSource: referenceList,
|
|
69
|
+
ListId: personalizationId,
|
|
70
|
+
runtimeParams: parameters ?? runtimeParams,
|
|
71
|
+
promisesArray,
|
|
72
|
+
getPConnect,
|
|
73
|
+
compositeKeys,
|
|
74
|
+
isSearchable,
|
|
75
|
+
isCacheable: true,
|
|
76
|
+
xRayUid
|
|
77
|
+
})
|
|
78
|
+
.then(async (context) => {
|
|
79
|
+
if (isCompStillMounted) {
|
|
80
|
+
return readContextResponse(context, {
|
|
81
|
+
...props,
|
|
82
|
+
editing,
|
|
83
|
+
selectionCountThreshold,
|
|
84
|
+
ref,
|
|
85
|
+
selectionMode,
|
|
86
|
+
xRayUid,
|
|
87
|
+
cosmosTableRef
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
})();
|
|
92
|
+
|
|
93
|
+
return () => {
|
|
94
|
+
isCompStillMounted = false;
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
}
|