@absreim/react-bootstrap-data-grid-pro 2.7.0 → 4.0.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/constants.d.ts +2 -0
- package/common/constants.js +2 -0
- package/common/editing/types.d.ts +7 -0
- package/{grid → common}/export/ExportForm.d.ts +1 -0
- package/{grid → common}/export/ExportForm.js +3 -3
- package/{grid → common}/filtering/DateFilterRow.d.ts +4 -4
- package/{grid → common}/filtering/DateFilterRow.js +1 -1
- package/common/filtering/FilterOptionsTable.d.ts +12 -0
- package/common/filtering/FilterOptionsTable.js +87 -0
- package/{grid → common}/filtering/FilterRow.d.ts +4 -4
- package/{grid → common}/filtering/FilterRow.js +1 -1
- package/{grid → common}/filtering/NumberFilterRow.d.ts +3 -3
- package/{grid → common}/filtering/NumberFilterRow.js +1 -1
- package/{grid → common}/filtering/StringFilterRow.d.ts +3 -3
- package/{grid → common}/filtering/StringFilterRow.js +1 -1
- package/{grid → common}/filtering/types.d.ts +6 -6
- package/common/filtering/useFilterFormState.d.ts +3 -0
- package/common/index.d.ts +11 -0
- package/common/index.js +11 -0
- package/{grid → common}/pagination/PageSelector.d.ts +1 -1
- package/{grid → common}/pagination/PageSizeSelector.d.ts +1 -1
- package/{grid → common}/pagination/Pagination.d.ts +1 -1
- package/{grid → common}/pagination/Pagination.js +6 -3
- package/{grid → common}/pagination/types.d.ts +3 -2
- package/{grid → common}/pipeline/useAugFormattedRows.d.ts +1 -1
- package/common/pipeline/useColNameToWidth.d.ts +3 -0
- package/common/pipeline/useColNameToWidth.js +7 -0
- package/{grid → common}/pipeline/useCombinedPipeline/index.d.ts +4 -4
- package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +3 -3
- package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.d.ts +1 -1
- package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.js +1 -2
- package/common/pipeline/useCombinedPipeline/useFilter.d.ts +4 -0
- package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +4 -0
- package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.d.ts +2 -2
- package/{grid → common}/pipeline/useGridSelectionFns.d.ts +2 -2
- package/{grid → common}/sorting/types.d.ts +3 -3
- package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.d.ts +2 -2
- package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.js +4 -4
- package/common/styling/types.d.ts +21 -0
- package/{grid → common}/toolbar/ToolbarContainer.d.ts +2 -2
- package/{grid → common}/toolbar/ToolbarContainer.js +11 -7
- package/common/toolbar/types.d.ts +11 -0
- package/common/toolbar/useInterfaces.d.ts +3 -0
- package/common/toolbar/useInterfaces.js +15 -0
- package/{grid → common}/types.d.ts +24 -34
- package/common/util/index.d.ts +5 -0
- package/common/util/index.js +5 -0
- package/grid/constants.d.ts +2 -0
- package/grid/constants.js +2 -0
- package/grid/index.d.ts +3 -10
- package/grid/index.js +3 -10
- package/grid/{Grid.d.ts → main/Grid.d.ts} +0 -1
- package/grid/main/Grid.js +59 -0
- package/grid/main/GridBody.d.ts +4 -0
- package/grid/main/GridBody.js +13 -0
- package/grid/main/GridHeader.d.ts +4 -0
- package/grid/main/GridHeader.js +11 -0
- package/grid/main/getWidthStyles.d.ts +3 -0
- package/grid/main/getWidthStyles.js +6 -0
- package/grid/main/types.d.ts +32 -0
- package/grid.css +1 -0
- package/grid.scss +231 -0
- package/package.json +1 -1
- package/pro/index.d.ts +5 -0
- package/pro/index.js +5 -0
- package/table/InternalTable.d.ts +21 -0
- package/table/InternalTable.js +58 -0
- package/table/Table.d.ts +5 -0
- package/{grid/Grid.js → table/Table.js} +11 -18
- package/{grid → table}/editing/EditControlsCell.d.ts +5 -5
- package/table/editing/EditControlsCell.js +10 -0
- package/{grid → table}/editing/EditableRow.d.ts +8 -9
- package/{grid → table}/editing/EditableRow.js +3 -3
- package/table/index.d.ts +5 -0
- package/table/index.js +5 -0
- package/table/main/BodyRows.d.ts +22 -0
- package/table/main/BodyRows.js +27 -0
- package/{grid → table}/main/ColHeaderCell/index.js +3 -3
- package/{grid → table}/selection/SelectAllHeaderCell.d.ts +2 -2
- package/{grid → table}/selection/SelectAllHeaderCell.js +2 -4
- package/{grid → table}/selection/SelectionInput.d.ts +1 -1
- package/table/style.scss +3 -0
- package/table/styling/types.d.ts +41 -0
- package/table/styling/types.js +1 -0
- package/table/types.d.ts +19 -0
- package/table/types.js +1 -0
- package/{grid-pro → table-pro}/ColHeaderCellPro.js +4 -4
- package/table-pro/TablePro.d.ts +4 -0
- package/{grid-pro/GridPro.js → table-pro/TablePro.js} +10 -13
- package/{grid-pro → table-pro}/index.d.ts +2 -2
- package/{grid-pro → table-pro}/index.js +2 -2
- package/{grid-pro → table-pro}/reorder/ReorderHandleCell.js +1 -1
- package/{grid-pro → table-pro}/reorder/useKeyboardReorder.js +1 -1
- package/{grid-pro → table-pro}/resize/useResizeModel.d.ts +1 -1
- package/table-pro/style.scss +69 -0
- package/{grid-pro → table-pro}/types.d.ts +3 -3
- package/table-pro/types.js +1 -0
- package/table-pro.scss +1 -0
- package/grid/InternalGrid.d.ts +0 -23
- package/grid/InternalGrid.js +0 -56
- package/grid/editing/EditControlsCell.js +0 -18
- package/grid/editing/types.d.ts +0 -16
- package/grid/filtering/FilterOptionsTable.d.ts +0 -11
- package/grid/filtering/FilterOptionsTable.js +0 -81
- package/grid/filtering/useFilterFormState.d.ts +0 -3
- package/grid/main/BodyRows.d.ts +0 -22
- package/grid/main/BodyRows.js +0 -11
- package/grid/main/ToggleButton.d.ts +0 -9
- package/grid/main/ToggleButton.js +0 -13
- package/grid/pipeline/useCombinedPipeline/useFilter.d.ts +0 -4
- package/grid/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +0 -4
- package/grid/pipeline/useUnwrappedGridStyles.d.ts +0 -7
- package/grid/pipeline/useUnwrappedGridStyles.js +0 -15
- package/grid/styling/styleModelUnwrappers.d.ts +0 -4
- package/grid/styling/styleModelUnwrappers.js +0 -47
- package/grid/styling/types.d.ts +0 -62
- package/grid/toolbar/types.d.ts +0 -3
- package/grid/toolbar/useInterfaces.d.ts +0 -9
- package/grid/toolbar/useInterfaces.js +0 -11
- package/grid-pro/GridPro.d.ts +0 -4
- /package/{grid → common}/editing/inputStrsToRowData.d.ts +0 -0
- /package/{grid → common}/editing/inputStrsToRowData.js +0 -0
- /package/{grid-pro/reorder → common/editing}/types.js +0 -0
- /package/{grid → common}/export/types.d.ts +0 -0
- /package/{grid-pro/resize → common/export}/types.js +0 -0
- /package/{grid → common}/export/useExportFn.d.ts +0 -0
- /package/{grid → common}/export/useExportFn.js +0 -0
- /package/{grid → common}/filtering/types.js +0 -0
- /package/{grid → common}/filtering/useFilterFormState.js +0 -0
- /package/{grid → common}/pagination/PageSelector.js +0 -0
- /package/{grid → common}/pagination/PageSizeSelector.js +0 -0
- /package/{grid-pro → common/pagination}/types.js +0 -0
- /package/{grid → common}/pipeline/types.d.ts +0 -0
- /package/{grid-pro/util → common/pipeline}/types.js +0 -0
- /package/{grid → common}/pipeline/useAugFormattedRows.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/index.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilter.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateFromEditable.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.js +0 -0
- /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.d.ts +0 -0
- /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.js +0 -0
- /package/{grid → common}/pipeline/useGridSelectionFns.js +0 -0
- /package/{grid → common}/selection/types.d.ts +0 -0
- /package/{grid → common}/selection/types.js +0 -0
- /package/{grid → common}/sorting/arrowPlaceholder.d.ts +0 -0
- /package/{grid → common}/sorting/arrowPlaceholder.js +0 -0
- /package/{grid → common}/sorting/downArrow.d.ts +0 -0
- /package/{grid → common}/sorting/downArrow.js +0 -0
- /package/{grid → common}/sorting/sortOrderToAriaSort.d.ts +0 -0
- /package/{grid → common}/sorting/sortOrderToAriaSort.js +0 -0
- /package/{grid/editing → common/sorting}/types.js +0 -0
- /package/{grid → common}/sorting/upArrow.d.ts +0 -0
- /package/{grid → common}/sorting/upArrow.js +0 -0
- /package/{grid/export → common/styling}/types.js +0 -0
- /package/{grid → common}/toolbar/Toolbar.d.ts +0 -0
- /package/{grid → common}/toolbar/Toolbar.js +0 -0
- /package/{grid/pagination → common/toolbar}/types.js +0 -0
- /package/{grid/pipeline → common}/types.js +0 -0
- /package/{grid → common}/util/datetime.d.ts +0 -0
- /package/{grid → common}/util/datetime.js +0 -0
- /package/{grid → common}/util/getWidthStyle.d.ts +0 -0
- /package/{grid → common}/util/getWidthStyle.js +0 -0
- /package/{grid → common}/util/isSubset.d.ts +0 -0
- /package/{grid → common}/util/isSubset.js +0 -0
- /package/{grid → common}/util/trueModulo.d.ts +0 -0
- /package/{grid → common}/util/trueModulo.js +0 -0
- /package/{grid → common}/util/useControlledHover.d.ts +0 -0
- /package/{grid → common}/util/useControlledHover.js +0 -0
- /package/grid/{sorting → main}/types.js +0 -0
- /package/{grid → table}/main/ColHeaderCell/index.d.ts +0 -0
- /package/{grid → table}/selection/SelectionInput.js +0 -0
- /package/{grid-pro → table-pro}/ColHeaderCellPro.d.ts +0 -0
- /package/{grid-pro → table-pro}/assets/HorizontalGrip.d.ts +0 -0
- /package/{grid-pro → table-pro}/assets/HorizontalGrip.js +0 -0
- /package/{grid-pro → table-pro}/assets/VerticalGrip.d.ts +0 -0
- /package/{grid-pro → table-pro}/assets/VerticalGrip.js +0 -0
- /package/{grid-pro/util → table-pro/lib}/regDragCleanup.d.ts +0 -0
- /package/{grid-pro/util → table-pro/lib}/regDragCleanup.js +0 -0
- /package/{grid-pro/util → table-pro/lib}/types.d.ts +0 -0
- /package/{grid/styling → table-pro/lib}/types.js +0 -0
- /package/{grid-pro → table-pro}/reorder/ReorderHandleCell.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.js +0 -0
- /package/{grid-pro → table-pro}/reorder/types.d.ts +0 -0
- /package/{grid/toolbar → table-pro/reorder}/types.js +0 -0
- /package/{grid-pro → table-pro}/reorder/useKeyboardReorder.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.js +0 -0
- /package/{grid-pro → table-pro}/reorder/useReorderStyles.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/useReorderStyles.js +0 -0
- /package/{grid-pro → table-pro}/resize/types.d.ts +0 -0
- /package/{grid → table-pro/resize}/types.js +0 -0
- /package/{grid-pro → table-pro}/resize/useResizeModel.js +0 -0
- /package/{grid-pro → table-pro}/util/index.d.ts +0 -0
- /package/{grid-pro → table-pro}/util/index.js +0 -0
- /package/{grid-pro → table-pro}/util/reorderRows.d.ts +0 -0
- /package/{grid-pro → table-pro}/util/reorderRows.js +0 -0
- /package/{style.css → table-pro.css} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { FilterOptionsTableProps } from "../filtering/FilterOptionsTable";
|
|
3
|
+
import { ExportFormProps } from "../export/ExportForm";
|
|
4
|
+
export type ToolbarOption = "filtering" | "exporting";
|
|
5
|
+
export type ToolbarInterfaces = Partial<Record<ToolbarOption, ReactNode>>;
|
|
6
|
+
export interface InterfaceParams {
|
|
7
|
+
filtering?: FilterOptionsTableProps;
|
|
8
|
+
exporting?: ExportFormProps;
|
|
9
|
+
}
|
|
10
|
+
export type InterfacePropGenerator = (closeUiCallback: () => void) => InterfaceParams;
|
|
11
|
+
export type InterfaceNodeGenerator = (closeUiCallback: () => void) => ToolbarInterfaces;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import FilterOptionsTable from "../filtering/FilterOptionsTable";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import ExportForm from "../export/ExportForm";
|
|
5
|
+
const useInterfaces = (gen) => {
|
|
6
|
+
return useMemo(() => (closeCallback) => {
|
|
7
|
+
const props = gen(closeCallback);
|
|
8
|
+
const { exporting, filtering } = props;
|
|
9
|
+
return {
|
|
10
|
+
filtering: filtering ? (_jsx(FilterOptionsTable, Object.assign({}, filtering))) : undefined,
|
|
11
|
+
exporting: exporting ? _jsx(ExportForm, Object.assign({}, exporting)) : undefined,
|
|
12
|
+
};
|
|
13
|
+
}, [gen]);
|
|
14
|
+
};
|
|
15
|
+
export default useInterfaces;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { EditModel } from "./editing/types";
|
|
2
|
+
import { PaginationModel } from "./pagination/types";
|
|
3
|
+
import { SortModel } from "./sorting/types";
|
|
4
4
|
import { FilterModel } from "./filtering/types";
|
|
5
5
|
import { SelectModel } from "./selection/types";
|
|
6
6
|
import { StyleModel } from "./styling/types";
|
|
@@ -23,45 +23,35 @@ export interface RowDef<Data extends ValidRowData = ValidRowData> {
|
|
|
23
23
|
id: RowId;
|
|
24
24
|
data: RowData<Data>;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
origIndex: number;
|
|
28
|
-
};
|
|
29
|
-
export type PostPaginationRowDef<Data extends ValidRowData = ValidRowData> = AugRowDef & {
|
|
30
|
-
prePaginationIndex: number;
|
|
31
|
-
};
|
|
32
|
-
export type FormattedRow = {
|
|
33
|
-
contents: CellData[];
|
|
34
|
-
} & Omit<PostPaginationRowDef, "data">;
|
|
35
|
-
export type AugCellData = CellData & {
|
|
36
|
-
width?: number;
|
|
37
|
-
};
|
|
38
|
-
export type AugFormattedRow = Omit<FormattedRow, "contents"> & {
|
|
39
|
-
contents: AugCellData[];
|
|
40
|
-
};
|
|
41
|
-
export type JustifyContentSetting = "start" | "end" | "center" | "between" | "around" | "evenly";
|
|
42
|
-
export type Size = "small" | "medium" | "large";
|
|
43
|
-
export type DisplayMode = "table" | "block";
|
|
44
|
-
export interface GridProps {
|
|
26
|
+
export interface MainComponentSharedProps {
|
|
45
27
|
rows: RowDef[];
|
|
46
28
|
cols: ColDef[];
|
|
47
|
-
pagination?:
|
|
48
|
-
sortModel?:
|
|
29
|
+
pagination?: PaginationModel;
|
|
30
|
+
sortModel?: SortModel;
|
|
49
31
|
filterModel?: FilterModel;
|
|
50
32
|
selectModel?: SelectModel;
|
|
51
33
|
editModel?: EditModel;
|
|
52
|
-
caption?: string;
|
|
53
34
|
styleModel?: StyleModel;
|
|
54
|
-
|
|
55
|
-
responsive?: boolean;
|
|
56
|
-
displayMode?: DisplayMode;
|
|
35
|
+
allowExport?: boolean;
|
|
57
36
|
}
|
|
58
|
-
export type
|
|
59
|
-
|
|
37
|
+
export type AugRowDef<Data extends ValidRowData = ValidRowData> = RowDef<Data> & {
|
|
38
|
+
origIndex: number;
|
|
60
39
|
};
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
export type PostPaginationRowDef<Data extends ValidRowData = ValidRowData> = AugRowDef<Data> & {
|
|
41
|
+
prePaginationIndex: number;
|
|
42
|
+
};
|
|
43
|
+
export interface CellData {
|
|
44
|
+
fieldName: string;
|
|
45
|
+
value: ColDataType;
|
|
46
|
+
type: ColDataTypeStrings;
|
|
64
47
|
ariaColIndex: number;
|
|
65
|
-
|
|
48
|
+
formattedValue: string;
|
|
49
|
+
label: string;
|
|
66
50
|
width?: number;
|
|
67
51
|
}
|
|
52
|
+
export type FormattedRow = {
|
|
53
|
+
contents: Omit<CellData, "width">[];
|
|
54
|
+
} & Omit<PostPaginationRowDef, "data">;
|
|
55
|
+
export type AugFormattedRow = {
|
|
56
|
+
contents: CellData[];
|
|
57
|
+
} & Omit<PostPaginationRowDef, "data">;
|
package/grid/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "
|
|
3
|
-
export
|
|
4
|
-
export * from "./selection/types";
|
|
5
|
-
export * from "./filtering/types";
|
|
6
|
-
export * from "./sorting/types";
|
|
7
|
-
export * from "./pagination/types";
|
|
8
|
-
export * from "./Grid";
|
|
9
|
-
export * from "./util/datetime";
|
|
10
|
-
export { default } from "./Grid";
|
|
1
|
+
export * from "./main/types";
|
|
2
|
+
export * from "../common";
|
|
3
|
+
export { default } from "./main/Grid";
|
package/grid/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "
|
|
3
|
-
export
|
|
4
|
-
export * from "./selection/types";
|
|
5
|
-
export * from "./filtering/types";
|
|
6
|
-
export * from "./sorting/types";
|
|
7
|
-
export * from "./pagination/types";
|
|
8
|
-
export * from "./Grid";
|
|
9
|
-
export * from "./util/datetime";
|
|
10
|
-
export { default } from "./Grid";
|
|
1
|
+
export * from "./main/types";
|
|
2
|
+
export * from "../common";
|
|
3
|
+
export { default } from "./main/Grid";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import useCombinedPipeline from "../../common/pipeline/useCombinedPipeline";
|
|
5
|
+
import useAugFormattedRows from "../../common/pipeline/useAugFormattedRows";
|
|
6
|
+
import useColNameToWidth from "../../common/pipeline/useColNameToWidth";
|
|
7
|
+
import GridHeader from "./GridHeader";
|
|
8
|
+
import GridBody from "./GridBody";
|
|
9
|
+
import classNames from "classnames";
|
|
10
|
+
import { CSS_PREFIX } from "../../common/constants";
|
|
11
|
+
const Grid = ({ rows, cols, filterModel, sortModel, pagination, selectModel, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, }) => {
|
|
12
|
+
const { displayRows, filteredRows } = useCombinedPipeline({
|
|
13
|
+
rows,
|
|
14
|
+
cols,
|
|
15
|
+
filterModel,
|
|
16
|
+
sortModel,
|
|
17
|
+
pagination,
|
|
18
|
+
selectModel,
|
|
19
|
+
});
|
|
20
|
+
const colNameToWidth = useColNameToWidth(cols);
|
|
21
|
+
const augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
|
|
22
|
+
const gridStyle = useMemo(() => {
|
|
23
|
+
function getWidthProperty(width) {
|
|
24
|
+
if (width === "parent") {
|
|
25
|
+
return "100%";
|
|
26
|
+
}
|
|
27
|
+
if (typeof width === "number") {
|
|
28
|
+
return width;
|
|
29
|
+
}
|
|
30
|
+
return "min-content";
|
|
31
|
+
}
|
|
32
|
+
function getHeightProperty(height) {
|
|
33
|
+
if (height === "parent") {
|
|
34
|
+
return "100%";
|
|
35
|
+
}
|
|
36
|
+
if (typeof height === "number") {
|
|
37
|
+
return height;
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
width: getWidthProperty(width),
|
|
43
|
+
height: getHeightProperty(height),
|
|
44
|
+
};
|
|
45
|
+
}, [width, height]);
|
|
46
|
+
const vertScrollable = height !== undefined && height !== "auto";
|
|
47
|
+
return (_jsxs("div", { style: gridStyle, className: classNames({
|
|
48
|
+
"overflow-x-auto": width !== undefined && width !== "auto",
|
|
49
|
+
"overflow-y-auto": vertScrollable,
|
|
50
|
+
"rbdg-grid-striped": stripes === "rows",
|
|
51
|
+
"rbdg-grid-striped-columns": stripes === "columns",
|
|
52
|
+
"rbdg-grid-hover": !!hover,
|
|
53
|
+
"rbdg-grid-bordered": borders === "full",
|
|
54
|
+
"rbdg-grid-borderless": borders === "none",
|
|
55
|
+
"rbdg-grid-sm": !!small,
|
|
56
|
+
"rbdg-grid-group-divider": !!divider,
|
|
57
|
+
}, "rbdg-grid", variant && `${CSS_PREFIX}-${variant}`, borderVariant && `border-${borderVariant}`), role: "grid", "aria-colcount": cols.length, "aria-rowcount": filteredRows.length + 1, children: [_jsx(GridHeader, { cols: cols, rowVariant: headerRowVariant, cellVariant: headerCellVariant, vertScrollable: vertScrollable }), _jsx(GridBody, { augFormattedRows: augFormattedRows, cols: cols, rowVariant: bodyRowVariant, cellVariant: bodyCellVariant })] }));
|
|
58
|
+
};
|
|
59
|
+
export default Grid;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import getWidthStyles from "./getWidthStyles";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { CSS_PREFIX, DEFAULT_COL_WIDTH } from "../../common/constants";
|
|
5
|
+
import { GRID_BODY_DATA_TEST_ID } from "../constants";
|
|
6
|
+
const GridBody = ({ augFormattedRows, cols, rowVariant, cellVariant, }) => {
|
|
7
|
+
return (_jsx("div", { role: "rowgroup", "data-testid": GRID_BODY_DATA_TEST_ID, children: augFormattedRows.map((row, rowDisplayIndex) => (_jsx("div", { role: "row", "aria-rowindex": row.prePaginationIndex + 2, className: classNames("d-flex", "flex-row", rowVariant &&
|
|
8
|
+
rowVariant(row, rowDisplayIndex) &&
|
|
9
|
+
`${CSS_PREFIX}-${rowVariant(row, rowDisplayIndex)}`), children: row.contents.map(({ formattedValue, width }, index) => (_jsx("div", { style: getWidthStyles(width || DEFAULT_COL_WIDTH), role: "gridcell", className: classNames("rbdg-grid-cell", cellVariant &&
|
|
10
|
+
cellVariant(row.contents[index], row, index, rowDisplayIndex) &&
|
|
11
|
+
`${CSS_PREFIX}-${cellVariant(row.contents[index], row, index, rowDisplayIndex)}`), "aria-colindex": index + 1, children: formattedValue }, cols[index].name))) }, row.id))) }));
|
|
12
|
+
};
|
|
13
|
+
export default GridBody;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import getWidthStyles from "./getWidthStyles";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { CSS_PREFIX, DEFAULT_COL_WIDTH } from "../../common/constants";
|
|
5
|
+
import { GRID_HEADER_DATA_TEST_ID } from "../constants";
|
|
6
|
+
const GridHeader = ({ cols, vertScrollable, rowVariant, cellVariant, }) => {
|
|
7
|
+
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 && `${CSS_PREFIX}-${rowVariant}`), "aria-rowindex": 1, children: cols.map((col, index) => (_jsx("div", { className: classNames("rbdg-grid-cell", "fw-bold", cellVariant &&
|
|
8
|
+
cellVariant(col, index) &&
|
|
9
|
+
`${CSS_PREFIX}-${cellVariant(col, index)}`), role: "columnheader", "aria-colindex": index + 1, style: getWidthStyles(col.width || DEFAULT_COL_WIDTH), children: col.label }, col.name))) }) }));
|
|
10
|
+
};
|
|
11
|
+
export default GridHeader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AugFormattedRow, CellData, ColDef, FormattedRow, MainComponentSharedProps } from "../../common";
|
|
2
|
+
export type GridProps = MainComponentSharedProps & {
|
|
3
|
+
height?: GridHeightSetting;
|
|
4
|
+
width?: GridWidthSetting;
|
|
5
|
+
variant?: string;
|
|
6
|
+
stripes?: GridStripeSetting;
|
|
7
|
+
hover?: boolean;
|
|
8
|
+
borders?: GridBorderSetting;
|
|
9
|
+
borderVariant?: string;
|
|
10
|
+
small?: boolean;
|
|
11
|
+
divider?: boolean;
|
|
12
|
+
headerRowVariant?: string;
|
|
13
|
+
headerCellVariant?: (col: ColDef, colIndex: number) => string | null;
|
|
14
|
+
bodyRowVariant?: (row: FormattedRow, displayIndex: number) => string | null;
|
|
15
|
+
bodyCellVariant?: (cell: CellData, row: FormattedRow, colIndex: number, displayIndex: number) => string | null;
|
|
16
|
+
};
|
|
17
|
+
export interface GridHeaderProps {
|
|
18
|
+
cols: GridProps["cols"];
|
|
19
|
+
vertScrollable: boolean;
|
|
20
|
+
rowVariant?: GridProps["headerRowVariant"];
|
|
21
|
+
cellVariant?: GridProps["headerCellVariant"];
|
|
22
|
+
}
|
|
23
|
+
export type GridBodyProps = {
|
|
24
|
+
augFormattedRows: AugFormattedRow[];
|
|
25
|
+
cols: GridProps["cols"];
|
|
26
|
+
rowVariant?: GridProps["bodyRowVariant"];
|
|
27
|
+
cellVariant?: GridProps["bodyCellVariant"];
|
|
28
|
+
};
|
|
29
|
+
export type GridHeightSetting = number | "auto" | "parent";
|
|
30
|
+
export type GridWidthSetting = number | "auto" | "parent";
|
|
31
|
+
export type GridStripeSetting = "rows" | "columns" | "none";
|
|
32
|
+
export type GridBorderSetting = "horizontal" | "full" | "none";
|
package/grid.css
ADDED
|
@@ -0,0 +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)}
|
package/grid.scss
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
|
|
4
|
+
$rbdg-prefix: "rbdg-";
|
|
5
|
+
|
|
6
|
+
.rbdg-grid > div,
|
|
7
|
+
.rbdg-grid > div > div,
|
|
8
|
+
.rbdg-grid > div > div > div {
|
|
9
|
+
border-color: inherit;
|
|
10
|
+
border-style: solid;
|
|
11
|
+
border-width: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// While these rules seem to work, the way that the three border modes, default; bordered; and borderless override each
|
|
15
|
+
// other is quite hard to understand.
|
|
16
|
+
// Consider refactoring so that each type mode, including default, has a separate class that contains rules for just
|
|
17
|
+
// that mode.
|
|
18
|
+
// The way that each border mode that interacts with dividers with quite complicated. Each combination should be tested
|
|
19
|
+
// separately.
|
|
20
|
+
|
|
21
|
+
.rbdg-grid {
|
|
22
|
+
// In Bootstrap's _tables.scss file, there are variable declarations here to reset some variables to the initial
|
|
23
|
+
// value to facilitate nesting of tables styled with Bootstrap's "table" CSS class. Unlike _tables.scss, there is no
|
|
24
|
+
// reset in this file because the RBDG flex grid is not meant to be nested.
|
|
25
|
+
|
|
26
|
+
--#{$rbdg-prefix}grid-color: #{$table-color};
|
|
27
|
+
--#{$rbdg-prefix}grid-bg: #{$table-bg};
|
|
28
|
+
--#{$rbdg-prefix}grid-border-color: #{$table-border-color};
|
|
29
|
+
--#{$rbdg-prefix}grid-accent-bg: #{$table-accent-bg};
|
|
30
|
+
--#{$rbdg-prefix}grid-striped-color: #{$table-striped-color};
|
|
31
|
+
--#{$rbdg-prefix}grid-striped-bg: #{$table-striped-bg};
|
|
32
|
+
--#{$rbdg-prefix}grid-active-color: #{$table-active-color};
|
|
33
|
+
--#{$rbdg-prefix}grid-active-bg: #{$table-active-bg};
|
|
34
|
+
--#{$rbdg-prefix}grid-hover-color: #{$table-hover-color};
|
|
35
|
+
--#{$rbdg-prefix}grid-hover-bg: #{$table-hover-bg};
|
|
36
|
+
|
|
37
|
+
border-color: var(--#{$rbdg-prefix}grid-border-color);
|
|
38
|
+
|
|
39
|
+
> div {
|
|
40
|
+
width: min-content;
|
|
41
|
+
|
|
42
|
+
> div > div {
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
padding: $table-cell-padding-y $table-cell-padding-x;
|
|
47
|
+
color: var(
|
|
48
|
+
--#{$rbdg-prefix}grid-color-state,
|
|
49
|
+
var(--#{$rbdg-prefix}grid-color-type, var(--#{$rbdg-prefix}grid-color))
|
|
50
|
+
);
|
|
51
|
+
background-color: var(--#{$rbdg-prefix}grid-bg);
|
|
52
|
+
border-bottom-width: $table-border-width;
|
|
53
|
+
box-shadow: inset 0 0 0 9999px
|
|
54
|
+
var(
|
|
55
|
+
--#{$rbdg-prefix}grid-bg-state,
|
|
56
|
+
var(
|
|
57
|
+
--#{$rbdg-prefix}grid-bg-type,
|
|
58
|
+
var(--#{$rbdg-prefix}grid-accent-bg)
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// These properties are overridden by the "> div > div > div:not(:last-child)" properties when rbdg-grid-bordered is
|
|
65
|
+
// applied.
|
|
66
|
+
> div:first-child > div > div {
|
|
67
|
+
border-bottom-width: var(
|
|
68
|
+
--#{$rbdg-prefix}grid-divider-border-width,
|
|
69
|
+
var(--#{$rbdg-prefix}grid-divider-borderless-width, $table-border-width)
|
|
70
|
+
);
|
|
71
|
+
border-bottom-style: var(
|
|
72
|
+
--#{$rbdg-prefix}grid-divider-border-style,
|
|
73
|
+
inherit
|
|
74
|
+
);
|
|
75
|
+
border-bottom-color: var(
|
|
76
|
+
--#{$rbdg-prefix}grid-divider-border-color,
|
|
77
|
+
inherit
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rbdg-grid-group-divider {
|
|
83
|
+
--#{$rbdg-prefix}grid-divider-border-width: calc(#{$table-border-width} * 2);
|
|
84
|
+
--#{$rbdg-prefix}grid-divider-border-style: solid;
|
|
85
|
+
--#{$rbdg-prefix}grid-divider-border-color: #{$table-group-separator-color};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.rbdg-grid-sm {
|
|
89
|
+
> div > div > div {
|
|
90
|
+
padding: $table-cell-padding-y-sm $table-cell-padding-x-sm;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rbdg-grid-bordered {
|
|
95
|
+
border-width: $table-border-width;
|
|
96
|
+
border-style: solid;
|
|
97
|
+
|
|
98
|
+
> div > div {
|
|
99
|
+
> div:not(:last-child) {
|
|
100
|
+
border-width: 0 $table-border-width 0 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
> div:last-child {
|
|
104
|
+
border-width: 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
> div:first-child > div {
|
|
109
|
+
border-top-width: 0;
|
|
110
|
+
border-right-width: 0;
|
|
111
|
+
border-left-width: 0;
|
|
112
|
+
border-bottom-width: var(
|
|
113
|
+
--#{$rbdg-prefix}grid-divider-border-width,
|
|
114
|
+
var(--#{$rbdg-prefix}grid-divider-borderless-width, $table-border-width)
|
|
115
|
+
);
|
|
116
|
+
border-bottom-style: var(
|
|
117
|
+
--#{$rbdg-prefix}grid-divider-border-style,
|
|
118
|
+
inherit
|
|
119
|
+
);
|
|
120
|
+
border-bottom-color: var(
|
|
121
|
+
--#{$rbdg-prefix}grid-divider-border-color,
|
|
122
|
+
inherit
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
> div:last-child {
|
|
127
|
+
> div:not(:last-child) {
|
|
128
|
+
border-width: 0 0 $table-border-width 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.rbdg-grid-borderless {
|
|
134
|
+
--#{$rbdg-prefix}grid-divider-borderless-width: 0;
|
|
135
|
+
|
|
136
|
+
> div > div > div {
|
|
137
|
+
border-bottom-width: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
> :not(:first-child) {
|
|
141
|
+
border-top-width: 0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.rbdg-grid-striped {
|
|
146
|
+
> div:nth-of-type(2) > div:nth-of-type(#{$table-striped-order}) > div {
|
|
147
|
+
--#{$rbdg-prefix}grid-color-type: var(--#{$rbdg-prefix}grid-striped-color);
|
|
148
|
+
--#{$rbdg-prefix}grid-bg-type: var(--#{$rbdg-prefix}grid-striped-bg);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rbdg-grid-striped-columns {
|
|
153
|
+
> div > div > :nth-child(#{$table-striped-columns-order}) {
|
|
154
|
+
--#{$rbdg-prefix}grid-color-type: var(--#{$rbdg-prefix}grid-striped-color);
|
|
155
|
+
--#{$rbdg-prefix}grid-bg-type: var(--#{$rbdg-prefix}grid-striped-bg);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.rbdg-grid-active {
|
|
160
|
+
--#{$rbdg-prefix}grid-color-state: var(--#{$prefix}grid-active-color);
|
|
161
|
+
--#{$rbdg-prefix}grid-bg-state: var(--#{$rbdg-prefix}grid-active-bg);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.rbdg-grid-hover {
|
|
165
|
+
> div:nth-of-type(2) > div:hover > div {
|
|
166
|
+
--#{$rbdg-prefix}grid-color-state: var(--#{$rbdg-prefix}grid-hover-color);
|
|
167
|
+
--#{$rbdg-prefix}grid-bg-state: var(--#{$rbdg-prefix}grid-hover-bg);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@mixin rbdg-grid-variant($state, $background) {
|
|
172
|
+
.rbdg-grid-#{$state} {
|
|
173
|
+
$color: color-contrast(opaque($body-bg, $background));
|
|
174
|
+
$hover-bg: color.mix(
|
|
175
|
+
$color,
|
|
176
|
+
$background,
|
|
177
|
+
math.percentage($table-hover-bg-factor)
|
|
178
|
+
);
|
|
179
|
+
$striped-bg: color.mix(
|
|
180
|
+
$color,
|
|
181
|
+
$background,
|
|
182
|
+
math.percentage($table-striped-bg-factor)
|
|
183
|
+
);
|
|
184
|
+
$active-bg: color.mix(
|
|
185
|
+
$color,
|
|
186
|
+
$background,
|
|
187
|
+
math.percentage($table-active-bg-factor)
|
|
188
|
+
);
|
|
189
|
+
$table-border-color: color.mix(
|
|
190
|
+
$color,
|
|
191
|
+
$background,
|
|
192
|
+
math.percentage($table-border-factor)
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
--#{$rbdg-prefix}grid-color: #{$color};
|
|
196
|
+
--#{$rbdg-prefix}grid-bg: #{$background};
|
|
197
|
+
--#{$rbdg-prefix}grid-border-color: #{$table-border-color};
|
|
198
|
+
--#{$rbdg-prefix}grid-striped-bg: #{$striped-bg};
|
|
199
|
+
--#{$rbdg-prefix}grid-striped-color: #{color-contrast($striped-bg)};
|
|
200
|
+
--#{$rbdg-prefix}grid-active-bg: #{$active-bg};
|
|
201
|
+
--#{$rbdg-prefix}grid-active-color: #{color-contrast($active-bg)};
|
|
202
|
+
--#{$rbdg-prefix}grid-hover-bg: #{$hover-bg};
|
|
203
|
+
--#{$rbdg-prefix}grid-hover-color: #{color-contrast($hover-bg)};
|
|
204
|
+
|
|
205
|
+
color: var(--#{$rbdg-prefix}grid-color);
|
|
206
|
+
border-color: var(--#{$rbdg-prefix}grid-border-color);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@each $color, $value in $table-variants {
|
|
211
|
+
@include rbdg-grid-variant($color, $value);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Note about Responsive Tables
|
|
215
|
+
//
|
|
216
|
+
// The Bootstrap _tables.scss file contains a series of classes to apply responsive tables at various breakpoints.
|
|
217
|
+
// There is no such equivalent for RBDG flex grid for the following reason.
|
|
218
|
+
//
|
|
219
|
+
// The RBDG flex grid is a div of type "block," so the concept of "responsive" scrollable breakpoints doesn't apply.
|
|
220
|
+
// It appears that for a table, even if the width is to 100%, the browser sometimes disobeys this setting causing
|
|
221
|
+
// the width to be more than the parent, hence the need for responsive tables. Divs do not appear to have this problem.
|
|
222
|
+
//
|
|
223
|
+
// The RBDG flex grid provides other options to achieving a horizontally scrollable grid. They are as follows.
|
|
224
|
+
//
|
|
225
|
+
// When using the default or "auto" setting for the RBDG grid's "width," the intrinsic width of the grid columns is
|
|
226
|
+
// used. In such circumstances, if one wants to make the grid scrollable horizontally, they can enclose the grid in a
|
|
227
|
+
// horizontally-scrollable div.
|
|
228
|
+
//
|
|
229
|
+
// When the grid's width is to set to "parent", the grid takes on the width of the parent (width 100% CSS value) just
|
|
230
|
+
// like the Bootstrap table does. In this case, the grid div itself is horizontally scrollable. In contrast, for
|
|
231
|
+
// responsive Bootstrap tables, it is a div that encloses the table element that is scrollable.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absreim/react-bootstrap-data-grid-pro",
|
|
3
3
|
"description": "Pro Version of data grid UI component for use with web apps using React and Bootstrap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"license": "Commercial. See LICENSE file.",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
package/pro/index.d.ts
ADDED
package/pro/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { BaseTableProps } from "./types";
|
|
3
|
+
import { UseCombinedPipelineHook } from "../common/pipeline/useCombinedPipeline";
|
|
4
|
+
import { UseGridSelectionFnsHook } from "../common/pipeline/useGridSelectionFns";
|
|
5
|
+
export interface InternalGridProps {
|
|
6
|
+
gridProps: BaseTableProps;
|
|
7
|
+
hooks: {
|
|
8
|
+
selectFns: UseGridSelectionFnsHook;
|
|
9
|
+
pipelineOutput: UseCombinedPipelineHook;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
colHeaderCells: ReactNode;
|
|
13
|
+
bodyRows: ReactNode;
|
|
14
|
+
prefixHeader?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
classes?: {
|
|
17
|
+
headerRow?: string[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare const InternalTable: FC<InternalGridProps>;
|
|
21
|
+
export default InternalTable;
|