sag_components 1.0.1007 → 1.0.1009
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.
|
@@ -32,12 +32,11 @@ const ReportTable = props => {
|
|
|
32
32
|
onCheckRowClick,
|
|
33
33
|
buttonText,
|
|
34
34
|
buttonIconName,
|
|
35
|
-
useCheckBoxes
|
|
36
|
-
sortable
|
|
35
|
+
useCheckBoxes
|
|
37
36
|
} = props;
|
|
38
37
|
const [FormattedTableData, setFormattedTableData] = (0, _react.useState)(tableData);
|
|
39
38
|
const [AllRowsChecked, setAllRowsChecked] = (0, _react.useState)(false);
|
|
40
|
-
const [
|
|
39
|
+
const [activeSortColumn, setActiveSortColumn] = (0, _react.useState)();
|
|
41
40
|
(0, _react.useEffect)(() => {
|
|
42
41
|
var _newTableData$columns, _tableData$columnsHea, _newTableData$columns2, _tableData$rowsValues;
|
|
43
42
|
if (!tableData || !tableData.columnsHeadings || !tableData.rowsValues) {
|
|
@@ -90,10 +89,7 @@ const ReportTable = props => {
|
|
|
90
89
|
setFormattedTableData(newTableData);
|
|
91
90
|
}, [tableData, useSelectButtons, useCheckBoxes]);
|
|
92
91
|
const handleButtonClick = index => {
|
|
93
|
-
|
|
94
|
-
...prevState,
|
|
95
|
-
[index]: !prevState[index]
|
|
96
|
-
}));
|
|
92
|
+
setActiveSortColumn(index);
|
|
97
93
|
};
|
|
98
94
|
const columnsNumber = tableData.columnsHeadings.length;
|
|
99
95
|
const tableWidthSize = 100 / (useSelectButtons ? maxColumnsNumber + 1 : maxColumnsNumber) * (useSelectButtons ? columnsNumber + 1 : columnsNumber);
|
|
@@ -207,7 +203,10 @@ const ReportTable = props => {
|
|
|
207
203
|
// eslint-disable-next-line react/no-array-index-key
|
|
208
204
|
return /*#__PURE__*/_react.default.createElement(_ReportTable.Th, {
|
|
209
205
|
key: index
|
|
210
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", null, headline.label), sortable &&
|
|
206
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", null, headline.label), headline.sortable &&
|
|
207
|
+
/*#__PURE__*/
|
|
208
|
+
// Check if the column is sortable
|
|
209
|
+
_react.default.createElement("button", {
|
|
211
210
|
style: {
|
|
212
211
|
border: "none",
|
|
213
212
|
background: "none",
|
|
@@ -216,7 +215,7 @@ const ReportTable = props => {
|
|
|
216
215
|
},
|
|
217
216
|
onClick: () => handleButtonClick(index)
|
|
218
217
|
}, /*#__PURE__*/_react.default.createElement(_SortIcon.SortIcon, {
|
|
219
|
-
fill:
|
|
218
|
+
fill: activeSortColumn === index ? "#229E38" : "#D0D0D0"
|
|
220
219
|
}))));
|
|
221
220
|
}))), /*#__PURE__*/_react.default.createElement("tbody", null, FormattedTableData.rowsValues.map((rowData, index) =>
|
|
222
221
|
/*#__PURE__*/
|