@pega/react-sdk-overrides 0.23.18 → 0.23.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.
@@ -53,11 +53,6 @@ let menuColumnLabel = '';
53
53
 
54
54
  let sortColumnId: any;
55
55
 
56
- // let dialogContainsFilter: string = "contains";
57
- // let dialogContainsValue: string = "";
58
- // let dialogDateFilter: string = "notequal";
59
- // let dialogDateValue: string = "";
60
-
61
56
  const filterByColumns: Array<any> = [];
62
57
 
63
58
  export default function ListView(props) {
@@ -217,19 +212,6 @@ export default function ListView(props) {
217
212
  setPage(0);
218
213
  };
219
214
 
220
- // function getDisplayColumns(fields = []) {
221
- // let arReturn = fields.map(( field: any, colIndex) => {
222
- // let theField = field.config.value.substring(field.config.value.indexOf(" ")+1);
223
- // if (theField.indexOf(".") == 0) {
224
- // theField = theField.substring(1);
225
- // }
226
-
227
- // return theField;
228
- // });
229
- // return arReturn;
230
-
231
- // }
232
-
233
215
  const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
234
216
  function getHeaderCells(colFields, fields, presetFields) {
235
217
  const arReturn = colFields.map((field: any, index) => {
@@ -345,10 +327,6 @@ export default function ListView(props) {
345
327
  myColList.push(col.id);
346
328
  });
347
329
 
348
- // for (const col of arCols) {
349
- // myColList.push(col.id);
350
- // }
351
-
352
330
  return myColList;
353
331
  }
354
332
 
@@ -381,7 +359,7 @@ export default function ListView(props) {
381
359
 
382
360
  let field = getFieldFromFilter(filterExpression, isDateRange);
383
361
  selectParam = [];
384
- // Constructing the select parameters list( will be sent in dashboardFilterPayload)
362
+ // Constructing the select parameters list (will be sent in dashboardFilterPayload)
385
363
  columnList.forEach(col => {
386
364
  selectParam.push({
387
365
  field: col
@@ -417,7 +395,7 @@ export default function ListView(props) {
417
395
  // If we reach here that implies we've at least one valid filter, hence setting the flag
418
396
  validFilter = true;
419
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
420
- * In Nebula, through Repeating Structures they might be using several APIs to do it, we're doing it here
398
+ * In Constellation DX Components, through Repeating Structures they might be using several APIs to do it. We're doing it here
421
399
  */
422
400
  if (isDateRange) {
423
401
  const dateRelationalOp = filter?.AND ? 'AND' : 'OR';
@@ -518,7 +496,8 @@ export default function ListView(props) {
518
496
  field: field.name
519
497
  });
520
498
  } else {
521
- // NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields corresponding to `state.groups` are set up. Needed in Client-mode grouping/pagination.
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.
522
501
  fieldDefs.forEach(field => {
523
502
  if (!listFields.find(f => f.field === field.name)) {
524
503
  listFields.push({
@@ -868,26 +847,6 @@ export default function ListView(props) {
868
847
  // move data to array and then sort
869
848
  setRows(theData);
870
849
  createSortHandler(sortColumnId);
871
-
872
- // grouping here
873
-
874
- // let reGroupData = this.addGroups(theData, this.groupByColumns$);
875
-
876
- // this.repeatList$.data = [];
877
- // this.repeatList$.data.push( ...reGroupData);
878
-
879
- // if (this.searchFilter && this.searchFilter != "") {
880
- // this.repeatList$.filter = this.searchFilter;
881
- // }
882
- // else {
883
- // this.perfFilter = performance.now().toString();
884
- // this.repeatList$.filter = this.perfFilter;
885
- // }
886
- // this.repeatList$.filter = "";
887
-
888
- // if (this.repeatList$.paginator) {
889
- // this.repeatList$.paginator.firstPage();
890
- // }
891
850
  }
892
851
 
893
852
  function _dialogContainsFilter(event) {
@@ -1349,10 +1308,8 @@ export default function ListView(props) {
1349
1308
  }
1350
1309
 
1351
1310
  ListView.defaultProps = {
1352
- // parameters: undefined
1353
1311
  };
1354
1312
 
1355
1313
  ListView.propTypes = {
1356
1314
  getPConnect: PropTypes.func.isRequired
1357
- // parameters: PropTypes.objectOf(PropTypes.any)
1358
1315
  };
@@ -147,14 +147,12 @@ export default function SimpleTableManual(props) {
147
147
  }
148
148
  }, [referenceList.length]);
149
149
 
150
- // Nebula has other handling for isReadOnlyMode but has Cosmos-specific code
151
- // so ignoring that for now...
152
150
  // fieldDefs will be an array where each entry will have a "name" which will be the
153
151
  // "resolved" property name (that we can use as the colId) though it's not really
154
152
  // resolved. The buildFieldsForTable helper just removes the "@P " (which is what
155
- // Nebula does). It will also have the "label", and "meta" contains the original,
153
+ // Constellation DX Components do). It will also have the "label", and "meta" contains the original,
156
154
  // unchanged config info. For now, much of the info here is carried over from
157
- // Nebula and we may not end up using it all.
155
+ // Constellation DX Components.
158
156
  const fieldDefs = buildFieldsForTable(rawFields, resolvedFields, showDeleteButton);
159
157
 
160
158
  const displayedColumns = fieldDefs.map(field => {
@@ -164,18 +162,6 @@ export default function SimpleTableManual(props) {
164
162
  // console.log(`SimpleTable displayedColumns:`);
165
163
  // console.log(displayedColumns);
166
164
 
167
- // And now we can process the resolvedFields to add in the "name"
168
- // from from the fieldDefs. This "name" is the value that
169
- // we'll share to connect things together in the table.
170
-
171
- // const processedFields = resolvedFields.map((field, i) => {
172
- // field.config['name'] = displayedColumns[i]; // .config["value"].replace(/ ./g,"_"); // replace space dot with underscore
173
- // return field;
174
- // });
175
-
176
- // console.log("SimpleTable processedFields:");
177
- // console.log(processedFields);
178
-
179
165
  // return the value that should be shown as the contents for the given row data
180
166
  // of the given row field
181
167
  function getRowValue(inRowData: Object, inColKey: string): any {
@@ -226,25 +212,18 @@ export default function SimpleTableManual(props) {
226
212
  }
227
213
  }
228
214
 
215
+ // May be useful for debugging or understanding how it works.
229
216
  // These are the data structures referred to in the html file.
230
217
  // These are the relationships that make the table work
231
218
  // displayedColumns: key/value pairs where key is order of column and
232
219
  // value is the property shown in that column. Ex: 1: "FirstName"
233
- // processedFields: key/value pairs where each key is order of column
234
- // and each value is an object of more detailed information about that
235
- // column.
236
220
  // rowData: array of each row's key/value pairs. Inside each row,
237
221
  // each key is an entry in displayedColumns: ex: "FirstName": "Charles"
238
222
  // Ex: { 1: {config: {label: "First Name", readOnly: true: name: "FirstName"}}, type: "TextInput" }
239
223
  // The "type" indicates the type of component that should be used for editing (when editing is enabled)
240
224
  //
241
- // Note that the "property" shown in the column ("FirstName" in the above examples) is what
242
- // ties the 3 data structures together.
243
-
244
225
  // console.log("SimpleTable displayedColumns:");
245
226
  // console.log(displayedColumns);
246
- // console.log("SimpleTable processedFields:");
247
- // console.log(processedFields);
248
227
  // console.log(`SimpleTable rowData (${rowData.length} row(s)):`);
249
228
  // console.log(JSON.stringify(rowData));
250
229
 
@@ -34,7 +34,7 @@
34
34
  min-width: 2.5rem;
35
35
  min-height: 2.5rem;
36
36
  max-width: 2.5rem;
37
- max-height: 2.5rem;
37
+ max-height: 2.5rem;
38
38
  border-radius: 50%;
39
39
  justify-content: center;
40
40
  align-items: center;
@@ -47,8 +47,8 @@
47
47
  }
48
48
 
49
49
  .psdk-todo-assignment {
50
- display: inline-flex;
51
- width:100%;
50
+ display: inline-flex;
51
+ width:100%;
52
52
  padding: 0.625rem 0rem;
53
53
  }
54
54
 
@@ -77,7 +77,7 @@
77
77
  }
78
78
 
79
79
  .psdk-todo-card {
80
- width: 100%;
80
+ width: 100%;
81
81
  padding-left: 0.625rem;
82
82
  }
83
83
 
@@ -85,3 +85,9 @@
85
85
  width: 100%;
86
86
  text-align: center;
87
87
  }
88
+
89
+ .psdk-todo-avatar-header{
90
+ display: flex;
91
+ align-items: center;
92
+ padding: 16px;
93
+ }
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-shadow */
2
+ /* eslint-disable @typescript-eslint/no-shadow */
1
3
  import React, { useState } from 'react';
2
4
  import PropTypes from 'prop-types';
3
5
  import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
@@ -167,14 +169,28 @@ export default function ToDo(props) {
167
169
  });
168
170
  }
169
171
 
172
+ const renderTaskId = (type, getPConnect, showTodoList, assignment) => {
173
+ const displayID = getID(assignment);
174
+
175
+ if ((showTodoList && type !== CONSTS.TODO) || assignment.isChild === true) {
176
+ /* Supress link for todo inside flow step */
177
+ return (
178
+ <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>
179
+ );
180
+ }
181
+ return displayID;
182
+ };
183
+
170
184
  const getListItemComponent = assignment => {
171
185
  if (isDesktop) {
172
186
  return (
173
187
  <>
174
188
  Task in
175
- <Button size='small' color='primary'>{`${assignment.name} ${getID(assignment)}`}</Button>
176
- {` \u2022 `}
177
- <span className='psdk-todo-assignment-status'>{assignment.status}</span>
189
+ {renderTaskId(type, getPConnect, showTodoList, assignment)}
190
+ {type === CONSTS.WORKLIST && assignment.status ? `\u2022 ` : undefined}
191
+ {type === CONSTS.WORKLIST && assignment.status ? (
192
+ <span className='psdk-todo-assignment-status'>{assignment.status}</span>
193
+ ) : undefined}
178
194
  {` \u2022 Urgency ${getPriority(assignment)}`}
179
195
  </>
180
196
  );
@@ -189,51 +205,98 @@ export default function ToDo(props) {
189
205
 
190
206
  return (
191
207
  <React.Fragment>
192
- <Card className={classes.root}>
193
- {showTodoList && (
194
- <CardHeader
195
- title={
208
+ {type === CONSTS.WORKLIST && (
209
+ <Card className={classes.root}>
210
+ {showTodoList && (
211
+ <CardHeader
212
+ title={
213
+ <Badge badgeContent={assignmentCount} color='primary'>
214
+ <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
215
+ </Badge>
216
+ }
217
+ avatar={<Avatar className={classes.avatar}>{currentUserInitials}</Avatar>}
218
+ ></CardHeader>
219
+ )}
220
+ <CardContent>
221
+ <List>
222
+ {assignments.map(assignment => (
223
+ <ListItem
224
+ key={getAssignmentId(assignment)}
225
+ dense
226
+ divider
227
+ onClick={() => clickGo(assignment)}
228
+ >
229
+ <ListItemText
230
+ primary={getAssignmentName(assignment)}
231
+ secondary={getListItemComponent(assignment)}
232
+ />
233
+ {type === CONSTS.WORKLIST && (
234
+ <ListItemSecondaryAction>
235
+ <IconButton onClick={() => clickGo(assignment)}>
236
+ <ArrowForwardIosOutlinedIcon />
237
+ </IconButton>
238
+ </ListItemSecondaryAction>
239
+ )}
240
+ </ListItem>
241
+ ))}
242
+ </List>
243
+ </CardContent>
244
+ {assignmentCount > 3 && (
245
+ <Box display='flex' justifyContent='center'>
246
+ {bShowMore ? (
247
+ <Button color='primary' onClick={_showMore}>
248
+ Show more
249
+ </Button>
250
+ ) : (
251
+ <Button onClick={_showLess}>Show less</Button>
252
+ )}
253
+ </Box>
254
+ )}
255
+ </Card>
256
+ )}
257
+
258
+ {type === CONSTS.TODO && (
259
+ <>
260
+ {showTodoList && (
261
+ <>
196
262
  <Badge badgeContent={assignmentCount} color='primary'>
197
263
  <Typography variant='h6'>{headerText}&nbsp;&nbsp;&nbsp;</Typography>
198
264
  </Badge>
199
- }
200
- avatar={<Avatar className={classes.avatar}>{currentUserInitials}</Avatar>}
201
- ></CardHeader>
202
- )}
203
- <CardContent>
265
+ </>
266
+ )}
204
267
  <List>
205
268
  {assignments.map(assignment => (
206
- <ListItem
207
- key={getAssignmentId(assignment)}
208
- dense
209
- divider
210
- onClick={() => clickGo(assignment)}
211
- >
212
- <ListItemText
213
- primary={getAssignmentName(assignment)}
214
- secondary={getListItemComponent(assignment)}
215
- />
216
- <ListItemSecondaryAction>
217
- <IconButton onClick={() => clickGo(assignment)}>
218
- <ArrowForwardIosOutlinedIcon />
219
- </IconButton>
220
- </ListItemSecondaryAction>
221
- </ListItem>
269
+ <>
270
+ <div className='psdk-todo-avatar-header'>
271
+ <Avatar className={classes.avatar} style={{ marginRight: '16px' }}>
272
+ {currentUserInitials}
273
+ </Avatar>
274
+ <div style={{ display: 'block' }}>
275
+ <Typography variant='h6'>{assignment?.name}</Typography>
276
+ {`Task in ${renderTaskId(
277
+ type,
278
+ getPConnect,
279
+ showTodoList,
280
+ assignment
281
+ )} \u2022 Urgency ${getPriority(assignment)}`}
282
+ </div>
283
+ </div>
284
+ </>
222
285
  ))}
223
286
  </List>
224
- </CardContent>
225
- {assignmentCount > 3 && (
226
- <Box display='flex' justifyContent='center'>
227
- {bShowMore ? (
228
- <Button color='primary' onClick={_showMore}>
229
- Show more
230
- </Button>
231
- ) : (
232
- <Button onClick={_showLess}>Show less</Button>
233
- )}
234
- </Box>
235
- )}
236
- </Card>
287
+ {assignmentCount > 3 && (
288
+ <Box display='flex' justifyContent='center'>
289
+ {bShowMore ? (
290
+ <Button color='primary' onClick={_showMore}>
291
+ Show more
292
+ </Button>
293
+ ) : (
294
+ <Button onClick={_showLess}>Show less</Button>
295
+ )}
296
+ </Box>
297
+ )}
298
+ </>
299
+ )}
237
300
 
238
301
  <Snackbar
239
302
  open={showSnackbar}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.18",
3
+ "version": "0.23.20",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [