@pega/react-sdk-components 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/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +20 -3
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +1 -2
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +23 -40
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.d.ts.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.js +5 -5
- package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.js +5 -5
- package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/field/Currency/Currency.d.ts.map +1 -1
- package/lib/components/field/Currency/Currency.js +21 -6
- package/lib/components/field/Currency/Currency.js.map +1 -1
- package/lib/components/field/Currency/currency-utils.d.ts +11 -0
- package/lib/components/field/Currency/currency-utils.d.ts.map +1 -0
- package/lib/components/field/Currency/currency-utils.js +60 -0
- package/lib/components/field/Currency/currency-utils.js.map +1 -0
- package/lib/components/field/Date/Date.d.ts.map +1 -1
- package/lib/components/field/Date/Date.js +17 -6
- package/lib/components/field/Date/Date.js.map +1 -1
- package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
- package/lib/components/field/DateTime/DateTime.js +16 -7
- package/lib/components/field/DateTime/DateTime.js.map +1 -1
- package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
- package/lib/components/field/Decimal/Decimal.js +5 -5
- package/lib/components/field/Decimal/Decimal.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +5 -5
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Email/Email.js +5 -5
- package/lib/components/field/Email/Email.js.map +1 -1
- package/lib/components/field/Integer/Integer.d.ts.map +1 -1
- package/lib/components/field/Integer/Integer.js +5 -5
- package/lib/components/field/Integer/Integer.js.map +1 -1
- package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
- package/lib/components/field/Percentage/Percentage.js +5 -5
- package/lib/components/field/Percentage/Percentage.js.map +1 -1
- package/lib/components/field/Phone/Phone.d.ts.map +1 -1
- package/lib/components/field/Phone/Phone.js +5 -5
- package/lib/components/field/Phone/Phone.js.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +5 -5
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.d.ts.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.js +5 -1
- package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
- package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/field/TextArea/TextArea.js +5 -5
- package/lib/components/field/TextArea/TextArea.js.map +1 -1
- package/lib/components/field/TextInput/TextInput.d.ts.map +1 -1
- package/lib/components/field/TextInput/TextInput.js +5 -5
- package/lib/components/field/TextInput/TextInput.js.map +1 -1
- package/lib/components/field/Time/Time.d.ts.map +1 -1
- package/lib/components/field/Time/Time.js +5 -5
- package/lib/components/field/Time/Time.js.map +1 -1
- package/lib/components/field/URL/URL.d.ts.map +1 -1
- package/lib/components/field/URL/URL.js +5 -5
- package/lib/components/field/URL/URL.js.map +1 -1
- package/lib/components/helpers/authManager.d.ts.map +1 -1
- package/lib/components/helpers/authManager.js +1 -0
- package/lib/components/helpers/authManager.js.map +1 -1
- package/lib/components/helpers/date-format-utils.d.ts +13 -0
- package/lib/components/helpers/date-format-utils.d.ts.map +1 -0
- package/lib/components/helpers/date-format-utils.js +59 -0
- package/lib/components/helpers/date-format-utils.js.map +1 -0
- package/lib/components/helpers/event-utils.js +1 -1
- package/lib/components/helpers/event-utils.js.map +1 -1
- package/lib/components/helpers/formatters/Currency.js +11 -5
- package/lib/components/helpers/formatters/Currency.js.map +1 -1
- package/lib/components/helpers/formatters/common.d.ts.map +1 -1
- package/lib/components/helpers/formatters/common.js +6 -1
- package/lib/components/helpers/formatters/common.js.map +1 -1
- package/lib/components/helpers/formatters/index.d.ts.map +1 -1
- package/lib/components/helpers/formatters/index.js +4 -0
- package/lib/components/helpers/formatters/index.js.map +1 -1
- package/lib/components/helpers/template-utils.d.ts +14 -0
- package/lib/components/helpers/template-utils.d.ts.map +1 -0
- package/lib/components/helpers/template-utils.js +65 -0
- package/lib/components/helpers/template-utils.js.map +1 -0
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +53 -54
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js +3 -49
- package/lib/components/infra/ErrorBoundary/ErrorBoundary.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.css +4 -18
- package/lib/components/infra/NavBar/NavBar.d.ts +1 -1
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +57 -121
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.d.ts.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js +0 -50
- package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
- package/lib/components/infra/Stages/Stages.d.ts.map +1 -1
- package/lib/components/infra/Stages/Stages.js +1 -2
- package/lib/components/infra/Stages/Stages.js.map +1 -1
- package/lib/components/infra/View/View.d.ts.map +1 -1
- package/lib/components/infra/View/View.js +13 -4
- package/lib/components/infra/View/View.js.map +1 -1
- package/lib/components/template/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/template/AppShell/AppShell.js +2 -323
- package/lib/components/template/AppShell/AppShell.js.map +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.js +1 -1
- package/lib/components/template/CaseSummary/CaseSummary.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +2 -3
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.d.ts.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.js +6 -1
- package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
- package/lib/components/template/Details/Details/Details.d.ts +2 -0
- package/lib/components/template/Details/Details/Details.d.ts.map +1 -1
- package/lib/components/template/Details/Details/Details.js +35 -18
- package/lib/components/template/Details/Details/Details.js.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts +12 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +43 -27
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts +12 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +43 -25
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
- package/lib/components/template/ListView/DefaultViewMeta.d.ts +91 -0
- package/lib/components/template/ListView/DefaultViewMeta.d.ts.map +1 -0
- package/lib/components/template/ListView/DefaultViewMeta.js +208 -0
- package/lib/components/template/ListView/DefaultViewMeta.js.map +1 -0
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +147 -83
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/hooks.d.ts +2 -0
- package/lib/components/template/ListView/hooks.d.ts.map +1 -0
- package/lib/components/template/ListView/hooks.js +73 -0
- package/lib/components/template/ListView/hooks.js.map +1 -0
- package/lib/components/template/ListView/utils.d.ts +63 -0
- package/lib/components/template/ListView/utils.d.ts.map +1 -0
- package/lib/components/template/ListView/utils.js +537 -0
- package/lib/components/template/ListView/utils.js.map +1 -0
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts +12 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +45 -29
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +3 -20
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts +12 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +45 -29
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.css +7 -0
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +25 -2
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/doc/KeyReleaseUpdates.md +33 -0
- package/package.json +1 -1
- package/lib/components/template/utils.d.ts +0 -3
- package/lib/components/template/utils.d.ts.map +0 -1
- package/lib/components/template/utils.js +0 -22
- package/lib/components/template/utils.js.map +0 -1
|
@@ -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 } 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 '../../helpers/simpleTableHelpers';
|
|
39
41
|
import './ListView.css';
|
|
42
|
+
import useInit from './hooks';
|
|
40
43
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
41
44
|
let myRows;
|
|
42
45
|
let myDisplayColumnList;
|
|
@@ -44,14 +47,18 @@ let menuColumnId = '';
|
|
|
44
47
|
let menuColumnType = '';
|
|
45
48
|
let menuColumnLabel = '';
|
|
46
49
|
let sortColumnId;
|
|
47
|
-
// let dialogContainsFilter: string = "contains";
|
|
48
|
-
// let dialogContainsValue: string = "";
|
|
49
|
-
// let dialogDateFilter: string = "notequal";
|
|
50
|
-
// let dialogDateValue: string = "";
|
|
51
50
|
const filterByColumns = [];
|
|
52
51
|
export default function ListView(props) {
|
|
53
52
|
const { getPConnect, bInForm } = props;
|
|
54
|
-
const { globalSearch,
|
|
53
|
+
const { globalSearch, referenceList, rowClickAction, selectionMode, referenceType, payload, parameters, compositeKeys, showDynamicFields, presets } = props;
|
|
54
|
+
const ref = useRef({}).current;
|
|
55
|
+
const cosmosTableRef = useRef();
|
|
56
|
+
// List component context
|
|
57
|
+
const [listContext, setListContext] = useState({});
|
|
58
|
+
const { meta } = listContext;
|
|
59
|
+
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
60
|
+
const xRayUid = xRayApis.startXRay();
|
|
61
|
+
useInit({ ...props, setListContext, ref, showDynamicFields, xRayUid, cosmosTableRef });
|
|
55
62
|
const thePConn = getPConnect();
|
|
56
63
|
const componentConfig = thePConn.getComponentConfig();
|
|
57
64
|
const resolvedConfigProps = thePConn.getConfigProps();
|
|
@@ -154,7 +161,6 @@ export default function ListView(props) {
|
|
|
154
161
|
function stableSort(array, comparator) {
|
|
155
162
|
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
156
163
|
stabilizedThis.sort((a, b) => {
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow, no-shadow
|
|
158
164
|
const order = comparator(a[0], b[0]);
|
|
159
165
|
if (order !== 0)
|
|
160
166
|
return order;
|
|
@@ -171,25 +177,19 @@ export default function ListView(props) {
|
|
|
171
177
|
setRowsPerPage(+event.target.value);
|
|
172
178
|
setPage(0);
|
|
173
179
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// if (theField.indexOf(".") == 0) {
|
|
178
|
-
// theField = theField.substring(1);
|
|
179
|
-
// }
|
|
180
|
-
// return theField;
|
|
181
|
-
// });
|
|
182
|
-
// return arReturn;
|
|
183
|
-
// }
|
|
184
|
-
function getHeaderCells(colFields, fields) {
|
|
185
|
-
const arReturn = colFields.map((field, colIndex) => {
|
|
180
|
+
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
181
|
+
function getHeaderCells(colFields, fields, presetFields) {
|
|
182
|
+
const arReturn = colFields.map((field, index) => {
|
|
186
183
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
187
184
|
if (theField.indexOf('.') === 0) {
|
|
188
185
|
theField = theField.substring(1);
|
|
189
186
|
}
|
|
187
|
+
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
188
|
+
const displayAsLink = field.config.displayAsLink;
|
|
190
189
|
const headerRow = {};
|
|
191
190
|
headerRow.id = theField;
|
|
192
191
|
headerRow.type = field.type;
|
|
192
|
+
headerRow.displayAsLink = displayAsLink;
|
|
193
193
|
headerRow.numeric =
|
|
194
194
|
field.type === 'Decimal' ||
|
|
195
195
|
field.type === 'Integer' ||
|
|
@@ -197,19 +197,28 @@ export default function ListView(props) {
|
|
|
197
197
|
field.type === 'Currency' ||
|
|
198
198
|
false;
|
|
199
199
|
headerRow.disablePadding = false;
|
|
200
|
-
headerRow.label =
|
|
200
|
+
headerRow.label = presetFields[index].config.label;
|
|
201
|
+
if (colIndex > -1) {
|
|
202
|
+
headerRow.classID = fields[colIndex].classID;
|
|
203
|
+
}
|
|
204
|
+
if (displayAsLink) {
|
|
205
|
+
headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
|
|
206
|
+
if (field.config.value?.startsWith('@CA')) {
|
|
207
|
+
headerRow.isAssociation = true;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
201
210
|
return headerRow;
|
|
202
211
|
});
|
|
203
212
|
return arReturn;
|
|
204
213
|
}
|
|
205
214
|
function updateFields(arFields, theColumns) {
|
|
206
|
-
const arReturn = arFields;
|
|
207
|
-
|
|
215
|
+
const arReturn = arFields.filter(ele => ele.type !== 'reference');
|
|
216
|
+
arReturn.forEach((field, index) => {
|
|
208
217
|
arReturn[index].config.name = theColumns[index].id;
|
|
209
218
|
});
|
|
210
219
|
return arReturn;
|
|
211
220
|
}
|
|
212
|
-
function getUsingData(arTableData
|
|
221
|
+
function getUsingData(arTableData) {
|
|
213
222
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
214
223
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
215
224
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
@@ -218,21 +227,7 @@ export default function ListView(props) {
|
|
|
218
227
|
}
|
|
219
228
|
}
|
|
220
229
|
const arReturn = arTableData?.map((data) => {
|
|
221
|
-
const row =
|
|
222
|
-
theColumns.forEach(col => {
|
|
223
|
-
row[col.id] = data[col.id];
|
|
224
|
-
});
|
|
225
|
-
row[rowID] = data[rowID];
|
|
226
|
-
// for (const field of theColumns) {
|
|
227
|
-
// row[field.id] = data[field.id];
|
|
228
|
-
// }
|
|
229
|
-
// add in pxRefObjectClass and pzInsKey
|
|
230
|
-
if (data['pxRefObjectClass']) {
|
|
231
|
-
row['pxRefObjectClass'] = data['pxRefObjectClass'];
|
|
232
|
-
}
|
|
233
|
-
if (data['pzInsKey']) {
|
|
234
|
-
row['pzInsKey'] = data['pzInsKey'];
|
|
235
|
-
}
|
|
230
|
+
const row = data;
|
|
236
231
|
return row;
|
|
237
232
|
});
|
|
238
233
|
return arReturn;
|
|
@@ -279,9 +274,6 @@ export default function ListView(props) {
|
|
|
279
274
|
arCols.forEach(col => {
|
|
280
275
|
myColList.push(col.id);
|
|
281
276
|
});
|
|
282
|
-
// for (const col of arCols) {
|
|
283
|
-
// myColList.push(col.id);
|
|
284
|
-
// }
|
|
285
277
|
return myColList;
|
|
286
278
|
}
|
|
287
279
|
/** Will return field from a filter expression */
|
|
@@ -311,7 +303,7 @@ export default function ListView(props) {
|
|
|
311
303
|
const relationalOp = 'AND';
|
|
312
304
|
let field = getFieldFromFilter(filterExpression, isDateRange);
|
|
313
305
|
selectParam = [];
|
|
314
|
-
// Constructing the select parameters list(
|
|
306
|
+
// Constructing the select parameters list (will be sent in dashboardFilterPayload)
|
|
315
307
|
columnList.forEach(col => {
|
|
316
308
|
selectParam.push({
|
|
317
309
|
field: col
|
|
@@ -343,7 +335,7 @@ export default function ListView(props) {
|
|
|
343
335
|
// If we reach here that implies we've at least one valid filter, hence setting the flag
|
|
344
336
|
validFilter = true;
|
|
345
337
|
/** Below are the 2 cases for- Text & Date-Range filter types where we'll construct filter data which will be sent in the dashboardFilterPayload
|
|
346
|
-
* In
|
|
338
|
+
* In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
|
|
347
339
|
*/
|
|
348
340
|
if (isDateRange) {
|
|
349
341
|
const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
|
|
@@ -396,19 +388,87 @@ export default function ListView(props) {
|
|
|
396
388
|
}, `dashboard-component-${'id'}`, false, getPConnect().getContextName());
|
|
397
389
|
}, 0);
|
|
398
390
|
}, []);
|
|
399
|
-
function fetchAllData() {
|
|
391
|
+
function fetchAllData(fields) {
|
|
392
|
+
let query = null;
|
|
393
|
+
if (payload) {
|
|
394
|
+
query = payload.query;
|
|
395
|
+
}
|
|
396
|
+
else if (fields?.length && meta.isQueryable) {
|
|
397
|
+
query = { select: fields };
|
|
398
|
+
}
|
|
399
|
+
else if (dashboardFilterPayload) {
|
|
400
|
+
query = dashboardFilterPayload.query;
|
|
401
|
+
}
|
|
400
402
|
const context = getPConnect().getContextName();
|
|
401
|
-
return PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null,
|
|
402
|
-
}
|
|
403
|
+
return PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
|
|
404
|
+
}
|
|
405
|
+
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
406
|
+
const listFields = [];
|
|
407
|
+
if (colId) {
|
|
408
|
+
const field = getField(fieldDefs, colId);
|
|
409
|
+
listFields.push({
|
|
410
|
+
field: field.name
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
// NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields
|
|
415
|
+
// corresponding to `state.groups` are set up. Needed in Client-mode grouping/pagination.
|
|
416
|
+
fieldDefs.forEach(field => {
|
|
417
|
+
if (!listFields.find(f => f.field === field.name)) {
|
|
418
|
+
listFields.push({
|
|
419
|
+
field: field.name
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
patchQueryFields.forEach(k => {
|
|
424
|
+
if (!listFields.find(f => f.field === k)) {
|
|
425
|
+
listFields.push({
|
|
426
|
+
field: k
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
compositeKeys.forEach(k => {
|
|
432
|
+
if (!listFields.find(f => f.field === k)) {
|
|
433
|
+
listFields.push({
|
|
434
|
+
field: k
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
return listFields;
|
|
439
|
+
};
|
|
440
|
+
const addItemKeyInSelect = (fieldDefs, itemKey, select, compositeKeys) => {
|
|
441
|
+
const elementFound = getField(fieldDefs, itemKey);
|
|
442
|
+
if (itemKey && !elementFound && Array.isArray(select) && !(compositeKeys !== null && compositeKeys?.length) && !select.find(sel => sel.field === itemKey)) {
|
|
443
|
+
return [...select, {
|
|
444
|
+
field: itemKey
|
|
445
|
+
}];
|
|
446
|
+
}
|
|
447
|
+
return select;
|
|
448
|
+
};
|
|
449
|
+
const getField = (fieldDefs, columnId) => {
|
|
450
|
+
const fieldsMap = getFieldsMap(fieldDefs);
|
|
451
|
+
return fieldsMap.get(columnId);
|
|
452
|
+
};
|
|
453
|
+
const getFieldsMap = fieldDefs => {
|
|
454
|
+
const fieldsMap = new Map();
|
|
455
|
+
fieldDefs.forEach(element => {
|
|
456
|
+
fieldsMap.set(element.id, element);
|
|
457
|
+
});
|
|
458
|
+
return fieldsMap;
|
|
459
|
+
};
|
|
403
460
|
async function fetchDataFromServer() {
|
|
404
461
|
let bCallSetRowsColumns = true;
|
|
405
|
-
const
|
|
462
|
+
const { fieldDefs, itemKey, patchQueryFields } = meta;
|
|
463
|
+
let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
|
|
464
|
+
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
465
|
+
const workListJSON = await fetchAllData(listFields);
|
|
406
466
|
// don't update these fields until we return from promise
|
|
407
467
|
let fields = presets[0].children[0].children;
|
|
408
468
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
409
469
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
410
470
|
const tableDataResults = workListJSON['data'];
|
|
411
|
-
const myColumns = getHeaderCells(columnFields, fields);
|
|
471
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs, fields);
|
|
412
472
|
const selectParams = [];
|
|
413
473
|
myColumns.forEach(column => {
|
|
414
474
|
selectParams.push({
|
|
@@ -422,7 +482,7 @@ export default function ListView(props) {
|
|
|
422
482
|
columnList = colList;
|
|
423
483
|
fields = updateFields(fields, myColumns);
|
|
424
484
|
setResponse(tableDataResults);
|
|
425
|
-
const usingDataResults = getUsingData(tableDataResults
|
|
485
|
+
const usingDataResults = getUsingData(tableDataResults);
|
|
426
486
|
// store globally, so can be searched, filtered, etc.
|
|
427
487
|
myRows = updateData(usingDataResults, fields);
|
|
428
488
|
myDisplayColumnList = getMyColumnList(myColumns);
|
|
@@ -443,8 +503,10 @@ export default function ListView(props) {
|
|
|
443
503
|
};
|
|
444
504
|
}
|
|
445
505
|
useEffect(() => {
|
|
446
|
-
|
|
447
|
-
|
|
506
|
+
if (listContext.meta) {
|
|
507
|
+
fetchDataFromServer();
|
|
508
|
+
}
|
|
509
|
+
}, [listContext]);
|
|
448
510
|
function searchFilter(value, rows) {
|
|
449
511
|
function filterArray(el) {
|
|
450
512
|
const bReturn = false;
|
|
@@ -504,7 +566,8 @@ export default function ListView(props) {
|
|
|
504
566
|
}
|
|
505
567
|
}
|
|
506
568
|
function openWork(row) {
|
|
507
|
-
const {
|
|
569
|
+
const { pxRefObjectKey } = row;
|
|
570
|
+
const pxRefObjectClass = row.pxRefObjectClass || row.pxObjClass;
|
|
508
571
|
if (pxRefObjectClass !== '' && pxRefObjectKey !== '') {
|
|
509
572
|
thePConn.getActionsApi().openWorkByHandle(pxRefObjectKey, pxRefObjectClass);
|
|
510
573
|
}
|
|
@@ -636,21 +699,6 @@ export default function ListView(props) {
|
|
|
636
699
|
// move data to array and then sort
|
|
637
700
|
setRows(theData);
|
|
638
701
|
createSortHandler(sortColumnId);
|
|
639
|
-
// grouping here
|
|
640
|
-
// let reGroupData = this.addGroups(theData, this.groupByColumns$);
|
|
641
|
-
// this.repeatList$.data = [];
|
|
642
|
-
// this.repeatList$.data.push( ...reGroupData);
|
|
643
|
-
// if (this.searchFilter && this.searchFilter != "") {
|
|
644
|
-
// this.repeatList$.filter = this.searchFilter;
|
|
645
|
-
// }
|
|
646
|
-
// else {
|
|
647
|
-
// this.perfFilter = performance.now().toString();
|
|
648
|
-
// this.repeatList$.filter = this.perfFilter;
|
|
649
|
-
// }
|
|
650
|
-
// this.repeatList$.filter = "";
|
|
651
|
-
// if (this.repeatList$.paginator) {
|
|
652
|
-
// this.repeatList$.paginator.firstPage();
|
|
653
|
-
// }
|
|
654
702
|
}
|
|
655
703
|
function _dialogContainsFilter(event) {
|
|
656
704
|
// dialogContainsFilter = event.target.value;
|
|
@@ -691,16 +739,35 @@ export default function ListView(props) {
|
|
|
691
739
|
}
|
|
692
740
|
return bReturn;
|
|
693
741
|
}
|
|
694
|
-
function _listViewClick(
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
742
|
+
function _listViewClick(row, column) {
|
|
743
|
+
const name = column.id;
|
|
744
|
+
if (column.displayAsLink) {
|
|
745
|
+
const { pxObjClass } = row;
|
|
746
|
+
let { pzInsKey } = row;
|
|
747
|
+
if (column.isAssociation) {
|
|
748
|
+
const associationCategory = name.split(':')[0];
|
|
749
|
+
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
750
|
+
}
|
|
751
|
+
if (column.isAssignmentLink) {
|
|
752
|
+
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
753
|
+
containerName: 'primary'
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
switch (name) {
|
|
762
|
+
case 'pxTaskLabel':
|
|
763
|
+
openAssignment(row);
|
|
764
|
+
break;
|
|
765
|
+
case 'pxRefObjectInsName':
|
|
766
|
+
openWork(row);
|
|
767
|
+
break;
|
|
768
|
+
default:
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
704
771
|
}
|
|
705
772
|
}
|
|
706
773
|
function _listTitle() {
|
|
@@ -764,7 +831,7 @@ export default function ListView(props) {
|
|
|
764
831
|
React.createElement(Grid, { item: true },
|
|
765
832
|
React.createElement(SearchIcon, null)),
|
|
766
833
|
React.createElement(Grid, { item: true },
|
|
767
|
-
React.createElement(TextField, { label: 'Search', fullWidth: true, variant: 'outlined', placeholder: '', size: 'small', onChange: _onSearch })))),
|
|
834
|
+
React.createElement(TextField, { label: 'Search', fullWidth: true, variant: 'outlined', placeholder: '', size: 'small', id: "search", onChange: _onSearch })))),
|
|
768
835
|
React.createElement(React.Fragment, null, bInForm ? (React.createElement(TableContainer, { className: classes.tableInForm },
|
|
769
836
|
React.createElement(Table, { stickyHeader: true, "aria-label": 'sticky table' },
|
|
770
837
|
React.createElement(TableHead, null,
|
|
@@ -785,8 +852,8 @@ export default function ListView(props) {
|
|
|
785
852
|
_rowClick(row);
|
|
786
853
|
} }, arColumns.map(column => {
|
|
787
854
|
const value = row[column.id];
|
|
788
|
-
return (React.createElement(TableCell, { key: column.id, align: column.align, className: classes.cell }, _showButton(column.id, row) ? (React.createElement(Link, { component: 'button', onClick: () => {
|
|
789
|
-
_listViewClick(
|
|
855
|
+
return (React.createElement(TableCell, { key: column.id, align: column.align, className: classes.cell }, _showButton(column.id, row) || column.displayAsLink ? (React.createElement(Link, { component: 'button', onClick: () => {
|
|
856
|
+
_listViewClick(row, column);
|
|
790
857
|
} }, column.format && typeof value === 'number'
|
|
791
858
|
? column.format(value)
|
|
792
859
|
: value)) : (React.createElement(React.Fragment, null, column.format && typeof value === 'number'
|
|
@@ -858,11 +925,8 @@ export default function ListView(props) {
|
|
|
858
925
|
React.createElement(Snackbar, { open: showSnackbar, autoHideDuration: 3000, onClose: handleSnackbarClose, message: snackbarMessage, action: React.createElement(IconButton, { size: 'small', "aria-label": 'close', color: 'inherit', onClick: handleSnackbarClose },
|
|
859
926
|
React.createElement(CloseIcon, { fontSize: 'small' })) })));
|
|
860
927
|
}
|
|
861
|
-
ListView.defaultProps = {
|
|
862
|
-
// parameters: undefined
|
|
863
|
-
};
|
|
928
|
+
ListView.defaultProps = {};
|
|
864
929
|
ListView.propTypes = {
|
|
865
930
|
getPConnect: PropTypes.func.isRequired
|
|
866
|
-
// parameters: PropTypes.objectOf(PropTypes.any)
|
|
867
931
|
};
|
|
868
932
|
//# sourceMappingURL=ListView.js.map
|