@makeen.io/material-ui-kit
Version:
Makeen UI components kit. Based on material-ui.
37 lines (27 loc) • 2.37 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";function _templateObject() {var data = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n box-sizing: border-box;\n flex: 1;\n height: ", "px;\n\n .explorer-table.table-cell {\n flex: 1;\n font-size: 13px;\n text-align: ", ";\n }\n"]);_templateObject = function _templateObject() {return data;};return data;}import React from "react";
import TableCell from "@material-ui/core/TableCell";
import { SortableHandle } from "react-sortable-hoc";
import styled from "styled-components";
var TableCellWrapper = styled(TableCell)(_templateObject(),
function (props) {return props.rowHeight || 72;},
function (props) {return props.align || "center";});
var DragHandle = SortableHandle(function (_ref) {var children = _ref.children;return /*#__PURE__*/React.createElement(React.Fragment, null, children);});
var isRowSortable = function isRowSortable(index, dataKey) {return index >= 0 && dataKey === "__reorder__";}; // Header row should not be draggable
var Cell = function Cell(props) {var
PropsCell = props.Cell,cellData = props.cellData,alignment = props.alignment,height = props.height,rowData = props.rowData,rowIndex = props.rowIndex,dataKey = props.dataKey;
return /*#__PURE__*/React.createElement(TableCellWrapper, { variant: "body", style: { height: height }, component: "div", align: alignment, onClick: function onClick(e) {
if (props.handleClick) {
props.handleClick({ rowData: rowData });
}
} }, /*#__PURE__*/
React.createElement("div", { className: "explorer-table table-cell" }, PropsCell ? isRowSortable(rowIndex, dataKey) ? /*#__PURE__*/React.createElement(DragHandle, null, /*#__PURE__*/
React.createElement(PropsCell, _extends({}, props))) : /*#__PURE__*/React.createElement(PropsCell, _extends({}, props)) : isRowSortable(rowIndex, dataKey) ? /*#__PURE__*/React.createElement(DragHandle, null, cellData) : /*#__PURE__*/React.createElement("span", null, cellData)));
/* if (isRowSortable(rowIndex)) {
console.log("CONSIDERATION _____ -----")
return <div className="dragColumn"><DragHandle>{CellComponent}</DragHandle></div>;
} else {
return <div>{CellComponent}</div>;
} */
};
export default Cell;
//# sourceMappingURL=Cell.js.map