UNPKG

5.35 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var React = _interopRequireWildcard(require("react"));
9
10var _styledComponents = require("./styled-components.js");
11
12var _index = require("../progress-bar/index.js");
13
14function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
16function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
18function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
19
20function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
22function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
24function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
26function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
27
28function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
29
30function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
32function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
34function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
36function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
38var Table =
39/*#__PURE__*/
40function (_React$Component) {
41 _inherits(Table, _React$Component);
42
43 function Table() {
44 _classCallCheck(this, Table);
45
46 return _possibleConstructorReturn(this, _getPrototypeOf(Table).apply(this, arguments));
47 }
48
49 _createClass(Table, [{
50 key: "render",
51 value: function render() {
52 return React.createElement(_styledComponents.StyledTable, {
53 "data-baseweb": "table",
54 "aria-colcount": this.props.columns.length,
55 "aria-rowcount": this.props.data.length
56 }, this.props.isLoading && React.createElement(_index.ProgressBar, {
57 infinite: true,
58 overrides: {
59 Bar: {
60 style: {
61 marginBottom: 0,
62 marginLeft: 0,
63 marginRight: 0,
64 marginTop: 0
65 }
66 }
67 }
68 }), React.createElement(_styledComponents.StyledHead, {
69 $width: this.props.horizontalScrollWidth
70 }, this.props.columns.map(function (column, index) {
71 return React.createElement(_styledComponents.StyledHeadCell, {
72 key: index
73 }, column);
74 })), React.createElement(_styledComponents.StyledBody, {
75 $width: this.props.horizontalScrollWidth
76 }, this.props.data.map(function (row, index) {
77 return React.createElement(_styledComponents.StyledRow, {
78 key: index
79 }, row.map(function (cell, cellIndex) {
80 return React.createElement(_styledComponents.StyledCell, {
81 key: cellIndex
82 }, cell);
83 }));
84 })));
85 }
86 }]);
87
88 return Table;
89}(React.Component);
90
91exports.default = Table;
92
93_defineProperty(Table, "defaultProps", {
94 columns: [],
95 data: [[]],
96 isLoading: false
97});
\No newline at end of file