@absreim/react-bootstrap-data-grid 4.1.0 → 4.2.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 +30 -0
- package/common/export/types.d.ts +6 -0
- package/common/export/useExportFn.js +1 -1
- package/common/filtering/DateFilterRow.d.ts +1 -1
- package/common/filtering/DateFilterRow.js +1 -1
- package/common/filtering/FilterOptionsTable.d.ts +3 -2
- package/common/filtering/NumberFilterRow.d.ts +1 -1
- package/common/filtering/NumberFilterRow.js +1 -1
- package/common/filtering/StringFilterRow.js +1 -1
- package/common/filtering/constants.d.ts +19 -0
- package/common/filtering/constants.js +44 -0
- package/common/filtering/internalTypes.d.ts +77 -0
- package/common/filtering/types.d.ts +165 -22
- package/common/filtering/types.js +46 -17
- package/common/filtering/useFilterFormState.d.ts +1 -1
- package/common/index.d.ts +0 -3
- package/common/index.js +0 -3
- package/common/internalTypes.d.ts +10 -0
- package/common/pagination/Pagination.d.ts +1 -1
- package/common/pagination/internalTypes.d.ts +8 -0
- package/common/pagination/internalTypes.js +1 -0
- package/common/pagination/types.d.ts +105 -5
- package/common/pipeline/{types.d.ts → internalTypes.d.ts} +5 -0
- package/common/pipeline/internalTypes.js +1 -0
- package/common/pipeline/useAugFormattedRows.d.ts +3 -2
- package/common/pipeline/useColNameToWidth.d.ts +2 -1
- package/common/pipeline/useCombinedPipeline/index.d.ts +4 -3
- package/common/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +2 -1
- package/common/pipeline/useCombinedPipeline/useCurrentPageRows.js +3 -2
- package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +2 -1
- package/common/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +2 -1
- package/common/pipeline/useGridSelectionFns.d.ts +2 -1
- package/common/selection/internalTypes.d.ts +34 -0
- package/common/selection/internalTypes.js +1 -0
- package/common/selection/types.d.ts +91 -17
- package/common/selection/types.js +0 -3
- package/common/sorting/internalTypes.d.ts +10 -0
- package/common/sorting/internalTypes.js +1 -0
- package/common/sorting/types.d.ts +48 -4
- package/common/sorting/useSortHeaderStates.d.ts +1 -1
- package/common/styling/types.d.ts +57 -0
- package/common/toolbar/Toolbar.d.ts +1 -1
- package/common/toolbar/ToolbarContainer.d.ts +1 -1
- package/common/toolbar/{types.d.ts → internalTypes.d.ts} +27 -0
- package/common/toolbar/internalTypes.js +1 -0
- package/common/toolbar/useInterfaces.d.ts +1 -1
- package/common/types.d.ts +165 -18
- package/common/util/datetime.d.ts +17 -0
- package/common/util/datetime.js +17 -0
- package/common/util/getWidthStyle.d.ts +9 -0
- package/common/util/getWidthStyle.js +9 -0
- package/common/util/index.d.ts +0 -4
- package/common/util/index.js +0 -4
- package/common/util/isSubset.d.ts +12 -1
- package/common/util/isSubset.js +13 -2
- package/common/util/useControlledHover.d.ts +5 -0
- package/common/util/useControlledHover.js +5 -0
- package/grid/focus/types.d.ts +11 -0
- package/grid/main/Grid.d.ts +5 -0
- package/grid/main/Grid.js +6 -5
- package/grid/main/GridBody.d.ts +1 -1
- package/grid/main/GridHeader.d.ts +1 -1
- package/grid/main/internalTypes.d.ts +29 -0
- package/grid/main/internalTypes.js +1 -0
- package/grid/main/types.d.ts +108 -19
- package/package.json +5 -5
- package/table/InternalTable.d.ts +1 -1
- package/table/Table.d.ts +5 -1
- package/table/Table.js +5 -0
- package/table/editing/EditableRow.d.ts +1 -1
- package/table/editing/EditableRow.js +1 -1
- package/table/internalTypes.d.ts +23 -0
- package/table/internalTypes.js +1 -0
- package/table/main/BodyRows.d.ts +4 -3
- package/table/main/ColHeaderCell/index.d.ts +1 -1
- package/table/selection/SelectAllHeaderCell.d.ts +1 -1
- package/table/styling/types.d.ts +122 -5
- package/table/types.d.ts +62 -15
- package/common/util/trueModulo.d.ts +0 -2
- package/common/util/trueModulo.js +0 -4
- /package/common/{pipeline/types.js → filtering/internalTypes.js} +0 -0
- /package/common/{toolbar/types.js → internalTypes.js} +0 -0
package/common/types.d.ts
CHANGED
|
@@ -1,57 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { StyleModel } from "./styling/types";
|
|
1
|
+
/**
|
|
2
|
+
* Union of all possible column data types.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
7
6
|
export type ColDataType = string | number | Date;
|
|
7
|
+
/**
|
|
8
|
+
* Union of strings that describe the type of a column.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
8
12
|
export type ColDataTypeStrings = "string" | "number" | "date" | "datetime";
|
|
13
|
+
/**
|
|
14
|
+
* Properties to a define a column that is shared between community and pro
|
|
15
|
+
* editions.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam ValueType - the type of the value of the column (e.g. string,
|
|
18
|
+
* number, or Date)
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
9
22
|
export interface ColDefBase<ValueType = any> {
|
|
23
|
+
/**
|
|
24
|
+
* String that specifies the data type of the column.
|
|
25
|
+
*/
|
|
10
26
|
type: ColDataTypeStrings;
|
|
27
|
+
/**
|
|
28
|
+
* The name of the property for the column in the {@link RowDef} object.
|
|
29
|
+
*/
|
|
11
30
|
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* The display name of the property in places like the column heading.
|
|
33
|
+
*/
|
|
12
34
|
label: string;
|
|
35
|
+
/**
|
|
36
|
+
* The formatter function for the column.
|
|
37
|
+
*/
|
|
13
38
|
formatter?: (value: ValueType) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies whether the column is sortable.
|
|
41
|
+
*
|
|
42
|
+
* @defaultValue false
|
|
43
|
+
*/
|
|
14
44
|
sortable?: boolean;
|
|
15
45
|
}
|
|
16
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Column definition properties specific to the community edition of the table
|
|
48
|
+
* and grid.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface CommunitySpecificColProps {
|
|
53
|
+
/**
|
|
54
|
+
* Sets the min-width and max-width CSS properties for all cells of the
|
|
55
|
+
* column.
|
|
56
|
+
*
|
|
57
|
+
* For the table, if no value is specified, then no value for min-width
|
|
58
|
+
* or max-width will be set.
|
|
59
|
+
*
|
|
60
|
+
* @defaultValue - 100 for the grid, undefined for the table
|
|
61
|
+
*/
|
|
17
62
|
width?: number;
|
|
18
|
-
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Column definition object for the community edition of the table and grid.
|
|
66
|
+
*
|
|
67
|
+
* @typeParam ValueType - the type of the value of the column (e.g. string,
|
|
68
|
+
* number, or Date)
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
export type ColDef<ValueType = any> = ColDefBase<ValueType> & CommunitySpecificColProps;
|
|
73
|
+
/**
|
|
74
|
+
* Type alias for "data" property of the {@link RowDef} interface. This type
|
|
75
|
+
* alias represents the most general type possible. One can specify a more
|
|
76
|
+
* specific type via the Data type parameter.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
19
80
|
export type ValidRowData = Record<string, any>;
|
|
81
|
+
/**
|
|
82
|
+
* The data fields for a row in a table or grid. Excludes the primary key for
|
|
83
|
+
* the row, which is stored separately in the "id" field of the {@link RowDef}
|
|
84
|
+
* interface.
|
|
85
|
+
*
|
|
86
|
+
* @typeParam Data - the type of the object. A more specific type can be
|
|
87
|
+
* specified in place of the default {@link ValidRowData} type to assist in
|
|
88
|
+
* type safety and IDE coding assistance.
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
20
92
|
export type RowData<Data extends ValidRowData = ValidRowData> = Data;
|
|
93
|
+
/**
|
|
94
|
+
* A union of the possible values for an id of a {@link RowDef} object.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
21
98
|
export type RowId = string | number;
|
|
99
|
+
/**
|
|
100
|
+
* An object that represents a single row.
|
|
101
|
+
*
|
|
102
|
+
* @typeParam Data - the type of the "data" property. Can be specified to
|
|
103
|
+
* enhance type safety.
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
22
107
|
export interface RowDef<Data extends ValidRowData = ValidRowData> {
|
|
108
|
+
/**
|
|
109
|
+
* An id for the row that must be unique among all rows passed in the "rows"
|
|
110
|
+
* prop of the {@link Table} or {@link Grid}.
|
|
111
|
+
*/
|
|
23
112
|
id: RowId;
|
|
113
|
+
/**
|
|
114
|
+
* Contains all data fields for different columns of the row.
|
|
115
|
+
*/
|
|
24
116
|
data: RowData<Data>;
|
|
25
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Interface that contains parameters shared between the Table, TablePro, and
|
|
120
|
+
* Grid components.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
26
124
|
export interface MainComponentSharedProps {
|
|
125
|
+
/**
|
|
126
|
+
* The rows of data to be displayed by the table or grid
|
|
127
|
+
*/
|
|
27
128
|
rows: RowDef[];
|
|
129
|
+
/**
|
|
130
|
+
* The column definitions of the table or grid
|
|
131
|
+
*/
|
|
28
132
|
cols: ColDef[];
|
|
29
|
-
pagination?: PaginationModel;
|
|
30
|
-
sortModel?: SortModel;
|
|
31
|
-
filterModel?: FilterModel;
|
|
32
|
-
selectModel?: SelectModel;
|
|
33
|
-
editModel?: EditModel;
|
|
34
|
-
styleModel?: StyleModel;
|
|
35
|
-
allowExport?: boolean;
|
|
36
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* {@link RowDef} object that additionally contains the index of the row in the
|
|
136
|
+
* original array.
|
|
137
|
+
*
|
|
138
|
+
* @typeParam Data - type of the data property of the RowDef object
|
|
139
|
+
*
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
37
142
|
export type AugRowDef<Data extends ValidRowData = ValidRowData> = RowDef<Data> & {
|
|
38
143
|
origIndex: number;
|
|
39
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* Row definition object that additionally contains index of the row before
|
|
147
|
+
* pagination was applied.
|
|
148
|
+
*
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
40
151
|
export type PostPaginationRowDef<Data extends ValidRowData = ValidRowData> = AugRowDef<Data> & {
|
|
41
152
|
prePaginationIndex: number;
|
|
42
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Object that describes the contents for a single table or grid cell along
|
|
156
|
+
* with various metadata.
|
|
157
|
+
*
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
43
160
|
export interface CellData {
|
|
161
|
+
/**
|
|
162
|
+
* The name of the property in the {@link RowDef} "data" property that
|
|
163
|
+
* contains the value for the cell.
|
|
164
|
+
*/
|
|
44
165
|
fieldName: string;
|
|
166
|
+
/**
|
|
167
|
+
* The raw, unformatted, value of the cell.
|
|
168
|
+
*/
|
|
45
169
|
value: ColDataType;
|
|
170
|
+
/**
|
|
171
|
+
* A string that specifies of the value type of the column for the cell.
|
|
172
|
+
* Same as the "type" property in corresponding {@link ColDef} object.
|
|
173
|
+
*/
|
|
46
174
|
type: ColDataTypeStrings;
|
|
175
|
+
/**
|
|
176
|
+
* The ARIA column index of the column that contains the cell.
|
|
177
|
+
*/
|
|
47
178
|
ariaColIndex: number;
|
|
179
|
+
/**
|
|
180
|
+
* The value of the cell after the column's formatter function is applied.
|
|
181
|
+
*/
|
|
48
182
|
formattedValue: string;
|
|
183
|
+
/**
|
|
184
|
+
* The label of the column that the cell is in. Same as the property of the
|
|
185
|
+
* same name in the corresponding {@link ColDef} object.
|
|
186
|
+
*/
|
|
49
187
|
label: string;
|
|
188
|
+
/**
|
|
189
|
+
* The width of the column that the cell is in. Same as the property of the
|
|
190
|
+
* same name in the corresponding {@link ColDef} object.
|
|
191
|
+
*/
|
|
50
192
|
width?: number;
|
|
51
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Comprehensive information for an entire row of a table or grid, after
|
|
196
|
+
* postprocessing such as sorting, pagination, and filtering are applied.
|
|
197
|
+
*
|
|
198
|
+
* Contains an array of {@link CellData} in the order that the columns appear.
|
|
199
|
+
*
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
52
202
|
export type FormattedRow = {
|
|
53
203
|
contents: Omit<CellData, "width">[];
|
|
54
204
|
} & Omit<PostPaginationRowDef, "data">;
|
|
55
|
-
export type AugFormattedRow = {
|
|
56
|
-
contents: CellData[];
|
|
57
|
-
} & Omit<PostPaginationRowDef, "data">;
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a string that represents a date in the format used by the input
|
|
3
|
+
* element of type "date".
|
|
4
|
+
*
|
|
5
|
+
* @param date - the Date object to format
|
|
6
|
+
* @returns a string in the format YYYY-MM-DD
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
1
10
|
export declare const dateToInputStr: (date: Date) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Returns of string representation of datetime from a Date object.
|
|
13
|
+
*
|
|
14
|
+
* @param date - the Date object to format
|
|
15
|
+
* @returns a string in the format YYYY-MM-DDTHH:mm
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
2
19
|
export declare const dateToDatetimeInputStr: (date: Date) => string;
|
package/common/util/datetime.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
+
/**
|
|
3
|
+
* Returns a string that represents a date in the format used by the input
|
|
4
|
+
* element of type "date".
|
|
5
|
+
*
|
|
6
|
+
* @param date - the Date object to format
|
|
7
|
+
* @returns a string in the format YYYY-MM-DD
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
2
11
|
export var dateToInputStr = function (date) { return dayjs(date).format("YYYY-MM-DD"); };
|
|
12
|
+
/**
|
|
13
|
+
* Returns of string representation of datetime from a Date object.
|
|
14
|
+
*
|
|
15
|
+
* @param date - the Date object to format
|
|
16
|
+
* @returns a string in the format YYYY-MM-DDTHH:mm
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
3
20
|
export var dateToDatetimeInputStr = function (date) {
|
|
4
21
|
return dayjs(date).format("YYYY-MM-DDTHH:mm");
|
|
5
22
|
};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Given a number representing a width, returns a React CSSProperties object
|
|
4
|
+
* that sets the min-width and max-width CSS properties based on that number.
|
|
5
|
+
* Returns undefined if the input is undefined.
|
|
6
|
+
*
|
|
7
|
+
* @param width - the number representing the width, or undefined
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
2
11
|
declare const getWidthStyle: (width: number | undefined) => CSSProperties | undefined;
|
|
3
12
|
export default getWidthStyle;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a number representing a width, returns a React CSSProperties object
|
|
3
|
+
* that sets the min-width and max-width CSS properties based on that number.
|
|
4
|
+
* Returns undefined if the input is undefined.
|
|
5
|
+
*
|
|
6
|
+
* @param width - the number representing the width, or undefined
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
1
10
|
var getWidthStyle = function (width) {
|
|
2
11
|
return width === undefined
|
|
3
12
|
? undefined
|
package/common/util/index.d.ts
CHANGED
package/common/util/index.js
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether the elements of an array is the subset of another.
|
|
3
|
+
*
|
|
4
|
+
* @param subset - an array that may be the subset of another set
|
|
5
|
+
* @param superset - an array that may be the superset of another set
|
|
6
|
+
*
|
|
7
|
+
* @returns a boolean value indicating whether the elements in subset are a
|
|
8
|
+
* subset of the elements in superset
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
declare const isSubset: <T>(subset: T[], superset: T[]) => boolean;
|
|
2
13
|
export default isSubset;
|
package/common/util/isSubset.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether the elements of an array is the subset of another.
|
|
3
|
+
*
|
|
4
|
+
* @param subset - an array that may be the subset of another set
|
|
5
|
+
* @param superset - an array that may be the superset of another set
|
|
6
|
+
*
|
|
7
|
+
* @returns a boolean value indicating whether the elements in subset are a
|
|
8
|
+
* subset of the elements in superset
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
var isSubset = function (subset, superset) {
|
|
13
|
+
var supersetSet = new Set(superset);
|
|
3
14
|
for (var _i = 0, subset_1 = subset; _i < subset_1.length; _i++) {
|
|
4
15
|
var member = subset_1[_i];
|
|
5
16
|
if (!supersetSet.has(member)) {
|
|
@@ -5,5 +5,10 @@ export interface UseControlledHoverHook<T> {
|
|
|
5
5
|
handleMouseOver: MouseEventHandler<T>;
|
|
6
6
|
handleMouseOut: MouseEventHandler<T>;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Implements React state-based hovering for an element.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
8
13
|
declare const useControlledHover: <T>() => UseControlledHoverHook<T>;
|
|
9
14
|
export default useControlledHover;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Implements React state-based hovering for an element.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
2
7
|
var useControlledHover = function () {
|
|
3
8
|
var _a = useState(false), isHovering = _a[0], setIsHovering = _a[1];
|
|
4
9
|
var handleMouseOver = function () { return setIsHovering(true); };
|
package/grid/focus/types.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grid cell coordinates based on ARIA row index and column index.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
1
6
|
export interface FocusCoordinates {
|
|
7
|
+
/**
|
|
8
|
+
* The ARIA row index.
|
|
9
|
+
*/
|
|
2
10
|
ariaRowIndex: number;
|
|
11
|
+
/**
|
|
12
|
+
* The ARIA column index.
|
|
13
|
+
*/
|
|
3
14
|
ariaColIndex: number;
|
|
4
15
|
}
|
package/grid/main/Grid.d.ts
CHANGED
package/grid/main/Grid.js
CHANGED
|
@@ -9,15 +9,16 @@ import GridBody from "./GridBody";
|
|
|
9
9
|
import classNames from "classnames";
|
|
10
10
|
import { CSS_PREFIX } from "../../common/constants";
|
|
11
11
|
import useGridFocus from "../focus/useGridFocus";
|
|
12
|
+
/**
|
|
13
|
+
* The main component for the grid feature of react-bootstrap-data-grid.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
12
17
|
var Grid = function (_a) {
|
|
13
|
-
var rows = _a.rows, cols = _a.cols,
|
|
18
|
+
var rows = _a.rows, cols = _a.cols, 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;
|
|
14
19
|
var _b = useCombinedPipeline({
|
|
15
20
|
rows: rows,
|
|
16
21
|
cols: cols,
|
|
17
|
-
filterModel: filterModel,
|
|
18
|
-
sortModel: sortModel,
|
|
19
|
-
pagination: pagination,
|
|
20
|
-
selectModel: selectModel,
|
|
21
22
|
}), displayRows = _b.displayRows, filteredRows = _b.filteredRows;
|
|
22
23
|
var colNameToWidth = useColNameToWidth(cols);
|
|
23
24
|
var augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
|
package/grid/main/GridBody.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AugFormattedRow } from "../../common/internalTypes";
|
|
2
|
+
import { FocusCoordinates } from "../focus/types";
|
|
3
|
+
import { GridProps } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Props interface for the GridHeader component
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface GridHeaderProps {
|
|
10
|
+
cols: GridProps["cols"];
|
|
11
|
+
vertScrollable: boolean;
|
|
12
|
+
rowVariant?: GridProps["headerRowVariant"];
|
|
13
|
+
cellVariant?: GridProps["headerCellVariant"];
|
|
14
|
+
focusColIndex: number | null;
|
|
15
|
+
cellFocusVariant?: GridProps["headerCellFocusVariant"];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Props interface for the GridBody component
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export type GridBodyProps = {
|
|
23
|
+
augFormattedRows: AugFormattedRow[];
|
|
24
|
+
cols: GridProps["cols"];
|
|
25
|
+
rowVariant?: GridProps["bodyRowVariant"];
|
|
26
|
+
cellVariant?: GridProps["bodyCellVariant"];
|
|
27
|
+
focusCoords: FocusCoordinates;
|
|
28
|
+
cellFocusVariant?: GridProps["bodyCellFocusVariant"];
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/grid/main/types.d.ts
CHANGED
|
@@ -1,41 +1,130 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CellData, ColDef, FormattedRow, MainComponentSharedProps } from "../../common";
|
|
2
|
+
/**
|
|
3
|
+
* The type of the function used to specify color variants on a grid body on a
|
|
4
|
+
* per-cell level of granularity.
|
|
5
|
+
*
|
|
6
|
+
* @param cell - details the current cell
|
|
7
|
+
* @param row - details of the entire row that the current cell is in
|
|
8
|
+
* @param colIndex - zero-based column index of the current cell
|
|
9
|
+
* @param displayIndex - the zero-based index of the row that the cell is in. The
|
|
10
|
+
* index is based on how the cell is actually displayed, after pagination,
|
|
11
|
+
* filtering, and sorting are applied.
|
|
12
|
+
*
|
|
13
|
+
* @returns - a string that is name of the color variant or null for no color
|
|
14
|
+
* variant
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
3
18
|
export type BodyCellVariantFn = (cell: CellData, row: FormattedRow, colIndex: number, displayIndex: number) => string | null;
|
|
19
|
+
/**
|
|
20
|
+
* The type of the function used to specify color variants on a grid header on a
|
|
21
|
+
* per-cell level of granularity.
|
|
22
|
+
*
|
|
23
|
+
* @param col - details of the column associated with the cell
|
|
24
|
+
* @param colIndex - the zero-based column index of the cell
|
|
25
|
+
*
|
|
26
|
+
* @returns - a string that is name of the color variant or null for no color
|
|
27
|
+
* variant
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
4
31
|
export type HeaderCellVariantFn = (col: ColDef, colIndex: number) => string | null;
|
|
5
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The type of the props passed to the {@link Grid} component.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export type GridProps = MainComponentSharedProps & GridSpecificProps;
|
|
38
|
+
/**
|
|
39
|
+
* Props specific to the {@link Grid} and not the {@link Table}.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export interface GridSpecificProps {
|
|
44
|
+
/**
|
|
45
|
+
* The height setting of the grid
|
|
46
|
+
*/
|
|
6
47
|
height?: GridHeightSetting;
|
|
48
|
+
/**
|
|
49
|
+
* The width setting of the grid
|
|
50
|
+
*/
|
|
7
51
|
width?: GridWidthSetting;
|
|
52
|
+
/**
|
|
53
|
+
* The grid-wide color variant
|
|
54
|
+
*/
|
|
8
55
|
variant?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The stripe setting of the grid
|
|
58
|
+
*/
|
|
9
59
|
stripes?: GridStripeSetting;
|
|
60
|
+
/**
|
|
61
|
+
* Toggles hover styles for the grid
|
|
62
|
+
*/
|
|
10
63
|
hover?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The border setting of the grid
|
|
66
|
+
*/
|
|
11
67
|
borders?: GridBorderSetting;
|
|
68
|
+
/**
|
|
69
|
+
* The border color variant of the grid
|
|
70
|
+
*/
|
|
12
71
|
borderVariant?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Toggles a denser grid style
|
|
74
|
+
*/
|
|
13
75
|
small?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Toggles a horizontal divider between the grid header and body
|
|
78
|
+
*/
|
|
14
79
|
divider?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Sets the color variant of the header row
|
|
82
|
+
*/
|
|
15
83
|
headerRowVariant?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Function to set the color variant of header cells. Overrides the row-wide
|
|
86
|
+
* setting when this function returns a non-null value.
|
|
87
|
+
*/
|
|
16
88
|
headerCellVariant?: HeaderCellVariantFn;
|
|
89
|
+
/**
|
|
90
|
+
* Function to set the color variant of body rows
|
|
91
|
+
*/
|
|
17
92
|
bodyRowVariant?: (row: FormattedRow, displayIndex: number) => string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Function to set the color variant of body cells on a per-cell basis.
|
|
95
|
+
* Overrides the row-wide setting when this function returns a non-null value.
|
|
96
|
+
*/
|
|
18
97
|
bodyCellVariant?: BodyCellVariantFn;
|
|
98
|
+
/**
|
|
99
|
+
* Function to set the color variant of header cell focus rings
|
|
100
|
+
*/
|
|
19
101
|
headerCellFocusVariant?: HeaderCellVariantFn;
|
|
102
|
+
/**
|
|
103
|
+
* Function to set the color variant of body cell focus rings
|
|
104
|
+
*/
|
|
20
105
|
bodyCellFocusVariant?: BodyCellVariantFn;
|
|
21
|
-
};
|
|
22
|
-
export interface GridHeaderProps {
|
|
23
|
-
cols: GridProps["cols"];
|
|
24
|
-
vertScrollable: boolean;
|
|
25
|
-
rowVariant?: GridProps["headerRowVariant"];
|
|
26
|
-
cellVariant?: GridProps["headerCellVariant"];
|
|
27
|
-
focusColIndex: number | null;
|
|
28
|
-
cellFocusVariant?: GridProps["headerCellFocusVariant"];
|
|
29
106
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
focusCoords: FocusCoordinates;
|
|
36
|
-
cellFocusVariant?: GridProps["bodyCellFocusVariant"];
|
|
37
|
-
};
|
|
107
|
+
/**
|
|
108
|
+
* The type of the prop to set grid height behavior
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
38
112
|
export type GridHeightSetting = number | "auto" | "parent";
|
|
113
|
+
/**
|
|
114
|
+
* The type of the prop to set grid width behavior
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
39
118
|
export type GridWidthSetting = number | "auto" | "parent";
|
|
119
|
+
/**
|
|
120
|
+
* The type of the prop to set the grid stripe style
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
40
124
|
export type GridStripeSetting = "rows" | "columns" | "none";
|
|
125
|
+
/**
|
|
126
|
+
* The type of the prop to set the grid border style
|
|
127
|
+
*
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
41
130
|
export type GridBorderSetting = "horizontal" | "full" | "none";
|
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.2.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"react": "^19",
|
|
24
24
|
"react-dom": "^19"
|
|
25
25
|
},
|
|
26
|
-
"main": "./index.js",
|
|
27
|
-
"module": "./index.js",
|
|
28
|
-
"types": "./index.d.ts",
|
|
26
|
+
"main": "./community/index.js",
|
|
27
|
+
"module": "./community/index.js",
|
|
28
|
+
"types": "./community/index.d.ts",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "git+https://github.com/absreim/react-bootstrap-data-grid.git",
|
|
32
|
-
"directory": "src/
|
|
32
|
+
"directory": "src/community"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/table/InternalTable.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import { BaseTableProps } from "./types";
|
|
3
2
|
import { UseCombinedPipelineHook } from "../common/pipeline/useCombinedPipeline";
|
|
4
3
|
import { UseGridSelectionFnsHook } from "../common/pipeline/useGridSelectionFns";
|
|
4
|
+
import { BaseTableProps } from "./internalTypes";
|
|
5
5
|
export interface InternalGridProps {
|
|
6
6
|
gridProps: BaseTableProps;
|
|
7
7
|
hooks: {
|
package/table/Table.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { TableProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* The main component of the table feature of react-bootstrap-data-grid.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
3
8
|
declare const Table: FC<TableProps>;
|
|
4
9
|
export default Table;
|
|
5
|
-
export type { TableProps } from "./types";
|
package/table/Table.js
CHANGED
|
@@ -8,6 +8,11 @@ import useGetInputStrSubmitCallback from "../common/pipeline/useGetInputStrSubmi
|
|
|
8
8
|
import useAugFormattedRows from "../common/pipeline/useAugFormattedRows";
|
|
9
9
|
import BodyRows from "./main/BodyRows";
|
|
10
10
|
import useColNameToWidth from "../common/pipeline/useColNameToWidth";
|
|
11
|
+
/**
|
|
12
|
+
* The main component of the table feature of react-bootstrap-data-grid.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
11
16
|
var Table = function (props) {
|
|
12
17
|
var rows = props.rows, cols = props.cols, filterModel = props.filterModel, sortModel = props.sortModel, pagination = props.pagination, selectModel = props.selectModel, styleModel = props.styleModel, editModel = props.editModel;
|
|
13
18
|
var combinedPipelineOutput = useCombinedPipeline({
|