@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.es.js CHANGED
@@ -48554,16 +48554,35 @@ var Table = function (_a) {
48554
48554
  if (rowSelection && rowSelection.onChange)
48555
48555
  rowSelection.onChange(newSelectedRowKeys, selectedKey, selectedRows, selectedRow);
48556
48556
  };
48557
- return (jsxs(Container$1, { children: [jsx$1(TableHead, { children: jsxs(TableRow, { children: [rowSelection && jsx$1("th", { style: { width: 55 } }), columns.map(function (_a, index) {
48557
+ var onSelectAllRows = function () {
48558
+ if (!rowSelection)
48559
+ return;
48560
+ if (selectedRowKeys.length === data.length) {
48561
+ setSelectedRowKeys([]);
48562
+ rowSelection.onChange([], "", [], undefined);
48563
+ }
48564
+ else {
48565
+ var newSelectedRowKeys = data.map(function (_a) {
48566
+ var key = _a.key;
48567
+ return key;
48568
+ });
48569
+ setSelectedRowKeys(newSelectedRowKeys);
48570
+ rowSelection.onChange(newSelectedRowKeys, "", data, undefined);
48571
+ }
48572
+ };
48573
+ return (jsxs(Container$1, { children: [jsx$1(TableHead, { children: jsxs(TableRow, { children: [rowSelection && (jsx$1("th", __assign$2({ style: {
48574
+ width: 55,
48575
+ display: "flex",
48576
+ justifyContent: "center",
48577
+ marginTop: 10,
48578
+ } }, { children: jsx$1(Checkbox, { id: "selectAll", name: "selectAll", value: "selectAll", onChange: onSelectAllRows }) }))), columns.map(function (_a, index) {
48558
48579
  var title = _a.title, titlePopup = _a.titlePopup, dataIndex = _a.dataIndex;
48559
48580
  return (jsx$1(ColumnTitle, { children: jsxs("div", __assign$2({ style: { display: "flex", alignItems: "center", gap: 5 } }, { children: [title && (jsx$1(Heading, __assign$2({ type: "h6", as: "span" }, { children: title }))), titlePopup && (jsx$1(Popup, __assign$2({ content: titlePopup }, { children: jsx$1(Icon, { type: "questionCircle", size: "tiny", color: "lightGray" }) })))] })) }, "".concat(dataIndex, "-").concat(index)));
48560
- })] }) }), jsx$1(TableBody, { children: data.length === 0 ? (jsx$1(TableRow, { children: jsx$1(EmptyTableCell, __assign$2({ colSpan: columns.length }, { children: jsx$1(Paragraph, __assign$2({ align: "center", size: "small", weight: "regular" }, { children: emptyText || "No data" })) })) })) : (data.map(function (row, rowIndex) {
48561
- return (jsxs(TableRow, { children: [rowSelection && (jsx$1(TableCell, { children: jsx$1(Checkbox, { id: "".concat(rowIndex), name: "".concat(rowIndex), value: row.key, onChange: onSelectRow }) }, "row-select-".concat(rowIndex))), columns.map(function (_a, colIndex) {
48562
- var dataIndex = _a.dataIndex, render = _a.render, align = _a.align;
48563
- var data = row[dataIndex];
48564
- return (jsx$1(TableCell, __assign$2({ align: align }, { children: render ? render(data, row) : data }), "col-".concat(colIndex)));
48565
- })] }, "row-".concat(rowIndex)));
48566
- })) })] }));
48581
+ })] }) }), jsx$1(TableBody, { children: data.length === 0 ? (jsx$1(TableRow, { children: jsx$1(EmptyTableCell, __assign$2({ colSpan: columns.length }, { children: jsx$1(Paragraph, __assign$2({ align: "center", size: "small", weight: "regular" }, { children: emptyText || "No data" })) })) })) : (data.map(function (row, rowIndex) { return (jsxs(TableRow, { children: [rowSelection && (jsx$1(TableCell, { children: jsx$1(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) {
48582
+ var dataIndex = _a.dataIndex, render = _a.render, align = _a.align;
48583
+ var data = row[dataIndex];
48584
+ return (jsx$1(TableCell, __assign$2({ align: align }, { children: render ? render(data, row) : data }), "col-".concat(colIndex)));
48585
+ })] }, "row-".concat(rowIndex))); })) })] }));
48567
48586
  };
48568
48587
 
48569
48588
  var Container = styled.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"])));