@typeolymp/ui-components 1.19.25 → 1.19.26

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
@@ -48581,16 +48581,35 @@ var Table = function (_a) {
48581
48581
  if (rowSelection && rowSelection.onChange)
48582
48582
  rowSelection.onChange(newSelectedRowKeys, selectedKey, selectedRows, selectedRow);
48583
48583
  };
48584
- return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsx(TableHead, { children: jsxRuntime.jsxs(TableRow, { children: [rowSelection && jsxRuntime.jsx("th", { style: { width: 55 } }), columns.map(function (_a, index) {
48584
+ var onSelectAllRows = function () {
48585
+ if (!rowSelection)
48586
+ return;
48587
+ if (selectedRowKeys.length === data.length) {
48588
+ setSelectedRowKeys([]);
48589
+ rowSelection.onChange([], "", [], undefined);
48590
+ }
48591
+ else {
48592
+ var newSelectedRowKeys = data.map(function (_a) {
48593
+ var key = _a.key;
48594
+ return key;
48595
+ });
48596
+ setSelectedRowKeys(newSelectedRowKeys);
48597
+ rowSelection.onChange(newSelectedRowKeys, "", data, undefined);
48598
+ }
48599
+ };
48600
+ return (jsxRuntime.jsxs(Container$1, { children: [jsxRuntime.jsx(TableHead, { children: jsxRuntime.jsxs(TableRow, { children: [rowSelection && (jsxRuntime.jsx("th", __assign$2({ style: {
48601
+ width: 55,
48602
+ display: "flex",
48603
+ justifyContent: "center",
48604
+ marginTop: 10,
48605
+ } }, { children: jsxRuntime.jsx(Checkbox, { id: "selectAll", name: "selectAll", value: "selectAll", onChange: onSelectAllRows }) }))), columns.map(function (_a, index) {
48585
48606
  var title = _a.title, titlePopup = _a.titlePopup, dataIndex = _a.dataIndex;
48586
48607
  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)));
48587
- })] }) }), 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) {
48588
- return (jsxRuntime.jsxs(TableRow, { children: [rowSelection && (jsxRuntime.jsx(TableCell, { children: jsxRuntime.jsx(Checkbox, { id: "".concat(rowIndex), name: "".concat(rowIndex), value: row.key, onChange: onSelectRow }) }, "row-select-".concat(rowIndex))), columns.map(function (_a, colIndex) {
48589
- var dataIndex = _a.dataIndex, render = _a.render, align = _a.align;
48590
- var data = row[dataIndex];
48591
- return (jsxRuntime.jsx(TableCell, __assign$2({ align: align }, { children: render ? render(data, row) : data }), "col-".concat(colIndex)));
48592
- })] }, "row-".concat(rowIndex)));
48593
- })) })] }));
48608
+ })] }) }), 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) {
48609
+ var dataIndex = _a.dataIndex, render = _a.render, align = _a.align;
48610
+ var data = row[dataIndex];
48611
+ return (jsxRuntime.jsx(TableCell, __assign$2({ align: align }, { children: render ? render(data, row) : data }), "col-".concat(colIndex)));
48612
+ })] }, "row-".concat(rowIndex))); })) })] }));
48594
48613
  };
48595
48614
 
48596
48615
  var Container = styled__default["default"].div(templateObject_1 || (templateObject_1 = __makeTemplateObject$1(["\n display: flex;\n align-items: stretch;\n\n > div:nth-child(odd) {\n width: 100%;\n min-width: 180px;\n min-height: 180px;\n\n > div {\n padding: 0;\n }\n }\n"], ["\n display: flex;\n align-items: stretch;\n\n > div:nth-child(odd) {\n width: 100%;\n min-width: 180px;\n min-height: 180px;\n\n > div {\n padding: 0;\n }\n }\n"])));