@commonsku/styles 1.17.22 → 1.17.23

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/dist/index.cjs CHANGED
@@ -7175,7 +7175,7 @@ function InputStepper(props) {
7175
7175
  var templateObject_1$c, templateObject_2$1, templateObject_3, templateObject_4;
7176
7176
 
7177
7177
  var VirtualTable = function (props) {
7178
- var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? '' : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent, onSort = props.onSort; props.onResize; var rowGroupStyles = props.rowGroupStyles, rowStyles = props.rowStyles, _k = props.gutterSize, gutterSize = _k === void 0 ? 0 : _k, _l = props.customTableFooterProps, customTableFooterProps = _l === void 0 ? {} : _l, TableFooter = props.TableFooter;
7178
+ var columns = props.columns, data = props.data, itemSize = props.itemSize, _a = props.height, height = _a === void 0 ? 500 : _a, _b = props.minWidth, minWidth = _b === void 0 ? 140 : _b, _c = props.maxWidth, maxWidth = _c === void 0 ? 500 : _c, defaultSort = props.defaultSort, onClickRow = props.onClickRow, onScroll = props.onScroll, onUpdateData = props.onUpdateData, _d = props.useTableProps, useTableProps = _d === void 0 ? {} : _d, _e = props.tableHeaderProps, tableHeaderProps = _e === void 0 ? {} : _e, _f = props.tableFooterProps, tableFooterProps = _f === void 0 ? {} : _f, _g = props.hideFooter, hideFooter = _g === void 0 ? true : _g, _h = props.hideHeader, hideHeader = _h === void 0 ? false : _h, _j = props.className, className = _j === void 0 ? '' : _j, NoRowsFound = props.NoRowsFound, renderRowSubComponent = props.renderRowSubComponent; props.onResize; var rowGroupStyles = props.rowGroupStyles, rowStyles = props.rowStyles, _k = props.gutterSize, gutterSize = _k === void 0 ? 0 : _k, _l = props.customTableFooterProps, customTableFooterProps = _l === void 0 ? {} : _l, TableFooter = props.TableFooter, onSortChange = props.onSortChange;
7179
7179
  var defaultColumn = React.useMemo(function () { return ({
7180
7180
  minWidth: minWidth,
7181
7181
  maxWidth: maxWidth,
@@ -7190,6 +7190,7 @@ var VirtualTable = function (props) {
7190
7190
  var footerRef = React.useRef(null);
7191
7191
  var rowsRef = React.useRef(null);
7192
7192
  var listRef = React.useRef(null);
7193
+ var sortBy = tableData.state.sortBy;
7193
7194
  function resetList(index) {
7194
7195
  if (index === void 0) { index = 0; }
7195
7196
  listRef.current && listRef.current.resetAfterIndex(index);
@@ -7205,8 +7206,7 @@ var VirtualTable = function (props) {
7205
7206
  var _a;
7206
7207
  listRef.current && listRef.current.resetAfterIndex(0);
7207
7208
  (_a = column.toggleSortBy) === null || _a === void 0 ? void 0 : _a.call(column);
7208
- onSort && onSort({ column: column });
7209
- }, [onSort]);
7209
+ }, []);
7210
7210
  function onListScroll(e) {
7211
7211
  if (headerRef.current && e && e.target) {
7212
7212
  var target = e.target;
@@ -7284,11 +7284,27 @@ var VirtualTable = function (props) {
7284
7284
  setScrolledToBottom(Math.round(rows.scrollTop) >= rows.scrollHeight - rows.offsetHeight);
7285
7285
  }
7286
7286
  }, [onScroll]);
7287
- return (React__default.default.createElement("div", __assign({}, getTableProps(), { className: "table ".concat(className || '') }),
7288
- React__default.default.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ''), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: 'none' } : {})) }), headerGroups.map(function (headerGroup) { return (React__default.default.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth, } }), headerGroup.headers.map(function (column) { return (React__default.default.createElement("div", __assign({}, getHeaderProps(column, false), { className: "th", onClick: function () { return handleSort(column); } }),
7287
+ var renderTableHeader = React.useCallback(function () {
7288
+ var sortIconDirection = function (column) { return column.isSorted
7289
+ ? sortDirection(column)
7290
+ : "updown"; };
7291
+ return (React__default.default.createElement("div", __assign({}, tableHeaderProps, { className: "thead ".concat(tableHeaderProps.className || ""), style: __assign(__assign({}, (tableHeaderProps.style || {})), (hideHeader ? { display: "none" } : {})) }), headerGroups.map(function (headerGroup) { return (React__default.default.createElement("div", __assign({}, getHeaderGroupProps(headerGroup, false), { ref: headerRef, style: { width: tableWidth } }), headerGroup.headers.map(function (column) { return (React__default.default.createElement("div", __assign({}, getHeaderProps(column, false), { className: "th", onClick: function () { return handleSort(column); } }),
7289
7292
  column.render("Header"),
7290
- React__default.default.createElement("span", null, column.canSort &&
7291
- React__default.default.createElement(FilledChevronIcon, { direction: column.isSorted ? sortDirection(column) : 'updown', size: "medium", style: { verticalAlign: 'middle' } })))); }))); })),
7293
+ React__default.default.createElement("span", null, column.canSort && (React__default.default.createElement(FilledChevronIcon, { direction: sortIconDirection(column), size: "medium", style: { verticalAlign: "middle" } }))))); }))); })));
7294
+ }, [
7295
+ getHeaderGroupProps,
7296
+ getHeaderProps,
7297
+ handleSort,
7298
+ headerGroups,
7299
+ hideHeader,
7300
+ tableHeaderProps,
7301
+ tableWidth,
7302
+ ]);
7303
+ React.useEffect(function () {
7304
+ onSortChange && onSortChange({ sortBy: sortBy });
7305
+ }, [sortBy]);
7306
+ return (React__default.default.createElement("div", __assign({}, getTableProps(), { className: "table ".concat(className || '') }),
7307
+ renderTableHeader(),
7292
7308
  React__default.default.createElement("div", __assign({ className: "tbody" }, getTableBodyProps()), rows.length === 0 && NoRowsFound ? React__default.default.createElement(NoRowsFound, null) :
7293
7309
  React__default.default.createElement("div", { className: "scroll-container" },
7294
7310
  !scrolledToTop &&