@absreim/react-bootstrap-data-grid-pro 4.5.0 → 4.6.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 +1 -0
- package/common/constants.js +1 -0
- package/common/toolbar/ToolbarContainer.js +9 -2
- package/common/toolbar/useInterfaces.d.ts +18 -2
- package/common/toolbar/useInterfaces.js +9 -5
- package/common/types.d.ts +14 -0
- package/grid/main/Grid.js +26 -4
- package/grid/main/types.d.ts +54 -0
- package/grid/pagination/types.d.ts +6 -7
- package/package.json +2 -2
- package/table/InternalTable.d.ts +3 -3
- package/table/InternalTable.js +17 -31
- package/table/Table.js +1 -1
- package/table/types.d.ts +1 -10
- package/table-pro/TablePro.js +1 -1
package/common/constants.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export declare const DEFAULT_COL_WIDTH = 100;
|
|
|
2
2
|
export declare const CSS_PREFIX = "rbdg-grid";
|
|
3
3
|
export declare const DEFAULT_MAX_PAGE_BUTTONS = 5;
|
|
4
4
|
export declare const DEFAULT_PAGE_SIZES: number[];
|
|
5
|
+
export declare const TOOLBAR_CONTAINER_TEST_ID = "toolbar feature interface content container";
|
package/common/constants.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import Toolbar from "./Toolbar";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
+
import { TOOLBAR_CONTAINER_TEST_ID } from "../constants";
|
|
5
6
|
const ToolbarContainer = ({ interfaceGen, styleModel, }) => {
|
|
6
7
|
const [option, setOption] = useState(null);
|
|
7
8
|
const closeUiCallback = useCallback(() => setOption(null), []);
|
|
@@ -13,9 +14,15 @@ const ToolbarContainer = ({ interfaceGen, styleModel, }) => {
|
|
|
13
14
|
return prev;
|
|
14
15
|
}, {});
|
|
15
16
|
}, [interfaces]);
|
|
16
|
-
|
|
17
|
+
// Z-index of 4 is needed to go on top of Bootstrap pagination links that have
|
|
18
|
+
// a z-index of 3.
|
|
19
|
+
// The z-index of 4 is applied as a style prop here to avoid a breaking
|
|
20
|
+
// change. As part of the next major release, move this setting the common
|
|
21
|
+
// SCSS file.
|
|
22
|
+
return (_jsxs("div", { className: "vstack", "data-testid": "toolbar container", children: [_jsx(Toolbar, { enabledFeatures: enabledFeatures, option: option, setOption: setOption, toolbarClasses: styleModel === null || styleModel === void 0 ? void 0 : styleModel.toolbar, activeClasses: styleModel === null || styleModel === void 0 ? void 0 : styleModel.activeButton, inactiveClasses: styleModel === null || styleModel === void 0 ? void 0 : styleModel.inactiveButton }), _jsx("div", { className: "position-relative", children: option !== null && (_jsx("div", { "data-testid": TOOLBAR_CONTAINER_TEST_ID, style: {
|
|
23
|
+
zIndex: 4,
|
|
24
|
+
}, className: classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.interfaceContainer) || [
|
|
17
25
|
"position-absolute",
|
|
18
|
-
"z-1",
|
|
19
26
|
"bg-body",
|
|
20
27
|
"border",
|
|
21
28
|
"shadow",
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { FilterState } from "../filtering/internalTypes";
|
|
2
|
+
import { EditableFilterState } from "../filtering/types";
|
|
3
|
+
import { ExportFormStyleModel, FilterInputTableStyleModel } from "../../table";
|
|
4
|
+
import { ExportFnInfo } from "../export/useExportFn";
|
|
5
|
+
import { ToolbarInterfaces } from "./internalTypes";
|
|
6
|
+
export interface InterfacePropParams {
|
|
7
|
+
exportParams?: {
|
|
8
|
+
exportFnInfo: ExportFnInfo;
|
|
9
|
+
styleModel?: ExportFormStyleModel;
|
|
10
|
+
};
|
|
11
|
+
filterParams?: {
|
|
12
|
+
filterState: FilterState;
|
|
13
|
+
setFilterState: (filterState: EditableFilterState) => void;
|
|
14
|
+
caption?: string;
|
|
15
|
+
styleModel?: FilterInputTableStyleModel;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
declare const useInterfaces: (params: InterfacePropParams) => (closeCallback: () => void) => ToolbarInterfaces;
|
|
3
19
|
export default useInterfaces;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
2
3
|
import FilterOptionsTable from "../filtering/FilterOptionsTable";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
4
|
import ExportForm from "../export/ExportForm";
|
|
5
|
-
const useInterfaces = (
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const useInterfaces = ({ exportParams, filterParams, }) => {
|
|
6
|
+
const generatorFn = useCallback((closeUiCallback) => ({
|
|
7
|
+
exporting: exportParams && Object.assign(Object.assign({}, exportParams), { closeCallback: closeUiCallback }),
|
|
8
|
+
filtering: filterParams && Object.assign(Object.assign({}, filterParams), { closeFormCallback: closeUiCallback }),
|
|
9
|
+
}), [exportParams, filterParams]);
|
|
10
|
+
return useCallback((closeCallback) => {
|
|
11
|
+
const props = generatorFn(closeCallback);
|
|
8
12
|
const { exporting, filtering } = props;
|
|
9
13
|
return {
|
|
10
14
|
filtering: filtering ? (_jsx(FilterOptionsTable, Object.assign({}, filtering))) : undefined,
|
|
11
15
|
exporting: exporting ? _jsx(ExportForm, Object.assign({}, exporting)) : undefined,
|
|
12
16
|
};
|
|
13
|
-
}, [
|
|
17
|
+
}, [generatorFn]);
|
|
14
18
|
};
|
|
15
19
|
export default useInterfaces;
|
package/common/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SortModel } from "./sorting/types";
|
|
2
|
+
import { FilterModel } from "./filtering/types";
|
|
2
3
|
/**
|
|
3
4
|
* Union of all possible column data types.
|
|
4
5
|
*
|
|
@@ -137,6 +138,19 @@ export interface MainComponentSharedProps {
|
|
|
137
138
|
* sorting feature of the component.
|
|
138
139
|
*/
|
|
139
140
|
sortModel?: SortModel;
|
|
141
|
+
/**
|
|
142
|
+
* Enables exporting of data from the table.
|
|
143
|
+
*
|
|
144
|
+
* @defaultValue `false` - Export button will not be displayed to the user.
|
|
145
|
+
*/
|
|
146
|
+
allowExport?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* The filter model of the table. Passing a truthy value enables the
|
|
149
|
+
* filtering feature of the component.
|
|
150
|
+
*
|
|
151
|
+
* @defaultValue `undefined` - Filtering will not be enabled.
|
|
152
|
+
*/
|
|
153
|
+
filterModel?: FilterModel;
|
|
140
154
|
}
|
|
141
155
|
/**
|
|
142
156
|
* {@link RowDef} object that additionally contains the index of the row in the
|
package/grid/main/Grid.js
CHANGED
|
@@ -10,18 +10,22 @@ import classNames from "classnames";
|
|
|
10
10
|
import { CSS_PREFIX } from "../../common/constants";
|
|
11
11
|
import useGridFocus from "../focus/useGridFocus";
|
|
12
12
|
import Pagination from "../../common/pagination/Pagination";
|
|
13
|
+
import useExportFn from "../../common/export/useExportFn";
|
|
14
|
+
import useInterfaces from "../../common/toolbar/useInterfaces";
|
|
15
|
+
import ToolbarContainer from "../../common/toolbar/ToolbarContainer";
|
|
13
16
|
/**
|
|
14
17
|
* The main component for the grid feature of react-bootstrap-data-grid.
|
|
15
18
|
*
|
|
16
19
|
* @public
|
|
17
20
|
*/
|
|
18
|
-
const Grid = ({ rows, cols, sortModel, pagination, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, headerCellFocusVariant, bodyCellFocusVariant, }) => {
|
|
21
|
+
const Grid = ({ rows, cols, sortModel, pagination, allowExport, filterModel, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, headerCellFocusVariant, bodyCellFocusVariant, styleOptions, }) => {
|
|
19
22
|
var _a, _b, _c;
|
|
20
|
-
const { displayRows, filteredRows, sortedRowsOutput, currentPageRowsOutput } = useCombinedPipeline({
|
|
23
|
+
const { displayRows, filterState, normalizedTableFilterModel, filteredRows, sortedRowsOutput, currentPageRowsOutput: { paginatedRows, normalizedModel }, } = useCombinedPipeline({
|
|
21
24
|
rows,
|
|
22
25
|
cols,
|
|
23
26
|
sortModel,
|
|
24
27
|
pagination,
|
|
28
|
+
filterModel,
|
|
25
29
|
});
|
|
26
30
|
const colNameToWidth = useColNameToWidth(cols);
|
|
27
31
|
const augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
|
|
@@ -96,8 +100,26 @@ const Grid = ({ rows, cols, sortModel, pagination, width, height, variant, strip
|
|
|
96
100
|
"d-flex",
|
|
97
101
|
`rbdg-justify-content-${((_a = pagination.styleOptions) === null || _a === void 0 ? void 0 : _a.horizontalAlignment) || "right"}`,
|
|
98
102
|
`gap-${((_b = pagination.styleOptions) === null || _b === void 0 ? void 0 : _b.paginationComponentSpacing) === undefined ? 2 : (_c = pagination.styleOptions) === null || _c === void 0 ? void 0 : _c.paginationComponentSpacing}`,
|
|
99
|
-
], normalizedModel:
|
|
103
|
+
], normalizedModel: normalizedModel, prePagingNumRows: rows.length, sizeSelectAfterPageSelect: (_d = pagination.styleOptions) === null || _d === void 0 ? void 0 : _d.sizeSelectAfterPageSelect }));
|
|
100
104
|
};
|
|
101
|
-
|
|
105
|
+
const exportFnInfo = useExportFn({
|
|
106
|
+
rows,
|
|
107
|
+
cols,
|
|
108
|
+
filteredRows: filterModel && filteredRows,
|
|
109
|
+
currentPageRows: pagination && paginatedRows,
|
|
110
|
+
});
|
|
111
|
+
const toolbarInterfaces = useInterfaces({
|
|
112
|
+
exportParams: allowExport ? { exportFnInfo } : undefined,
|
|
113
|
+
filterParams: filterModel
|
|
114
|
+
? {
|
|
115
|
+
filterState: filterState,
|
|
116
|
+
setFilterState: normalizedTableFilterModel.setTableFilterState,
|
|
117
|
+
caption: filterModel.filterTableCaption,
|
|
118
|
+
}
|
|
119
|
+
: undefined,
|
|
120
|
+
});
|
|
121
|
+
const showToolbar = allowExport || filterModel;
|
|
122
|
+
const mainSpacingSetting = (_a = styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.mainComponentSpacing) !== null && _a !== void 0 ? _a : (_b = pagination === null || pagination === void 0 ? void 0 : pagination.styleOptions) === null || _b === void 0 ? void 0 : _b.mainComponentSpacing;
|
|
123
|
+
return pagination || showToolbar ? (_jsxs("div", { style: { width: widthProperty, height: heightProperties.containerDiv }, className: classNames("d-flex", "flex-column", `gap-${mainSpacingSetting === undefined ? 2 : mainSpacingSetting}`), "data-testid": "rbdg-top-level-grid-container", children: [showToolbar && _jsx(ToolbarContainer, { interfaceGen: toolbarInterfaces }), pagination ? (_jsx(_Fragment, { children: ((_c = pagination.styleOptions) === null || _c === void 0 ? void 0 : _c.aboveMainComponent) ? (_jsxs(_Fragment, { children: [getPagination(pagination), mainGridComponent] })) : (_jsxs(_Fragment, { children: [mainGridComponent, getPagination(pagination)] })) })) : (_jsx(_Fragment, { children: mainGridComponent }))] })) : (_jsx(_Fragment, { children: mainGridComponent }));
|
|
102
124
|
};
|
|
103
125
|
export default Grid;
|
package/grid/main/types.d.ts
CHANGED
|
@@ -56,62 +56,98 @@ export interface GridSpecificProps {
|
|
|
56
56
|
width?: GridWidthSetting;
|
|
57
57
|
/**
|
|
58
58
|
* The grid-wide color variant
|
|
59
|
+
*
|
|
60
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
59
61
|
*/
|
|
60
62
|
variant?: string;
|
|
61
63
|
/**
|
|
62
64
|
* The stripe setting of the grid
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `undefined` - no stripes will be present.
|
|
63
67
|
*/
|
|
64
68
|
stripes?: GridStripeSetting;
|
|
65
69
|
/**
|
|
66
70
|
* Toggles hover styles for the grid
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue `undefined` - no hover styles will be active.
|
|
67
73
|
*/
|
|
68
74
|
hover?: boolean;
|
|
69
75
|
/**
|
|
70
76
|
* The border setting of the grid
|
|
77
|
+
*
|
|
78
|
+
* @defaultValue `undefined` - no borders will be shown.
|
|
71
79
|
*/
|
|
72
80
|
borders?: GridBorderSetting;
|
|
73
81
|
/**
|
|
74
82
|
* The border color variant of the grid
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue `undefined` - the default Bootstrap border color will be
|
|
85
|
+
* used.
|
|
75
86
|
*/
|
|
76
87
|
borderVariant?: string;
|
|
77
88
|
/**
|
|
78
89
|
* Toggles a denser grid style
|
|
90
|
+
*
|
|
91
|
+
* @defaultValue `false` - the grid will have the default density of cells
|
|
92
|
+
* that are used in Bootstrap tables.
|
|
79
93
|
*/
|
|
80
94
|
small?: boolean;
|
|
81
95
|
/**
|
|
82
96
|
* Toggles a horizontal divider between the grid header and body
|
|
97
|
+
*
|
|
98
|
+
* @defaultValue `false` - no divider will be shown.
|
|
83
99
|
*/
|
|
84
100
|
divider?: boolean;
|
|
85
101
|
/**
|
|
86
102
|
* Sets the color variant of the header row
|
|
103
|
+
*
|
|
104
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
87
105
|
*/
|
|
88
106
|
headerRowVariant?: string;
|
|
89
107
|
/**
|
|
90
108
|
* Function to set the color variant of header cells. Overrides the row-wide
|
|
91
109
|
* setting when this function returns a non-null value.
|
|
110
|
+
*
|
|
111
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
92
112
|
*/
|
|
93
113
|
headerCellVariant?: HeaderCellVariantFn;
|
|
94
114
|
/**
|
|
95
115
|
* Function to set the color variant of body rows
|
|
116
|
+
*
|
|
117
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
96
118
|
*/
|
|
97
119
|
bodyRowVariant?: (row: FormattedRow, displayIndex: number) => string | null;
|
|
98
120
|
/**
|
|
99
121
|
* Function to set the color variant of body cells on a per-cell basis.
|
|
100
122
|
* Overrides the row-wide setting when this function returns a non-null value.
|
|
123
|
+
*
|
|
124
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
101
125
|
*/
|
|
102
126
|
bodyCellVariant?: BodyCellVariantFn;
|
|
103
127
|
/**
|
|
104
128
|
* Function to set the color variant of header cell focus rings
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
105
131
|
*/
|
|
106
132
|
headerCellFocusVariant?: HeaderCellVariantFn;
|
|
107
133
|
/**
|
|
108
134
|
* Function to set the color variant of body cell focus rings
|
|
135
|
+
*
|
|
136
|
+
* @defaultValue `undefined` - no variant will be specified.
|
|
109
137
|
*/
|
|
110
138
|
bodyCellFocusVariant?: BodyCellVariantFn;
|
|
111
139
|
/**
|
|
112
140
|
* Enables and configures pagination for the grid
|
|
141
|
+
*
|
|
142
|
+
* @defaultValue `undefined` - pagination will be disabled.
|
|
113
143
|
*/
|
|
114
144
|
pagination?: GridPaginationModel;
|
|
145
|
+
/**
|
|
146
|
+
* Configures preset styles.
|
|
147
|
+
*
|
|
148
|
+
* @defaultValue `undefined` - default values for preset styles will be used.
|
|
149
|
+
*/
|
|
150
|
+
styleOptions?: StyleOptions;
|
|
115
151
|
}
|
|
116
152
|
/**
|
|
117
153
|
* The type of the prop to set grid height behavior
|
|
@@ -145,3 +181,21 @@ export type GridStripeSetting = "rows" | "columns" | "none";
|
|
|
145
181
|
* @public
|
|
146
182
|
*/
|
|
147
183
|
export type GridBorderSetting = "horizontal" | "full" | "none";
|
|
184
|
+
/**
|
|
185
|
+
* Object that contains preset style options for the {@link Grid} component.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
export interface StyleOptions {
|
|
190
|
+
/**
|
|
191
|
+
* Sets the amount of vertical spacing between the main grid component, the
|
|
192
|
+
* toolbar, and pagination UI components. The number supplied to this
|
|
193
|
+
* property will be used for the
|
|
194
|
+
* {@link https://getbootstrap.com/docs/5.3/utilities/spacing/#gap | Bootstrap gap utility}.
|
|
195
|
+
* Valid values depend on Bootstrap `$spacers` Sass map. Be default, the valid
|
|
196
|
+
* values range from 0 to 5.
|
|
197
|
+
*
|
|
198
|
+
* @defaultValue `2`- the gap-2 Bootstrap utility class will be applied.
|
|
199
|
+
*/
|
|
200
|
+
mainComponentSpacing?: number;
|
|
201
|
+
}
|
|
@@ -33,14 +33,13 @@ export interface PaginationStyleOptions {
|
|
|
33
33
|
*/
|
|
34
34
|
horizontalAlignment?: "left" | "center" | "right";
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
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.
|
|
36
|
+
* Copy of the property of the same name in the {@link StyleOptions}
|
|
37
|
+
* interface. The value of the {@link StyleOptions} property takes
|
|
38
|
+
* precedence. This value is only used if the other value doesn't exist.
|
|
42
39
|
*
|
|
43
|
-
* @
|
|
40
|
+
* @deprecated Use the property in the {@link StyleOptions} interface instead.
|
|
41
|
+
* The property is only kept around for backwards compatibility and may be
|
|
42
|
+
* removed in the next major release.
|
|
44
43
|
*/
|
|
45
44
|
mainComponentSpacing?: number;
|
|
46
45
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absreim/react-bootstrap-data-grid-pro",
|
|
3
3
|
"description": "Pro Version of data grid UI component for use with web apps using React and Bootstrap",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.6.0",
|
|
5
5
|
"license": "Commercial. See LICENSE file.",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"classnames": "^2.5.1",
|
|
19
19
|
"dayjs": "^1.11.13",
|
|
20
|
-
"papaparse": "^5.
|
|
20
|
+
"papaparse": "^5.7.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": "^19",
|
package/table/InternalTable.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { FC, ReactNode } from "react";
|
|
|
2
2
|
import { UseCombinedPipelineHook } from "../common/pipeline/useCombinedPipeline";
|
|
3
3
|
import { UseGridSelectionFnsHook } from "../common/pipeline/useGridSelectionFns";
|
|
4
4
|
import { BaseTableProps } from "./internalTypes";
|
|
5
|
-
export interface
|
|
6
|
-
|
|
5
|
+
export interface InternalTableProps {
|
|
6
|
+
tableProps: BaseTableProps;
|
|
7
7
|
hooks: {
|
|
8
8
|
selectFns: UseGridSelectionFnsHook;
|
|
9
9
|
pipelineOutput: UseCombinedPipelineHook;
|
|
@@ -17,5 +17,5 @@ export interface InternalGridProps {
|
|
|
17
17
|
headerRow?: string[];
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
declare const InternalTable: FC<
|
|
20
|
+
declare const InternalTable: FC<InternalTableProps>;
|
|
21
21
|
export default InternalTable;
|
package/table/InternalTable.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
3
|
import SelectAllHeaderCell from "./selection/SelectAllHeaderCell";
|
|
5
4
|
import Pagination from "../common/pagination/Pagination";
|
|
6
5
|
import classNames from "classnames";
|
|
@@ -8,7 +7,7 @@ import useInterfaces from "../common/toolbar/useInterfaces";
|
|
|
8
7
|
import ToolbarContainer from "../common/toolbar/ToolbarContainer";
|
|
9
8
|
import useExportFn from "../common/export/useExportFn";
|
|
10
9
|
import getWidthStyle from "../common/util/getWidthStyle";
|
|
11
|
-
const InternalTable = ({
|
|
10
|
+
const InternalTable = ({ tableProps: { rows, cols, pagination, filterModel, selectModel, editModel, caption, styleModel, displayMode, allowExport, }, hooks: { pipelineOutput, selectFns }, slots: { colHeaderCells, bodyRows, prefixHeader }, classes, }) => {
|
|
12
11
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
13
12
|
const { normalizedTableFilterModel, filteredRows, filterState, sortedRowsOutput: { sortedRows }, currentPageRowsOutput: { paginatedRows, normalizedModel }, showSelectCol, } = pipelineOutput;
|
|
14
13
|
const exportFnInfo = useExportFn({
|
|
@@ -18,35 +17,22 @@ const InternalTable = ({ gridProps: { rows, cols, pagination, filterModel, selec
|
|
|
18
17
|
currentPageRows: pagination && paginatedRows,
|
|
19
18
|
});
|
|
20
19
|
const showToolbar = filterModel || allowExport;
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
:
|
|
32
|
-
|
|
33
|
-
?
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
: undefined,
|
|
39
|
-
};
|
|
40
|
-
}, [
|
|
41
|
-
allowExport,
|
|
42
|
-
exportFnInfo,
|
|
43
|
-
filterModel,
|
|
44
|
-
filterState,
|
|
45
|
-
normalizedTableFilterModel,
|
|
46
|
-
styleModel === null || styleModel === void 0 ? void 0 : styleModel.exportFormStyleModel,
|
|
47
|
-
styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel,
|
|
48
|
-
]);
|
|
49
|
-
const toolbarInterfaces = useInterfaces(toolbarPropGen);
|
|
20
|
+
const toolbarInterfaces = useInterfaces({
|
|
21
|
+
exportParams: allowExport
|
|
22
|
+
? {
|
|
23
|
+
exportFnInfo,
|
|
24
|
+
styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.exportFormStyleModel,
|
|
25
|
+
}
|
|
26
|
+
: undefined,
|
|
27
|
+
filterParams: filterModel
|
|
28
|
+
? {
|
|
29
|
+
filterState: filterState,
|
|
30
|
+
setFilterState: normalizedTableFilterModel.setTableFilterState,
|
|
31
|
+
caption: filterModel.filterTableCaption,
|
|
32
|
+
styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel,
|
|
33
|
+
}
|
|
34
|
+
: undefined,
|
|
35
|
+
});
|
|
50
36
|
const { rowsAreSelectable, selectionInfo, selectAllOnClick } = selectFns;
|
|
51
37
|
const mainTable = (_jsxs("table", { className: classNames({
|
|
52
38
|
"table-hover": rowsAreSelectable,
|
package/table/Table.js
CHANGED
|
@@ -42,7 +42,7 @@ const Table = (props) => {
|
|
|
42
42
|
styleModel.mainTableStyleModel.theadTh(index), width: width }, name));
|
|
43
43
|
});
|
|
44
44
|
const bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, tableStyleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel }));
|
|
45
|
-
return (_jsx(InternalTable, {
|
|
45
|
+
return (_jsx(InternalTable, { tableProps: props, hooks: {
|
|
46
46
|
pipelineOutput: combinedPipelineOutput,
|
|
47
47
|
selectFns: gridSelectionFns,
|
|
48
48
|
}, slots: { colHeaderCells, bodyRows } }));
|
package/table/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditModel,
|
|
1
|
+
import { EditModel, MainComponentSharedProps, PaginationModel, SelectModel, StyleModel } from "../common";
|
|
2
2
|
/**
|
|
3
3
|
* Available options for the displayMode prop of {@link TableSpecificProps}.
|
|
4
4
|
*
|
|
@@ -12,11 +12,6 @@ export type DisplayMode = "table" | "block";
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
export interface TableSpecificProps {
|
|
15
|
-
/**
|
|
16
|
-
* The filter model of the table. Passing a truthy value enables the
|
|
17
|
-
* filtering feature of the component.
|
|
18
|
-
*/
|
|
19
|
-
filterModel?: FilterModel;
|
|
20
15
|
/**
|
|
21
16
|
* The select model of the table. Passing a truthy value enables the
|
|
22
17
|
* selection feature of the component.
|
|
@@ -33,10 +28,6 @@ export interface TableSpecificProps {
|
|
|
33
28
|
* table.
|
|
34
29
|
*/
|
|
35
30
|
styleModel?: StyleModel;
|
|
36
|
-
/**
|
|
37
|
-
* Enables exporting of data from the table.
|
|
38
|
-
*/
|
|
39
|
-
allowExport?: boolean;
|
|
40
31
|
/**
|
|
41
32
|
* Sets a caption for the table
|
|
42
33
|
*/
|
package/table-pro/TablePro.js
CHANGED
|
@@ -122,7 +122,7 @@ const TablePro = (props) => {
|
|
|
122
122
|
]);
|
|
123
123
|
const bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, renderPrefixCells: renderPrefixCells, additionalColIndexOffset: reorder ? 1 : 0, additionalRowStyles: additionalBodyRowStyles, tableStyleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel }));
|
|
124
124
|
const prefixHeader = reorder ? _jsx(ReorderHeaderCell, {}) : null;
|
|
125
|
-
return (_jsx(InternalTable, {
|
|
125
|
+
return (_jsx(InternalTable, { tableProps: props, hooks: {
|
|
126
126
|
pipelineOutput: combinedPipelineOutput,
|
|
127
127
|
selectFns: gridSelectionFns,
|
|
128
128
|
}, slots: { colHeaderCells, bodyRows, prefixHeader }, classes: {
|