@absreim/react-bootstrap-data-grid-pro 4.3.0 → 4.5.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.
- package/common/editing/types.d.ts +1 -1
- package/common/filtering/types.d.ts +1 -1
- package/common/pagination/PageSelector.js +28 -18
- package/common/pagination/PageSizeSelector.d.ts +1 -0
- package/common/pagination/PageSizeSelector.js +20 -7
- package/common/pagination/Pagination.d.ts +2 -1
- package/common/pagination/Pagination.js +7 -5
- package/common/pagination/internalTypes.d.ts +1 -1
- package/common/pagination/types.d.ts +16 -5
- package/common/pipeline/useCombinedPipeline/useCurrentPageRows.js +1 -0
- package/common/selection/types.d.ts +2 -2
- package/common/types.d.ts +4 -3
- package/common.css +1 -0
- package/common.scss +7 -0
- package/grid/index.d.ts +1 -0
- package/grid/index.js +1 -0
- package/grid/main/Grid.js +47 -27
- package/grid/main/types.d.ts +7 -2
- package/grid/pagination/types.d.ts +78 -0
- package/grid/pagination/types.js +1 -0
- package/grid.css +1 -1
- package/grid.scss +12 -0
- package/package.json +1 -1
- package/table/types.d.ts +5 -5
- package/table-pro/types.d.ts +4 -4
|
@@ -31,7 +31,7 @@ export interface EditModel {
|
|
|
31
31
|
* for editing a row. In particular, the min-width and max-width CSS
|
|
32
32
|
* properties will be set.
|
|
33
33
|
*
|
|
34
|
-
* @defaultValue undefined - no CSS will be specified
|
|
34
|
+
* @defaultValue `undefined` - no CSS will be specified
|
|
35
35
|
*/
|
|
36
36
|
editColWidth?: number;
|
|
37
37
|
}
|
|
@@ -191,7 +191,7 @@ export interface ControlledFilterModel {
|
|
|
191
191
|
/**
|
|
192
192
|
* Caption for the filter settings table element.
|
|
193
193
|
*
|
|
194
|
-
* @defaultValue undefined - no caption will be displayed
|
|
194
|
+
* @defaultValue `undefined` - no caption will be displayed
|
|
195
195
|
*/
|
|
196
196
|
filterTableCaption?: string;
|
|
197
197
|
}
|
|
@@ -14,7 +14,7 @@ import classNames from "classnames";
|
|
|
14
14
|
* @param size - Size variant of the <ul> element
|
|
15
15
|
*/
|
|
16
16
|
const PageSelector = ({ numPages, numButtons, pageNum, setPageNum, ariaLabel, alignment, size, }) => {
|
|
17
|
-
const ulClasses = ["pagination"];
|
|
17
|
+
const ulClasses = ["pagination", "mb-0"];
|
|
18
18
|
if (size === "small") {
|
|
19
19
|
ulClasses.push("pagination-sm");
|
|
20
20
|
}
|
|
@@ -43,39 +43,49 @@ const PageSelector = ({ numPages, numButtons, pageNum, setPageNum, ariaLabel, al
|
|
|
43
43
|
}
|
|
44
44
|
return indices;
|
|
45
45
|
}, [lowerBound, upperBound]);
|
|
46
|
+
const leftArrowButtonsDisabled = pageNum === 1;
|
|
47
|
+
const rightArrowButtonsDisabled = pageNum === numPages;
|
|
46
48
|
function getFirstArrowButton() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return (_jsx("li", { className: "page-item", children: _jsx("a", { className: "page-link", href: "#", "aria-label": "First", onClick: (event) => {
|
|
49
|
+
return (_jsx("li", { className: classNames("page-item", {
|
|
50
|
+
disabled: leftArrowButtonsDisabled,
|
|
51
|
+
}), children: _jsx("a", { className: "page-link", href: "#", "aria-label": "First", tabIndex: leftArrowButtonsDisabled ? -1 : 0, onClick: (event) => {
|
|
51
52
|
event.preventDefault();
|
|
53
|
+
if (leftArrowButtonsDisabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
52
56
|
setPageNum(1);
|
|
53
57
|
}, children: _jsx("span", { "aria-hidden": "true", children: "<<" }) }) }));
|
|
54
58
|
}
|
|
55
59
|
function getPrevArrowButton() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (_jsx("li", { className: "page-item", children: _jsx("a", { className: "page-link", href: "#", "aria-label": "Previous", onClick: (event) => {
|
|
60
|
+
return (_jsx("li", { className: classNames("page-item", {
|
|
61
|
+
disabled: leftArrowButtonsDisabled,
|
|
62
|
+
}), children: _jsx("a", { className: "page-link", href: "#", "aria-label": "Previous", tabIndex: leftArrowButtonsDisabled ? -1 : 0, onClick: (event) => {
|
|
60
63
|
event.preventDefault();
|
|
64
|
+
if (leftArrowButtonsDisabled) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
61
67
|
setPageNum(pageNum - 1);
|
|
62
68
|
}, children: _jsx("span", { "aria-hidden": "true", children: "<" }) }) }));
|
|
63
69
|
}
|
|
64
70
|
function getNextArrowButton() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return (_jsx("li", { className: "page-item", children: _jsx("a", { className: "page-link", href: "#", "aria-label": "Next", onClick: (event) => {
|
|
71
|
+
return (_jsx("li", { className: classNames("page-item", {
|
|
72
|
+
disabled: rightArrowButtonsDisabled,
|
|
73
|
+
}), children: _jsx("a", { className: "page-link", href: "#", "aria-label": "Next", tabIndex: rightArrowButtonsDisabled ? -1 : 0, onClick: (event) => {
|
|
69
74
|
event.preventDefault();
|
|
75
|
+
if (rightArrowButtonsDisabled) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
70
78
|
setPageNum(pageNum + 1);
|
|
71
79
|
}, children: _jsx("span", { "aria-hidden": "true", children: ">" }) }) }));
|
|
72
80
|
}
|
|
73
81
|
function getLastArrowButton() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return (_jsx("li", { className: "page-item", children: _jsx("a", { className: "page-link", href: "#", "aria-label": "Last", onClick: (event) => {
|
|
82
|
+
return (_jsx("li", { className: classNames("page-item", {
|
|
83
|
+
disabled: rightArrowButtonsDisabled,
|
|
84
|
+
}), children: _jsx("a", { className: "page-link", href: "#", "aria-label": "Last", tabIndex: rightArrowButtonsDisabled ? -1 : 0, onClick: (event) => {
|
|
78
85
|
event.preventDefault();
|
|
86
|
+
if (rightArrowButtonsDisabled) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
79
89
|
setPageNum(numPages);
|
|
80
90
|
}, children: _jsx("span", { "aria-hidden": "true", children: ">>" }) }) }));
|
|
81
91
|
}
|
|
@@ -86,6 +96,6 @@ const PageSelector = ({ numPages, numButtons, pageNum, setPageNum, ariaLabel, al
|
|
|
86
96
|
event.preventDefault();
|
|
87
97
|
setPageNum(buttonIndex);
|
|
88
98
|
}, children: buttonIndex }) }, buttonIndex)));
|
|
89
|
-
return (_jsx("nav", { "aria-label": ariaLabel, children: _jsxs("ul", { className: classNames(ulClasses), children: [getFirstArrowButton(), getPrevArrowButton(), indexButtons, getNextArrowButton(), getLastArrowButton()] }) }));
|
|
99
|
+
return (_jsx("nav", { "aria-label": ariaLabel === undefined ? "Select page" : ariaLabel, "data-testid": "rbdg-page-selector", children: _jsxs("ul", { className: classNames(ulClasses), children: [getFirstArrowButton(), getPrevArrowButton(), indexButtons, getNextArrowButton(), getLastArrowButton()] }) }));
|
|
90
100
|
};
|
|
91
101
|
export default PageSelector;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import classNames from "classnames";
|
|
3
|
-
const
|
|
4
|
+
const labelText = "Rows per page";
|
|
5
|
+
const PageSizeSelector = ({ componentSize, pageSizeOptions, pageSizeIndex, handleSetPageSize, showTextLabel, }) => {
|
|
6
|
+
const id = useId();
|
|
4
7
|
const onChange = (event) => {
|
|
5
8
|
const pageSizeIndex = Number(event.target.value);
|
|
6
9
|
handleSetPageSize(pageSizeIndex);
|
|
7
10
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
11
|
+
function getTextSizeClass() {
|
|
12
|
+
switch (componentSize) {
|
|
13
|
+
case "small":
|
|
14
|
+
return "rbdg-input-label-sm";
|
|
15
|
+
case "large":
|
|
16
|
+
return "rbdg-input-label-lg";
|
|
17
|
+
default:
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return (_jsxs("div", { "data-testid": "rbdg-page-size-selector", className: "d-flex align-items-center gap-2 flex-shrink-0", children: [showTextLabel && (_jsx("label", { htmlFor: id, className: classNames("flex-shrink-0", getTextSizeClass()), children: labelText })), _jsx("select", { "aria-label": showTextLabel ? undefined : labelText, id: id, name: "rowsPerPage", className: classNames({
|
|
22
|
+
"form-select": true,
|
|
23
|
+
"form-select-lg": componentSize === "large",
|
|
24
|
+
"form-select-sm": componentSize === "small",
|
|
25
|
+
}, "flex-shrink-0", "w-auto"), value: pageSizeIndex, onChange: onChange, children: pageSizeOptions.map((numRows, index) => (_jsx("option", { value: index, children: numRows }, index))) })] }));
|
|
13
26
|
};
|
|
14
27
|
export default PageSizeSelector;
|
|
@@ -3,7 +3,8 @@ import { NormalizedPaginationModel } from "./internalTypes";
|
|
|
3
3
|
export interface PaginationProps {
|
|
4
4
|
normalizedModel: NormalizedPaginationModel;
|
|
5
5
|
prePagingNumRows: number;
|
|
6
|
-
containerDivClasses
|
|
6
|
+
containerDivClasses?: string[];
|
|
7
|
+
sizeSelectAfterPageSelect?: boolean;
|
|
7
8
|
}
|
|
8
9
|
declare const Pagination: FC<PaginationProps>;
|
|
9
10
|
export default Pagination;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import PageSizeSelector from "./PageSizeSelector";
|
|
3
3
|
import PageSelector from "./PageSelector";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
const Pagination = ({ normalizedModel, prePagingNumRows, containerDivClasses, }) => {
|
|
6
|
-
const { pageSizeOptions, pageSizeIndex, currentPage, setCurrentPage, setPageSizeIndex, componentSize, maxPageButtons, pageSelectorAriaLabel, pageSelectorJustifyContent, } = normalizedModel;
|
|
5
|
+
const Pagination = ({ normalizedModel, prePagingNumRows, containerDivClasses, sizeSelectAfterPageSelect, }) => {
|
|
6
|
+
const { pageSizeOptions, pageSizeIndex, currentPage, setCurrentPage, setPageSizeIndex, componentSize, maxPageButtons, pageSelectorAriaLabel, pageSelectorJustifyContent, showTextLabel, } = normalizedModel;
|
|
7
7
|
const numPages = Math.ceil(prePagingNumRows / pageSizeOptions[pageSizeIndex]);
|
|
8
8
|
const pageIndexAwarePageSizeSetter = (newPageSizeIndex) => {
|
|
9
9
|
const newPageSize = pageSizeOptions[newPageSizeIndex];
|
|
@@ -16,11 +16,13 @@ const Pagination = ({ normalizedModel, prePagingNumRows, containerDivClasses, })
|
|
|
16
16
|
setCurrentPage(maxPages);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
const pageSizeSelect = (_jsx(PageSizeSelector, { componentSize: componentSize, pageSizeOptions: pageSizeOptions, pageSizeIndex: pageSizeIndex, handleSetPageSize: pageIndexAwarePageSizeSetter, showTextLabel: !!showTextLabel }));
|
|
20
|
+
const pageSelect = (_jsx(PageSelector, { numPages: numPages, pageNum: currentPage, numButtons: maxPageButtons, setPageNum: setCurrentPage, size: componentSize, ariaLabel: pageSelectorAriaLabel, alignment: pageSelectorJustifyContent }));
|
|
21
|
+
return (_jsx("div", { "data-testid": "rdbg-pagination-ui-container", className: classNames(containerDivClasses || [
|
|
20
22
|
"d-flex",
|
|
21
23
|
"justify-content-end",
|
|
22
24
|
"gap-2",
|
|
23
25
|
"px-2",
|
|
24
|
-
]), children:
|
|
26
|
+
]), children: sizeSelectAfterPageSelect ? (_jsxs(_Fragment, { children: [pageSelect, pageSizeSelect] })) : (_jsxs(_Fragment, { children: [pageSizeSelect, pageSelect] })) }));
|
|
25
27
|
};
|
|
26
28
|
export default Pagination;
|
|
@@ -5,4 +5,4 @@ import { ControlledPaginationModel } from "./types";
|
|
|
5
5
|
*
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export type NormalizedPaginationModel = Required<Omit<ControlledPaginationModel, "type" | "pageSelectorAriaLabel" | "pageSelectorJustifyContent">> & Pick<ControlledPaginationModel, "pageSelectorAriaLabel" | "pageSelectorJustifyContent">;
|
|
8
|
+
export type NormalizedPaginationModel = Required<Omit<ControlledPaginationModel, "type" | "pageSelectorAriaLabel" | "pageSelectorJustifyContent" | "showTextLabel">> & Pick<ControlledPaginationModel, "pageSelectorAriaLabel" | "pageSelectorJustifyContent" | "showTextLabel">;
|
|
@@ -21,21 +21,21 @@ export interface PaginationOptions {
|
|
|
21
21
|
/**
|
|
22
22
|
* An array of page sizes that can be selected by the user.
|
|
23
23
|
*
|
|
24
|
-
* @defaultValue [10, 25, 100]
|
|
24
|
+
* @defaultValue `[10, 25, 100]`
|
|
25
25
|
*/
|
|
26
26
|
pageSizeOptions?: number[];
|
|
27
27
|
/**
|
|
28
28
|
* Maximum number of buttons pointing to numerically-indexed pages that can
|
|
29
29
|
* be displayed at once.
|
|
30
30
|
*
|
|
31
|
-
* @defaultValue 5
|
|
31
|
+
* @defaultValue `5`
|
|
32
32
|
*/
|
|
33
33
|
maxPageButtons?: number;
|
|
34
34
|
/**
|
|
35
35
|
* The size of the pagination component. Set via CSS classes provided with
|
|
36
36
|
* Bootstrap.
|
|
37
37
|
*
|
|
38
|
-
* @defaultValue "medium" - corresponds to not specifying a CSS class for
|
|
38
|
+
* @defaultValue `"medium"` - corresponds to not specifying a CSS class for
|
|
39
39
|
* pagination component size
|
|
40
40
|
*/
|
|
41
41
|
componentSize?: Size;
|
|
@@ -43,18 +43,29 @@ export interface PaginationOptions {
|
|
|
43
43
|
* The ARIA label for the nav element that represents the pagination
|
|
44
44
|
* component.
|
|
45
45
|
*
|
|
46
|
-
* @defaultValue
|
|
46
|
+
* @defaultValue `"Select page"`
|
|
47
47
|
*/
|
|
48
48
|
pageSelectorAriaLabel?: string;
|
|
49
49
|
/**
|
|
50
50
|
* Justify-content CSS property for the ul element of the pagination
|
|
51
51
|
* component.
|
|
52
52
|
*
|
|
53
|
-
* @defaultValue undefined - no justify-content property is specified, which
|
|
53
|
+
* @defaultValue `undefined` - no justify-content property is specified, which
|
|
54
54
|
* acts like "start" based on CSS standards. See
|
|
55
55
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/justify-content#syntax}.
|
|
56
|
+
*
|
|
57
|
+
* @deprecated This property has no effect under normal circumstances because
|
|
58
|
+
* the enclosing nav element is using the block display type. It is kept
|
|
59
|
+
* around only to avoid breaking existing code.
|
|
56
60
|
*/
|
|
57
61
|
pageSelectorJustifyContent?: JustifyContentSetting;
|
|
62
|
+
/**
|
|
63
|
+
* Configures whether to show a text label for the page size selector
|
|
64
|
+
* dropdown.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `undefined` - the text label is not displayed.
|
|
67
|
+
*/
|
|
68
|
+
showTextLabel?: boolean;
|
|
58
69
|
}
|
|
59
70
|
/**
|
|
60
71
|
* Properties specific to configuring pagination in a controlled manner.
|
|
@@ -36,6 +36,7 @@ const useCurrentPageRows = (sortedRows, paginationModel) => {
|
|
|
36
36
|
componentSize,
|
|
37
37
|
pageSelectorAriaLabel: paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSelectorAriaLabel,
|
|
38
38
|
pageSelectorJustifyContent: paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSelectorJustifyContent,
|
|
39
|
+
showTextLabel: paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.showTextLabel,
|
|
39
40
|
};
|
|
40
41
|
const pageSize = pageSizeOptions[pageSizeIndex];
|
|
41
42
|
const lowerIndex = pageSize * (currentPage - 1);
|
|
@@ -27,7 +27,7 @@ export interface BaseSelectModel {
|
|
|
27
27
|
* The width of the select column. Set via CSS min-width and max-width
|
|
28
28
|
* properties. The column is only shown if mode is set to "column".
|
|
29
29
|
*
|
|
30
|
-
* @defaultValue undefined - no CSS properties will be set
|
|
30
|
+
* @defaultValue `undefined` - no CSS properties will be set
|
|
31
31
|
*/
|
|
32
32
|
selectColWidth?: number;
|
|
33
33
|
}
|
|
@@ -85,7 +85,7 @@ export interface SingleSelectState {
|
|
|
85
85
|
* {@link https://react.dev/reference/react/useId | useId hook}
|
|
86
86
|
* can be used to generate an ID.
|
|
87
87
|
*
|
|
88
|
-
* @defaultValue undefined - an id generated by the useId hook will be used
|
|
88
|
+
* @defaultValue `undefined` - an id generated by the useId hook will be used
|
|
89
89
|
*/
|
|
90
90
|
groupName?: string;
|
|
91
91
|
}
|
package/common/types.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface ColDefBase<ValueType = any> {
|
|
|
40
40
|
/**
|
|
41
41
|
* Specifies whether the column is sortable.
|
|
42
42
|
*
|
|
43
|
-
* @defaultValue false
|
|
43
|
+
* @defaultValue `false`
|
|
44
44
|
*/
|
|
45
45
|
sortable?: boolean;
|
|
46
46
|
}
|
|
@@ -58,7 +58,7 @@ export interface CommunitySpecificColProps {
|
|
|
58
58
|
* For the table, if no value is specified, then no value for min-width
|
|
59
59
|
* or max-width will be set.
|
|
60
60
|
*
|
|
61
|
-
* @defaultValue
|
|
61
|
+
* @defaultValue `100` for the grid, `undefined` for the table
|
|
62
62
|
*/
|
|
63
63
|
width?: number;
|
|
64
64
|
}
|
|
@@ -118,7 +118,8 @@ export interface RowDef<Data extends ValidRowData = ValidRowData> {
|
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Interface that contains parameters shared between the {@link Table},
|
|
121
|
-
* {@link TablePro}, and
|
|
121
|
+
* {@link @absreim/react-bootstrap-data-grid-pro#TablePro | TablePro}, and
|
|
122
|
+
* {@link Grid} components.
|
|
122
123
|
*
|
|
123
124
|
* @public
|
|
124
125
|
*/
|
package/common.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.rbdg-input-label-lg{font-size:1.25rem}.rbdg-input-label-sm{font-size:.875rem}
|
package/common.scss
ADDED
package/grid/index.d.ts
CHANGED
package/grid/index.js
CHANGED
package/grid/main/Grid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useRef, } from "react";
|
|
4
4
|
import useCombinedPipeline from "../../common/pipeline/useCombinedPipeline";
|
|
5
5
|
import useAugFormattedRows from "../../common/pipeline/useAugFormattedRows";
|
|
6
6
|
import useColNameToWidth from "../../common/pipeline/useColNameToWidth";
|
|
@@ -9,43 +9,51 @@ import GridBody from "./GridBody";
|
|
|
9
9
|
import classNames from "classnames";
|
|
10
10
|
import { CSS_PREFIX } from "../../common/constants";
|
|
11
11
|
import useGridFocus from "../focus/useGridFocus";
|
|
12
|
+
import Pagination from "../../common/pagination/Pagination";
|
|
12
13
|
/**
|
|
13
14
|
* The main component for the grid feature of react-bootstrap-data-grid.
|
|
14
15
|
*
|
|
15
16
|
* @public
|
|
16
17
|
*/
|
|
17
|
-
const Grid = ({ rows, cols, sortModel, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, headerCellFocusVariant, bodyCellFocusVariant, }) => {
|
|
18
|
-
|
|
18
|
+
const Grid = ({ rows, cols, sortModel, pagination, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, headerCellFocusVariant, bodyCellFocusVariant, }) => {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
const { displayRows, filteredRows, sortedRowsOutput, currentPageRowsOutput } = useCombinedPipeline({
|
|
19
21
|
rows,
|
|
20
22
|
cols,
|
|
21
23
|
sortModel,
|
|
24
|
+
pagination,
|
|
22
25
|
});
|
|
23
26
|
const colNameToWidth = useColNameToWidth(cols);
|
|
24
27
|
const augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return "100%";
|
|
29
|
-
}
|
|
30
|
-
if (typeof width === "number") {
|
|
31
|
-
return width;
|
|
32
|
-
}
|
|
33
|
-
return "min-content";
|
|
28
|
+
function getWidthProperty(width) {
|
|
29
|
+
if (width === "parent") {
|
|
30
|
+
return "100%";
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
if (typeof width === "number") {
|
|
33
|
+
return width;
|
|
34
|
+
}
|
|
35
|
+
return "max-content";
|
|
36
|
+
}
|
|
37
|
+
const widthProperty = getWidthProperty(width);
|
|
38
|
+
function getHeightProperties(height) {
|
|
39
|
+
if (height === "parent") {
|
|
40
|
+
return {
|
|
41
|
+
containerDiv: "100%",
|
|
42
|
+
mainDiv: "100%",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (typeof height === "number") {
|
|
46
|
+
return {
|
|
47
|
+
containerDiv: undefined,
|
|
48
|
+
mainDiv: height,
|
|
49
|
+
};
|
|
43
50
|
}
|
|
44
51
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
containerDiv: undefined,
|
|
53
|
+
mainDiv: undefined,
|
|
47
54
|
};
|
|
48
|
-
}
|
|
55
|
+
}
|
|
56
|
+
const heightProperties = getHeightProperties(height);
|
|
49
57
|
const vertScrollable = height !== undefined && height !== "auto";
|
|
50
58
|
const gridRef = useRef(null);
|
|
51
59
|
const sortableColIndices = sortModel
|
|
@@ -53,7 +61,7 @@ const Grid = ({ rows, cols, sortModel, width, height, variant, stripes, hover, b
|
|
|
53
61
|
.map((_, index) => index + 1)
|
|
54
62
|
.filter((ariaColIndex) => cols[ariaColIndex - 1].sortable)
|
|
55
63
|
: [];
|
|
56
|
-
const { effectiveCoords, gridClickHandler, gridKeydownHandler } = useGridFocus(gridRef,
|
|
64
|
+
const { effectiveCoords, gridClickHandler, gridKeydownHandler } = useGridFocus(gridRef, displayRows.length + 1, cols.length, sortableColIndices);
|
|
57
65
|
const onCopy = useCallback((event) => {
|
|
58
66
|
var _a;
|
|
59
67
|
if (!((_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))) {
|
|
@@ -66,7 +74,10 @@ const Grid = ({ rows, cols, sortModel, width, height, variant, stripes, hover, b
|
|
|
66
74
|
event.preventDefault();
|
|
67
75
|
event.clipboardData.setData("text/plain", selection.focusNode.textContent);
|
|
68
76
|
}, []);
|
|
69
|
-
|
|
77
|
+
const mainGridComponent = (_jsxs("div", { onCopy: onCopy, onClick: gridClickHandler, onKeyDown: gridKeydownHandler, ref: gridRef, style: {
|
|
78
|
+
width: widthProperty,
|
|
79
|
+
height: heightProperties.mainDiv,
|
|
80
|
+
}, className: classNames({
|
|
70
81
|
"overflow-x-auto": width !== undefined && width !== "auto",
|
|
71
82
|
"overflow-y-auto": vertScrollable,
|
|
72
83
|
"rbdg-grid-striped": stripes === "rows",
|
|
@@ -76,8 +87,17 @@ const Grid = ({ rows, cols, sortModel, width, height, variant, stripes, hover, b
|
|
|
76
87
|
"rbdg-grid-borderless": borders === "none",
|
|
77
88
|
"rbdg-grid-sm": !!small,
|
|
78
89
|
"rbdg-grid-group-divider": !!divider,
|
|
79
|
-
}, "rbdg-grid", variant && `${CSS_PREFIX}-${variant}`, borderVariant && `border-${borderVariant}`), role: "grid", "aria-colcount": cols.length, "aria-rowcount": filteredRows.length + 1, children: [_jsx(GridHeader, { cols: cols, rowVariant: headerRowVariant, cellVariant: headerCellVariant, vertScrollable: vertScrollable, focusColIndex: effectiveCoords.ariaRowIndex === 1
|
|
90
|
+
}, "rbdg-grid", variant && `${CSS_PREFIX}-${variant}`, borderVariant && `border-${borderVariant}`), role: "grid", "aria-colcount": cols.length, "aria-rowcount": filteredRows.length + 1, "data-testid": "rbdg-grid", children: [_jsx(GridHeader, { cols: cols, rowVariant: headerRowVariant, cellVariant: headerCellVariant, vertScrollable: vertScrollable, focusColIndex: effectiveCoords.ariaRowIndex === 1
|
|
80
91
|
? effectiveCoords.ariaColIndex
|
|
81
92
|
: null, cellFocusVariant: headerCellFocusVariant, sortInfo: sortedRowsOutput }), _jsx(GridBody, { focusCoords: effectiveCoords, augFormattedRows: augFormattedRows, cols: cols, rowVariant: bodyRowVariant, cellVariant: bodyCellVariant, cellFocusVariant: bodyCellFocusVariant })] }));
|
|
93
|
+
const getPagination = (pagination) => {
|
|
94
|
+
var _a, _b, _c, _d;
|
|
95
|
+
return (_jsx(Pagination, { containerDivClasses: [
|
|
96
|
+
"d-flex",
|
|
97
|
+
`rbdg-justify-content-${((_a = pagination.styleOptions) === null || _a === void 0 ? void 0 : _a.horizontalAlignment) || "right"}`,
|
|
98
|
+
`gap-${((_b = pagination.styleOptions) === null || _b === void 0 ? void 0 : _b.paginationComponentSpacing) === undefined ? 2 : (_c = pagination.styleOptions) === null || _c === void 0 ? void 0 : _c.paginationComponentSpacing}`,
|
|
99
|
+
], normalizedModel: currentPageRowsOutput.normalizedModel, prePagingNumRows: rows.length, sizeSelectAfterPageSelect: (_d = pagination.styleOptions) === null || _d === void 0 ? void 0 : _d.sizeSelectAfterPageSelect }));
|
|
100
|
+
};
|
|
101
|
+
return pagination ? (_jsx("div", { style: { width: widthProperty, height: heightProperties.containerDiv }, className: classNames("d-flex", "flex-column", `gap-${((_a = pagination.styleOptions) === null || _a === void 0 ? void 0 : _a.mainComponentSpacing) === undefined ? 2 : (_b = pagination.styleOptions) === null || _b === void 0 ? void 0 : _b.mainComponentSpacing}`), "data-testid": "rbdg-top-level-grid-container", children: ((_c = pagination.styleOptions) === null || _c === void 0 ? void 0 : _c.aboveMainComponent) ? (_jsxs(_Fragment, { children: [getPagination(pagination), mainGridComponent] })) : (_jsxs(_Fragment, { children: [mainGridComponent, getPagination(pagination)] })) })) : (_jsx(_Fragment, { children: mainGridComponent }));
|
|
82
102
|
};
|
|
83
103
|
export default Grid;
|
package/grid/main/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CellData, ColDef, FormattedRow, MainComponentSharedProps } from "../../common";
|
|
2
|
+
import { GridPaginationModel } from "../pagination/types";
|
|
2
3
|
/**
|
|
3
4
|
* The type of the function used to specify color variants on a grid body on a
|
|
4
5
|
* per-cell level of granularity.
|
|
@@ -44,13 +45,13 @@ export interface GridSpecificProps {
|
|
|
44
45
|
/**
|
|
45
46
|
* The height setting of the grid
|
|
46
47
|
*
|
|
47
|
-
* @defaultValue `auto`
|
|
48
|
+
* @defaultValue `"auto"`
|
|
48
49
|
*/
|
|
49
50
|
height?: GridHeightSetting;
|
|
50
51
|
/**
|
|
51
52
|
* The width setting of the grid
|
|
52
53
|
*
|
|
53
|
-
* @defaultValue `auto`
|
|
54
|
+
* @defaultValue `"auto"`
|
|
54
55
|
*/
|
|
55
56
|
width?: GridWidthSetting;
|
|
56
57
|
/**
|
|
@@ -107,6 +108,10 @@ export interface GridSpecificProps {
|
|
|
107
108
|
* Function to set the color variant of body cell focus rings
|
|
108
109
|
*/
|
|
109
110
|
bodyCellFocusVariant?: BodyCellVariantFn;
|
|
111
|
+
/**
|
|
112
|
+
* Enables and configures pagination for the grid
|
|
113
|
+
*/
|
|
114
|
+
pagination?: GridPaginationModel;
|
|
110
115
|
}
|
|
111
116
|
/**
|
|
112
117
|
* The type of the prop to set grid height behavior
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { PaginationModel } from "../../common";
|
|
2
|
+
/**
|
|
3
|
+
* Object that contains preset style options involving the pagination UI
|
|
4
|
+
* components. These settings are in contrast to the alternative means of
|
|
5
|
+
* controlling styling that involve applying custom CSS classes to different
|
|
6
|
+
* slots.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface PaginationStyleOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Sets whether the pagination components are positioned above the main
|
|
13
|
+
* grid or table component.
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue `false` - pagination components are positioned below the main
|
|
16
|
+
* component.
|
|
17
|
+
*/
|
|
18
|
+
aboveMainComponent?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Sets whether the page size selector dropdown menu is placed to the right of
|
|
21
|
+
* the page number selector.
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue `false` - the page size selector dropdown menu is placed
|
|
24
|
+
* before (to the left of) the page number selector component.
|
|
25
|
+
*/
|
|
26
|
+
sizeSelectAfterPageSelect?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Sets the horizontal alignment of the pagination UI components.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue `"right"` - both pagination UI components, the page size
|
|
31
|
+
* selector and page number selector, are aligned to the left of the
|
|
32
|
+
* enclosing div.
|
|
33
|
+
*/
|
|
34
|
+
horizontalAlignment?: "left" | "center" | "right";
|
|
35
|
+
/**
|
|
36
|
+
* Sets the amount of vertical spacing between the main grid or table
|
|
37
|
+
* component and the pagination UI components. The number supplied to this
|
|
38
|
+
* property will be used for the
|
|
39
|
+
* {@link https://getbootstrap.com/docs/5.3/utilities/spacing/#gap | Bootstrap gap utility}.
|
|
40
|
+
* Valid values depend on Bootstrap `$spacers` Sass map. Be default, the valid
|
|
41
|
+
* values range from 0 to 5.
|
|
42
|
+
*
|
|
43
|
+
* @defaultValue `2`- the gap-2 Bootstrap utility class will be applied.
|
|
44
|
+
*/
|
|
45
|
+
mainComponentSpacing?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the amount of horizontal spacing between page size selector and page
|
|
48
|
+
* number selector. The number supplied to this
|
|
49
|
+
* property will be used for the
|
|
50
|
+
* {@link https://getbootstrap.com/docs/5.3/utilities/spacing/#gap | Bootstrap gap utility}.
|
|
51
|
+
* Valid values depend on Bootstrap `$spacers` Sass map. Be default, the valid
|
|
52
|
+
* values range from 0 to 5.
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue `2`- the gap-2 Bootstrap utility class will be applied.
|
|
55
|
+
*/
|
|
56
|
+
paginationComponentSpacing?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Properties in the {@link GridPaginationModel} but not the
|
|
60
|
+
* {@link PaginationModel}.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export interface GridSpecificPaginationProperties {
|
|
65
|
+
/**
|
|
66
|
+
* Preset style options involving pagination UI components.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue `undefined` - All default values for the
|
|
69
|
+
* {@link PaginationStyleOptions} interface will be applied.
|
|
70
|
+
*/
|
|
71
|
+
styleOptions?: PaginationStyleOptions;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Enables and configures pagination for the {@link Grid} component.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export type GridPaginationModel = PaginationModel & GridSpecificPaginationProperties;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/grid.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.rbdg-grid>div,.rbdg-grid>div>div,.rbdg-grid>div>div>div{border-color:inherit;border-style:solid;border-width:0}.rbdg-grid{--rbdg-grid-color: var(--bs-emphasis-color);--rbdg-grid-bg: var(--bs-body-bg);--rbdg-grid-border-color: var(--bs-border-color);--rbdg-grid-accent-bg: transparent;--rbdg-grid-striped-color: var(--bs-emphasis-color);--rbdg-grid-striped-bg: rgba(var(--bs-emphasis-color-rgb), 0.05);--rbdg-grid-active-color: var(--bs-emphasis-color);--rbdg-grid-active-bg: rgba(var(--bs-emphasis-color-rgb), 0.1);--rbdg-grid-hover-color: var(--bs-emphasis-color);--rbdg-grid-hover-bg: rgba(var(--bs-emphasis-color-rgb), 0.075);border-color:var(--rbdg-grid-border-color)}.rbdg-grid>div{width:min-content}.rbdg-grid>div>div>div{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:.5rem .5rem;color:var(--rbdg-grid-color-state, var(--rbdg-grid-color-type, var(--rbdg-grid-color)));background-color:var(--rbdg-grid-bg);border-bottom-width:var(--bs-border-width);box-shadow:inset 0 0 0 9999px var(--rbdg-grid-bg-state, var(--rbdg-grid-bg-type, var(--rbdg-grid-accent-bg)))}.rbdg-grid>div>div>div.rbdg-sortable-header-cell{padding:0;overflow:visible}.rbdg-grid>div>div>div.rbdg-focusable-cell:focus{outline:0;box-shadow:inset 0 0 0 9999px var(--rbdg-grid-bg-state, var(--rbdg-grid-bg-type, var(--rbdg-grid-accent-bg))),var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}.rbdg-grid>div:first-child>div>div{border-bottom-width:var(--rbdg-grid-divider-border-width, var(--rbdg-grid-divider-borderless-width, var(--bs-border-width)));border-bottom-style:var(--rbdg-grid-divider-border-style, inherit);border-bottom-color:var(--rbdg-grid-divider-border-color, inherit)}.rbdg-grid-group-divider{--rbdg-grid-divider-border-width: calc(var(--bs-border-width) * 2);--rbdg-grid-divider-border-style: solid;--rbdg-grid-divider-border-color: currentcolor}.rbdg-grid-sm>div>div>div{padding:.25rem .25rem}.rbdg-grid-bordered{border-width:var(--bs-border-width);border-style:solid}.rbdg-grid-bordered>div>div>div:not(:last-child){border-width:0 var(--bs-border-width) 0 0}.rbdg-grid-bordered>div>div>div:last-child{border-width:0}.rbdg-grid-bordered>div:first-child>div{border-top-width:0;border-right-width:0;border-left-width:0;border-bottom-width:var(--rbdg-grid-divider-border-width, var(--rbdg-grid-divider-borderless-width, var(--bs-border-width)));border-bottom-style:var(--rbdg-grid-divider-border-style, inherit);border-bottom-color:var(--rbdg-grid-divider-border-color, inherit)}.rbdg-grid-bordered>div:last-child>div:not(:last-child){border-width:0 0 var(--bs-border-width) 0}.rbdg-grid-borderless{--rbdg-grid-divider-borderless-width: 0}.rbdg-grid-borderless>div>div>div{border-bottom-width:0}.rbdg-grid-borderless>:not(:first-child){border-top-width:0}.rbdg-grid-striped>div:nth-of-type(2)>div:nth-of-type(odd)>div{--rbdg-grid-color-type: var(--rbdg-grid-striped-color);--rbdg-grid-bg-type: var(--rbdg-grid-striped-bg)}.rbdg-grid-striped-columns>div>div>:nth-child(even){--rbdg-grid-color-type: var(--rbdg-grid-striped-color);--rbdg-grid-bg-type: var(--rbdg-grid-striped-bg)}.rbdg-grid-active{--rbdg-grid-color-state: var(--bs-grid-active-color);--rbdg-grid-bg-state: var(--rbdg-grid-active-bg)}.rbdg-grid-hover>div:nth-of-type(2)>div:hover>div{--rbdg-grid-color-state: var(--rbdg-grid-hover-color);--rbdg-grid-bg-state: var(--rbdg-grid-hover-bg)}.rbdg-grid-primary{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(206.6, 226, 254.6);--rbdg-grid-border-color: rgb(165.28, 180.8, 203.68);--rbdg-grid-striped-bg: rgb(196.27, 214.7, 241.87);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(185.94, 203.4, 229.14);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(191.105, 209.05, 235.505);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-secondary{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(225.6, 227.4, 229);--rbdg-grid-border-color: rgb(180.48, 181.92, 183.2);--rbdg-grid-striped-bg: rgb(214.32, 216.03, 217.55);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(203.04, 204.66, 206.1);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(208.68, 210.345, 211.825);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-success{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(209, 231, 220.8);--rbdg-grid-border-color: rgb(167.2, 184.8, 176.64);--rbdg-grid-striped-bg: rgb(198.55, 219.45, 209.76);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(188.1, 207.9, 198.72);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(193.325, 213.675, 204.24);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-info{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(206.6, 244.4, 252);--rbdg-grid-border-color: rgb(165.28, 195.52, 201.6);--rbdg-grid-striped-bg: rgb(196.27, 232.18, 239.4);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(185.94, 219.96, 226.8);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(191.105, 226.07, 233.1);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-warning{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(255, 242.6, 205.4);--rbdg-grid-border-color: rgb(204, 194.08, 164.32);--rbdg-grid-striped-bg: rgb(242.25, 230.47, 195.13);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(229.5, 218.34, 184.86);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(235.875, 224.405, 189.995);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-danger{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(248, 214.6, 217.8);--rbdg-grid-border-color: rgb(198.4, 171.68, 174.24);--rbdg-grid-striped-bg: rgb(235.6, 203.87, 206.91);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(223.2, 193.14, 196.02);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(229.4, 198.505, 201.465);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-light{--rbdg-grid-color: #000;--rbdg-grid-bg: #f8f9fa;--rbdg-grid-border-color: rgb(198.4, 199.2, 200);--rbdg-grid-striped-bg: rgb(235.6, 236.55, 237.5);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(223.2, 224.1, 225);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(229.4, 230.325, 231.25);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-dark{--rbdg-grid-color: #fff;--rbdg-grid-bg: #212529;--rbdg-grid-border-color: rgb(77.4, 80.6, 83.8);--rbdg-grid-striped-bg: rgb(44.1, 47.9, 51.7);--rbdg-grid-striped-color: #fff;--rbdg-grid-active-bg: rgb(55.2, 58.8, 62.4);--rbdg-grid-active-color: #fff;--rbdg-grid-hover-bg: rgb(49.65, 53.35, 57.05);--rbdg-grid-hover-color: #fff;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-header-button{display:flex;align-items:center;appearance:none;background:rgba(0,0,0,0);border:none;padding:.5rem .5rem;width:100%;height:100%;cursor:pointer;color:inherit;font-weight:inherit;text-align:inherit}.rbdg-grid-header-button .rbdg-grid-header-button-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex-shrink:1}.rbdg-grid-header-button .rbdg-grid-header-button-hover-only-icon{visibility:hidden}.rbdg-grid-header-button:hover{color:var(--rbdg-grid-hover-color);background:var(--rbdg-grid-hover-bg)}.rbdg-grid-header-button:hover .rbdg-grid-header-button-hover-only-icon{visibility:visible}.rbdg-grid-header-button:focus{outline:0;box-shadow:inset 0 0 0 9999px var(--rbdg-grid-bg-state, var(--rbdg-grid-bg-type, var(--rbdg-grid-accent-bg))),var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}.rbdg-grid-header-button-icon{height:1em;flex-shrink:0}
|
|
1
|
+
.rbdg-grid>div,.rbdg-grid>div>div,.rbdg-grid>div>div>div{border-color:inherit;border-style:solid;border-width:0}.rbdg-grid{--rbdg-grid-color: var(--bs-emphasis-color);--rbdg-grid-bg: var(--bs-body-bg);--rbdg-grid-border-color: var(--bs-border-color);--rbdg-grid-accent-bg: transparent;--rbdg-grid-striped-color: var(--bs-emphasis-color);--rbdg-grid-striped-bg: rgba(var(--bs-emphasis-color-rgb), 0.05);--rbdg-grid-active-color: var(--bs-emphasis-color);--rbdg-grid-active-bg: rgba(var(--bs-emphasis-color-rgb), 0.1);--rbdg-grid-hover-color: var(--bs-emphasis-color);--rbdg-grid-hover-bg: rgba(var(--bs-emphasis-color-rgb), 0.075);border-color:var(--rbdg-grid-border-color)}.rbdg-grid>div{width:min-content}.rbdg-grid>div>div>div{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:.5rem .5rem;color:var(--rbdg-grid-color-state, var(--rbdg-grid-color-type, var(--rbdg-grid-color)));background-color:var(--rbdg-grid-bg);border-bottom-width:var(--bs-border-width);box-shadow:inset 0 0 0 9999px var(--rbdg-grid-bg-state, var(--rbdg-grid-bg-type, var(--rbdg-grid-accent-bg)))}.rbdg-grid>div>div>div.rbdg-sortable-header-cell{padding:0;overflow:visible}.rbdg-grid>div>div>div.rbdg-focusable-cell:focus{outline:0;box-shadow:inset 0 0 0 9999px var(--rbdg-grid-bg-state, var(--rbdg-grid-bg-type, var(--rbdg-grid-accent-bg))),var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}.rbdg-grid>div:first-child>div>div{border-bottom-width:var(--rbdg-grid-divider-border-width, var(--rbdg-grid-divider-borderless-width, var(--bs-border-width)));border-bottom-style:var(--rbdg-grid-divider-border-style, inherit);border-bottom-color:var(--rbdg-grid-divider-border-color, inherit)}.rbdg-grid-group-divider{--rbdg-grid-divider-border-width: calc(var(--bs-border-width) * 2);--rbdg-grid-divider-border-style: solid;--rbdg-grid-divider-border-color: currentcolor}.rbdg-grid-sm>div>div>div{padding:.25rem .25rem}.rbdg-grid-bordered{border-width:var(--bs-border-width);border-style:solid}.rbdg-grid-bordered>div>div>div:not(:last-child){border-width:0 var(--bs-border-width) 0 0}.rbdg-grid-bordered>div>div>div:last-child{border-width:0}.rbdg-grid-bordered>div:first-child>div{border-top-width:0;border-right-width:0;border-left-width:0;border-bottom-width:var(--rbdg-grid-divider-border-width, var(--rbdg-grid-divider-borderless-width, var(--bs-border-width)));border-bottom-style:var(--rbdg-grid-divider-border-style, inherit);border-bottom-color:var(--rbdg-grid-divider-border-color, inherit)}.rbdg-grid-bordered>div:last-child>div:not(:last-child){border-width:0 0 var(--bs-border-width) 0}.rbdg-grid-borderless{--rbdg-grid-divider-borderless-width: 0}.rbdg-grid-borderless>div>div>div{border-bottom-width:0}.rbdg-grid-borderless>:not(:first-child){border-top-width:0}.rbdg-grid-striped>div:nth-of-type(2)>div:nth-of-type(odd)>div{--rbdg-grid-color-type: var(--rbdg-grid-striped-color);--rbdg-grid-bg-type: var(--rbdg-grid-striped-bg)}.rbdg-grid-striped-columns>div>div>:nth-child(even){--rbdg-grid-color-type: var(--rbdg-grid-striped-color);--rbdg-grid-bg-type: var(--rbdg-grid-striped-bg)}.rbdg-grid-active{--rbdg-grid-color-state: var(--bs-grid-active-color);--rbdg-grid-bg-state: var(--rbdg-grid-active-bg)}.rbdg-grid-hover>div:nth-of-type(2)>div:hover>div{--rbdg-grid-color-state: var(--rbdg-grid-hover-color);--rbdg-grid-bg-state: var(--rbdg-grid-hover-bg)}.rbdg-grid-primary{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(206.6, 226, 254.6);--rbdg-grid-border-color: rgb(165.28, 180.8, 203.68);--rbdg-grid-striped-bg: rgb(196.27, 214.7, 241.87);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(185.94, 203.4, 229.14);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(191.105, 209.05, 235.505);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-secondary{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(225.6, 227.4, 229);--rbdg-grid-border-color: rgb(180.48, 181.92, 183.2);--rbdg-grid-striped-bg: rgb(214.32, 216.03, 217.55);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(203.04, 204.66, 206.1);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(208.68, 210.345, 211.825);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-success{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(209, 231, 220.8);--rbdg-grid-border-color: rgb(167.2, 184.8, 176.64);--rbdg-grid-striped-bg: rgb(198.55, 219.45, 209.76);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(188.1, 207.9, 198.72);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(193.325, 213.675, 204.24);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-info{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(206.6, 244.4, 252);--rbdg-grid-border-color: rgb(165.28, 195.52, 201.6);--rbdg-grid-striped-bg: rgb(196.27, 232.18, 239.4);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(185.94, 219.96, 226.8);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(191.105, 226.07, 233.1);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-warning{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(255, 242.6, 205.4);--rbdg-grid-border-color: rgb(204, 194.08, 164.32);--rbdg-grid-striped-bg: rgb(242.25, 230.47, 195.13);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(229.5, 218.34, 184.86);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(235.875, 224.405, 189.995);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-danger{--rbdg-grid-color: #000;--rbdg-grid-bg: rgb(248, 214.6, 217.8);--rbdg-grid-border-color: rgb(198.4, 171.68, 174.24);--rbdg-grid-striped-bg: rgb(235.6, 203.87, 206.91);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(223.2, 193.14, 196.02);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(229.4, 198.505, 201.465);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-light{--rbdg-grid-color: #000;--rbdg-grid-bg: #f8f9fa;--rbdg-grid-border-color: rgb(198.4, 199.2, 200);--rbdg-grid-striped-bg: rgb(235.6, 236.55, 237.5);--rbdg-grid-striped-color: #000;--rbdg-grid-active-bg: rgb(223.2, 224.1, 225);--rbdg-grid-active-color: #000;--rbdg-grid-hover-bg: rgb(229.4, 230.325, 231.25);--rbdg-grid-hover-color: #000;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-dark{--rbdg-grid-color: #fff;--rbdg-grid-bg: #212529;--rbdg-grid-border-color: rgb(77.4, 80.6, 83.8);--rbdg-grid-striped-bg: rgb(44.1, 47.9, 51.7);--rbdg-grid-striped-color: #fff;--rbdg-grid-active-bg: rgb(55.2, 58.8, 62.4);--rbdg-grid-active-color: #fff;--rbdg-grid-hover-bg: rgb(49.65, 53.35, 57.05);--rbdg-grid-hover-color: #fff;color:var(--rbdg-grid-color);border-color:var(--rbdg-grid-border-color)}.rbdg-grid-header-button{display:flex;align-items:center;appearance:none;background:rgba(0,0,0,0);border:none;padding:.5rem .5rem;width:100%;height:100%;cursor:pointer;color:inherit;font-weight:inherit;text-align:inherit}.rbdg-grid-header-button .rbdg-grid-header-button-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex-shrink:1}.rbdg-grid-header-button .rbdg-grid-header-button-hover-only-icon{visibility:hidden}.rbdg-grid-header-button:hover{color:var(--rbdg-grid-hover-color);background:var(--rbdg-grid-hover-bg)}.rbdg-grid-header-button:hover .rbdg-grid-header-button-hover-only-icon{visibility:visible}.rbdg-grid-header-button:focus{outline:0;box-shadow:inset 0 0 0 9999px var(--rbdg-grid-bg-state, var(--rbdg-grid-bg-type, var(--rbdg-grid-accent-bg))),var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}.rbdg-grid-header-button-icon{height:1em;flex-shrink:0}.rbdg-justify-content-center{justify-content:center}.rbdg-justify-content-left{justify-content:left}.rbdg-justify-content-right{justify-content:right}
|
package/grid.scss
CHANGED
|
@@ -303,3 +303,15 @@ responsive Bootstrap tables, it is a div that encloses the table element that is
|
|
|
303
303
|
height: 1em;
|
|
304
304
|
flex-shrink: 0;
|
|
305
305
|
}
|
|
306
|
+
|
|
307
|
+
.rbdg-justify-content-center {
|
|
308
|
+
justify-content: center;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.rbdg-justify-content-left {
|
|
312
|
+
justify-content: left;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.rbdg-justify-content-right {
|
|
316
|
+
justify-content: right;
|
|
317
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absreim/react-bootstrap-data-grid-pro",
|
|
3
3
|
"description": "Pro Version of data grid UI component for use with web apps using React and Bootstrap",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.5.0",
|
|
5
5
|
"license": "Commercial. See LICENSE file.",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
package/table/types.d.ts
CHANGED
|
@@ -12,11 +12,6 @@ export type DisplayMode = "table" | "block";
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
export interface TableSpecificProps {
|
|
15
|
-
/**
|
|
16
|
-
* The pagination model of the table. Passing a truthy value enables
|
|
17
|
-
* the pagination feature of the component.
|
|
18
|
-
*/
|
|
19
|
-
pagination?: PaginationModel;
|
|
20
15
|
/**
|
|
21
16
|
* The filter model of the table. Passing a truthy value enables the
|
|
22
17
|
* filtering feature of the component.
|
|
@@ -52,6 +47,11 @@ export interface TableSpecificProps {
|
|
|
52
47
|
* @defaultValue `"table"`
|
|
53
48
|
*/
|
|
54
49
|
displayMode?: DisplayMode;
|
|
50
|
+
/**
|
|
51
|
+
* The pagination model of the table. Passing a truthy value enables
|
|
52
|
+
* the pagination feature of the component.
|
|
53
|
+
*/
|
|
54
|
+
pagination?: PaginationModel;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* The type of the props object for the Table component.
|
package/table-pro/types.d.ts
CHANGED
|
@@ -9,21 +9,21 @@ export interface ProColDefSpecificFields {
|
|
|
9
9
|
/**
|
|
10
10
|
* Configures whether the column is resizable.
|
|
11
11
|
*
|
|
12
|
-
* @defaultValue false
|
|
12
|
+
* @defaultValue `false`
|
|
13
13
|
*/
|
|
14
14
|
resizeable?: boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Configures the width of the column. The value can be a number in pixels or
|
|
17
17
|
* a state setter/getter object of type {@link WidthModel}.
|
|
18
18
|
*
|
|
19
|
-
* @defaultValue 100
|
|
19
|
+
* @defaultValue `100`
|
|
20
20
|
*/
|
|
21
21
|
width?: ColDef["width"] | WidthModel;
|
|
22
22
|
/**
|
|
23
23
|
* When the column is resizable, configures the minimum width to which the
|
|
24
24
|
* column can be resized.
|
|
25
25
|
*
|
|
26
|
-
* @defaultValue 64 if the column is sortable, 32 if not
|
|
26
|
+
* @defaultValue `64` if the column is sortable, `32` if not
|
|
27
27
|
*/
|
|
28
28
|
minResizeWidth?: number;
|
|
29
29
|
/**
|
|
@@ -37,7 +37,7 @@ export interface ProColDefSpecificFields {
|
|
|
37
37
|
* Configures the number of pixels to change the width per keypress when
|
|
38
38
|
* resizing.
|
|
39
39
|
*
|
|
40
|
-
* @defaultValue 10
|
|
40
|
+
* @defaultValue `10`
|
|
41
41
|
*/
|
|
42
42
|
keyboardResizeStep?: number;
|
|
43
43
|
}
|