@pega/react-sdk-overrides 0.25.4 → 0.25.5

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.
@@ -38,7 +38,8 @@ const NO_HEADER_TEMPLATES = [
38
38
  'WideNarrowDetails',
39
39
  'Confirmation',
40
40
  'DynamicTabs',
41
- 'DetailsSubTabs'
41
+ 'DetailsSubTabs',
42
+ 'ListView'
42
43
  ];
43
44
 
44
45
  export default function View(props: PropsWithChildren<ViewProps>) {
@@ -81,7 +81,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
81
81
  const classes = useStyles();
82
82
  const actionsAPI = pConn.getActionsApi();
83
83
  const localeReference = pConn.getValue('.pyLocaleReference', ''); // 2nd arg empty string until typedef marked correctly
84
- const [imageBlobUrl, setImageBlobUrl] = useState<string | null>(null);
84
+ const [imageBlobUrl, setImageBlobUrl] = useState<string | Blob | null>(null);
85
85
  // useState for appName and mapChildren - note these are ONLY updated once (on component mount!)
86
86
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
87
87
  const [appName, setAppName] = useState('');
@@ -133,8 +133,8 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
133
133
  }
134
134
  }, []);
135
135
 
136
- const [iconURL, setIconURL] = useState('');
137
- const [fullIconURL, setFullIconURL] = useState('');
136
+ const [iconURL, setIconURL] = useState<string | Blob>('');
137
+ const [fullIconURL, setFullIconURL] = useState<string | Blob>('');
138
138
  useEffect(() => {
139
139
  // using the default icon then fetch it from the static folder (not auth involved)
140
140
  if (
@@ -150,8 +150,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
150
150
  // not using default icon to fetch it using the way which uses authentication
151
151
  else {
152
152
  PCore.getAssetLoader()
153
- .getSvcImage(portalLogo)
154
- .then(blob => window.URL.createObjectURL(blob))
153
+ .getSvcImageUrl(portalLogo)
155
154
  .then(data => {
156
155
  setIconURL(data);
157
156
  setFullIconURL(data);
@@ -165,8 +164,7 @@ export default function AppShell(props: PropsWithChildren<AppShellProps>) {
165
164
  useEffect(() => {
166
165
  if (imageKey && portalTemplate === 'wss') {
167
166
  PCore.getAssetLoader()
168
- .getSvcImage(imageKey)
169
- .then(blob => window.URL.createObjectURL(blob))
167
+ .getSvcImageUrl(imageKey)
170
168
  .then(imagePath => setImageBlobUrl(imagePath));
171
169
  }
172
170
  }, []);
@@ -1,95 +1,22 @@
1
- import type { PropsWithChildren, ReactElement } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
3
3
  import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
4
4
 
5
5
  interface CaseSummaryProps extends PConnProps {
6
6
  // If any, enter additional props that only exist on this component
7
+ arPrimaryFields: any[];
8
+ arSecondaryFields: any[];
7
9
  }
8
10
 
9
11
  export default function CaseSummary(props: PropsWithChildren<CaseSummaryProps>) {
10
12
  // Get emitted components from map (so we can get any override that may exist)
11
13
  const CaseSummaryFields = getComponentFromMap('CaseSummaryFields');
12
14
 
13
- const { getPConnect, children } = props;
14
-
15
- const thePConn = getPConnect();
16
- const theConfigProps: any = thePConn.getConfigProps();
17
- // const { status, showStatus } = theConfigProps;
18
- const status = theConfigProps.status;
19
- const showStatus = theConfigProps.showStatus;
20
- const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
- const localeCategory = 'ModalContainer';
22
- // from Constellation DX Components
23
- // get the primary and secondary fields with the raw data (which has the non-resolved property values)
24
- // const regionsRaw = getPConnect().getRawMetadata().children;
25
- // const primaryFieldsRaw = regionsRaw[0].children;
26
- // const secondaryFieldsRaw = regionsRaw[1].children;
27
-
28
- // From other SDKs
29
- // may want to move these into useEffect/useState combo
30
- let arPrimaryFields: any[] = [];
31
- let arSecondaryFields: any[] = [];
32
-
33
- function prepareComponentInCaseSummary(pConnectMeta, getPConnect) {
34
- const { config, children } = pConnectMeta;
35
- const pConnect = getPConnect();
36
-
37
- const caseSummaryComponentObject: any = {};
38
-
39
- const { type } = pConnectMeta;
40
- const createdComponent = pConnect.createComponent({
41
- type,
42
- children: children ? [...children] : [],
43
- config: {
44
- ...config
45
- }
46
- });
47
-
48
- caseSummaryComponentObject.value = createdComponent;
49
- return caseSummaryComponentObject;
50
- }
51
-
52
- function prepareCaseSummaryData(summaryFieldChildren) {
53
- const convertChildrenToSummaryData = kid => {
54
- return kid?.map((childItem, index) => {
55
- const childMeta = childItem.getPConnect().meta;
56
- const caseSummaryComponentObject = prepareComponentInCaseSummary(childMeta, childItem.getPConnect);
57
- caseSummaryComponentObject.id = index + 1;
58
- return caseSummaryComponentObject;
59
- });
60
- };
61
- return summaryFieldChildren ? convertChildrenToSummaryData(summaryFieldChildren?.getChildren()) : undefined;
62
- }
63
-
64
- for (const child of children as ReactElement[]) {
65
- const childPConn = (child as ReactElement).props.getPConnect();
66
- const childPConnData = childPConn.resolveConfigProps(childPConn.getRawMetadata());
67
- if (childPConnData.name.toLowerCase() === 'primary fields') {
68
- arPrimaryFields = childPConnData.children;
69
- arPrimaryFields.forEach(field => {
70
- if (field.config?.value && typeof field.config?.value === 'string') {
71
- field.config.value = localizedVal(field.config.value, localeCategory);
72
- }
73
- });
74
- } else if (childPConnData.name.toLowerCase() === 'secondary fields') {
75
- const secondarySummaryFields = prepareCaseSummaryData(childPConn);
76
- arSecondaryFields = childPConnData.children;
77
- arSecondaryFields.forEach((field, index) => {
78
- field.config.displayLabel = secondarySummaryFields[index]?.value?.props?.label;
79
- });
80
- }
81
- }
82
-
83
- // At this point, should hand off to another component for layout and rendering
84
- // of primary and secondary fields in the Case Summary
85
-
86
- // debugging/investigation help
87
- // console.log(`CaseSummary: arPrimaryFields: ${JSON.stringify(arPrimaryFields)}`);
88
- // console.log(`CaseSummary: arSecondaryFields: ${JSON.stringify(arSecondaryFields)}`);
15
+ const { arPrimaryFields, arSecondaryFields } = props;
89
16
 
90
17
  return (
91
18
  <div id='CaseSummary'>
92
- <CaseSummaryFields status={status} showStatus={showStatus} theFields={arPrimaryFields} />
19
+ <CaseSummaryFields theFields={arPrimaryFields} />
93
20
  <CaseSummaryFields theFields={arSecondaryFields} />
94
21
  </div>
95
22
  );
@@ -9,6 +9,7 @@ import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils';
9
9
  import StoreContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
10
10
  import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
11
11
  import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
12
+ import { prepareCaseSummaryData } from '@pega/react-sdk-components/lib/components/template/utils';
12
13
 
13
14
  interface CaseViewProps extends PConnProps {
14
15
  // If any, enter additional props that only exist on this component
@@ -41,9 +42,6 @@ const useStyles = makeStyles(theme => ({
41
42
  width: theme.spacing(8),
42
43
  height: theme.spacing(8),
43
44
  padding: theme.spacing(1)
44
- },
45
- caseViewIconImage: {
46
- filter: 'var(--svg-color)'
47
45
  }
48
46
  }));
49
47
 
@@ -52,6 +50,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
52
50
  const CaseViewActionsMenu = getComponentFromMap('CaseViewActionsMenu');
53
51
  const VerticalTabs = getComponentFromMap('VerticalTabs');
54
52
  const DeferLoad = getComponentFromMap('DeferLoad');
53
+ const CaseSummary = getComponentFromMap('CaseSummary');
55
54
 
56
55
  const {
57
56
  getPConnect,
@@ -59,12 +58,9 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
59
58
  header,
60
59
  subheader,
61
60
  children = [],
62
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
63
- showIconInHeader = true,
64
- caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments, caseTypeID = '', caseTypeName = '' }
61
+ caseInfo: { availableActions = [], availableProcesses = [], hasNewAttachments, caseTypeID = '', caseTypeName = '', caseTypeIcon }
65
62
  } = props;
66
63
  const { lastUpdateCaseTime = getPConnect().getValue('caseInfo.lastUpdateTime') } = props;
67
-
68
64
  const currentCaseID = props.caseInfo.ID;
69
65
  let isComponentMounted = true;
70
66
  const { displayOnlyFA } = useContext<any>(StoreContext);
@@ -84,9 +80,8 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
84
80
  */
85
81
  function getChildRegionByName(inName: string): any {
86
82
  for (const child of children as ReactElement[]) {
87
- const theMetadataType: string = (child as ReactElement).props.getPConnect().getRawMetadata().type.toLowerCase();
88
- const theMetadataName: string = (child as ReactElement).props.getPConnect().getRawMetadata().name.toLowerCase();
89
-
83
+ const theMetadataType: string = (child as ReactElement).props.getPConnect().getRawMetadata().type?.toLowerCase();
84
+ const theMetadataName: string = (child as ReactElement).props.getPConnect().getRawMetadata().name?.toLowerCase();
90
85
  if (theMetadataType === 'region' && theMetadataName === inName) {
91
86
  return child;
92
87
  }
@@ -95,13 +90,23 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
95
90
  return null;
96
91
  }
97
92
 
98
- const theSummaryRegion = getChildRegionByName('summary');
93
+ const theSummaryRegion = children && children[0];
94
+
95
+ const data = prepareCaseSummaryData(theSummaryRegion);
96
+ const primarySummaryFields = data.primarySummaryFields;
97
+ const secondarySummaryFields = data.secondarySummaryFields;
98
+
99
99
  const theStagesRegion = getChildRegionByName('stages');
100
100
  const theTodoRegion = getChildRegionByName('todo');
101
101
  const theUtilitiesRegion = getChildRegionByName('utilities');
102
102
  const theTabsRegion = getChildRegionByName('tabs');
103
103
 
104
- const svgCase = Utils.getImageSrc(icon, Utils.getSDKStaticConentUrl());
104
+ let iconForCaseType = caseTypeIcon ? caseTypeIcon.replace('pi pi-', '') : icon;
105
+
106
+ if (!iconForCaseType || iconForCaseType.includes('.')) {
107
+ iconForCaseType = 'polaris-solid';
108
+ }
109
+ const caseSvgIconUrl = Utils.getImageSrc(iconForCaseType, Utils.getSDKStaticConentUrl());
105
110
 
106
111
  const [activeVertTab, setActiveVertTab] = useState(0);
107
112
 
@@ -109,7 +114,7 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
109
114
  // const tmpLoadData2 = { config: { label: "Case History", name: "CaseHistory" }, type: "DeferLoad" };
110
115
 
111
116
  // Extract the tabs we need to display from theTabsRegion (one tab per entry in theTabsRegionChildren)
112
- const theTabsRegionChildren = theTabsRegion.props.getPConnect().getChildren();
117
+ const theTabsRegionChildren = theTabsRegion?.props.getPConnect().getChildren();
113
118
 
114
119
  // vertTabInfo is sent to VerticalTabs component
115
120
  const vertTabInfo: object[] = [];
@@ -226,13 +231,13 @@ export default function CaseView(props: PropsWithChildren<CaseViewProps>) {
226
231
  }
227
232
  avatar={
228
233
  <Avatar className={classes.caseViewIconBox} variant='square'>
229
- <img src={svgCase} className={classes.caseViewIconImage} />
234
+ <img src={caseSvgIconUrl} />
230
235
  </Avatar>
231
236
  }
232
237
  />
233
238
  {getActionButtonsHtml()}
234
239
  <Divider />
235
- {theSummaryRegion}
240
+ <CaseSummary arPrimaryFields={primarySummaryFields} arSecondaryFields={secondarySummaryFields}></CaseSummary>
236
241
  <Divider />
237
242
  {vertTabInfo.length > 1 && <VerticalTabs tabconfig={vertTabInfo} />}
238
243
  </Card>
@@ -1,6 +1,7 @@
1
1
  import { useMemo, Children } from 'react';
2
2
  import type { ReactNode } from 'react';
3
- import Banner from '@pega/react-sdk-components/lib/components/designSystemExtension/Banner';
3
+ import { Grid2 } from '@mui/material';
4
+ import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
4
5
 
5
6
  export interface CommonPageProps {
6
7
  /** Page title */
@@ -53,6 +54,13 @@ interface DefaultPageProps extends CommonPageProps {
53
54
  // layoutModel?: GridLayoutModel | undefined;
54
55
  }
55
56
 
57
+ const COLUMNS_WIDTHS = {
58
+ 'one-column': [12],
59
+ 'two-column': [6, 6],
60
+ 'narrow-wide': [4, 8],
61
+ 'wide-narrow': [8, 4]
62
+ };
63
+
56
64
  export default function DefaultPage({
57
65
  layout = 'one-column',
58
66
  children,
@@ -64,6 +72,8 @@ export default function DefaultPage({
64
72
  backgroundColor = '',
65
73
  tintImage
66
74
  }: DefaultPageProps) {
75
+ const Banner = getComponentFromMap('Banner');
76
+
67
77
  const childArray = useMemo(() => {
68
78
  return Children.toArray(children);
69
79
  }, [children]);
@@ -85,4 +95,14 @@ export default function DefaultPage({
85
95
  />
86
96
  );
87
97
  }
98
+
99
+ return (
100
+ <Grid2 container spacing={1}>
101
+ {childArray.map((child, index) => (
102
+ <Grid2 key={index} size={COLUMNS_WIDTHS[layout][index]}>
103
+ {child}
104
+ </Grid2>
105
+ ))}
106
+ </Grid2>
107
+ );
88
108
  }
@@ -157,10 +157,9 @@ export default function ListView(props: ListViewProps) {
157
157
  width: '100%',
158
158
  marginTop: theme.spacing(2),
159
159
  marginBottom: theme.spacing(2),
160
- display: 'grid'
161
- },
162
- search: {
163
- padding: '5px 5px'
160
+ display: 'grid',
161
+ borderRadius: 16,
162
+ padding: 20
164
163
  },
165
164
  table: {
166
165
  minWidth: 750
@@ -189,10 +188,6 @@ export default function ListView(props: ListViewProps) {
189
188
  position: 'absolute',
190
189
  top: 20,
191
190
  width: 1
192
- },
193
- title: {
194
- marginTop: theme.spacing(1),
195
- marginLeft: theme.spacing(1)
196
191
  }
197
192
  })
198
193
  );
@@ -1065,162 +1060,162 @@ export default function ListView(props: ListViewProps) {
1065
1060
  <>
1066
1061
  {arColumns && arColumns.length > 0 && (
1067
1062
  <Paper className={classes.paper}>
1068
- <Typography className={classes.title} variant='h6' color='textPrimary' gutterBottom>
1069
- {_listTitle()}
1070
- </Typography>
1071
- {globalSearch && (
1072
- <Grid2 container spacing={1} alignItems='flex-end' className={classes.search}>
1073
- <Grid2>
1074
- <SearchIcon />
1075
- </Grid2>
1076
- <Grid2>
1077
- <TextField
1078
- label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
1079
- fullWidth
1080
- variant='outlined'
1081
- placeholder=''
1082
- size='small'
1083
- id='search'
1084
- onChange={_onSearch}
1085
- />
1063
+ <Grid2 container justifyContent='space-between'>
1064
+ <Typography variant='h6' color='textPrimary' gutterBottom>
1065
+ {_listTitle()}
1066
+ </Typography>
1067
+ {globalSearch && (
1068
+ <Grid2 container spacing={1} alignItems='flex-end'>
1069
+ <Grid2>
1070
+ <SearchIcon />
1071
+ </Grid2>
1072
+ <Grid2>
1073
+ <TextField
1074
+ label={PCore.getLocaleUtils().getLocaleValue('Search', 'Search')}
1075
+ fullWidth
1076
+ variant='outlined'
1077
+ placeholder=''
1078
+ size='small'
1079
+ id='search'
1080
+ onChange={_onSearch}
1081
+ />
1082
+ </Grid2>
1086
1083
  </Grid2>
1087
- </Grid2>
1088
- )}
1089
- <>
1090
- {!bInForm ? (
1091
- <TableContainer id='list-view' className={classes.tableInForm}>
1092
- <Table stickyHeader aria-label='sticky table'>
1093
- <TableHead>
1094
- <TableRow>
1095
- {arColumns.map(column => {
1084
+ )}
1085
+ </Grid2>
1086
+ {!bInForm ? (
1087
+ <TableContainer id='list-view' className={classes.tableInForm}>
1088
+ <Table stickyHeader aria-label='sticky table'>
1089
+ <TableHead>
1090
+ <TableRow>
1091
+ {arColumns.map(column => {
1092
+ return (
1093
+ <TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
1094
+ <TableSortLabel
1095
+ active={orderBy === column.id}
1096
+ direction={orderBy === column.id ? order : 'asc'}
1097
+ onClick={createSortHandler(column.id)}
1098
+ >
1099
+ {column.label}
1100
+ {_showFilteredIcon(column.id) && <FilterListIcon className={classes.filteredIcon} />}
1101
+ {orderBy === column.id ? (
1102
+ <span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
1103
+ ) : null}
1104
+ </TableSortLabel>
1105
+ <MoreIcon
1106
+ className={classes.moreIcon}
1107
+ onClick={event => {
1108
+ _menuClick(event, column.id, column.type, column.label);
1109
+ }}
1110
+ />
1111
+ </TableCell>
1112
+ );
1113
+ })}
1114
+ </TableRow>
1115
+ </TableHead>
1116
+ <TableBody>
1117
+ {arRows &&
1118
+ stableSort(arRows, getComparator(order, orderBy))
1119
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1120
+ .map(row => {
1096
1121
  return (
1097
- <TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
1098
- <TableSortLabel
1099
- active={orderBy === column.id}
1100
- direction={orderBy === column.id ? order : 'asc'}
1101
- onClick={createSortHandler(column.id)}
1102
- >
1103
- {column.label}
1104
- {_showFilteredIcon(column.id) && <FilterListIcon className={classes.filteredIcon} />}
1105
- {orderBy === column.id ? (
1106
- <span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
1107
- ) : null}
1108
- </TableSortLabel>
1109
- <MoreIcon
1110
- className={classes.moreIcon}
1111
- onClick={event => {
1112
- _menuClick(event, column.id, column.type, column.label);
1113
- }}
1114
- />
1115
- </TableCell>
1122
+ <TableRow key={row.pxRefObjectInsName || row.pyID}>
1123
+ {arColumns.map(column => {
1124
+ const value = row[column.id];
1125
+ return (
1126
+ <TableCell key={column.id} align={column.align} className={classes.cell}>
1127
+ {_showButton(column.id, row) || column.displayAsLink ? (
1128
+ <Link
1129
+ component='button'
1130
+ onClick={() => {
1131
+ _listViewClick(row, column);
1132
+ }}
1133
+ underline='hover'
1134
+ >
1135
+ {column.format && typeof value === 'number' ? column.format(value) : value}
1136
+ </Link>
1137
+ ) : (
1138
+ <>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
1139
+ )}
1140
+ </TableCell>
1141
+ );
1142
+ })}
1143
+ </TableRow>
1116
1144
  );
1117
1145
  })}
1118
- </TableRow>
1119
- </TableHead>
1120
- <TableBody>
1121
- {arRows &&
1122
- stableSort(arRows, getComparator(order, orderBy))
1123
- .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1124
- .map(row => {
1125
- return (
1126
- <TableRow key={row.pxRefObjectInsName || row.pyID}>
1127
- {arColumns.map(column => {
1128
- const value = row[column.id];
1129
- return (
1130
- <TableCell key={column.id} align={column.align} className={classes.cell}>
1131
- {_showButton(column.id, row) || column.displayAsLink ? (
1132
- <Link
1133
- component='button'
1134
- onClick={() => {
1135
- _listViewClick(row, column);
1136
- }}
1137
- underline='hover'
1138
- >
1139
- {column.format && typeof value === 'number' ? column.format(value) : value}
1140
- </Link>
1141
- ) : (
1142
- <>{column.format && typeof value === 'number' ? column.format(value) : value || '---'}</>
1143
- )}
1144
- </TableCell>
1145
- );
1146
- })}
1147
- </TableRow>
1148
- );
1149
- })}
1150
- </TableBody>
1151
- </Table>
1152
- </TableContainer>
1153
- ) : (
1154
- <TableContainer id='list-view'>
1155
- <Table>
1156
- <TableHead>
1157
- <TableRow>
1158
- {(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
1159
- {arColumns.map(column => {
1146
+ </TableBody>
1147
+ </Table>
1148
+ </TableContainer>
1149
+ ) : (
1150
+ <TableContainer id='list-view'>
1151
+ <Table>
1152
+ <TableHead>
1153
+ <TableRow>
1154
+ {(selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) && <TableCell />}
1155
+ {arColumns.map(column => {
1156
+ return (
1157
+ <TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
1158
+ <TableSortLabel
1159
+ active={orderBy === column.id}
1160
+ direction={orderBy === column.id ? order : 'asc'}
1161
+ onClick={createSortHandler(column.id)}
1162
+ >
1163
+ {column.label}
1164
+ {orderBy === column.id ? (
1165
+ <span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
1166
+ ) : null}
1167
+ </TableSortLabel>
1168
+ </TableCell>
1169
+ );
1170
+ })}
1171
+ </TableRow>
1172
+ </TableHead>
1173
+ <TableBody>
1174
+ {arRows &&
1175
+ arRows.length > 0 &&
1176
+ stableSort(arRows, getComparator(order, orderBy))
1177
+ .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1178
+ .map(row => {
1160
1179
  return (
1161
- <TableCell className={classes.cell} key={column.id} sortDirection={orderBy === column.id ? order : false}>
1162
- <TableSortLabel
1163
- active={orderBy === column.id}
1164
- direction={orderBy === column.id ? order : 'asc'}
1165
- onClick={createSortHandler(column.id)}
1166
- >
1167
- {column.label}
1168
- {orderBy === column.id ? (
1169
- <span className={classes.visuallyHidden}>{order === 'desc' ? 'sorted descending' : 'sorted ascending'}</span>
1170
- ) : null}
1171
- </TableSortLabel>
1172
- </TableCell>
1180
+ <TableRow key={row[rowID]}>
1181
+ {selectionMode === SELECTION_MODE.SINGLE && (
1182
+ <TableCell>
1183
+ <Radio
1184
+ onChange={handleChange}
1185
+ value={row[rowID]}
1186
+ name='radio-buttons'
1187
+ inputProps={{ 'aria-label': 'A' }}
1188
+ checked={selectedValue === row[rowID]}
1189
+ />
1190
+ </TableCell>
1191
+ )}
1192
+ {selectionMode === SELECTION_MODE.MULTI && (
1193
+ <TableCell>
1194
+ <Checkbox
1195
+ onChange={onCheckboxClick}
1196
+ checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
1197
+ value={row[rowID]}
1198
+ />
1199
+ </TableCell>
1200
+ )}
1201
+ {arColumns.map(column => {
1202
+ const value = row[column.id];
1203
+ return (
1204
+ <TableCell className={classes.cell} key={column.id} align={column.align}>
1205
+ {processColumnValue(column, value)}
1206
+ </TableCell>
1207
+ );
1208
+ })}
1209
+ </TableRow>
1173
1210
  );
1174
1211
  })}
1175
- </TableRow>
1176
- </TableHead>
1177
- <TableBody>
1178
- {arRows &&
1179
- arRows.length > 0 &&
1180
- stableSort(arRows, getComparator(order, orderBy))
1181
- .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
1182
- .map(row => {
1183
- return (
1184
- <TableRow key={row[rowID]}>
1185
- {selectionMode === SELECTION_MODE.SINGLE && (
1186
- <TableCell>
1187
- <Radio
1188
- onChange={handleChange}
1189
- value={row[rowID]}
1190
- name='radio-buttons'
1191
- inputProps={{ 'aria-label': 'A' }}
1192
- checked={selectedValue === row[rowID]}
1193
- />
1194
- </TableCell>
1195
- )}
1196
- {selectionMode === SELECTION_MODE.MULTI && (
1197
- <TableCell>
1198
- <Checkbox
1199
- onChange={onCheckboxClick}
1200
- checked={selectedValues.some(selectedValue => selectedValue[rowID] === row[rowID])}
1201
- value={row[rowID]}
1202
- />
1203
- </TableCell>
1204
- )}
1205
- {arColumns.map(column => {
1206
- const value = row[column.id];
1207
- return (
1208
- <TableCell className={classes.cell} key={column.id} align={column.align}>
1209
- {processColumnValue(column, value)}
1210
- </TableCell>
1211
- );
1212
- })}
1213
- </TableRow>
1214
- );
1215
- })}
1216
- </TableBody>
1217
- </Table>
1218
- {(!arRows || arRows.length === 0) && (
1219
- <div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
1220
- )}
1221
- </TableContainer>
1222
- )}
1223
- </>
1212
+ </TableBody>
1213
+ </Table>
1214
+ {(!arRows || arRows.length === 0) && (
1215
+ <div className='no-records'>{getGenericFieldsLocalizedValue('CosmosFields.fields.lists', 'No records found.')}</div>
1216
+ )}
1217
+ </TableContainer>
1218
+ )}
1224
1219
  {arRows && arRows.length > 0 && (
1225
1220
  <TablePagination
1226
1221
  id='pagination'