grep-components 1.22.0-GREPF-2004.1 → 1.23.0

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.
@@ -44,6 +44,7 @@ export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHead
44
44
  rowHeight?: number;
45
45
  disableSelectOnClick?: boolean;
46
46
  underlineOnFocus?: boolean;
47
+ rowTabIndex?: number;
47
48
  }
48
49
  interface StyleProps {
49
50
  outlined?: boolean;
@@ -67,6 +68,6 @@ export declare const useStyles: (params: StyleProps, styleOverrides?: {
67
68
  * @todo enhance page handling
68
69
  *
69
70
  */
70
- export declare const GrepTable: <T>({ placeholderText, dropdownItems, isRowDisabled, pagination, outlined, columns, header, data, onSelectedRowChange, sortBy, sortDirection, onSortBy, onRowClick, size, caption, stickyHeader, padding, disableSelectOnClick, menuButtonLabel, underlineOnFocus, ...props }: GrepTableProps<T>) => JSX.Element;
71
+ export declare const GrepTable: <T>({ placeholderText, dropdownItems, isRowDisabled, pagination, outlined, columns, header, data, onSelectedRowChange, sortBy, sortDirection, onSortBy, onRowClick, size, caption, stickyHeader, padding, disableSelectOnClick, menuButtonLabel, underlineOnFocus, rowTabIndex, ...props }: GrepTableProps<T>) => JSX.Element;
71
72
  export { GrepTableRow };
72
73
  export default GrepTable;
package/dist/index.js CHANGED
@@ -3126,8 +3126,7 @@ var CollapsableMenu = function (_a) {
3126
3126
  var TooltipMenuItem = function (_a) {
3127
3127
  var children = _a.children, tooltipText = _a.tooltipText, disabled = _a.disabled, props = __rest$1(_a, ["children", "tooltipText", "disabled"]);
3128
3128
  return (React__default.createElement(Tooltip, { title: tooltipText },
3129
- React__default.createElement("span", null,
3130
- React__default.createElement(MenuItem, __assign({ role: "menuitem", disabled: disabled }, props), children))));
3129
+ React__default.createElement(MenuItem, __assign({ role: "menuitem", disabled: disabled, sx: { pointerEvents: 'inherit !important' } }, props), children)));
3131
3130
  };
3132
3131
 
3133
3132
  var useStyles$g = makeStyles()(function (_a, _b) {
@@ -3495,7 +3494,7 @@ var GrepTableRow = function (_a) {
3495
3494
  var render = function (column, index) { return (React__default.createElement(GrepTableRow$1, __assign({ key: index }, { column: column, row: row, variant: variant, selected: selected }))); };
3496
3495
  return (React__default.createElement(TableRow, __assign({ sx: {
3497
3496
  ':focus': { textDecoration: underlineOnFocus ? 'underline' : 'none' },
3498
- } }, __assign({ selected: selected }, props)), columns.map(render)));
3497
+ }, tabIndex: props.tabIndex }, __assign({ selected: selected }, props)), columns.map(render)));
3499
3498
  };
3500
3499
 
3501
3500
  var usePaginationActionStyles = makeStyles()(function (_a) {
@@ -3663,7 +3662,7 @@ var getElementIndex = function (el) {
3663
3662
  *
3664
3663
  */
3665
3664
  var GrepTable = function (_a) {
3666
- var placeholderText = _a.placeholderText, dropdownItems = _a.dropdownItems, isRowDisabled = _a.isRowDisabled, pagination = _a.pagination, outlined = _a.outlined, columns = _a.columns, header = _a.header, data = _a.data, onSelectedRowChange = _a.onSelectedRowChange, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, onRowClick = _a.onRowClick, size = _a.size, caption = _a.caption, stickyHeader = _a.stickyHeader, padding = _a.padding, _b = _a.disableSelectOnClick, disableSelectOnClick = _b === void 0 ? false : _b, menuButtonLabel = _a.menuButtonLabel, underlineOnFocus = _a.underlineOnFocus, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick", "menuButtonLabel", "underlineOnFocus"]);
3665
+ var placeholderText = _a.placeholderText, dropdownItems = _a.dropdownItems, isRowDisabled = _a.isRowDisabled, pagination = _a.pagination, outlined = _a.outlined, columns = _a.columns, header = _a.header, data = _a.data, onSelectedRowChange = _a.onSelectedRowChange, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, onRowClick = _a.onRowClick, size = _a.size, caption = _a.caption, stickyHeader = _a.stickyHeader, padding = _a.padding, _b = _a.disableSelectOnClick, disableSelectOnClick = _b === void 0 ? false : _b, menuButtonLabel = _a.menuButtonLabel, underlineOnFocus = _a.underlineOnFocus, rowTabIndex = _a.rowTabIndex, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick", "menuButtonLabel", "underlineOnFocus", "rowTabIndex"]);
3667
3666
  var _c = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _c[0], setRowsPerPage = _c[1];
3668
3667
  var _d = __read(React__default.useState(null), 2), menuAnchor = _d[0], setMenuAnchor = _d[1];
3669
3668
  var _e = __read(React__default.useState(0), 2), currentPage = _e[0], _setCurrentPage = _e[1];
@@ -3752,7 +3751,7 @@ var GrepTable = function (_a) {
3752
3751
  var clickableRows = !!onRowClick;
3753
3752
  var disabled = isRowDisabled && isRowDisabled(row);
3754
3753
  var rowIndex = index + currentPage * rowsPerPage;
3755
- return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, clickable: clickableRows, onMouseDown: function (_a) {
3754
+ return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex !== null && rowTabIndex !== void 0 ? rowTabIndex : 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, clickable: clickableRows, onMouseDown: function (_a) {
3756
3755
  var currentTarget = _a.currentTarget;
3757
3756
  setSelectedElement(currentTarget);
3758
3757
  if (!disableSelectOnClick) {
@@ -4092,16 +4091,13 @@ var GrepSelect = function (props) {
4092
4091
  } }, label),
4093
4092
  React.createElement(Select, __assign({}, rest, { inputProps: __assign({ id: id }, inputProps), disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
4094
4093
  // @todo: make input respect label length
4095
- input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: {
4096
- anchorOrigin: {
4094
+ input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: __assign(__assign({}, rest.MenuProps), { anchorOrigin: {
4097
4095
  vertical: 'bottom',
4098
4096
  horizontal: 'center',
4099
- },
4100
- transformOrigin: {
4097
+ }, transformOrigin: {
4101
4098
  vertical: 'top',
4102
4099
  horizontal: 'center',
4103
- },
4104
- } }),
4100
+ } }) }),
4105
4101
  unselectOption && (React.createElement(MenuItem, { value: "" },
4106
4102
  React.createElement("em", null, "Fjern valgt"))),
4107
4103
  selectItems.map(function (_a, i) {
@@ -21909,7 +21905,7 @@ var GrepTableOfContentNav = function (props) {
21909
21905
  });
21910
21906
  }, [ref]);
21911
21907
  var onKeyDown = function (e) {
21912
- if (selected && e.which === Key_enum.Key.Tab) {
21908
+ if (selected && e.which === Key_enum.Key.Tab && e.shiftKey === false) {
21913
21909
  var tabindex_1 = selected.getAttribute('tabindex');
21914
21910
  selected.setAttribute('tabindex', '0');
21915
21911
  selected.focus();