@absreim/react-bootstrap-data-grid 4.2.0 → 4.4.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/icons/CaretDownFill.d.ts +4 -0
- package/common/icons/CaretDownFill.js +6 -0
- package/common/icons/CaretUp.d.ts +4 -0
- package/common/icons/CaretUp.js +6 -0
- package/common/icons/CaretUpFill.d.ts +4 -0
- package/common/icons/CaretUpFill.js +6 -0
- package/common/icons/internalTypes.d.ts +3 -0
- package/common/icons/internalTypes.js +1 -0
- package/common/pagination/PageSelector.js +1 -1
- package/common/pagination/PageSizeSelector.js +1 -1
- package/common/pagination/Pagination.d.ts +2 -1
- package/common/pagination/Pagination.js +6 -4
- package/common/pagination/types.d.ts +5 -5
- package/common/selection/types.d.ts +2 -2
- package/common/sorting/ArrowPlaceholder.d.ts +3 -0
- package/common/sorting/ArrowPlaceholder.js +3 -0
- package/common/sorting/DownArrow.d.ts +6 -0
- package/common/sorting/DownArrow.js +6 -0
- package/common/sorting/UpArrow.d.ts +6 -0
- package/common/sorting/UpArrow.js +6 -0
- package/common/sorting/useSortHeaderStates.js +8 -7
- package/common/types.d.ts +14 -7
- package/grid/focus/useGridFocus.d.ts +1 -1
- package/grid/focus/useGridFocus.js +20 -5
- package/grid/index.d.ts +1 -0
- package/grid/index.js +1 -0
- package/grid/main/Grid.js +55 -29
- package/grid/main/GridHeader.js +29 -2
- package/grid/main/internalTypes.d.ts +2 -0
- package/grid/main/types.d.ts +19 -2
- package/grid/pagination/types.d.ts +78 -0
- package/grid/pagination/types.js +1 -0
- package/grid/sort/HeaderToggleButton.d.ts +11 -0
- package/grid/sort/HeaderToggleButton.js +30 -0
- package/grid.css +1 -1
- package/grid.scss +107 -33
- package/package.json +1 -1
- package/table/editing/EditableRow.js +1 -1
- package/table/types.d.ts +6 -11
- package/common/sorting/arrowPlaceholder.d.ts +0 -2
- package/common/sorting/arrowPlaceholder.js +0 -7
- package/common/sorting/downArrow.d.ts +0 -2
- package/common/sorting/downArrow.js +0 -3
- package/common/sorting/upArrow.d.ts +0 -2
- package/common/sorting/upArrow.js +0 -13
|
@@ -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
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var CaretUpFill = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: className, viewBox: "0 0 16 16", children: _jsx("path", { d: "M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z" }) }));
|
|
5
|
+
};
|
|
6
|
+
export default CaretUpFill;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var CaretUp = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: className, viewBox: "0 0 16 16", children: _jsx("path", { d: "M3.204 11h9.592L8 5.519zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506 0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659" }) }));
|
|
5
|
+
};
|
|
6
|
+
export default CaretUp;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var CaretUpFill = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: className, viewBox: "0 0 16 16", children: _jsx("path", { d: "m7.247 4.86-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z" }) }));
|
|
5
|
+
};
|
|
6
|
+
export default CaretUpFill;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -87,6 +87,6 @@ var PageSelector = function (_a) {
|
|
|
87
87
|
event.preventDefault();
|
|
88
88
|
setPageNum(buttonIndex);
|
|
89
89
|
}, children: buttonIndex }) }, buttonIndex)); });
|
|
90
|
-
return (_jsx("nav", { "aria-label": ariaLabel, children: _jsxs("ul", { className: classNames(ulClasses), children: [getFirstArrowButton(), getPrevArrowButton(), indexButtons, getNextArrowButton(), getLastArrowButton()] }) }));
|
|
90
|
+
return (_jsx("nav", { "aria-label": ariaLabel, "data-testid": "rbdg-page-selector", children: _jsxs("ul", { className: classNames(ulClasses), children: [getFirstArrowButton(), getPrevArrowButton(), indexButtons, getNextArrowButton(), getLastArrowButton()] }) }));
|
|
91
91
|
};
|
|
92
92
|
export default PageSelector;
|
|
@@ -6,7 +6,7 @@ var PageSizeSelector = function (_a) {
|
|
|
6
6
|
var pageSizeIndex = Number(event.target.value);
|
|
7
7
|
handleSetPageSize(pageSizeIndex);
|
|
8
8
|
};
|
|
9
|
-
return (_jsx("div", { children: _jsx("select", { name: "rowsPerPage", className: classNames({
|
|
9
|
+
return (_jsx("div", { "data-testid": "rbdg-page-size-selector", children: _jsx("select", { name: "rowsPerPage", className: classNames({
|
|
10
10
|
"form-select": true,
|
|
11
11
|
"form-select-lg": componentSize === "large",
|
|
12
12
|
"form-select-sm": componentSize === "small",
|
|
@@ -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
5
|
var Pagination = function (_a) {
|
|
6
|
-
var normalizedModel = _a.normalizedModel, prePagingNumRows = _a.prePagingNumRows, containerDivClasses = _a.containerDivClasses;
|
|
6
|
+
var normalizedModel = _a.normalizedModel, prePagingNumRows = _a.prePagingNumRows, containerDivClasses = _a.containerDivClasses, sizeSelectAfterPageSelect = _a.sizeSelectAfterPageSelect;
|
|
7
7
|
var pageSizeOptions = normalizedModel.pageSizeOptions, pageSizeIndex = normalizedModel.pageSizeIndex, currentPage = normalizedModel.currentPage, setCurrentPage = normalizedModel.setCurrentPage, setPageSizeIndex = normalizedModel.setPageSizeIndex, componentSize = normalizedModel.componentSize, maxPageButtons = normalizedModel.maxPageButtons, pageSelectorAriaLabel = normalizedModel.pageSelectorAriaLabel, pageSelectorJustifyContent = normalizedModel.pageSelectorJustifyContent;
|
|
8
8
|
var numPages = Math.ceil(prePagingNumRows / pageSizeOptions[pageSizeIndex]);
|
|
9
9
|
var pageIndexAwarePageSizeSetter = function (newPageSizeIndex) {
|
|
@@ -17,11 +17,13 @@ var Pagination = function (_a) {
|
|
|
17
17
|
setCurrentPage(maxPages);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
var pageSizeSelect = (_jsx(PageSizeSelector, { componentSize: componentSize, pageSizeOptions: pageSizeOptions, pageSizeIndex: pageSizeIndex, handleSetPageSize: pageIndexAwarePageSizeSetter }));
|
|
21
|
+
var pageSelect = (_jsx(PageSelector, { numPages: numPages, pageNum: currentPage, numButtons: maxPageButtons, setPageNum: setCurrentPage, size: componentSize, ariaLabel: pageSelectorAriaLabel, alignment: pageSelectorJustifyContent }));
|
|
22
|
+
return (_jsx("div", { "data-testid": "rdbg-pagination-ui-container", className: classNames(containerDivClasses || [
|
|
21
23
|
"d-flex",
|
|
22
24
|
"justify-content-end",
|
|
23
25
|
"gap-2",
|
|
24
26
|
"px-2",
|
|
25
|
-
]), children:
|
|
27
|
+
]), children: sizeSelectAfterPageSelect ? (_jsxs(_Fragment, { children: [pageSelect, pageSizeSelect] })) : (_jsxs(_Fragment, { children: [pageSizeSelect, pageSelect] })) }));
|
|
26
28
|
};
|
|
27
29
|
export default Pagination;
|
|
@@ -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,14 +43,14 @@ export interface PaginationOptions {
|
|
|
43
43
|
* The ARIA label for the nav element that represents the pagination
|
|
44
44
|
* component.
|
|
45
45
|
*
|
|
46
|
-
* @defaultValue undefined - no ARIA label
|
|
46
|
+
* @defaultValue `undefined` - no ARIA label
|
|
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
56
|
*/
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var ArrowPlaceholder = function () { return (_jsxs("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("title", { children: "(not being sorted)" }), _jsx("desc", { children: "Empty transparent square for styling purposes" })] })); };
|
|
3
|
+
export default ArrowPlaceholder;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var DownArrow = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_jsxs("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", className: className, children: [_jsx("title", { children: "Down arrow" }), _jsx("desc", { children: "Downward-pointing arrow" }), _jsx("path", { fillRule: "evenodd", d: "M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1" })] }));
|
|
5
|
+
};
|
|
6
|
+
export default DownArrow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var UpArrow = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_jsxs("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: className, viewBox: "0 0 16 16", children: [_jsx("title", { children: "Up arrow" }), _jsx("desc", { children: "Upward-pointing arrow" }), _jsx("path", { fillRule: "evenodd", d: "M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5" })] }));
|
|
5
|
+
};
|
|
6
|
+
export default UpArrow;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import useControlledHover from "../util/useControlledHover";
|
|
2
3
|
import { useMemo } from "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import UpArrow from "./UpArrow";
|
|
5
|
+
import ArrowPlaceholder from "./ArrowPlaceholder";
|
|
6
|
+
import DownArrow from "./DownArrow";
|
|
6
7
|
var useSortHeaderStates = function (sortModel) {
|
|
7
8
|
var _a = useControlledHover(), isHovering = _a.isHovering, setIsHovering = _a.setIsHovering, handleMouseOver = _a.handleMouseOver, handleMouseOut = _a.handleMouseOut;
|
|
8
9
|
var handleClick = function () {
|
|
@@ -30,15 +31,15 @@ var useSortHeaderStates = function (sortModel) {
|
|
|
30
31
|
switch (sortModel.sortOrder) {
|
|
31
32
|
case null: {
|
|
32
33
|
if (isHovering) {
|
|
33
|
-
return
|
|
34
|
+
return _jsx(UpArrow, { className: "text-body-secondary" });
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return _jsx(ArrowPlaceholder, {});
|
|
36
37
|
}
|
|
37
38
|
case "asc": {
|
|
38
|
-
return
|
|
39
|
+
return _jsx(UpArrow, {});
|
|
39
40
|
}
|
|
40
41
|
case "desc": {
|
|
41
|
-
return
|
|
42
|
+
return _jsx(DownArrow, {});
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}, [isHovering, sortModel]);
|
package/common/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SortModel } from "./sorting/types";
|
|
1
2
|
/**
|
|
2
3
|
* Union of all possible column data types.
|
|
3
4
|
*
|
|
@@ -39,7 +40,7 @@ export interface ColDefBase<ValueType = any> {
|
|
|
39
40
|
/**
|
|
40
41
|
* Specifies whether the column is sortable.
|
|
41
42
|
*
|
|
42
|
-
* @defaultValue false
|
|
43
|
+
* @defaultValue `false`
|
|
43
44
|
*/
|
|
44
45
|
sortable?: boolean;
|
|
45
46
|
}
|
|
@@ -57,7 +58,7 @@ export interface CommunitySpecificColProps {
|
|
|
57
58
|
* For the table, if no value is specified, then no value for min-width
|
|
58
59
|
* or max-width will be set.
|
|
59
60
|
*
|
|
60
|
-
* @defaultValue
|
|
61
|
+
* @defaultValue `100` for the grid, `undefined` for the table
|
|
61
62
|
*/
|
|
62
63
|
width?: number;
|
|
63
64
|
}
|
|
@@ -116,26 +117,32 @@ export interface RowDef<Data extends ValidRowData = ValidRowData> {
|
|
|
116
117
|
data: RowData<Data>;
|
|
117
118
|
}
|
|
118
119
|
/**
|
|
119
|
-
* Interface that contains parameters shared between the Table,
|
|
120
|
-
*
|
|
120
|
+
* Interface that contains parameters shared between the {@link Table},
|
|
121
|
+
* {@link @absreim/react-bootstrap-data-grid-pro#TablePro | TablePro}, and
|
|
122
|
+
* {@link Grid} components.
|
|
121
123
|
*
|
|
122
124
|
* @public
|
|
123
125
|
*/
|
|
124
126
|
export interface MainComponentSharedProps {
|
|
125
127
|
/**
|
|
126
|
-
* The rows of data to be displayed by the table or grid
|
|
128
|
+
* The rows of data to be displayed by the table or grid.
|
|
127
129
|
*/
|
|
128
130
|
rows: RowDef[];
|
|
129
131
|
/**
|
|
130
|
-
* The column definitions of the table or grid
|
|
132
|
+
* The column definitions of the table or grid.
|
|
131
133
|
*/
|
|
132
134
|
cols: ColDef[];
|
|
135
|
+
/**
|
|
136
|
+
* The sort model of the table or grid. Passing a truthy value enables the
|
|
137
|
+
* sorting feature of the component.
|
|
138
|
+
*/
|
|
139
|
+
sortModel?: SortModel;
|
|
133
140
|
}
|
|
134
141
|
/**
|
|
135
142
|
* {@link RowDef} object that additionally contains the index of the row in the
|
|
136
143
|
* original array.
|
|
137
144
|
*
|
|
138
|
-
* @typeParam Data - type of the data property of the RowDef object
|
|
145
|
+
* @typeParam Data - type of the data property of the {@link RowDef} object
|
|
139
146
|
*
|
|
140
147
|
* @public
|
|
141
148
|
*/
|
|
@@ -6,5 +6,5 @@ export interface GridFocusOutput {
|
|
|
6
6
|
gridKeydownHandler: KeyboardEventHandler<HTMLDivElement>;
|
|
7
7
|
}
|
|
8
8
|
declare const useGridFocus: (gridRef: RefObject<HTMLDivElement | null>, numRows: number, // Number that includes the header row
|
|
9
|
-
numCols: number) => GridFocusOutput;
|
|
9
|
+
numCols: number, sortableColIndices: number[]) => GridFocusOutput;
|
|
10
10
|
export default useGridFocus;
|
|
@@ -3,7 +3,7 @@ var startingCoordinates = {
|
|
|
3
3
|
ariaColIndex: 1,
|
|
4
4
|
ariaRowIndex: 1,
|
|
5
5
|
};
|
|
6
|
-
var useGridFocus = function (gridRef, numRows, numCols) {
|
|
6
|
+
var useGridFocus = function (gridRef, numRows, numCols, sortableColIndices) {
|
|
7
7
|
var _a = useState(startingCoordinates), coords = _a[0], setCoords = _a[1];
|
|
8
8
|
// Even though row and col count can be gotten from attributes, it needs to
|
|
9
9
|
// be a prop here to update effective coordinates at the appropriate times.
|
|
@@ -11,9 +11,16 @@ var useGridFocus = function (gridRef, numRows, numCols) {
|
|
|
11
11
|
ariaColIndex: Math.min(coords.ariaColIndex, numCols),
|
|
12
12
|
ariaRowIndex: Math.min(coords.ariaRowIndex, numRows),
|
|
13
13
|
}); }, [coords.ariaColIndex, coords.ariaRowIndex, numCols, numRows]);
|
|
14
|
+
var currentCellIsSortableHeader = useMemo(function () {
|
|
15
|
+
if (coords.ariaRowIndex !== 1) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return sortableColIndices.includes(coords.ariaColIndex);
|
|
19
|
+
}, [coords.ariaColIndex, coords.ariaRowIndex, sortableColIndices]);
|
|
14
20
|
var gridClickHandler = useCallback(function (event) {
|
|
15
21
|
var cursor = event.target;
|
|
16
|
-
while (cursor !== event.currentTarget &&
|
|
22
|
+
while (cursor !== event.currentTarget &&
|
|
23
|
+
!cursor.hasAttribute("aria-colindex")) {
|
|
17
24
|
cursor = cursor.parentElement;
|
|
18
25
|
}
|
|
19
26
|
if (!cursor.hasAttribute("aria-colindex")) {
|
|
@@ -116,15 +123,23 @@ var useGridFocus = function (gridRef, numRows, numCols) {
|
|
|
116
123
|
if (!gridRef.current.contains(document.activeElement)) {
|
|
117
124
|
return;
|
|
118
125
|
}
|
|
119
|
-
var
|
|
126
|
+
var cellSelector = ":scope > div > div[aria-rowindex=\"".concat(effectiveCoords.ariaRowIndex, "\"] > div[aria-colindex=\"").concat(effectiveCoords.ariaColIndex, "\"]");
|
|
127
|
+
var elToFocus = gridRef.current.querySelector(currentCellIsSortableHeader
|
|
128
|
+
? cellSelector + " .rbdg-grid-header-button"
|
|
129
|
+
: cellSelector);
|
|
120
130
|
if (elToFocus !== document.activeElement) {
|
|
121
131
|
elToFocus.focus({ preventScroll: true });
|
|
122
132
|
}
|
|
123
|
-
}, [
|
|
133
|
+
}, [
|
|
134
|
+
effectiveCoords.ariaColIndex,
|
|
135
|
+
effectiveCoords.ariaRowIndex,
|
|
136
|
+
gridRef,
|
|
137
|
+
currentCellIsSortableHeader,
|
|
138
|
+
]);
|
|
124
139
|
return {
|
|
125
140
|
effectiveCoords: effectiveCoords,
|
|
126
141
|
gridClickHandler: gridClickHandler,
|
|
127
|
-
gridKeydownHandler: gridKeydownHandler
|
|
142
|
+
gridKeydownHandler: gridKeydownHandler,
|
|
128
143
|
};
|
|
129
144
|
};
|
|
130
145
|
export default useGridFocus;
|
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,46 +9,60 @@ 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
18
|
var Grid = function (_a) {
|
|
18
|
-
var
|
|
19
|
-
var
|
|
19
|
+
var _b, _c, _d;
|
|
20
|
+
var rows = _a.rows, cols = _a.cols, sortModel = _a.sortModel, pagination = _a.pagination, width = _a.width, height = _a.height, variant = _a.variant, stripes = _a.stripes, hover = _a.hover, borders = _a.borders, small = _a.small, divider = _a.divider, borderVariant = _a.borderVariant, headerCellVariant = _a.headerCellVariant, headerRowVariant = _a.headerRowVariant, bodyCellVariant = _a.bodyCellVariant, bodyRowVariant = _a.bodyRowVariant, headerCellFocusVariant = _a.headerCellFocusVariant, bodyCellFocusVariant = _a.bodyCellFocusVariant;
|
|
21
|
+
var _e = useCombinedPipeline({
|
|
20
22
|
rows: rows,
|
|
21
23
|
cols: cols,
|
|
22
|
-
|
|
24
|
+
sortModel: sortModel,
|
|
25
|
+
pagination: pagination,
|
|
26
|
+
}), displayRows = _e.displayRows, filteredRows = _e.filteredRows, sortedRowsOutput = _e.sortedRowsOutput, currentPageRowsOutput = _e.currentPageRowsOutput;
|
|
23
27
|
var colNameToWidth = useColNameToWidth(cols);
|
|
24
28
|
var augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return "100%";
|
|
29
|
-
}
|
|
30
|
-
if (typeof width === "number") {
|
|
31
|
-
return width;
|
|
32
|
-
}
|
|
33
|
-
return "min-content";
|
|
29
|
+
function getWidthProperty(width) {
|
|
30
|
+
if (width === "parent") {
|
|
31
|
+
return "100%";
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
if (typeof width === "number") {
|
|
34
|
+
return width;
|
|
35
|
+
}
|
|
36
|
+
return "min-content";
|
|
37
|
+
}
|
|
38
|
+
var widthProperty = getWidthProperty(width);
|
|
39
|
+
function getHeightProperties(height) {
|
|
40
|
+
if (height === "parent") {
|
|
41
|
+
return {
|
|
42
|
+
containerDiv: "100%",
|
|
43
|
+
mainDiv: "100%",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (typeof height === "number") {
|
|
47
|
+
return {
|
|
48
|
+
containerDiv: undefined,
|
|
49
|
+
mainDiv: height,
|
|
50
|
+
};
|
|
43
51
|
}
|
|
44
52
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
containerDiv: undefined,
|
|
54
|
+
mainDiv: undefined,
|
|
47
55
|
};
|
|
48
|
-
}
|
|
56
|
+
}
|
|
57
|
+
var heightProperties = getHeightProperties(height);
|
|
49
58
|
var vertScrollable = height !== undefined && height !== "auto";
|
|
50
59
|
var gridRef = useRef(null);
|
|
51
|
-
var
|
|
60
|
+
var sortableColIndices = sortModel
|
|
61
|
+
? cols
|
|
62
|
+
.map(function (_, index) { return index + 1; })
|
|
63
|
+
.filter(function (ariaColIndex) { return cols[ariaColIndex - 1].sortable; })
|
|
64
|
+
: [];
|
|
65
|
+
var _f = useGridFocus(gridRef, displayRows.length + 1, cols.length, sortableColIndices), effectiveCoords = _f.effectiveCoords, gridClickHandler = _f.gridClickHandler, gridKeydownHandler = _f.gridKeydownHandler;
|
|
52
66
|
var onCopy = useCallback(function (event) {
|
|
53
67
|
var _a;
|
|
54
68
|
if (!((_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))) {
|
|
@@ -61,7 +75,10 @@ var Grid = function (_a) {
|
|
|
61
75
|
event.preventDefault();
|
|
62
76
|
event.clipboardData.setData("text/plain", selection.focusNode.textContent);
|
|
63
77
|
}, []);
|
|
64
|
-
|
|
78
|
+
var mainGridComponent = (_jsxs("div", { onCopy: onCopy, onClick: gridClickHandler, onKeyDown: gridKeydownHandler, ref: gridRef, style: {
|
|
79
|
+
width: widthProperty,
|
|
80
|
+
height: heightProperties.mainDiv,
|
|
81
|
+
}, className: classNames({
|
|
65
82
|
"overflow-x-auto": width !== undefined && width !== "auto",
|
|
66
83
|
"overflow-y-auto": vertScrollable,
|
|
67
84
|
"rbdg-grid-striped": stripes === "rows",
|
|
@@ -71,8 +88,17 @@ var Grid = function (_a) {
|
|
|
71
88
|
"rbdg-grid-borderless": borders === "none",
|
|
72
89
|
"rbdg-grid-sm": !!small,
|
|
73
90
|
"rbdg-grid-group-divider": !!divider,
|
|
74
|
-
}, "rbdg-grid", variant && "".concat(CSS_PREFIX, "-").concat(variant), borderVariant && "border-".concat(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
|
|
91
|
+
}, "rbdg-grid", variant && "".concat(CSS_PREFIX, "-").concat(variant), borderVariant && "border-".concat(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
|
|
75
92
|
? effectiveCoords.ariaColIndex
|
|
76
|
-
: null, cellFocusVariant: headerCellFocusVariant }), _jsx(GridBody, { focusCoords: effectiveCoords, augFormattedRows: augFormattedRows, cols: cols, rowVariant: bodyRowVariant, cellVariant: bodyCellVariant, cellFocusVariant: bodyCellFocusVariant })] }));
|
|
93
|
+
: null, cellFocusVariant: headerCellFocusVariant, sortInfo: sortedRowsOutput }), _jsx(GridBody, { focusCoords: effectiveCoords, augFormattedRows: augFormattedRows, cols: cols, rowVariant: bodyRowVariant, cellVariant: bodyCellVariant, cellFocusVariant: bodyCellFocusVariant })] }));
|
|
94
|
+
var getPagination = function (pagination) {
|
|
95
|
+
var _a, _b, _c, _d;
|
|
96
|
+
return (_jsx(Pagination, { containerDivClasses: [
|
|
97
|
+
"d-flex",
|
|
98
|
+
"rbdg-justify-content-".concat(((_a = pagination.styleOptions) === null || _a === void 0 ? void 0 : _a.horizontalAlignment) || "right"),
|
|
99
|
+
"gap-".concat(((_b = pagination.styleOptions) === null || _b === void 0 ? void 0 : _b.paginationComponentSpacing) === undefined ? 2 : (_c = pagination.styleOptions) === null || _c === void 0 ? void 0 : _c.paginationComponentSpacing),
|
|
100
|
+
], normalizedModel: currentPageRowsOutput.normalizedModel, prePagingNumRows: rows.length, sizeSelectAfterPageSelect: (_d = pagination.styleOptions) === null || _d === void 0 ? void 0 : _d.sizeSelectAfterPageSelect }));
|
|
101
|
+
};
|
|
102
|
+
return pagination ? (_jsx("div", { style: { width: widthProperty, height: heightProperties.containerDiv }, className: classNames("d-flex", "flex-column", "gap-".concat(((_b = pagination.styleOptions) === null || _b === void 0 ? void 0 : _b.mainComponentSpacing) === undefined ? 2 : (_c = pagination.styleOptions) === null || _c === void 0 ? void 0 : _c.mainComponentSpacing)), "data-testid": "rbdg-top-level-grid-container", children: ((_d = pagination.styleOptions) === null || _d === void 0 ? void 0 : _d.aboveMainComponent) ? (_jsxs(_Fragment, { children: [getPagination(pagination), mainGridComponent] })) : (_jsxs(_Fragment, { children: [mainGridComponent, getPagination(pagination)] })) })) : (_jsx(_Fragment, { children: mainGridComponent }));
|
|
77
103
|
};
|
|
78
104
|
export default Grid;
|
package/grid/main/GridHeader.js
CHANGED
|
@@ -3,14 +3,41 @@ import getWidthStyles from "./getWidthStyles";
|
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { CSS_PREFIX, DEFAULT_COL_WIDTH } from "../../common/constants";
|
|
5
5
|
import { GRID_HEADER_DATA_TEST_ID } from "../constants";
|
|
6
|
+
import HeaderToggleButton from "../sort/HeaderToggleButton";
|
|
7
|
+
import sortOrderToAriaSort from "../../common/sorting/sortOrderToAriaSort";
|
|
6
8
|
var GridHeader = function (_a) {
|
|
7
|
-
var cols = _a.cols, vertScrollable = _a.vertScrollable, rowVariant = _a.rowVariant, cellVariant = _a.cellVariant, focusColIndex = _a.focusColIndex, cellFocusVariant = _a.cellFocusVariant;
|
|
9
|
+
var cols = _a.cols, vertScrollable = _a.vertScrollable, rowVariant = _a.rowVariant, cellVariant = _a.cellVariant, focusColIndex = _a.focusColIndex, cellFocusVariant = _a.cellFocusVariant, sortInfo = _a.sortInfo;
|
|
10
|
+
var sortingEnabled = sortInfo.sortingEnabled, sortColDef = sortInfo.sortColDef, setSortColDef = sortInfo.setSortColDef;
|
|
11
|
+
var getSortButtonListener = function (colName) { return function () {
|
|
12
|
+
if ((sortColDef === null || sortColDef === void 0 ? void 0 : sortColDef.name) !== colName) {
|
|
13
|
+
setSortColDef({
|
|
14
|
+
name: colName,
|
|
15
|
+
order: "asc",
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (sortColDef.order === "asc") {
|
|
20
|
+
setSortColDef({
|
|
21
|
+
name: colName,
|
|
22
|
+
order: "desc",
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setSortColDef(null);
|
|
27
|
+
}; };
|
|
8
28
|
return (_jsx("div", { "data-testid": GRID_HEADER_DATA_TEST_ID, role: "rowgroup", className: classNames(vertScrollable ? ["position-sticky", "z-1", "top-0"] : []), children: _jsx("div", { role: "row", className: classNames("d-flex", "flex-row", rowVariant && "".concat(CSS_PREFIX, "-").concat(rowVariant)), "aria-rowindex": 1, children: cols.map(function (col, index) {
|
|
9
29
|
var ariaColIndex = index + 1;
|
|
10
30
|
var isFocused = focusColIndex === ariaColIndex;
|
|
11
31
|
var cellVariantVal = cellVariant && cellVariant(col, index);
|
|
12
32
|
var cellFocusVariantVal = cellFocusVariant && cellFocusVariant(col, index);
|
|
13
|
-
|
|
33
|
+
var currentColSortingEnabled = sortingEnabled && col.sortable;
|
|
34
|
+
return (_jsx("div", { tabIndex: isFocused && !currentColSortingEnabled ? 0 : -1, className: classNames("rbdg-grid-cell", "fw-bold", cellVariantVal && "".concat(CSS_PREFIX, "-").concat(cellVariantVal), cellFocusVariantVal && "focus-ring-".concat(cellFocusVariantVal), {
|
|
35
|
+
"z-2": isFocused,
|
|
36
|
+
"rbdg-focusable-cell": isFocused && !currentColSortingEnabled,
|
|
37
|
+
"rbdg-sortable-header-cell": currentColSortingEnabled,
|
|
38
|
+
}), role: "columnheader", "aria-colindex": ariaColIndex, "aria-sort": currentColSortingEnabled && (sortColDef === null || sortColDef === void 0 ? void 0 : sortColDef.name) === col.name
|
|
39
|
+
? sortOrderToAriaSort(sortColDef.order)
|
|
40
|
+
: undefined, style: getWidthStyles(col.width || DEFAULT_COL_WIDTH), children: currentColSortingEnabled ? (_jsx(HeaderToggleButton, { tabIndex: isFocused ? 0 : -1, colLabel: col.label, sortOrder: (sortColDef === null || sortColDef === void 0 ? void 0 : sortColDef.name) === col.name ? sortColDef.order : null, onClick: getSortButtonListener(col.name) })) : (col.label) }, col.name));
|
|
14
41
|
}) }) }));
|
|
15
42
|
};
|
|
16
43
|
export default GridHeader;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AugFormattedRow } from "../../common/internalTypes";
|
|
2
2
|
import { FocusCoordinates } from "../focus/types";
|
|
3
3
|
import { GridProps } from "./types";
|
|
4
|
+
import { SortedRowsOutput } from "../../common/pipeline/useCombinedPipeline/useSortedRows";
|
|
4
5
|
/**
|
|
5
6
|
* Props interface for the GridHeader component
|
|
6
7
|
*
|
|
@@ -13,6 +14,7 @@ export interface GridHeaderProps {
|
|
|
13
14
|
cellVariant?: GridProps["headerCellVariant"];
|
|
14
15
|
focusColIndex: number | null;
|
|
15
16
|
cellFocusVariant?: GridProps["headerCellFocusVariant"];
|
|
17
|
+
sortInfo: Omit<SortedRowsOutput, "sortedRows">;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Props interface for the GridBody component
|
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.
|
|
@@ -6,8 +7,8 @@ import { CellData, ColDef, FormattedRow, MainComponentSharedProps } from "../../
|
|
|
6
7
|
* @param cell - details the current cell
|
|
7
8
|
* @param row - details of the entire row that the current cell is in
|
|
8
9
|
* @param colIndex - zero-based column index of the current cell
|
|
9
|
-
* @param displayIndex - the zero-based index of the row that the cell is in.
|
|
10
|
-
* index is based on how the cell is actually displayed
|
|
10
|
+
* @param displayIndex - the zero-based index of the row that the cell is in.
|
|
11
|
+
* The index is based on how the cell is actually displayed after pagination,
|
|
11
12
|
* filtering, and sorting are applied.
|
|
12
13
|
*
|
|
13
14
|
* @returns - a string that is name of the color variant or null for no color
|
|
@@ -43,10 +44,14 @@ export type GridProps = MainComponentSharedProps & GridSpecificProps;
|
|
|
43
44
|
export interface GridSpecificProps {
|
|
44
45
|
/**
|
|
45
46
|
* The height setting of the grid
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue `"auto"`
|
|
46
49
|
*/
|
|
47
50
|
height?: GridHeightSetting;
|
|
48
51
|
/**
|
|
49
52
|
* The width setting of the grid
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue `"auto"`
|
|
50
55
|
*/
|
|
51
56
|
width?: GridWidthSetting;
|
|
52
57
|
/**
|
|
@@ -103,16 +108,28 @@ export interface GridSpecificProps {
|
|
|
103
108
|
* Function to set the color variant of body cell focus rings
|
|
104
109
|
*/
|
|
105
110
|
bodyCellFocusVariant?: BodyCellVariantFn;
|
|
111
|
+
/**
|
|
112
|
+
* Enables and configures pagination for the grid
|
|
113
|
+
*/
|
|
114
|
+
pagination?: GridPaginationModel;
|
|
106
115
|
}
|
|
107
116
|
/**
|
|
108
117
|
* The type of the prop to set grid height behavior
|
|
109
118
|
*
|
|
119
|
+
* - number: fixed height of grid in pixels
|
|
120
|
+
* - `auto`: takes on the intrinsic height of the contents
|
|
121
|
+
* - `parent`: takes on 100% of the parent height
|
|
122
|
+
*
|
|
110
123
|
* @public
|
|
111
124
|
*/
|
|
112
125
|
export type GridHeightSetting = number | "auto" | "parent";
|
|
113
126
|
/**
|
|
114
127
|
* The type of the prop to set grid width behavior
|
|
115
128
|
*
|
|
129
|
+
* - number: fixed width of grid in pixels
|
|
130
|
+
* - `auto`: takes on the intrinsic width of the contents
|
|
131
|
+
* - `parent`: takes on 100% of the parent width
|
|
132
|
+
*
|
|
116
133
|
* @public
|
|
117
134
|
*/
|
|
118
135
|
export type GridWidthSetting = number | "auto" | "parent";
|
|
@@ -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 {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SortOrder } from "../../common";
|
|
2
|
+
import { FC, MouseEventHandler } from "react";
|
|
3
|
+
export interface HeaderToggleButtonProps {
|
|
4
|
+
colLabel: string;
|
|
5
|
+
sortOrder: SortOrder | null;
|
|
6
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
tabIndex: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const HeaderToggleButton: FC<HeaderToggleButtonProps>;
|
|
11
|
+
export default HeaderToggleButton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import CaretUp from "../../common/icons/CaretUp";
|
|
3
|
+
import CaretDownFill from "../../common/icons/CaretDownFill";
|
|
4
|
+
import CaretUpFill from "../../common/icons/CaretUpFill";
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
var HeaderToggleButton = function (_a) {
|
|
7
|
+
var colLabel = _a.colLabel, sortOrder = _a.sortOrder, onClick = _a.onClick, tabIndex = _a.tabIndex, className = _a.className;
|
|
8
|
+
function getIcon() {
|
|
9
|
+
switch (sortOrder) {
|
|
10
|
+
case "asc":
|
|
11
|
+
return _jsx(CaretUpFill, { className: "rbdg-grid-header-button-icon" });
|
|
12
|
+
case "desc":
|
|
13
|
+
return _jsx(CaretDownFill, { className: "rbdg-grid-header-button-icon" });
|
|
14
|
+
default:
|
|
15
|
+
return (_jsx(CaretUp, { className: "rbdg-grid-header-button-icon rbdg-grid-header-button-hover-only-icon" }));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function getAriaLabelSuffix() {
|
|
19
|
+
switch (sortOrder) {
|
|
20
|
+
case "asc":
|
|
21
|
+
return "(Sorted ascending. Click to sort descending.)";
|
|
22
|
+
case "desc":
|
|
23
|
+
return "(Sorted descending. Click to stop sorting.)";
|
|
24
|
+
default:
|
|
25
|
+
return "(Not sorted. Click to sort ascending.)";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return (_jsxs("button", { "aria-label": colLabel + " " + getAriaLabelSuffix(), onClick: onClick, className: classNames("rbdg-grid-header-button", className), tabIndex: tabIndex, children: [_jsx("span", { className: "rbdg-grid-header-button-label", children: colLabel }), getIcon()] }));
|
|
29
|
+
};
|
|
30
|
+
export default HeaderToggleButton;
|
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-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)}
|
|
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
|
@@ -11,6 +11,19 @@ $rbdg-prefix: "rbdg-";
|
|
|
11
11
|
border-width: 0;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
@mixin rbdg-focusable-element {
|
|
15
|
+
outline: 0;
|
|
16
|
+
box-shadow:
|
|
17
|
+
inset 0 0 0 9999px
|
|
18
|
+
var(
|
|
19
|
+
--#{$rbdg-prefix}grid-bg-state,
|
|
20
|
+
var(--#{$rbdg-prefix}grid-bg-type, var(--#{$rbdg-prefix}grid-accent-bg))
|
|
21
|
+
),
|
|
22
|
+
var(--#{$prefix}focus-ring-x, 0) var(--#{$prefix}focus-ring-y, 0)
|
|
23
|
+
var(--#{$prefix}focus-ring-blur, 0) var(--#{$prefix}focus-ring-width)
|
|
24
|
+
var(--#{$prefix}focus-ring-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
// While these rules seem to work, the way that the three border modes, default; bordered; and borderless override each
|
|
15
28
|
// other is quite hard to understand.
|
|
16
29
|
// Consider refactoring so that each type mode, including default, has a separate class that contains rules for just
|
|
@@ -47,28 +60,30 @@ $rbdg-prefix: "rbdg-";
|
|
|
47
60
|
padding: $table-cell-padding-y $table-cell-padding-x;
|
|
48
61
|
color: var(
|
|
49
62
|
--#{$rbdg-prefix}grid-color-state,
|
|
50
|
-
var(
|
|
63
|
+
var(
|
|
64
|
+
--#{$rbdg-prefix}grid-color-type,
|
|
65
|
+
var(--#{$rbdg-prefix}grid-color)
|
|
66
|
+
)
|
|
51
67
|
);
|
|
52
68
|
background-color: var(--#{$rbdg-prefix}grid-bg);
|
|
53
69
|
border-bottom-width: $table-border-width;
|
|
54
|
-
box-shadow: inset 0 0 0 9999px
|
|
55
|
-
--#{$rbdg-prefix}grid-bg-state,
|
|
70
|
+
box-shadow: inset 0 0 0 9999px
|
|
56
71
|
var(
|
|
57
|
-
--#{$rbdg-prefix}grid-bg-
|
|
58
|
-
var(
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
--#{$rbdg-prefix}grid-bg-state,
|
|
73
|
+
var(
|
|
74
|
+
--#{$rbdg-prefix}grid-bg-type,
|
|
75
|
+
var(--#{$rbdg-prefix}grid-accent-bg)
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
> div.rbdg-sortable-header-cell {
|
|
81
|
+
padding: 0;
|
|
82
|
+
overflow: visible;
|
|
61
83
|
}
|
|
62
84
|
|
|
63
85
|
> div.rbdg-focusable-cell:focus {
|
|
64
|
-
|
|
65
|
-
box-shadow: inset 0 0 0 9999px var(
|
|
66
|
-
--#{$rbdg-prefix}grid-bg-state,
|
|
67
|
-
var(
|
|
68
|
-
--#{$rbdg-prefix}grid-bg-type,
|
|
69
|
-
var(--#{$rbdg-prefix}grid-accent-bg)
|
|
70
|
-
)
|
|
71
|
-
), var(--#{$prefix}focus-ring-x, 0) var(--#{$prefix}focus-ring-y, 0) var(--#{$prefix}focus-ring-blur, 0) var(--#{$prefix}focus-ring-width) var(--#{$prefix}focus-ring-color);
|
|
86
|
+
@include rbdg-focusable-element;
|
|
72
87
|
}
|
|
73
88
|
}
|
|
74
89
|
}
|
|
@@ -223,21 +238,80 @@ $rbdg-prefix: "rbdg-";
|
|
|
223
238
|
@include rbdg-grid-variant($color, $value);
|
|
224
239
|
}
|
|
225
240
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
/*
|
|
242
|
+
A Note About Responsive Tables
|
|
243
|
+
|
|
244
|
+
The Bootstrap _tables.scss file contains a series of classes to apply responsive tables at various breakpoints.
|
|
245
|
+
There is no such equivalent for RBDG flex grid for the following reason.
|
|
246
|
+
|
|
247
|
+
The RBDG flex grid is a div of type "block," so the concept of "responsive" scrollable breakpoints doesn't apply.
|
|
248
|
+
It appears that for a table, even if the width is to 100%, the browser sometimes disobeys this setting causing
|
|
249
|
+
the width to be more than the parent, hence the need for responsive tables. Divs do not appear to have this problem.
|
|
250
|
+
|
|
251
|
+
The RBDG flex grid provides other options to achieving a horizontally scrollable grid. They are as follows.
|
|
252
|
+
|
|
253
|
+
When using the default or "auto" setting for the RBDG grid's "width," the intrinsic width of the grid columns is
|
|
254
|
+
used. In such circumstances, if one wants to make the grid scrollable horizontally, they can enclose the grid in a
|
|
255
|
+
horizontally-scrollable div.
|
|
256
|
+
|
|
257
|
+
When the grid's width is to set to "parent", the grid takes on the width of the parent (width 100% CSS value) just
|
|
258
|
+
like the Bootstrap table does. In this case, the grid div itself is horizontally scrollable. In contrast, for
|
|
259
|
+
responsive Bootstrap tables, it is a div that encloses the table element that is scrollable.
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
.rbdg-grid-header-button {
|
|
263
|
+
display: flex;
|
|
264
|
+
align-items: center;
|
|
265
|
+
appearance: none;
|
|
266
|
+
background: transparent;
|
|
267
|
+
border: none;
|
|
268
|
+
padding: $table-cell-padding-y $table-cell-padding-x;
|
|
269
|
+
width: 100%;
|
|
270
|
+
height: 100%;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
color: inherit;
|
|
273
|
+
font-weight: inherit;
|
|
274
|
+
text-align: inherit;
|
|
275
|
+
|
|
276
|
+
.rbdg-grid-header-button-label {
|
|
277
|
+
overflow: hidden;
|
|
278
|
+
text-overflow: ellipsis;
|
|
279
|
+
white-space: nowrap;
|
|
280
|
+
min-width: 0;
|
|
281
|
+
flex-shrink: 1;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.rbdg-grid-header-button-hover-only-icon {
|
|
285
|
+
visibility: hidden;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&:hover {
|
|
289
|
+
color: var(--#{$rbdg-prefix}grid-hover-color);
|
|
290
|
+
background: var(--#{$rbdg-prefix}grid-hover-bg);
|
|
291
|
+
|
|
292
|
+
.rbdg-grid-header-button-hover-only-icon {
|
|
293
|
+
visibility: visible;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
&:focus {
|
|
298
|
+
@include rbdg-focusable-element;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.rbdg-grid-header-button-icon {
|
|
303
|
+
height: 1em;
|
|
304
|
+
flex-shrink: 0;
|
|
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",
|
|
3
3
|
"description": "Data grid UI component for use with web apps using React and Bootstrap",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
|
-
import { dateToDatetimeInputStr, dateToInputStr
|
|
4
|
+
import { dateToDatetimeInputStr, dateToInputStr } from "../../common";
|
|
5
5
|
import EditControlsCell from "./EditControlsCell";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import getWidthStyle from "../../common/util/getWidthStyle";
|
package/table/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditModel, FilterModel, MainComponentSharedProps, PaginationModel, SelectModel,
|
|
1
|
+
import { EditModel, FilterModel, MainComponentSharedProps, PaginationModel, SelectModel, StyleModel } from "../common";
|
|
2
2
|
/**
|
|
3
3
|
* Available options for the displayMode prop of {@link TableSpecificProps}.
|
|
4
4
|
*
|
|
@@ -12,16 +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
|
-
/**
|
|
21
|
-
* The sort model of the table. Passing a truthy value enables the
|
|
22
|
-
* sorting feature of the component.
|
|
23
|
-
*/
|
|
24
|
-
sortModel?: SortModel;
|
|
25
15
|
/**
|
|
26
16
|
* The filter model of the table. Passing a truthy value enables the
|
|
27
17
|
* filtering feature of the component.
|
|
@@ -57,6 +47,11 @@ export interface TableSpecificProps {
|
|
|
57
47
|
* @defaultValue `"table"`
|
|
58
48
|
*/
|
|
59
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;
|
|
60
55
|
}
|
|
61
56
|
/**
|
|
62
57
|
* The type of the props object for the Table component.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Temporary solution to prevent column widths from changing when hovering over
|
|
3
|
-
// columns with a mouse.
|
|
4
|
-
// More ideal permanent solution would be to fix column widths based on preset
|
|
5
|
-
// values.
|
|
6
|
-
var arrowPlaceholder = (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("title", { children: "(not being sorted)" }), _jsx("desc", { children: "Empty transparent square for styling purposes" })] }));
|
|
7
|
-
export default arrowPlaceholder;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
var downArrow = (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("title", { children: "(sorted descending)" }), _jsx("desc", { children: "Down arrow indicating that the column is being sorted in an descending manner" }), _jsx("path", { fillRule: "evenodd", d: "M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1" })] }));
|
|
3
|
-
export default downArrow;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import classNames from "classnames";
|
|
12
|
-
var upArrow = function (grayed) { return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: classNames(__spreadArray([], (grayed ? ["text-body-secondary"] : []), true)), viewBox: "0 0 16 16", children: [!grayed && (_jsxs(_Fragment, { children: [_jsx("title", { children: "(sorted ascending)" }), _jsx("desc", { children: "Up arrow indicating that the column is being sorted in an ascending manner" })] })), _jsx("path", { fillRule: "evenodd", d: "M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5" })] })); };
|
|
13
|
-
export default upArrow;
|