grep-components 1.25.0 → 1.26.0-GREPF-2165.1

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.
@@ -20,6 +20,7 @@ export interface GrepTableProps<T> extends Pick<TableProps, 'size' | 'stickyHead
20
20
  header?: boolean;
21
21
  outlined?: boolean;
22
22
  rowsPerPage?: number;
23
+ rowsPerPageOptions?: number[];
23
24
  pagination?: boolean;
24
25
  /**
25
26
  * @deprecated No longer in use.
@@ -68,6 +69,6 @@ export declare const useStyles: (params: StyleProps, styleOverrides?: {
68
69
  * @todo enhance page handling
69
70
  *
70
71
  */
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;
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;
72
73
  export { GrepTableRow };
73
74
  export default GrepTable;
package/dist/index.js CHANGED
@@ -3612,7 +3612,7 @@ var PaginationActions = function (_a) {
3612
3612
 
3613
3613
  var GrepTablePagination = function (props) {
3614
3614
  var classes = usePaginationStyles().classes;
3615
- return (React__default.createElement(TablePagination, __assign({ classes: classes, rowsPerPageOptions: props.rowsPerPageOptions || [5, 10, 25, 50], SelectProps: {
3615
+ return (React__default.createElement(TablePagination, __assign({ classes: classes, rowsPerPageOptions: props.rowsPerPageOptions, SelectProps: {
3616
3616
  inputProps: {
3617
3617
  title: 'Velg antall elementer',
3618
3618
  },
@@ -3662,13 +3662,13 @@ 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, 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"]);
3666
- var _c = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _c[0], setRowsPerPage = _c[1];
3667
- var _d = __read(React__default.useState(null), 2), menuAnchor = _d[0], setMenuAnchor = _d[1];
3668
- var _e = __read(React__default.useState(0), 2), currentPage = _e[0], _setCurrentPage = _e[1];
3669
- var _f = __read(React__default.useState(), 2), selectedRowIndex = _f[0], _setSelectedRowIndex = _f[1];
3670
- var _g = __read(React__default.useState(), 2), expandedRowIndex = _g[0], _setExpandedRowIndex = _g[1];
3671
- var _h = __read(React__default.useState(), 2), dropdownContext = _h[0], setDropdownContext = _h[1];
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"]);
3666
+ var _d = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _d[0], setRowsPerPage = _d[1];
3667
+ var _e = __read(React__default.useState(null), 2), menuAnchor = _e[0], setMenuAnchor = _e[1];
3668
+ var _f = __read(React__default.useState(0), 2), currentPage = _f[0], _setCurrentPage = _f[1];
3669
+ var _g = __read(React__default.useState(), 2), selectedRowIndex = _g[0], _setSelectedRowIndex = _g[1];
3670
+ var _h = __read(React__default.useState(), 2), expandedRowIndex = _h[0], _setExpandedRowIndex = _h[1];
3671
+ var _j = __read(React__default.useState(), 2), dropdownContext = _j[0], setDropdownContext = _j[1];
3672
3672
  var selectedRow = data[selectedRowIndex] || null;
3673
3673
  var setCurrentPage = useCallback$1(function (index, rowIndex, shouldExpand) {
3674
3674
  index = pagination && index >= 0 ? index : 0;
@@ -3831,7 +3831,7 @@ var GrepTable = function (_a) {
3831
3831
  React__default.createElement(TableHeader, { className: classes.header, columns: columns, sortBy: sortBy, sortDirection: sortDirection, onSortBy: onSortBy, dropdownItems: dropdownItems }),
3832
3832
  React__default.createElement(TableBody, { ref: tableRef, className: classes.body, onKeyDown: onKey }, data.length ? (rows.map(_renderRow)) : (React__default.createElement(GrepTablePlaceholder, { padding: padding, columns: columns, text: placeholderText }))),
3833
3833
  React__default.createElement(TableFooter, null, pagination && (React__default.createElement(TableRow, null,
3834
- React__default.createElement(GrepTablePagination, { page: currentPage, count: data.length, rowsPerPage: rowsPerPage, onPageChange: _handlePageChange, onRowsPerPageChange: _handleChangeRowsPerPage, labelRowsPerPage: '', labelDisplayedRows: function (_a) {
3834
+ React__default.createElement(GrepTablePagination, { page: currentPage, count: data.length, rowsPerPage: rowsPerPage, onPageChange: _handlePageChange, rowsPerPageOptions: rowsPerPageOptions, onRowsPerPageChange: _handleChangeRowsPerPage, labelRowsPerPage: '', labelDisplayedRows: function (_a) {
3835
3835
  var from = _a.from, to = _a.to, count = _a.count;
3836
3836
  return "Viser ".concat(from, "-").concat(to, " av ").concat(count);
3837
3837
  } }))))),
@@ -4609,7 +4609,7 @@ var DatePicker = function (_a) {
4609
4609
  var _c = __read(useState(), 2), error = _c[0], setError = _c[1];
4610
4610
  var helperText = errorMessage || error || props.helperText;
4611
4611
  useEffect(function () { return onChange(date); }, [String(date)]);
4612
- return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs, locale: 'nb' },
4612
+ return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: 'nb' },
4613
4613
  React__default.createElement(DesktopDatePicker
4614
4614
  // clearable @todo
4615
4615
  , __assign({