@typeolymp/ui-components 1.19.32 → 1.19.34

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/build/index.js CHANGED
@@ -48565,9 +48565,6 @@ var templateObject_1$1, templateObject_2$1, templateObject_3$1, templateObject_4
48565
48565
  var Table = function (_a) {
48566
48566
  var columns = _a.columns, data = _a.data, emptyText = _a.emptyText, rowSelection = _a.rowSelection;
48567
48567
  var _b = React$3.useState([]), selectedRowKeys = _b[0], setSelectedRowKeys = _b[1];
48568
- React$3.useEffect(function () {
48569
- setSelectedRowKeys([]);
48570
- }, [data]);
48571
48568
  var onSelectRow = function (selectedKey) {
48572
48569
  var index = selectedRowKeys.indexOf(selectedKey);
48573
48570
  var newSelectedRowKeys = __spreadArray([], selectedRowKeys, true);
@@ -48608,10 +48605,10 @@ var Table = function (_a) {
48608
48605
  display: "flex",
48609
48606
  justifyContent: "center",
48610
48607
  marginTop: 10,
48611
- } }, { children: jsxRuntime.jsx(Checkbox, { id: "selectAll", name: "selectAll", value: "selectAll", checked: selectedRowKeys.length === data.length, onChange: onSelectAllRows }) }))), columns.map(function (_a, index) {
48608
+ } }, { children: jsxRuntime.jsx(Checkbox, { id: "selectAll", name: "selectAll", value: "selectAll", checked: selectedRowKeys.length > 0 && selectedRowKeys.length === data.length, onChange: onSelectAllRows }) }))), columns.map(function (_a, index) {
48612
48609
  var title = _a.title, titlePopup = _a.titlePopup, dataIndex = _a.dataIndex;
48613
48610
  return (jsxRuntime.jsx(ColumnTitle, { children: jsxRuntime.jsxs("div", __assign$2({ style: { display: "flex", alignItems: "center", gap: 5 } }, { children: [title && (jsxRuntime.jsx(Heading, __assign$2({ type: "h6", as: "span" }, { children: title }))), titlePopup && (jsxRuntime.jsx(Popup, __assign$2({ content: titlePopup }, { children: jsxRuntime.jsx(Icon, { type: "questionCircle", size: "tiny", color: "lightGray" }) })))] })) }, "".concat(dataIndex, "-").concat(index)));
48614
- })] }) }), jsxRuntime.jsx(TableBody, { children: data.length === 0 ? (jsxRuntime.jsx(TableRow, { children: jsxRuntime.jsx(EmptyTableCell, __assign$2({ colSpan: columns.length }, { children: jsxRuntime.jsx(Paragraph, __assign$2({ align: "center", size: "small", weight: "regular" }, { children: emptyText || "No data" })) })) })) : (data.map(function (row, rowIndex) { return (jsxRuntime.jsxs(TableRow, { children: [rowSelection && (jsxRuntime.jsx(TableCell, { children: jsxRuntime.jsx(Checkbox, { id: rowIndex.toString(), name: rowIndex.toString(), value: row.key, checked: selectedRowKeys.includes(row.key), onChange: onSelectRow }) }, "row-select-".concat(rowIndex))), columns.map(function (_a, colIndex) {
48611
+ })] }) }), jsxRuntime.jsx(TableBody, { children: data.length === 0 ? (jsxRuntime.jsx(TableRow, { children: jsxRuntime.jsx(EmptyTableCell, __assign$2({ colSpan: rowSelection ? columns.length + 1 : columns.length }, { children: jsxRuntime.jsx(Paragraph, __assign$2({ align: "center", size: "small", weight: "regular" }, { children: emptyText || "No data" })) })) })) : (data.map(function (row, rowIndex) { return (jsxRuntime.jsxs(TableRow, { children: [rowSelection && (jsxRuntime.jsx(TableCell, { children: jsxRuntime.jsx(Checkbox, { id: rowIndex.toString(), name: rowIndex.toString(), value: row.key, checked: selectedRowKeys.includes(row.key), onChange: onSelectRow }) }, "row-select-".concat(rowIndex))), columns.map(function (_a, colIndex) {
48615
48612
  var dataIndex = _a.dataIndex, render = _a.render, align = _a.align;
48616
48613
  var data = row[dataIndex];
48617
48614
  return (jsxRuntime.jsx(TableCell, __assign$2({ align: align }, { children: render ? render(data, row) : data }), "col-".concat(colIndex)));