baseui
Version:
A React Component library implementing the Base design language
58 lines (56 loc) • 3.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _styledComponents = require("./styled-components");
var _progressBar = require("../progress-bar");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
class Table extends React.Component {
render() {
return /*#__PURE__*/React.createElement(_styledComponents.StyledTable, {
"data-baseweb": "table",
"aria-colcount": this.props.columns.length,
"aria-rowcount": this.props.data.length
}, this.props.isLoading && /*#__PURE__*/React.createElement(_progressBar.ProgressBar, {
infinite: true,
overrides: {
Bar: {
style: {
marginBottom: 0,
marginLeft: 0,
marginRight: 0,
marginTop: 0
}
}
}
}), /*#__PURE__*/React.createElement(_styledComponents.StyledHead, {
$width: this.props.horizontalScrollWidth
}, this.props.columns.map((column, index) => /*#__PURE__*/React.createElement(_styledComponents.StyledHeadCell, {
key: index
}, column))), /*#__PURE__*/React.createElement(_styledComponents.StyledBody, {
$width: this.props.horizontalScrollWidth
}, this.props.data.map((row, index) => /*#__PURE__*/React.createElement(_styledComponents.StyledRow, {
key: index
}, row.map((cell, cellIndex) => /*#__PURE__*/React.createElement(_styledComponents.StyledCell, {
key: cellIndex
}, cell))))));
}
}
exports.default = Table;
_defineProperty(Table, "defaultProps", {
// @ts-ignore
columns: [],
// @ts-ignore
data: [[]],
isLoading: false
});