@absreim/react-bootstrap-data-grid 4.0.0 → 4.1.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/grid/focus/types.d.ts +4 -0
- package/grid/focus/types.js +1 -0
- package/grid/focus/useGridFocus.d.ts +10 -0
- package/grid/focus/useGridFocus.js +130 -0
- package/grid/main/Grid.js +21 -4
- package/grid/main/GridBody.js +20 -9
- package/grid/main/GridHeader.js +8 -4
- package/grid/main/types.d.ts +11 -2
- package/grid.css +1 -1
- package/grid.scss +26 -14
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KeyboardEventHandler, PointerEventHandler, RefObject } from "react";
|
|
2
|
+
import { FocusCoordinates } from "./types";
|
|
3
|
+
export interface GridFocusOutput {
|
|
4
|
+
effectiveCoords: FocusCoordinates;
|
|
5
|
+
gridClickHandler: PointerEventHandler<HTMLDivElement>;
|
|
6
|
+
gridKeydownHandler: KeyboardEventHandler<HTMLDivElement>;
|
|
7
|
+
}
|
|
8
|
+
declare const useGridFocus: (gridRef: RefObject<HTMLDivElement | null>, numRows: number, // Number that includes the header row
|
|
9
|
+
numCols: number) => GridFocusOutput;
|
|
10
|
+
export default useGridFocus;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState, } from "react";
|
|
2
|
+
var startingCoordinates = {
|
|
3
|
+
ariaColIndex: 1,
|
|
4
|
+
ariaRowIndex: 1,
|
|
5
|
+
};
|
|
6
|
+
var useGridFocus = function (gridRef, numRows, numCols) {
|
|
7
|
+
var _a = useState(startingCoordinates), coords = _a[0], setCoords = _a[1];
|
|
8
|
+
// Even though row and col count can be gotten from attributes, it needs to
|
|
9
|
+
// be a prop here to update effective coordinates at the appropriate times.
|
|
10
|
+
var effectiveCoords = useMemo(function () { return ({
|
|
11
|
+
ariaColIndex: Math.min(coords.ariaColIndex, numCols),
|
|
12
|
+
ariaRowIndex: Math.min(coords.ariaRowIndex, numRows),
|
|
13
|
+
}); }, [coords.ariaColIndex, coords.ariaRowIndex, numCols, numRows]);
|
|
14
|
+
var gridClickHandler = useCallback(function (event) {
|
|
15
|
+
var cursor = event.target;
|
|
16
|
+
while (cursor !== event.currentTarget && !cursor.hasAttribute("aria-colindex")) {
|
|
17
|
+
cursor = cursor.parentElement;
|
|
18
|
+
}
|
|
19
|
+
if (!cursor.hasAttribute("aria-colindex")) {
|
|
20
|
+
// This is a legit outcome if the click was registered at a level above
|
|
21
|
+
// grid cells or column headers.
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var row = cursor.parentElement;
|
|
25
|
+
setCoords({
|
|
26
|
+
ariaColIndex: Number(cursor.getAttribute("aria-colIndex")),
|
|
27
|
+
ariaRowIndex: Number(row.getAttribute("aria-rowIndex")),
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
var gridKeydownHandler = useCallback(function (event) {
|
|
31
|
+
switch (event.code) {
|
|
32
|
+
case "ArrowDown": {
|
|
33
|
+
if (effectiveCoords.ariaRowIndex !== numRows) {
|
|
34
|
+
setCoords({
|
|
35
|
+
ariaColIndex: effectiveCoords.ariaColIndex,
|
|
36
|
+
ariaRowIndex: effectiveCoords.ariaRowIndex + 1,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case "ArrowUp": {
|
|
42
|
+
if (effectiveCoords.ariaRowIndex !== 1) {
|
|
43
|
+
setCoords({
|
|
44
|
+
ariaColIndex: effectiveCoords.ariaColIndex,
|
|
45
|
+
ariaRowIndex: effectiveCoords.ariaRowIndex - 1,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case "ArrowLeft": {
|
|
51
|
+
if (effectiveCoords.ariaColIndex !== 1) {
|
|
52
|
+
setCoords({
|
|
53
|
+
ariaColIndex: effectiveCoords.ariaColIndex - 1,
|
|
54
|
+
ariaRowIndex: effectiveCoords.ariaRowIndex,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "ArrowRight": {
|
|
60
|
+
if (effectiveCoords.ariaColIndex !== numCols) {
|
|
61
|
+
setCoords({
|
|
62
|
+
ariaColIndex: effectiveCoords.ariaColIndex + 1,
|
|
63
|
+
ariaRowIndex: effectiveCoords.ariaRowIndex,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case "Home": {
|
|
69
|
+
if (event.ctrlKey || event.metaKey) {
|
|
70
|
+
setCoords({
|
|
71
|
+
ariaColIndex: 1,
|
|
72
|
+
ariaRowIndex: 1,
|
|
73
|
+
});
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
setCoords({
|
|
77
|
+
ariaColIndex: 1,
|
|
78
|
+
ariaRowIndex: effectiveCoords.ariaRowIndex,
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case "End": {
|
|
83
|
+
if (event.ctrlKey || event.metaKey) {
|
|
84
|
+
setCoords({
|
|
85
|
+
ariaColIndex: numCols,
|
|
86
|
+
ariaRowIndex: numRows,
|
|
87
|
+
});
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
setCoords({
|
|
91
|
+
ariaColIndex: numCols,
|
|
92
|
+
ariaRowIndex: effectiveCoords.ariaRowIndex,
|
|
93
|
+
});
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
default: {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
// Optionally set the element focus here. Not sure how much differences it
|
|
102
|
+
// makes in terms of performance vs relying on the useEffect hook.
|
|
103
|
+
}, [
|
|
104
|
+
effectiveCoords.ariaColIndex,
|
|
105
|
+
effectiveCoords.ariaRowIndex,
|
|
106
|
+
numCols,
|
|
107
|
+
numRows,
|
|
108
|
+
]);
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
if (!gridRef.current) {
|
|
111
|
+
// Not completely sure when this code can be reached, but it seems like a
|
|
112
|
+
// decent solution to just return. At the worst the user may need to click
|
|
113
|
+
// or do a keypress again during a corner case.
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!gridRef.current.contains(document.activeElement)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
var elToFocus = gridRef.current.querySelector(":scope > div > div[aria-rowindex=\"".concat(effectiveCoords.ariaRowIndex, "\"] > div[aria-colindex=\"").concat(effectiveCoords.ariaColIndex, "\"]"));
|
|
120
|
+
if (elToFocus !== document.activeElement) {
|
|
121
|
+
elToFocus.focus({ preventScroll: true });
|
|
122
|
+
}
|
|
123
|
+
}, [effectiveCoords.ariaColIndex, effectiveCoords.ariaRowIndex, gridRef]);
|
|
124
|
+
return {
|
|
125
|
+
effectiveCoords: effectiveCoords,
|
|
126
|
+
gridClickHandler: gridClickHandler,
|
|
127
|
+
gridKeydownHandler: gridKeydownHandler
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export default useGridFocus;
|
package/grid/main/Grid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
3
|
+
import { useCallback, useMemo, 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";
|
|
@@ -8,8 +8,9 @@ import GridHeader from "./GridHeader";
|
|
|
8
8
|
import GridBody from "./GridBody";
|
|
9
9
|
import classNames from "classnames";
|
|
10
10
|
import { CSS_PREFIX } from "../../common/constants";
|
|
11
|
+
import useGridFocus from "../focus/useGridFocus";
|
|
11
12
|
var Grid = function (_a) {
|
|
12
|
-
var rows = _a.rows, cols = _a.cols, filterModel = _a.filterModel, sortModel = _a.sortModel, pagination = _a.pagination, selectModel = _a.selectModel, 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;
|
|
13
|
+
var rows = _a.rows, cols = _a.cols, filterModel = _a.filterModel, sortModel = _a.sortModel, pagination = _a.pagination, selectModel = _a.selectModel, 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;
|
|
13
14
|
var _b = useCombinedPipeline({
|
|
14
15
|
rows: rows,
|
|
15
16
|
cols: cols,
|
|
@@ -45,7 +46,21 @@ var Grid = function (_a) {
|
|
|
45
46
|
};
|
|
46
47
|
}, [width, height]);
|
|
47
48
|
var vertScrollable = height !== undefined && height !== "auto";
|
|
48
|
-
|
|
49
|
+
var gridRef = useRef(null);
|
|
50
|
+
var _c = useGridFocus(gridRef, rows.length + 1, cols.length), effectiveCoords = _c.effectiveCoords, gridClickHandler = _c.gridClickHandler, gridKeydownHandler = _c.gridKeydownHandler;
|
|
51
|
+
var onCopy = useCallback(function (event) {
|
|
52
|
+
var _a;
|
|
53
|
+
if (!((_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var selection = document.getSelection();
|
|
57
|
+
if (!selection || !selection.isCollapsed) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
event.clipboardData.setData("text/plain", selection.focusNode.textContent);
|
|
62
|
+
}, []);
|
|
63
|
+
return (_jsxs("div", { onCopy: onCopy, onClick: gridClickHandler, onKeyDown: gridKeydownHandler, ref: gridRef, style: gridStyle, className: classNames({
|
|
49
64
|
"overflow-x-auto": width !== undefined && width !== "auto",
|
|
50
65
|
"overflow-y-auto": vertScrollable,
|
|
51
66
|
"rbdg-grid-striped": stripes === "rows",
|
|
@@ -55,6 +70,8 @@ var Grid = function (_a) {
|
|
|
55
70
|
"rbdg-grid-borderless": borders === "none",
|
|
56
71
|
"rbdg-grid-sm": !!small,
|
|
57
72
|
"rbdg-grid-group-divider": !!divider,
|
|
58
|
-
}, "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
|
|
73
|
+
}, "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
|
|
74
|
+
? effectiveCoords.ariaColIndex
|
|
75
|
+
: null, cellFocusVariant: headerCellFocusVariant }), _jsx(GridBody, { focusCoords: effectiveCoords, augFormattedRows: augFormattedRows, cols: cols, rowVariant: bodyRowVariant, cellVariant: bodyCellVariant, cellFocusVariant: bodyCellFocusVariant })] }));
|
|
59
76
|
};
|
|
60
77
|
export default Grid;
|
package/grid/main/GridBody.js
CHANGED
|
@@ -4,14 +4,25 @@ import classNames from "classnames";
|
|
|
4
4
|
import { CSS_PREFIX, DEFAULT_COL_WIDTH } from "../../common/constants";
|
|
5
5
|
import { GRID_BODY_DATA_TEST_ID } from "../constants";
|
|
6
6
|
var GridBody = function (_a) {
|
|
7
|
-
var augFormattedRows = _a.augFormattedRows, cols = _a.cols, rowVariant = _a.rowVariant, cellVariant = _a.cellVariant;
|
|
8
|
-
return (_jsx("div", { role: "rowgroup", "data-testid": GRID_BODY_DATA_TEST_ID, children: augFormattedRows.map(function (row, rowDisplayIndex) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
var augFormattedRows = _a.augFormattedRows, cols = _a.cols, rowVariant = _a.rowVariant, cellVariant = _a.cellVariant, focusCoords = _a.focusCoords, cellFocusVariant = _a.cellFocusVariant;
|
|
8
|
+
return (_jsx("div", { role: "rowgroup", "data-testid": GRID_BODY_DATA_TEST_ID, children: augFormattedRows.map(function (row, rowDisplayIndex) {
|
|
9
|
+
var ariaRowIndex = row.prePaginationIndex + 2;
|
|
10
|
+
return (_jsx("div", { role: "row", "aria-rowindex": ariaRowIndex, className: classNames("d-flex", "flex-row", rowVariant &&
|
|
11
|
+
rowVariant(row, rowDisplayIndex) &&
|
|
12
|
+
"".concat(CSS_PREFIX, "-").concat(rowVariant(row, rowDisplayIndex))), children: row.contents.map(function (_a, index) {
|
|
13
|
+
var formattedValue = _a.formattedValue, width = _a.width;
|
|
14
|
+
var ariaColIndex = index + 1;
|
|
15
|
+
var isFocused = focusCoords.ariaColIndex === ariaColIndex &&
|
|
16
|
+
focusCoords.ariaRowIndex === ariaRowIndex;
|
|
17
|
+
var cellVariantVal = cellVariant &&
|
|
18
|
+
cellVariant(row.contents[index], row, index, rowDisplayIndex);
|
|
19
|
+
var cellFocusVariantVal = cellFocusVariant &&
|
|
20
|
+
cellFocusVariant(row.contents[index], row, index, rowDisplayIndex);
|
|
21
|
+
return (_jsx("div", { tabIndex: isFocused ? 0 : -1, style: getWidthStyles(width || DEFAULT_COL_WIDTH), role: "gridcell", className: classNames("rbdg-grid-cell", cellVariantVal && "".concat(CSS_PREFIX, "-").concat(cellVariantVal), cellFocusVariantVal && "focus-ring-".concat(cellFocusVariantVal), {
|
|
22
|
+
"z-2": isFocused,
|
|
23
|
+
"rbdg-focusable-cell": isFocused,
|
|
24
|
+
}), "aria-colindex": ariaColIndex, children: formattedValue }, cols[index].name));
|
|
25
|
+
}) }, row.id));
|
|
26
|
+
}) }));
|
|
16
27
|
};
|
|
17
28
|
export default GridBody;
|
package/grid/main/GridHeader.js
CHANGED
|
@@ -4,9 +4,13 @@ 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
6
|
var GridHeader = function (_a) {
|
|
7
|
-
var cols = _a.cols, vertScrollable = _a.vertScrollable, rowVariant = _a.rowVariant, cellVariant = _a.cellVariant;
|
|
8
|
-
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
|
-
|
|
10
|
-
|
|
7
|
+
var cols = _a.cols, vertScrollable = _a.vertScrollable, rowVariant = _a.rowVariant, cellVariant = _a.cellVariant, focusColIndex = _a.focusColIndex, cellFocusVariant = _a.cellFocusVariant;
|
|
8
|
+
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
|
+
var ariaColIndex = index + 1;
|
|
10
|
+
var isFocused = focusColIndex === ariaColIndex;
|
|
11
|
+
var cellVariantVal = cellVariant && cellVariant(col, index);
|
|
12
|
+
var cellFocusVariantVal = cellFocusVariant && cellFocusVariant(col, index);
|
|
13
|
+
return (_jsx("div", { tabIndex: isFocused ? 0 : -1, className: classNames("rbdg-grid-cell", "fw-bold", cellVariantVal && "".concat(CSS_PREFIX, "-").concat(cellVariantVal), cellFocusVariantVal && "focus-ring-".concat(cellFocusVariantVal), { "z-2": isFocused, "rbdg-focusable-cell": isFocused }), role: "columnheader", "aria-colindex": ariaColIndex, style: getWidthStyles(col.width || DEFAULT_COL_WIDTH), children: col.label }, col.name));
|
|
14
|
+
}) }) }));
|
|
11
15
|
};
|
|
12
16
|
export default GridHeader;
|
package/grid/main/types.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { AugFormattedRow, CellData, ColDef, FormattedRow, MainComponentSharedProps } from "../../common";
|
|
2
|
+
import { FocusCoordinates } from "../focus/types";
|
|
3
|
+
export type BodyCellVariantFn = (cell: CellData, row: FormattedRow, colIndex: number, displayIndex: number) => string | null;
|
|
4
|
+
export type HeaderCellVariantFn = (col: ColDef, colIndex: number) => string | null;
|
|
2
5
|
export type GridProps = MainComponentSharedProps & {
|
|
3
6
|
height?: GridHeightSetting;
|
|
4
7
|
width?: GridWidthSetting;
|
|
@@ -10,21 +13,27 @@ export type GridProps = MainComponentSharedProps & {
|
|
|
10
13
|
small?: boolean;
|
|
11
14
|
divider?: boolean;
|
|
12
15
|
headerRowVariant?: string;
|
|
13
|
-
headerCellVariant?:
|
|
16
|
+
headerCellVariant?: HeaderCellVariantFn;
|
|
14
17
|
bodyRowVariant?: (row: FormattedRow, displayIndex: number) => string | null;
|
|
15
|
-
bodyCellVariant?:
|
|
18
|
+
bodyCellVariant?: BodyCellVariantFn;
|
|
19
|
+
headerCellFocusVariant?: HeaderCellVariantFn;
|
|
20
|
+
bodyCellFocusVariant?: BodyCellVariantFn;
|
|
16
21
|
};
|
|
17
22
|
export interface GridHeaderProps {
|
|
18
23
|
cols: GridProps["cols"];
|
|
19
24
|
vertScrollable: boolean;
|
|
20
25
|
rowVariant?: GridProps["headerRowVariant"];
|
|
21
26
|
cellVariant?: GridProps["headerCellVariant"];
|
|
27
|
+
focusColIndex: number | null;
|
|
28
|
+
cellFocusVariant?: GridProps["headerCellFocusVariant"];
|
|
22
29
|
}
|
|
23
30
|
export type GridBodyProps = {
|
|
24
31
|
augFormattedRows: AugFormattedRow[];
|
|
25
32
|
cols: GridProps["cols"];
|
|
26
33
|
rowVariant?: GridProps["bodyRowVariant"];
|
|
27
34
|
cellVariant?: GridProps["bodyCellVariant"];
|
|
35
|
+
focusCoords: FocusCoordinates;
|
|
36
|
+
cellFocusVariant?: GridProps["bodyCellFocusVariant"];
|
|
28
37
|
};
|
|
29
38
|
export type GridHeightSetting = number | "auto" | "parent";
|
|
30
39
|
export type GridWidthSetting = number | "auto" | "parent";
|
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: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-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)}
|
package/grid.scss
CHANGED
|
@@ -39,25 +39,37 @@ $rbdg-prefix: "rbdg-";
|
|
|
39
39
|
> div {
|
|
40
40
|
width: min-content;
|
|
41
41
|
|
|
42
|
-
> div
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var(
|
|
42
|
+
> div {
|
|
43
|
+
> div {
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
padding: $table-cell-padding-y $table-cell-padding-x;
|
|
48
|
+
color: var(
|
|
49
|
+
--#{$rbdg-prefix}grid-color-state,
|
|
50
|
+
var(--#{$rbdg-prefix}grid-color-type, var(--#{$rbdg-prefix}grid-color))
|
|
51
|
+
);
|
|
52
|
+
background-color: var(--#{$rbdg-prefix}grid-bg);
|
|
53
|
+
border-bottom-width: $table-border-width;
|
|
54
|
+
box-shadow: inset 0 0 0 9999px var(
|
|
55
55
|
--#{$rbdg-prefix}grid-bg-state,
|
|
56
56
|
var(
|
|
57
57
|
--#{$rbdg-prefix}grid-bg-type,
|
|
58
58
|
var(--#{$rbdg-prefix}grid-accent-bg)
|
|
59
59
|
)
|
|
60
60
|
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
> div.rbdg-focusable-cell:focus {
|
|
64
|
+
outline: 0;
|
|
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);
|
|
72
|
+
}
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
75
|
|
|
@@ -211,7 +223,7 @@ $rbdg-prefix: "rbdg-";
|
|
|
211
223
|
@include rbdg-grid-variant($color, $value);
|
|
212
224
|
}
|
|
213
225
|
|
|
214
|
-
//
|
|
226
|
+
// A note about Responsive Tables
|
|
215
227
|
//
|
|
216
228
|
// The Bootstrap _tables.scss file contains a series of classes to apply responsive tables at various breakpoints.
|
|
217
229
|
// There is no such equivalent for RBDG flex grid for the following reason.
|
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.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|