grep-components 1.26.0-GREPF-2165.1 → 1.26.0-GREPF-2165.2
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/components/GrepTable/index.d.ts +2 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHead
|
|
|
43
43
|
* @deprecated No longer in use.
|
|
44
44
|
*/
|
|
45
45
|
rowHeight?: number;
|
|
46
|
+
rowStyle?: React.CSSProperties | ((data: any, index: number) => React.CSSProperties);
|
|
46
47
|
disableSelectOnClick?: boolean;
|
|
47
48
|
underlineOnFocus?: boolean;
|
|
48
49
|
rowTabIndex?: number;
|
|
@@ -69,6 +70,6 @@ export declare const useStyles: (params: StyleProps, styleOverrides?: {
|
|
|
69
70
|
* @todo enhance page handling
|
|
70
71
|
*
|
|
71
72
|
*/
|
|
72
|
-
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, rowsPerPageOptions, ...props }: GrepTableProps<T>) => JSX.Element;
|
|
73
|
+
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, rowStyle, rowsPerPageOptions, ...props }: GrepTableProps<T>) => JSX.Element;
|
|
73
74
|
export { GrepTableRow };
|
|
74
75
|
export default GrepTable;
|
package/dist/index.js
CHANGED
|
@@ -3662,7 +3662,7 @@ var getElementIndex = function (el) {
|
|
|
3662
3662
|
*
|
|
3663
3663
|
*/
|
|
3664
3664
|
var GrepTable = function (_a) {
|
|
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, _c = _a.rowsPerPageOptions, rowsPerPageOptions = _c === void 0 ? [5, 10, 25, 50] : _c, 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", "rowsPerPageOptions"]);
|
|
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, rowStyle = _a.rowStyle, _c = _a.rowsPerPageOptions, rowsPerPageOptions = _c === void 0 ? [5, 10, 25, 50] : _c, 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", "rowStyle", "rowsPerPageOptions"]);
|
|
3666
3666
|
var _d = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _d[0], setRowsPerPage = _d[1];
|
|
3667
3667
|
var _e = __read(React__default.useState(null), 2), menuAnchor = _e[0], setMenuAnchor = _e[1];
|
|
3668
3668
|
var _f = __read(React__default.useState(0), 2), currentPage = _f[0], _setCurrentPage = _f[1];
|
|
@@ -3756,6 +3756,16 @@ var GrepTable = function (_a) {
|
|
|
3756
3756
|
}, tabIndex: 0, size: "large", "aria-label": menuButtonLabel !== null && menuButtonLabel !== void 0 ? menuButtonLabel : 'Åpne meny' },
|
|
3757
3757
|
React__default.createElement(MoreVert, null)))));
|
|
3758
3758
|
};
|
|
3759
|
+
var getRowStyle = function (row, index, clickableRows, disabled) {
|
|
3760
|
+
var style = { cursor: clickableRows && !disabled ? 'pointer' : '' };
|
|
3761
|
+
if (typeof rowStyle === "function") {
|
|
3762
|
+
style = __assign(__assign({}, style), rowStyle(row, index));
|
|
3763
|
+
}
|
|
3764
|
+
else if (rowStyle) {
|
|
3765
|
+
style = __assign(__assign({}, style), rowStyle);
|
|
3766
|
+
}
|
|
3767
|
+
return style;
|
|
3768
|
+
};
|
|
3759
3769
|
var _renderRow = function (row, index) {
|
|
3760
3770
|
var rowColumns = dropdownItems
|
|
3761
3771
|
? columns.concat([{ getCell: _renderCellButton, padding: 'none' }])
|
|
@@ -3775,7 +3785,7 @@ var GrepTable = function (_a) {
|
|
|
3775
3785
|
_handleRowClick(row);
|
|
3776
3786
|
}
|
|
3777
3787
|
}
|
|
3778
|
-
}, columns: rowColumns, row: row, style:
|
|
3788
|
+
}, columns: rowColumns, row: row, style: getRowStyle(row, index, clickableRows, disabled), onFocus: function (e) {
|
|
3779
3789
|
if (selectedRowIndex !== rowIndex) {
|
|
3780
3790
|
setSelectedElement(e.currentTarget);
|
|
3781
3791
|
}
|