sag_components 1.0.646 → 1.0.648
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.
|
@@ -69,7 +69,7 @@ const BarChartsByWeeks = props => {
|
|
|
69
69
|
const week = isTitleOriganal ? label : label && (label === null || label === void 0 ? void 0 : label.toString().length) === 6 ? label.toString().substring(4, 6) : 0;
|
|
70
70
|
let currentTooltipValue = 0;
|
|
71
71
|
if ((_payload$0$payload = payload[0].payload) !== null && _payload$0$payload !== void 0 && _payload$0$payload.value) currentTooltipValue = (_payload$0$payload2 = payload[0].payload) === null || _payload$0$payload2 === void 0 ? void 0 : _payload$0$payload2.value;
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipTitle, null, "Week:
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipTitle, null, "".concat(isTitleOriganal ? '' : 'Week: ').concat(week)), /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipLabel, null, "".concat(tooltipTitle, " \n ").concat(displayFormattedValue(currentTooltipValue), " \n ")));
|
|
73
73
|
};
|
|
74
74
|
const getWeek = () => {
|
|
75
75
|
if (!barChartData || (barChartData === null || barChartData === void 0 ? void 0 : barChartData.length) === 0) return null;
|
|
@@ -25,12 +25,14 @@ const ReportTable = props => {
|
|
|
25
25
|
disableInfo,
|
|
26
26
|
selectTextColor,
|
|
27
27
|
onSelectRowClick,
|
|
28
|
+
onAllRowsCheckBoxClick,
|
|
28
29
|
onCheckRowClick,
|
|
29
30
|
buttonText,
|
|
30
31
|
buttonIconName,
|
|
31
32
|
useCheckBoxes
|
|
32
33
|
} = props;
|
|
33
34
|
const [FormattedTableData, setFormattedTableData] = (0, _react.useState)(tableData);
|
|
35
|
+
const [AllRowsChecked, setAllRowsChecked] = (0, _react.useState)(false);
|
|
34
36
|
(0, _react.useEffect)(() => {
|
|
35
37
|
var _newTableData$columns, _tableData$columnsHea, _newTableData$columns2, _tableData$rowsValues;
|
|
36
38
|
if (!tableData || !tableData.columnsHeadings || !tableData.rowsValues) {
|
|
@@ -99,14 +101,29 @@ const ReportTable = props => {
|
|
|
99
101
|
} = rest2;
|
|
100
102
|
onSelectRowClick(rest3);
|
|
101
103
|
};
|
|
102
|
-
const
|
|
104
|
+
const handleHeaderCheckBoxClick = () => {
|
|
103
105
|
var _FormattedTableData$r;
|
|
106
|
+
setAllRowsChecked(!AllRowsChecked);
|
|
107
|
+
const updatedTableHeaderRowsData = FormattedTableData === null || FormattedTableData === void 0 ? void 0 : (_FormattedTableData$r = FormattedTableData.rowsValues) === null || _FormattedTableData$r === void 0 ? void 0 : _FormattedTableData$r.map(item => ({
|
|
108
|
+
...item,
|
|
109
|
+
checkboxState: !AllRowsChecked
|
|
110
|
+
}));
|
|
111
|
+
setFormattedTableData({
|
|
112
|
+
...FormattedTableData,
|
|
113
|
+
rowsValues: updatedTableHeaderRowsData
|
|
114
|
+
});
|
|
115
|
+
onAllRowsCheckBoxClick({
|
|
116
|
+
AllRowsChecked: !AllRowsChecked
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const handleRowCheckBoxClick = row => {
|
|
120
|
+
var _FormattedTableData$r2;
|
|
104
121
|
if (!row) return;
|
|
105
122
|
const updatedRow = {
|
|
106
123
|
...row,
|
|
107
124
|
checkboxState: !(row !== null && row !== void 0 && row.checkboxState)
|
|
108
125
|
};
|
|
109
|
-
const updatedTableRowsData = FormattedTableData === null || FormattedTableData === void 0 ? void 0 : (_FormattedTableData$
|
|
126
|
+
const updatedTableRowsData = FormattedTableData === null || FormattedTableData === void 0 ? void 0 : (_FormattedTableData$r2 = FormattedTableData.rowsValues) === null || _FormattedTableData$r2 === void 0 ? void 0 : _FormattedTableData$r2.map(item => item.index === row.index ? updatedRow : item);
|
|
110
127
|
setFormattedTableData({
|
|
111
128
|
...FormattedTableData,
|
|
112
129
|
rowsValues: updatedTableRowsData
|
|
@@ -132,13 +149,13 @@ const ReportTable = props => {
|
|
|
132
149
|
}) : /*#__PURE__*/_react.default.createElement(_ArrowSelectIcon.default, {
|
|
133
150
|
className: "ArrowSelectIcon"
|
|
134
151
|
})));
|
|
135
|
-
const displayCheckBox = rowData => /*#__PURE__*/_react.default.createElement(_ReportTable.SelectCheckboxContainer, {
|
|
152
|
+
const displayCheckBox = (rowData, isHeader) => /*#__PURE__*/_react.default.createElement(_ReportTable.SelectCheckboxContainer, {
|
|
136
153
|
className: "SelectCheckboxContainer"
|
|
137
154
|
}, /*#__PURE__*/_react.default.createElement(_ReportTable.SelectCheckboxSubContainer, {
|
|
138
155
|
className: "SelectCheckboxSubContainer",
|
|
139
156
|
selectTextColor: selectTextColor,
|
|
140
|
-
onClick: () => handleRowCheckBoxClick(rowData)
|
|
141
|
-
}, rowData !== null && rowData !== void 0 && rowData.checkboxState ? /*#__PURE__*/_react.default.createElement(_CheckBoxCheckedIcon.CheckBoxCheckedIcon, {
|
|
157
|
+
onClick: () => isHeader ? handleHeaderCheckBoxClick() : handleRowCheckBoxClick(rowData)
|
|
158
|
+
}, !isHeader && rowData !== null && rowData !== void 0 && rowData.checkboxState || isHeader && AllRowsChecked ? /*#__PURE__*/_react.default.createElement(_CheckBoxCheckedIcon.CheckBoxCheckedIcon, {
|
|
142
159
|
className: "CheckBoxCheckedIcon",
|
|
143
160
|
width: "14px",
|
|
144
161
|
height: "14px",
|
|
@@ -166,17 +183,24 @@ const ReportTable = props => {
|
|
|
166
183
|
tableWidthSize: tableWidthSize
|
|
167
184
|
}, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", {
|
|
168
185
|
className: "headerRow"
|
|
169
|
-
}, FormattedTableData.columnsHeadings.map((headline, index) =>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
186
|
+
}, FormattedTableData.columnsHeadings.map((headline, index) => {
|
|
187
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
188
|
+
if (headline.label === 'checkbox') {
|
|
189
|
+
return /*#__PURE__*/_react.default.createElement(_ReportTable.Th, {
|
|
190
|
+
key: index
|
|
191
|
+
}, displayCheckBox(headline, true));
|
|
192
|
+
}
|
|
193
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
194
|
+
if (headline.label === 'button') {
|
|
195
|
+
return /*#__PURE__*/_react.default.createElement(_ReportTable.Th, {
|
|
196
|
+
key: index
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement(_ReportTable.Th, {
|
|
201
|
+
key: index
|
|
202
|
+
}, headline.label);
|
|
203
|
+
}))), /*#__PURE__*/_react.default.createElement("tbody", null, FormattedTableData.rowsValues.map((rowData, index) =>
|
|
180
204
|
/*#__PURE__*/
|
|
181
205
|
// eslint-disable-next-line react/no-array-index-key
|
|
182
206
|
_react.default.createElement(_ReportTable.Tr, {
|
|
@@ -191,7 +215,7 @@ const ReportTable = props => {
|
|
|
191
215
|
_react.default.createElement(_ReportTable.Td, {
|
|
192
216
|
className: "checkbox",
|
|
193
217
|
key: index
|
|
194
|
-
}, displayCheckBox(rowData)) : value === 'button' ?
|
|
218
|
+
}, displayCheckBox(rowData, false)) : value === 'button' ?
|
|
195
219
|
/*#__PURE__*/
|
|
196
220
|
// eslint-disable-next-line react/no-array-index-key
|
|
197
221
|
_react.default.createElement(_ReportTable.Td, {
|
|
@@ -255,5 +279,6 @@ ReportTable.defaultProps = {
|
|
|
255
279
|
selectTextColor: '#229E38',
|
|
256
280
|
onSelectRowClick: () => {},
|
|
257
281
|
onCheckRowClick: () => {},
|
|
282
|
+
onAllRowsCheckBoxClick: () => {},
|
|
258
283
|
useCheckBoxes: false
|
|
259
284
|
};
|