@nest-ui/table
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -13,5 +13,6 @@ # CHANGELOG | ||
<!-- Start of Current Changelog --> | ||
## 0.x.x `yyyy-mm-dd` | ||
### New Components | ||
#### Component Name | ||
## 0.0.1 `2023-02-08` | ||
### Initial Release | ||
#### Table | ||
- :rocket: Nest Table [#102](https://github.com/tokopedia/nest/pull/102) | ||
<!-- End of Current Changelog --> |
@@ -22,3 +22,3 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
borderInlineStart: bordered ? "1px solid ".concat(borderColor) : undefined | ||
}, process.env.NODE_ENV === "production" ? "" : ";label:cssWrapper;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFTIiwiZmlsZSI6InN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHR5cGUgeyBUaGVtZSB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCBtZWRpYVN0eWxlIGZyb20gJ0AvdXRpbHMvbWVkaWFTdHlsZSc7XG5pbXBvcnQgdHlwZSB7IFRhYmxlU2Nyb2xsQXJlYSB9IGZyb20gJ0AvdHlwZSc7XG5cbmV4cG9ydCBjb25zdCBjc3NXcmFwcGVyID0gKHNjcm9sbEFyZWE6IFRhYmxlU2Nyb2xsQXJlYSwgYm9yZGVyZWQ6IGJvb2xlYW4pID0+ICh0aGVtZTogVGhlbWUpID0+IHtcbiAgY29uc3QgYm9yZGVyQ29sb3IgPSB0aGVtZVsndGFibGUtYm9yZGVyQ29sb3InXSB8fCAnI0U1RTdFOSc7XG5cbiAgcmV0dXJuI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sndGFibGUtaGVhZEZvbnRDb2xvciddIHx8ICcjMjEyMTIxJztcbiAgY29uc3QgZm9udENvbG9yID0gdGhlbWVbJ3RhYmxlLWZvbnRDb2xvciddO1xuXG4gIHJldHVybiBjc3MoXG4gICAge1xuICAgICAgY29sb3I6IGZvbnRDb2xvcixcbiAgICAgIHdpZHRoOiBzY3JvbGxBcmVhLngsXG4gICAgICBtaW5XaWR0aDogJzEwMCUnLFxuICAgICAgcG9zaXRpb246ICdyZWxhdGl2ZScsXG4gICAgICBib3JkZXJDb2xsYXBzZTogJ3NlcGFyYXRlJyxcbiAgICAgIGJvcmRlclNwYWNpbmc6IDAsXG4gICAgICAnPnRoZWFkLCA+dGJvZHknOiB7XG4gICAgICAgICc+dHInOiB7XG4gICAgICAgICAgJz50aCwgPnRkJzoge1xuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yLFxuICAgICAgICAgICAgdGV4dEFsaWduOiAnbGVmdCcsXG4gICAgICAgICAgICBib3JkZXJCb3R0b206IGAxcHggc29saWQgJHtib3JkZXJDb2xvcn1gLFxuICAgICAgICAgICAgYm9yZGVySW5saW5lRW5kOiBib3JkZXJlZCA/IGAxcHggc29saWQgJHtib3JkZXJDb2xvcn1gIDogdW5kZWZpbmVkLFxuICAgICAgICAgICAgJyZbY29sc3Bhbj1cIjBcIl0sICZbcm93c3Bhbj1cIjBcIl0nOiB7IGRpc3BsYXk6ICdub25lJyB9LFxuICAgICAgICAgICAgJyZbZGF0YS1uLWFsaWduPVwibGVmdFwiXSc6IHsgdGV4dEFsaWduOiAnbGVmdCcgfSxcbiAgICAgICAgICAgICcmW2RhdGEtbi1hbGlnbj1cImNlbnRlclwiXSc6IHsgdGV4dEFsaWduOiAnY2VudGVyJyB9LFxuICAgICAgICAgICAgJyZbZGF0YS1uLWFsaWduPVwicmlnaHRcIl0nOiB7IHRleHRBbGlnbjogJ3JpZ2h0JyB9LFxuICAgICAgICAgICAgJyZbZGF0YS1uLXN0aWNreV0nOiB7XG4gICAgICAgICAgICAgIC8vIGNvbHVtbiBzdGlja3lcbiAgICAgICAgICAgICAgcG9zaXRpb246ICdzdGlja3knLFxuICAgICAgICAgICAgICB6SW5kZXg6IDEsXG4gICAgICAgICAgICAgIHRyYW5zaXRpb246ICdib3gtc2hhZG93IC4ycyBlYXNlLW91dCcsXG4gICAgICAgICAgICAgICcmW2RhdGEtbi1sc2hhZG93PVwidHJ1ZVwiXSc6IHsgYm94U2hhZG93OiAnOHB4IDBweCA4cHggMHB4IHJnYig1IDUgNSAvIDYlKScgfSxcbiAgICAgICAgICAgICAgJyZbZGF0YS1uLXJzaGFkb3c9XCJ0cnVlXCJdJzogeyBib3hTaGFkb3c6ICctOHB4IDBweCA4cHggMHB4IHJnYig1IDUgNSAvIDYlKScgfSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgICAnPnRoZWFkJzoge1xuICAgICAgICBjb2xvcjogaGVhZEZvbnRDb2xvcixcbiAgICAgICAgJz50ciA+dGgnOiB7IGJhY2tncm91bmRDb2xvcjogaGVhZEJnQ29sb3IgfSxcbiAgICAgICAgJyZbZGF0YS1uLXN0aWNreV0nOiB7XG4gICAgICAgICAgdG9wOiAwLFxuICAgICAgICAgIHBvc2l0aW9uOiAnc3RpY2t5JyxcbiAgICAgICAgICB6SW5kZXg6IDIsXG4gICAgICAgIH0sXG4gICAgICAgICc+dHI6Zmlyc3Qtb2YtdHlwZSA+dGgnOiB7IGJvcmRlclRvcDogYDFweCBzb2xpZCAke2JvcmRlckNvbG9yfWAgfSxcbiAgICAgIH0sXG4gICAgICAnPnRib2R5Jzoge1xuICAgICAgICAnPnRyW2RhdGEtbi1leHBhbmRdID50ZCc6IHsgYmFja2dyb3VuZENvbG9yOiBleHBhbmRCZ0NvbG9yIH0sXG4gICAgICAgICc+dHI6aG92ZXIgPnRkJzogeyBiYWNrZ3JvdW5kQ29sb3I6IGJnQ29sb3JIb3ZlciB9LFxuICAgICAgfSxcbiAgICB9LFxuICAgIC4uLmJyZWFrcG9pbnRzLm1hcChcbiAgICAgIG1lZGlhU3R5bGUoaWR4ID0+ICh7XG4gICAgICAgIGZvbnRTaXplOiBmb250U2l6ZVtpZHhdLFxuICAgICAgICBsaW5lSGVpZ2h0OiBsaW5lSGVpZ2h0W2lkeF0sXG4gICAgICAgICc+dGhlYWQsID50Ym9keSc6IHtcbiAgICAgICAgICAnPnRyJzoge1xuICAgICAgICAgICAgJz50aCwgPnRkJzogeyBwYWRkaW5nOiBjZWxsUGFkZGluZ1tpZHhdIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0pKSxcbiAgICApLFxuICApO1xufTtcbiJdfQ== */"); | ||
}, process.env.NODE_ENV === "production" ? "" : ";label:cssWrapper;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFTIiwiZmlsZSI6InN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHR5cGUgeyBUaGVtZSB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCBtZWRpYVN0eWxlIGZyb20gJ0AvdGFibGUvdXRpbHMvbWVkaWFTdHlsZSc7XG5pbXBvcnQgdHlwZSB7IFRhYmxlU2Nyb2xsQXJlYSB9IGZyb20gJ0AvdGFibGUvdHlwZSc7XG5cbmV4cG9ydCBjb25zdCBjc3NXcmFwcGVyID0gKHNjcm9sbEFyZWE6IFRhYmxlU2Nyb2xsQXJlYSwgYm9yZGVyZWQ6IGJvb2xlYW4pID0+ICh0aGVtZTogVGhlbWUpID0+IHtcbiAgY29uc3QgYm9yZGVyQ29sb3IgPSB0aGVtZVsndGFibGUtYm9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ENvbG9yJ107XG4gIGNvbnN0IGhlYWRGb250Q29sb3IgPSB0aGVtZVsndGFibGUtaGVhZEZvbnRDb2xvciddIHx8ICcjMjEyMTIxJztcbiAgY29uc3QgZm9udENvbG9yID0gdGhlbWVbJ3RhYmxlLWZvbnRDb2xvciddO1xuXG4gIHJldHVybiBjc3MoXG4gICAge1xuICAgICAgY29sb3I6IGZvbnRDb2xvcixcbiAgICAgIHdpZHRoOiBzY3JvbGxBcmVhLngsXG4gICAgICBtaW5XaWR0aDogJzEwMCUnLFxuICAgICAgcG9zaXRpb246ICdyZWxhdGl2ZScsXG4gICAgICBib3JkZXJDb2xsYXBzZTogJ3NlcGFyYXRlJyxcbiAgICAgIGJvcmRlclNwYWNpbmc6IDAsXG4gICAgICAnPnRoZWFkLCA+dGJvZHknOiB7XG4gICAgICAgICc+dHInOiB7XG4gICAgICAgICAgJz50aCwgPnRkJzoge1xuICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yLFxuICAgICAgICAgICAgdGV4dEFsaWduOiAnbGVmdCcsXG4gICAgICAgICAgICBib3JkZXJCb3R0b206IGAxcHggc29saWQgJHtib3JkZXJDb2xvcn1gLFxuICAgICAgICAgICAgYm9yZGVySW5saW5lRW5kOiBib3JkZXJlZCA/IGAxcHggc29saWQgJHtib3JkZXJDb2xvcn1gIDogdW5kZWZpbmVkLFxuICAgICAgICAgICAgJyZbY29sc3Bhbj1cIjBcIl0sICZbcm93c3Bhbj1cIjBcIl0nOiB7IGRpc3BsYXk6ICdub25lJyB9LFxuICAgICAgICAgICAgJyZbZGF0YS1uLWFsaWduPVwibGVmdFwiXSc6IHsgdGV4dEFsaWduOiAnbGVmdCcgfSxcbiAgICAgICAgICAgICcmW2RhdGEtbi1hbGlnbj1cImNlbnRlclwiXSc6IHsgdGV4dEFsaWduOiAnY2VudGVyJyB9LFxuICAgICAgICAgICAgJyZbZGF0YS1uLWFsaWduPVwicmlnaHRcIl0nOiB7IHRleHRBbGlnbjogJ3JpZ2h0JyB9LFxuICAgICAgICAgICAgJyZbZGF0YS1uLXN0aWNreV0nOiB7XG4gICAgICAgICAgICAgIC8vIGNvbHVtbiBzdGlja3lcbiAgICAgICAgICAgICAgcG9zaXRpb246ICdzdGlja3knLFxuICAgICAgICAgICAgICB6SW5kZXg6IDEsXG4gICAgICAgICAgICAgIHRyYW5zaXRpb246ICdib3gtc2hhZG93IC4ycyBlYXNlLW91dCcsXG4gICAgICAgICAgICAgICcmW2RhdGEtbi1sc2hhZG93PVwidHJ1ZVwiXSc6IHsgYm94U2hhZG93OiAnOHB4IDBweCA4cHggMHB4IHJnYig1IDUgNSAvIDYlKScgfSxcbiAgICAgICAgICAgICAgJyZbZGF0YS1uLXJzaGFkb3c9XCJ0cnVlXCJdJzogeyBib3hTaGFkb3c6ICctOHB4IDBweCA4cHggMHB4IHJnYig1IDUgNSAvIDYlKScgfSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgICAnPnRoZWFkJzoge1xuICAgICAgICBjb2xvcjogaGVhZEZvbnRDb2xvcixcbiAgICAgICAgJz50ciA+dGgnOiB7IGJhY2tncm91bmRDb2xvcjogaGVhZEJnQ29sb3IgfSxcbiAgICAgICAgJyZbZGF0YS1uLXN0aWNreV0nOiB7XG4gICAgICAgICAgdG9wOiAwLFxuICAgICAgICAgIHBvc2l0aW9uOiAnc3RpY2t5JyxcbiAgICAgICAgICB6SW5kZXg6IDIsXG4gICAgICAgIH0sXG4gICAgICAgICc+dHI6Zmlyc3Qtb2YtdHlwZSA+dGgnOiB7IGJvcmRlclRvcDogYDFweCBzb2xpZCAke2JvcmRlckNvbG9yfWAgfSxcbiAgICAgIH0sXG4gICAgICAnPnRib2R5Jzoge1xuICAgICAgICAnPnRyW2RhdGEtbi1leHBhbmRdID50ZCc6IHsgYmFja2dyb3VuZENvbG9yOiBleHBhbmRCZ0NvbG9yIH0sXG4gICAgICAgICc+dHI6aG92ZXIgPnRkJzogeyBiYWNrZ3JvdW5kQ29sb3I6IGJnQ29sb3JIb3ZlciB9LFxuICAgICAgfSxcbiAgICB9LFxuICAgIC4uLmJyZWFrcG9pbnRzLm1hcChcbiAgICAgIG1lZGlhU3R5bGUoaWR4ID0+ICh7XG4gICAgICAgIGZvbnRTaXplOiBmb250U2l6ZVtpZHhdLFxuICAgICAgICBsaW5lSGVpZ2h0OiBsaW5lSGVpZ2h0W2lkeF0sXG4gICAgICAgICc+dGhlYWQsID50Ym9keSc6IHtcbiAgICAgICAgICAnPnRyJzoge1xuICAgICAgICAgICAgJz50aCwgPnRkJzogeyBwYWRkaW5nOiBjZWxsUGFkZGluZ1tpZHhdIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0pKSxcbiAgICApLFxuICApO1xufTtcbiJdfQ== */"); | ||
}; | ||
@@ -25,0 +25,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
import type noop from '@/utils/noop'; | ||
import type { Interpolation, Theme } from '@emotion/react'; | ||
import type { HTMLAttributes, ReactElement, ReactNode, Ref, TdHTMLAttributes, ThHTMLAttributes } from 'react'; | ||
import type noop from './utils/noop'; | ||
declare type CSSAttr<Element> = Element & { | ||
@@ -5,0 +5,0 @@ css?: Interpolation<Theme>; |
@@ -1,2 +0,2 @@ | ||
declare const Table: TableComponent; | ||
export default Table; | ||
export { default as Table } from './dist/Table'; | ||
export type { TableColumnsProps, TableExpandable, TableScrollArea, TableDataTree, TableProps, TableComponent, } from './dist/type'; |
222
index.js
@@ -1,221 +0,1 @@ | ||
var _excluded = ["bordered", "columns", "data", "dataTree", "expandable", "headerRowProps", "rowKey", "rowProps", "scrollArea", "sticky", "tableProps"]; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
function _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; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
import { useEffect, useRef, Fragment, memo, forwardRef } from 'react'; | ||
import noop from "./dist/utils/noop"; | ||
import emotionClone from "./dist/utils/emotionClone"; | ||
import { calcColSpan, calcMaxRow, initStickyCell } from "./dist/utils/table"; | ||
import { cssTable, cssWrapper } from "./dist/style"; // recursive to render column children from column group | ||
import { jsx as _jsx } from "@emotion/react/jsx-runtime"; | ||
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime"; | ||
var renderColGroup = function renderColGroup(columns) { | ||
return _jsx(_Fragment, { | ||
children: columns.map(function (column) { | ||
if (column.children) return _jsx(Fragment, { | ||
children: renderColGroup(column.children) | ||
}, column.key); | ||
return _jsx("col", { | ||
style: { | ||
width: column.width | ||
} | ||
}, column.key); | ||
}) | ||
}); | ||
}; // recursive to render headerRow for column group | ||
var renderHeader = function renderHeader(columns) { | ||
var headerRowProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; | ||
var maxRow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var row = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; | ||
var currMaxRow = maxRow || calcMaxRow(columns); | ||
var nextRowArr = []; | ||
var trProps = headerRowProps(columns, row); | ||
return _jsxs(Fragment, { | ||
children: [_jsx("tr", _objectSpread(_objectSpread({}, trProps), {}, { | ||
children: columns.map(function (column) { | ||
var align = column.align; | ||
if (column.children) { | ||
nextRowArr.push.apply(nextRowArr, _toConsumableArray(column.children)); | ||
align = align || 'center'; | ||
} | ||
return _jsx("th", _objectSpread(_objectSpread({ | ||
colSpan: calcColSpan(column), | ||
"data-n-align": align, | ||
"data-n-sticky": column.sticky || undefined, | ||
rowSpan: column.children ? 1 : currMaxRow - row | ||
}, column.headerCellProps), {}, { | ||
children: column.title | ||
}), column.key); | ||
}) | ||
})), nextRowArr.length > 0 && renderHeader(nextRowArr, headerRowProps, currMaxRow, row + 1)] | ||
}); | ||
}; // recursive to render column children from column group | ||
var renderColumns = function renderColumns(columns, rowData, rowIdx, treeLevel) { | ||
return _jsx(_Fragment, { | ||
children: columns.map(function (column) { | ||
var _column$cellProps = column.cellProps, | ||
cellProps = _column$cellProps === void 0 ? noop : _column$cellProps, | ||
children = column.children, | ||
dataKey = column.dataKey, | ||
key = column.key, | ||
render = column.render, | ||
treeIndent = column.treeIndent; | ||
if (children) return _jsx(Fragment, { | ||
children: renderColumns(children, rowData, rowIdx, treeLevel) | ||
}, key); | ||
return _jsxs("td", _objectSpread(_objectSpread({ | ||
"data-n-align": column.align || undefined, | ||
"data-n-sticky": column.sticky || undefined | ||
}, cellProps(rowData, rowIdx)), {}, { | ||
children: [Boolean(treeLevel) && treeIndent && _jsx("span", { | ||
style: { | ||
paddingLeft: "".concat(treeLevel * treeIndent, "px") | ||
} | ||
}), render ? render(rowData[dataKey || key], rowData) : "".concat(rowData[dataKey || key])] | ||
}), key); | ||
}) | ||
}); | ||
}; // recursive to render row children for data tree | ||
var renderRow = function renderRow(_ref) { | ||
var columns = _ref.columns, | ||
_ref$columnsLength = _ref.columnsLength, | ||
columnsLength = _ref$columnsLength === void 0 ? 0 : _ref$columnsLength, | ||
data = _ref.data, | ||
dataTree = _ref.dataTree, | ||
expandable = _ref.expandable, | ||
rowKey = _ref.rowKey, | ||
_ref$rowProps = _ref.rowProps, | ||
rowProps = _ref$rowProps === void 0 ? noop : _ref$rowProps, | ||
_ref$treeLevel = _ref.treeLevel, | ||
treeLevel = _ref$treeLevel === void 0 ? 0 : _ref$treeLevel; | ||
var currColumnsLength = columnsLength || columns.reduce(function (prev, column) { | ||
return calcColSpan(column, prev); | ||
}, 0); | ||
return _jsx(_Fragment, { | ||
children: data.map(function (rowData, idx) { | ||
var expandableJsx; | ||
if (expandable && (expandable.expanded ? expandable.expanded(rowData, idx) : true)) { | ||
expandableJsx = expandable.render(rowData, idx); | ||
expandableJsx = expandableJsx && _jsxs("tr", _objectSpread(_objectSpread({ | ||
"data-n-expand": true | ||
}, (expandable.rowProps || noop)(rowData, idx)), {}, { | ||
children: [expandable.startAfterCol && _jsx("td", { | ||
colSpan: expandable.startAfterCol | ||
}), _jsx("td", _objectSpread(_objectSpread({ | ||
colSpan: currColumnsLength - (expandable.startAfterCol || 0) | ||
}, (expandable.cellProps || noop)(rowData, idx)), {}, { | ||
children: expandableJsx | ||
}))] | ||
})); | ||
} | ||
return _jsxs(Fragment, { | ||
children: [_jsx("tr", _objectSpread(_objectSpread({}, rowProps(rowData, idx)), {}, { | ||
children: renderColumns(columns, rowData, idx, treeLevel) | ||
})), expandableJsx, dataTree && (dataTree.expanded ? dataTree.expanded(rowData, idx) : true) && renderRow({ | ||
columns: columns, | ||
columnsLength: currColumnsLength, | ||
data: rowData[dataTree.childKey] || [], | ||
dataTree: dataTree, | ||
expandable: expandable, | ||
rowKey: rowKey, | ||
rowProps: rowProps, | ||
treeLevel: treeLevel + 1 | ||
})] | ||
}, rowData[rowKey]); | ||
}) | ||
}); | ||
}; | ||
var _Table = /*#__PURE__*/forwardRef(function (props, ref) { | ||
var _props$bordered = props.bordered, | ||
bordered = _props$bordered === void 0 ? false : _props$bordered, | ||
_props$columns = props.columns, | ||
columns = _props$columns === void 0 ? [] : _props$columns, | ||
_props$data = props.data, | ||
data = _props$data === void 0 ? [] : _props$data, | ||
dataTree = props.dataTree, | ||
expandable = props.expandable, | ||
headerRowProps = props.headerRowProps, | ||
_props$rowKey = props.rowKey, | ||
rowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey, | ||
rowProps = props.rowProps, | ||
_props$scrollArea = props.scrollArea, | ||
scrollArea = _props$scrollArea === void 0 ? {} : _props$scrollArea, | ||
sticky = props.sticky, | ||
tableProps = props.tableProps, | ||
restProps = _objectWithoutProperties(props, _excluded); | ||
var table = useRef(null); | ||
useEffect(function () { | ||
var tableDOM = table.current; | ||
if (tableDOM) { | ||
var stickyCell = initStickyCell(tableDOM); | ||
return stickyCell.destroy; | ||
} | ||
return; // reinitiate when table config updates | ||
}, [data, columns, scrollArea]); | ||
return _jsx("div", _objectSpread(_objectSpread({ | ||
ref: ref, | ||
css: cssWrapper(scrollArea, bordered) | ||
}, restProps), {}, { | ||
children: emotionClone(_jsxs("table", _objectSpread(_objectSpread({ | ||
ref: table | ||
}, tableProps), {}, { | ||
children: [_jsx("colgroup", { | ||
children: renderColGroup(columns) | ||
}), _jsx("thead", { | ||
"data-n-sticky": sticky ? '' : undefined, | ||
children: renderHeader(columns, headerRowProps) | ||
}), _jsx("tbody", { | ||
children: renderRow({ | ||
data: data, | ||
columns: columns, | ||
rowKey: rowKey, | ||
rowProps: rowProps, | ||
expandable: expandable, | ||
dataTree: dataTree | ||
}) | ||
})] | ||
})), { | ||
css: cssTable(scrollArea, bordered) | ||
}) | ||
})); | ||
}); | ||
var Table = /*#__PURE__*/memo(_Table); | ||
export default Table; | ||
export { default as Table } from "./dist/Table"; |
{ | ||
"name": "@nest-ui/table", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "NEST Table", | ||
@@ -9,3 +9,3 @@ "license": "ISC", | ||
"scripts": { | ||
"build": "sh ../../scripts/build/prebuild-single.sh", | ||
"build": "sh ../../scripts/build/prebuild-single.sh --table", | ||
"build:clean": "pnpm run clean && pnpm run build", | ||
@@ -12,0 +12,0 @@ "clean": "rm -rf dist index.js index.d.ts style.js style.d.ts type.d.ts", |
@@ -7,3 +7,3 @@ # Nest Table | ||
`$ npm i @nest-ui/table` | ||
`$ npm i @nest-ui/table @emotion/react@^11.10.4` | ||
@@ -13,3 +13,3 @@ ## Basic usage | ||
```jsx | ||
import Table from '@nest-ui/table'; | ||
import { Table } from '@nest-ui/table'; | ||
@@ -16,0 +16,0 @@ const Greetings = () => { |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
34009
18
538