@absreim/react-bootstrap-data-grid-pro 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.
Files changed (105) hide show
  1. package/common/constants.d.ts +2 -0
  2. package/common/constants.js +2 -0
  3. package/common/editing/types.d.ts +30 -0
  4. package/common/export/types.d.ts +6 -0
  5. package/common/export/useExportFn.js +1 -1
  6. package/common/filtering/DateFilterRow.d.ts +1 -1
  7. package/common/filtering/DateFilterRow.js +1 -1
  8. package/common/filtering/FilterOptionsTable.d.ts +3 -2
  9. package/common/filtering/NumberFilterRow.d.ts +1 -1
  10. package/common/filtering/NumberFilterRow.js +1 -1
  11. package/common/filtering/StringFilterRow.js +1 -1
  12. package/common/filtering/constants.d.ts +19 -0
  13. package/common/filtering/constants.js +44 -0
  14. package/common/filtering/internalTypes.d.ts +77 -0
  15. package/common/filtering/types.d.ts +165 -22
  16. package/common/filtering/types.js +46 -17
  17. package/common/filtering/useFilterFormState.d.ts +1 -1
  18. package/common/index.d.ts +0 -3
  19. package/common/index.js +0 -3
  20. package/common/internalTypes.d.ts +10 -0
  21. package/common/pagination/Pagination.d.ts +1 -1
  22. package/common/pagination/internalTypes.d.ts +8 -0
  23. package/common/pagination/types.d.ts +105 -5
  24. package/common/pipeline/{types.d.ts → internalTypes.d.ts} +5 -0
  25. package/common/pipeline/internalTypes.js +1 -0
  26. package/common/pipeline/useAugFormattedRows.d.ts +3 -2
  27. package/common/pipeline/useColNameToWidth.d.ts +2 -1
  28. package/common/pipeline/useCombinedPipeline/index.d.ts +4 -3
  29. package/common/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +2 -1
  30. package/common/pipeline/useCombinedPipeline/useCurrentPageRows.js +3 -2
  31. package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +2 -1
  32. package/common/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +2 -1
  33. package/common/pipeline/useGridSelectionFns.d.ts +2 -1
  34. package/common/selection/internalTypes.d.ts +34 -0
  35. package/common/selection/internalTypes.js +1 -0
  36. package/common/selection/types.d.ts +91 -17
  37. package/common/selection/types.js +0 -3
  38. package/common/sorting/internalTypes.d.ts +10 -0
  39. package/common/sorting/internalTypes.js +1 -0
  40. package/common/sorting/types.d.ts +48 -4
  41. package/common/sorting/useSortHeaderStates.d.ts +1 -1
  42. package/common/styling/types.d.ts +57 -0
  43. package/common/toolbar/Toolbar.d.ts +1 -1
  44. package/common/toolbar/ToolbarContainer.d.ts +1 -1
  45. package/common/toolbar/{types.d.ts → internalTypes.d.ts} +27 -0
  46. package/common/toolbar/internalTypes.js +1 -0
  47. package/common/toolbar/useInterfaces.d.ts +1 -1
  48. package/common/types.d.ts +165 -18
  49. package/common/util/datetime.d.ts +17 -0
  50. package/common/util/datetime.js +17 -0
  51. package/common/util/getWidthStyle.d.ts +9 -0
  52. package/common/util/getWidthStyle.js +9 -0
  53. package/common/util/index.d.ts +0 -4
  54. package/common/util/index.js +0 -4
  55. package/common/util/isSubset.d.ts +12 -1
  56. package/common/util/isSubset.js +13 -2
  57. package/common/util/trueModulo.d.ts +8 -0
  58. package/common/util/trueModulo.js +8 -0
  59. package/common/util/useControlledHover.d.ts +5 -0
  60. package/common/util/useControlledHover.js +5 -0
  61. package/grid/focus/types.d.ts +11 -0
  62. package/grid/main/Grid.d.ts +5 -0
  63. package/grid/main/Grid.js +6 -5
  64. package/grid/main/GridBody.d.ts +1 -1
  65. package/grid/main/GridHeader.d.ts +1 -1
  66. package/grid/main/internalTypes.d.ts +29 -0
  67. package/grid/main/internalTypes.js +1 -0
  68. package/grid/main/types.d.ts +108 -19
  69. package/package.json +5 -5
  70. package/table/InternalTable.d.ts +1 -1
  71. package/table/Table.d.ts +5 -1
  72. package/table/Table.js +5 -0
  73. package/table/editing/EditableRow.d.ts +1 -1
  74. package/table/editing/EditableRow.js +1 -1
  75. package/table/internalTypes.d.ts +23 -0
  76. package/table/internalTypes.js +1 -0
  77. package/table/main/BodyRows.d.ts +4 -3
  78. package/table/main/ColHeaderCell/index.d.ts +1 -1
  79. package/table/selection/SelectAllHeaderCell.d.ts +1 -1
  80. package/table/styling/types.d.ts +122 -5
  81. package/table/types.d.ts +62 -15
  82. package/table-pro/ColHeaderCellPro.d.ts +1 -1
  83. package/table-pro/TablePro.d.ts +5 -0
  84. package/table-pro/TablePro.js +5 -0
  85. package/table-pro/index.d.ts +0 -1
  86. package/table-pro/index.js +0 -1
  87. package/table-pro/internalTypes.d.ts +11 -0
  88. package/table-pro/internalTypes.js +1 -0
  89. package/table-pro/reorder/ReorderHandleCell.d.ts +2 -1
  90. package/table-pro/reorder/internalTypes.d.ts +53 -0
  91. package/table-pro/reorder/internalTypes.js +1 -0
  92. package/table-pro/reorder/types.d.ts +36 -15
  93. package/table-pro/reorder/useKeyboardReorder.d.ts +1 -1
  94. package/table-pro/reorder/useKeyboardReorderListener.d.ts +2 -1
  95. package/table-pro/reorder/useReorderStyles.d.ts +2 -1
  96. package/table-pro/resize/internalType.d.ts +20 -0
  97. package/table-pro/resize/internalType.js +1 -0
  98. package/table-pro/resize/useResizeModel.d.ts +1 -1
  99. package/table-pro/types.d.ts +91 -8
  100. package/table-pro/util/reorderRows.d.ts +13 -0
  101. package/table-pro/util/reorderRows.js +13 -0
  102. package/table-pro/resize/types.d.ts +0 -5
  103. /package/common/{pipeline/types.js → filtering/internalTypes.js} +0 -0
  104. /package/common/{toolbar/types.js → internalTypes.js} +0 -0
  105. /package/{table-pro/resize/types.js → common/pagination/internalTypes.js} +0 -0
package/common/types.d.ts CHANGED
@@ -1,57 +1,204 @@
1
- import { EditModel } from "./editing/types";
2
- import { PaginationModel } from "./pagination/types";
3
- import { SortModel } from "./sorting/types";
4
- import { FilterModel } from "./filtering/types";
5
- import { SelectModel } from "./selection/types";
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
- export type ColDef<ValueType = any> = ColDefBase<ValueType> & {
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;
@@ -1,3 +1,20 @@
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 const dateToInputStr = (date) => 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 const dateToDatetimeInputStr = (date) => dayjs(date).format("YYYY-MM-DDTHH:mm");
@@ -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
  const getWidthStyle = (width) => width === undefined
2
11
  ? undefined
3
12
  : {
@@ -1,5 +1 @@
1
1
  export * from "./datetime";
2
- export { default as getWidthStyle } from "./getWidthStyle";
3
- export { default as isSubset } from "./isSubset";
4
- export { default as trueModulo } from "./trueModulo";
5
- export { default as useControlledHover } from "./useControlledHover";
@@ -1,5 +1 @@
1
1
  export * from "./datetime";
2
- export { default as getWidthStyle } from "./getWidthStyle";
3
- export { default as isSubset } from "./isSubset";
4
- export { default as trueModulo } from "./trueModulo";
5
- export { default as useControlledHover } from "./useControlledHover";
@@ -1,2 +1,13 @@
1
- declare const isSubset: <T>(subset: T[], superSet: T[]) => boolean;
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;
@@ -1,5 +1,16 @@
1
- const isSubset = (subset, superSet) => {
2
- const supersetSet = new Set(superSet);
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
+ const isSubset = (subset, superset) => {
13
+ const supersetSet = new Set(superset);
3
14
  for (const member of subset) {
4
15
  if (!supersetSet.has(member)) {
5
16
  return false;
@@ -1,2 +1,10 @@
1
+ /**
2
+ * Computes a mathematical modulo.
3
+ *
4
+ * @param num - to number to which to apply the modulo operator
5
+ * @param divisor - the divisor of the module operator
6
+ *
7
+ * @internal
8
+ */
1
9
  declare const trueModulo: (num: number, divisor: number) => number;
2
10
  export default trueModulo;
@@ -1,2 +1,10 @@
1
+ /**
2
+ * Computes a mathematical modulo.
3
+ *
4
+ * @param num - to number to which to apply the modulo operator
5
+ * @param divisor - the divisor of the module operator
6
+ *
7
+ * @internal
8
+ */
1
9
  const trueModulo = (num, divisor) => ((num % divisor) + divisor) % divisor;
2
10
  export default trueModulo;
@@ -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
  const useControlledHover = () => {
3
8
  const [isHovering, setIsHovering] = useState(false);
4
9
  const handleMouseOver = () => setIsHovering(true);
@@ -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
  }
@@ -1,4 +1,9 @@
1
1
  import { FC } from "react";
2
2
  import { GridProps } from "./types";
3
+ /**
4
+ * The main component for the grid feature of react-bootstrap-data-grid.
5
+ *
6
+ * @public
7
+ */
3
8
  declare const Grid: FC<GridProps>;
4
9
  export default Grid;
package/grid/main/Grid.js CHANGED
@@ -9,14 +9,15 @@ 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
- const Grid = ({ rows, cols, filterModel, sortModel, pagination, selectModel, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, headerCellFocusVariant, bodyCellFocusVariant }) => {
12
+ /**
13
+ * The main component for the grid feature of react-bootstrap-data-grid.
14
+ *
15
+ * @public
16
+ */
17
+ const Grid = ({ rows, cols, width, height, variant, stripes, hover, borders, small, divider, borderVariant, headerCellVariant, headerRowVariant, bodyCellVariant, bodyRowVariant, headerCellFocusVariant, bodyCellFocusVariant }) => {
13
18
  const { displayRows, filteredRows } = useCombinedPipeline({
14
19
  rows,
15
20
  cols,
16
- filterModel,
17
- sortModel,
18
- pagination,
19
- selectModel,
20
21
  });
21
22
  const colNameToWidth = useColNameToWidth(cols);
22
23
  const augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
@@ -1,4 +1,4 @@
1
1
  import { FC } from "react";
2
- import { GridBodyProps } from "./types";
2
+ import { GridBodyProps } from "./internalTypes";
3
3
  declare const GridBody: FC<GridBodyProps>;
4
4
  export default GridBody;
@@ -1,4 +1,4 @@
1
1
  import { FC } from "react";
2
- import { GridHeaderProps } from "./types";
2
+ import { GridHeaderProps } from "./internalTypes";
3
3
  declare const GridHeader: FC<GridHeaderProps>;
4
4
  export default GridHeader;
@@ -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 {};
@@ -1,41 +1,130 @@
1
- import { AugFormattedRow, CellData, ColDef, FormattedRow, MainComponentSharedProps } from "../../common";
2
- import { FocusCoordinates } from "../focus/types";
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
- export type GridProps = MainComponentSharedProps & {
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
- export type GridBodyProps = {
31
- augFormattedRows: AugFormattedRow[];
32
- cols: GridProps["cols"];
33
- rowVariant?: GridProps["bodyRowVariant"];
34
- cellVariant?: GridProps["bodyCellVariant"];
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-pro",
3
3
  "description": "Pro Version of data grid UI component for use with web apps using React and Bootstrap",
4
- "version": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "license": "Commercial. See LICENSE file.",
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": "./grid-pro/index.js",
27
- "module": "./grid-pro/index.js",
28
- "types": "./grid-pro/index.d.ts",
26
+ "main": "./pro/index.js",
27
+ "module": "./pro/index.js",
28
+ "types": "./pro/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/grid-pro"
32
+ "directory": "src/pro"
33
33
  }
34
34
  }
@@ -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: {