@absreim/react-bootstrap-data-grid-pro 4.1.0 → 4.3.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 (133) 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/icons/CaretDownFill.d.ts +4 -0
  19. package/common/icons/CaretDownFill.js +3 -0
  20. package/common/icons/CaretUp.d.ts +4 -0
  21. package/common/icons/CaretUp.js +3 -0
  22. package/common/icons/CaretUpFill.d.ts +4 -0
  23. package/common/icons/CaretUpFill.js +3 -0
  24. package/common/icons/internalTypes.d.ts +3 -0
  25. package/common/index.d.ts +0 -3
  26. package/common/index.js +0 -3
  27. package/common/internalTypes.d.ts +10 -0
  28. package/common/pagination/Pagination.d.ts +1 -1
  29. package/common/pagination/internalTypes.d.ts +8 -0
  30. package/common/pagination/internalTypes.js +1 -0
  31. package/common/pagination/types.d.ts +105 -5
  32. package/common/pipeline/{types.d.ts → internalTypes.d.ts} +5 -0
  33. package/common/pipeline/internalTypes.js +1 -0
  34. package/common/pipeline/useAugFormattedRows.d.ts +3 -2
  35. package/common/pipeline/useColNameToWidth.d.ts +2 -1
  36. package/common/pipeline/useCombinedPipeline/index.d.ts +4 -3
  37. package/common/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +2 -1
  38. package/common/pipeline/useCombinedPipeline/useCurrentPageRows.js +3 -2
  39. package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +2 -1
  40. package/common/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +2 -1
  41. package/common/pipeline/useGridSelectionFns.d.ts +2 -1
  42. package/common/selection/internalTypes.d.ts +34 -0
  43. package/common/selection/internalTypes.js +1 -0
  44. package/common/selection/types.d.ts +91 -17
  45. package/common/selection/types.js +0 -3
  46. package/common/sorting/ArrowPlaceholder.d.ts +3 -0
  47. package/common/sorting/ArrowPlaceholder.js +3 -0
  48. package/common/sorting/DownArrow.d.ts +6 -0
  49. package/common/sorting/DownArrow.js +3 -0
  50. package/common/sorting/UpArrow.d.ts +6 -0
  51. package/common/sorting/UpArrow.js +3 -0
  52. package/common/sorting/internalTypes.d.ts +10 -0
  53. package/common/sorting/internalTypes.js +1 -0
  54. package/common/sorting/types.d.ts +48 -4
  55. package/common/sorting/useSortHeaderStates.d.ts +1 -1
  56. package/common/sorting/useSortHeaderStates.js +8 -7
  57. package/common/styling/types.d.ts +57 -0
  58. package/common/toolbar/Toolbar.d.ts +1 -1
  59. package/common/toolbar/ToolbarContainer.d.ts +1 -1
  60. package/common/toolbar/{types.d.ts → internalTypes.d.ts} +27 -0
  61. package/common/toolbar/internalTypes.js +1 -0
  62. package/common/toolbar/useInterfaces.d.ts +1 -1
  63. package/common/types.d.ts +169 -16
  64. package/common/util/datetime.d.ts +17 -0
  65. package/common/util/datetime.js +17 -0
  66. package/common/util/getWidthStyle.d.ts +9 -0
  67. package/common/util/getWidthStyle.js +9 -0
  68. package/common/util/index.d.ts +0 -4
  69. package/common/util/index.js +0 -4
  70. package/common/util/isSubset.d.ts +12 -1
  71. package/common/util/isSubset.js +13 -2
  72. package/common/util/trueModulo.d.ts +8 -0
  73. package/common/util/trueModulo.js +8 -0
  74. package/common/util/useControlledHover.d.ts +5 -0
  75. package/common/util/useControlledHover.js +5 -0
  76. package/grid/focus/types.d.ts +11 -0
  77. package/grid/focus/useGridFocus.d.ts +1 -1
  78. package/grid/focus/useGridFocus.js +20 -5
  79. package/grid/main/Grid.d.ts +5 -0
  80. package/grid/main/Grid.js +14 -7
  81. package/grid/main/GridBody.d.ts +1 -1
  82. package/grid/main/GridHeader.d.ts +1 -1
  83. package/grid/main/GridHeader.js +29 -2
  84. package/grid/main/internalTypes.d.ts +31 -0
  85. package/grid/main/internalTypes.js +1 -0
  86. package/grid/main/types.d.ts +120 -19
  87. package/grid/sort/HeaderToggleButton.d.ts +11 -0
  88. package/grid/sort/HeaderToggleButton.js +29 -0
  89. package/grid.css +1 -1
  90. package/grid.scss +95 -33
  91. package/package.json +5 -5
  92. package/table/InternalTable.d.ts +1 -1
  93. package/table/Table.d.ts +5 -1
  94. package/table/Table.js +5 -0
  95. package/table/editing/EditableRow.d.ts +1 -1
  96. package/table/editing/EditableRow.js +1 -1
  97. package/table/internalTypes.d.ts +23 -0
  98. package/table/internalTypes.js +1 -0
  99. package/table/main/BodyRows.d.ts +4 -3
  100. package/table/main/ColHeaderCell/index.d.ts +1 -1
  101. package/table/selection/SelectAllHeaderCell.d.ts +1 -1
  102. package/table/styling/types.d.ts +122 -5
  103. package/table/types.d.ts +57 -15
  104. package/table-pro/ColHeaderCellPro.d.ts +1 -1
  105. package/table-pro/TablePro.d.ts +5 -0
  106. package/table-pro/TablePro.js +5 -0
  107. package/table-pro/index.d.ts +0 -1
  108. package/table-pro/index.js +0 -1
  109. package/table-pro/internalTypes.d.ts +11 -0
  110. package/table-pro/internalTypes.js +1 -0
  111. package/table-pro/reorder/ReorderHandleCell.d.ts +2 -1
  112. package/table-pro/reorder/internalTypes.d.ts +53 -0
  113. package/table-pro/reorder/internalTypes.js +1 -0
  114. package/table-pro/reorder/types.d.ts +36 -15
  115. package/table-pro/reorder/useKeyboardReorder.d.ts +1 -1
  116. package/table-pro/reorder/useKeyboardReorderListener.d.ts +2 -1
  117. package/table-pro/reorder/useReorderStyles.d.ts +2 -1
  118. package/table-pro/resize/internalType.d.ts +20 -0
  119. package/table-pro/resize/internalType.js +1 -0
  120. package/table-pro/resize/useResizeModel.d.ts +1 -1
  121. package/table-pro/types.d.ts +91 -8
  122. package/table-pro/util/reorderRows.d.ts +13 -0
  123. package/table-pro/util/reorderRows.js +13 -0
  124. package/common/sorting/arrowPlaceholder.d.ts +0 -2
  125. package/common/sorting/arrowPlaceholder.js +0 -7
  126. package/common/sorting/downArrow.d.ts +0 -2
  127. package/common/sorting/downArrow.js +0 -3
  128. package/common/sorting/upArrow.d.ts +0 -2
  129. package/common/sorting/upArrow.js +0 -4
  130. package/table-pro/resize/types.d.ts +0 -5
  131. /package/common/{pipeline/types.js → filtering/internalTypes.js} +0 -0
  132. /package/common/{toolbar/types.js → icons/internalTypes.js} +0 -0
  133. /package/{table-pro/resize/types.js → common/internalTypes.js} +0 -0
@@ -1,38 +1,155 @@
1
- import { RowId } from "../../common/types";
1
+ import { RowId } from "../../common";
2
+ /**
3
+ * Style model properties shared between the main table and the filter
4
+ * options table.
5
+ *
6
+ * @public
7
+ */
2
8
  export interface SharedTableStyleModel {
9
+ /**
10
+ * Classes for the table element.
11
+ */
3
12
  table?: string[];
13
+ /**
14
+ * Classes for the tbody element.
15
+ */
4
16
  tbody?: string[];
17
+ /**
18
+ * Classes for the thead element.
19
+ */
5
20
  thead?: string[];
21
+ /**
22
+ * Classes for the sole tr element inside the thead element.
23
+ */
6
24
  theadTr?: string[];
25
+ /**
26
+ * Classes for the th elements within the thead element.
27
+ */
7
28
  theadTh?: (colIndex: number) => string[] | null;
29
+ /**
30
+ * Classes for the caption element.
31
+ */
8
32
  caption?: string[];
9
33
  }
10
- export type TableStyleModel = SharedTableStyleModel & {
34
+ /**
35
+ * Style model properties specific to the main table.
36
+ *
37
+ * @public
38
+ */
39
+ export interface MainTableSpecificStyleModel {
40
+ /**
41
+ * Classes for tr elements within the tbody element.
42
+ */
11
43
  tbodyTr?: (rowId: RowId, displayIndex: number) => string[] | null;
44
+ /**
45
+ * Classes for td elements within the tbody element.
46
+ */
12
47
  tbodyTd?: (rowId: RowId, displayRowIndex: number, colIndex: number) => string[] | null;
48
+ /**
49
+ * Classes for input elements within the tbody element.
50
+ */
13
51
  tbodyTdInput?: (rowId: RowId, displayRowIndex: number, colIndex: number) => string[] | null;
52
+ /**
53
+ * Classes for th element in the edit column.
54
+ */
14
55
  editColTh?: string[];
56
+ /**
57
+ * Classes for the td elements in the edit column.
58
+ */
15
59
  editColTd?: (rowId: RowId, displayIndex: number) => string[] | null;
60
+ /**
61
+ * Classes for the start button in the edit column.
62
+ */
16
63
  editStartButton?: (rowId: RowId, displayIndex: number) => string[] | null;
64
+ /**
65
+ * Classes for the delete button in the edit column.
66
+ */
17
67
  editDeleteButton?: (rowId: RowId, displayIndex: number) => string[] | null;
68
+ /**
69
+ * Classes for the save button in the edit column.
70
+ */
18
71
  editSaveButton?: (rowId: RowId, displayIndex: number) => string[] | null;
72
+ /**
73
+ * Classes for the cancel button in the edit column.
74
+ */
19
75
  editCancelButton?: (rowId: RowId, displayIndex: number) => string[] | null;
76
+ /**
77
+ * Classes for the th element of the row selection column.
78
+ */
20
79
  rowSelectColTh?: string[];
80
+ /**
81
+ * Classes for the td elements of the row selection column.
82
+ */
21
83
  rowSelectColTd?: (rowId: RowId, displayIndex: number) => string[] | null;
84
+ /**
85
+ * Classes for the input elements of the row selection column.
86
+ */
22
87
  rowSelectInput?: (rowId: RowId, displayIndex: number) => string[] | null;
23
- };
24
- export type FilterInputTableStyleModel = SharedTableStyleModel & {
88
+ }
89
+ /**
90
+ * Style model for the main table.
91
+ *
92
+ * @public
93
+ */
94
+ export type TableStyleModel = SharedTableStyleModel & MainTableSpecificStyleModel;
95
+ /**
96
+ * Style model properties specific to the filter inputs table.
97
+ *
98
+ * @public
99
+ */
100
+ export interface FilterTableSpecificStyleModel {
101
+ /**
102
+ * Classes for the tr elements in the tbody element.
103
+ */
25
104
  tbodyTr?: (rowIndex: number) => string[] | null;
105
+ /**
106
+ * Classes for the td elements in the tbody element.
107
+ */
26
108
  tbodyTd?: (rowIndex: number, colIndex: number) => string[] | null;
109
+ /**
110
+ * Classes for the checkboxes that enable filtering for columns.
111
+ */
27
112
  enablementInput?: (rowIndex: number) => string[] | null;
113
+ /**
114
+ * Classes for the dropdowns for selecting filter schemes.
115
+ */
28
116
  schemeSelectionInput?: (rowIndex: number) => string[] | null;
117
+ /**
118
+ * Classes for text search string input elements.
119
+ */
29
120
  searchStringInput?: (rowIndex: number) => string[] | null;
121
+ /**
122
+ * Classes for numerical input elements.
123
+ */
30
124
  numberInput?: (rowIndex: number) => string[] | null;
125
+ /**
126
+ * Classes for the state date inputs.
127
+ */
31
128
  startDateInput?: (rowIndex: number) => string[] | null;
129
+ /**
130
+ * Classes for the end date inputs.
131
+ */
32
132
  endDateInput?: (rowIndex: number) => string[] | null;
133
+ /**
134
+ * Classes for the form submit button.
135
+ */
33
136
  submitButton?: string[];
137
+ /**
138
+ * Classes for the form element.
139
+ */
34
140
  form?: string[];
35
- };
141
+ }
142
+ /**
143
+ * Style model for the filter inputs table.
144
+ *
145
+ * @public
146
+ */
147
+ export type FilterInputTableStyleModel = SharedTableStyleModel & FilterTableSpecificStyleModel;
148
+ /**
149
+ * Style model for components that are not included in other categories.
150
+ *
151
+ * @public
152
+ */
36
153
  export interface AdditionalComponentsStyleModel {
37
154
  topLevelDiv?: string[];
38
155
  tableAndPaginationDiv?: string[];
package/table/types.d.ts CHANGED
@@ -1,19 +1,61 @@
1
- import { ColSortModel } from "../common/sorting/types";
2
- import { ColDefBase, MainComponentSharedProps } from "../common/types";
3
- import { StyleModel } from "../common/styling/types";
1
+ import { EditModel, FilterModel, MainComponentSharedProps, PaginationModel, SelectModel, StyleModel } from "../common";
2
+ /**
3
+ * Available options for the displayMode prop of {@link TableSpecificProps}.
4
+ *
5
+ * @public
6
+ */
4
7
  export type DisplayMode = "table" | "block";
5
- export type TableProps = MainComponentSharedProps & {
6
- caption?: string;
8
+ /**
9
+ * Props specific to the {@link Table} component and not the {@link Grid}
10
+ * component.
11
+ *
12
+ * @public
13
+ */
14
+ export interface TableSpecificProps {
15
+ /**
16
+ * The pagination model of the table. Passing a truthy value enables
17
+ * the pagination feature of the component.
18
+ */
19
+ pagination?: PaginationModel;
20
+ /**
21
+ * The filter model of the table. Passing a truthy value enables the
22
+ * filtering feature of the component.
23
+ */
24
+ filterModel?: FilterModel;
25
+ /**
26
+ * The select model of the table. Passing a truthy value enables the
27
+ * selection feature of the component.
28
+ */
29
+ selectModel?: SelectModel;
30
+ /**
31
+ * The edit model of the table. Passing a truthy value enables the
32
+ * editing feature of the component.
33
+ */
34
+ editModel?: EditModel;
35
+ /**
36
+ * The style model of the table. Passing a truthy value enables the
37
+ * developer to customize the CSS classes applied to various elements of the
38
+ * table.
39
+ */
7
40
  styleModel?: StyleModel;
41
+ /**
42
+ * Enables exporting of data from the table.
43
+ */
44
+ allowExport?: boolean;
45
+ /**
46
+ * Sets a caption for the table
47
+ */
48
+ caption?: string;
49
+ /**
50
+ * Sets the CSS display property for the table element.
51
+ *
52
+ * @defaultValue `"table"`
53
+ */
8
54
  displayMode?: DisplayMode;
9
- };
10
- export type BaseTableProps = Omit<TableProps, "cols"> & {
11
- cols: ColDefBase[];
12
- };
13
- export interface ColHeaderCellProps {
14
- label: string;
15
- sortModel?: ColSortModel;
16
- ariaColIndex: number;
17
- additionalClasses?: string[] | null;
18
- width?: number;
19
55
  }
56
+ /**
57
+ * The type of the props object for the Table component.
58
+ *
59
+ * @public
60
+ */
61
+ export type TableProps = MainComponentSharedProps & TableSpecificProps;
@@ -1,4 +1,4 @@
1
1
  import { FC } from "react";
2
- import { ColHeaderCellProProps } from "./types";
2
+ import { ColHeaderCellProProps } from "./internalTypes";
3
3
  declare const ColHeaderCellPro: FC<ColHeaderCellProProps>;
4
4
  export default ColHeaderCellPro;
@@ -1,4 +1,9 @@
1
1
  import { FC } from "react";
2
2
  import { TableProProps } from "./types";
3
+ /**
4
+ * Pro edition of the table component.
5
+ *
6
+ * @public
7
+ */
3
8
  declare const TablePro: FC<TableProProps>;
4
9
  export default TablePro;
@@ -14,6 +14,11 @@ import ReorderHandleCell from "./reorder/ReorderHandleCell";
14
14
  import useKeyboardReorder from "./reorder/useKeyboardReorder";
15
15
  import useReorderStyles from "./reorder/useReorderStyles";
16
16
  import useKeyboardReorderListener from "./reorder/useKeyboardReorderListener";
17
+ /**
18
+ * Pro edition of the table component.
19
+ *
20
+ * @public
21
+ */
17
22
  const TablePro = (props) => {
18
23
  const { rows, cols, editModel, filterModel, sortModel, pagination, selectModel, styleModel, displayMode, reorder, } = props;
19
24
  const combinedPipelineOutput = useCombinedPipeline({
@@ -3,4 +3,3 @@ export { default } from "./TablePro";
3
3
  export * from "./types";
4
4
  export * from "./util";
5
5
  export * from "./reorder/types";
6
- export * from "./resize/types";
@@ -3,4 +3,3 @@ export { default } from "./TablePro";
3
3
  export * from "./types";
4
4
  export * from "./util";
5
5
  export * from "./reorder/types";
6
- export * from "./resize/types";
@@ -0,0 +1,11 @@
1
+ import { ColHeaderCellProps } from "../table/internalTypes";
2
+ import { TableProps } from "../table";
3
+ import { ProColDef } from "./types";
4
+ /**
5
+ * Props for the {@link ColHeaderCellPro} component.
6
+ *
7
+ * @internal
8
+ */
9
+ export type ColHeaderCellProProps = ColHeaderCellProps & Pick<TableProps, "displayMode"> & {
10
+ setWidth?: (width: number) => void;
11
+ } & Pick<ProColDef, "minResizeWidth" | "maxResizeWidth" | "keyboardResizeStep">;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { FC } from "react";
2
- import { ReorderStyles, RowId } from "../";
2
+ import { RowId } from "../";
3
+ import { ReorderStyles } from "./internalTypes";
3
4
  export type ReorderHandleCellProps = {
4
5
  rowId: RowId;
5
6
  ariaRowIndex: number;
@@ -0,0 +1,53 @@
1
+ import { RowId } from "../../common";
2
+ import { ReorderStyleModel } from "./types";
3
+ /**
4
+ * Like the {@link ReorderModel}, but normalized with default values for
5
+ * properties that are not specified.
6
+ *
7
+ * @internal
8
+ */
9
+ export type ReorderStyles = Required<ReorderStyleModel>;
10
+ /**
11
+ * Tracks the current source and destination when using a keyboard to reorder
12
+ * rows.
13
+ *
14
+ * @internal
15
+ */
16
+ export interface KeyboardReorderState {
17
+ /**
18
+ * The id of the source row.
19
+ */
20
+ rowId: RowId;
21
+ /**
22
+ * The current destination index.
23
+ */
24
+ destIndex: number;
25
+ }
26
+ /**
27
+ * In addition to tracking the state of keyboard reordering UI like
28
+ * {@link KeyboardReorderState} does, also provides functions to respond to
29
+ * keystrokes.
30
+ *
31
+ * @internal
32
+ */
33
+ export type ActiveKeyboardReorderState = KeyboardReorderState & {
34
+ moveToPrevTarget: () => void;
35
+ moveToNextTarget: () => void;
36
+ clearState: () => void;
37
+ drageeIndex: number;
38
+ };
39
+ /**
40
+ * Output of the hook used to implement keyboard-based row reordering.
41
+ *
42
+ * @internal
43
+ */
44
+ export interface UseKeyboardReorderOutput {
45
+ /**
46
+ * THe current state of the UI and functions to respond to keystrokes.
47
+ */
48
+ drageeState: ActiveKeyboardReorderState | null;
49
+ /**
50
+ * Function to set a new row as the one being moved.
51
+ */
52
+ setDragee: (rowId: RowId) => void;
53
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,27 +1,48 @@
1
1
  import { RowId } from "../";
2
+ /**
3
+ * Type of the callback function to respond to a reorder operation.
4
+ *
5
+ * @param id - the id of the source row
6
+ * @param destIndex - the index of the destination row
7
+ *
8
+ * @public
9
+ */
2
10
  export type ReorderCallback = (id: RowId, destIndex: number) => void;
11
+ /**
12
+ * Object that enables the row reordering feature.
13
+ *
14
+ * @public
15
+ */
3
16
  export interface ReorderModel {
17
+ /**
18
+ * Callback function called when a reorder operation is performed via the UI.
19
+ */
4
20
  callback: ReorderCallback;
5
21
  }
22
+ /**
23
+ * Style model properties specific to the row reordering feature.
24
+ *
25
+ * @public
26
+ */
6
27
  export interface ReorderStyleModel {
28
+ /**
29
+ * Classes for the row being dragged.
30
+ */
7
31
  draggedRowClasses?: string[];
32
+ /**
33
+ * Classes for the row above the row being dragged.
34
+ */
8
35
  draggedRowPredecessorClasses?: string[];
36
+ /**
37
+ * Classes for the row below the drag destination.
38
+ */
9
39
  topBorderRowClasses?: string[];
40
+ /**
41
+ * Classes for the row above the drag destination.
42
+ */
10
43
  bottomBorderRowClasses?: string[];
44
+ /**
45
+ * Classes for the drag marker that follows the cursor while dragging.
46
+ */
11
47
  ghostDivClasses?: string[];
12
48
  }
13
- export type ReorderStyles = Required<ReorderStyleModel>;
14
- export interface KeyboardReorderState {
15
- rowId: RowId;
16
- destIndex: number;
17
- }
18
- export type ActiveKeyboardReorderState = KeyboardReorderState & {
19
- moveToPrevTarget: () => void;
20
- moveToNextTarget: () => void;
21
- clearState: () => void;
22
- drageeIndex: number;
23
- };
24
- export interface UseKeyboardReorderOutput {
25
- drageeState: ActiveKeyboardReorderState | null;
26
- setDragee: (rowId: RowId) => void;
27
- }
@@ -1,4 +1,4 @@
1
1
  import { RowId } from "../";
2
- import { UseKeyboardReorderOutput } from "./types";
2
+ import { UseKeyboardReorderOutput } from "./internalTypes";
3
3
  declare const useKeyboardReorder: (displayRowIds: RowId[]) => UseKeyboardReorderOutput;
4
4
  export default useKeyboardReorder;
@@ -1,3 +1,4 @@
1
- import { ActiveKeyboardReorderState, ReorderCallback } from "./types";
1
+ import { ReorderCallback } from "./types";
2
+ import { ActiveKeyboardReorderState } from "./internalTypes";
2
3
  declare const useKeyboardReorderListener: (state: ActiveKeyboardReorderState | null, reorderCallback: ReorderCallback | undefined) => (event: KeyboardEvent) => void;
3
4
  export default useKeyboardReorderListener;
@@ -1,3 +1,4 @@
1
- import { ReorderStyleModel, ReorderStyles } from "./types";
1
+ import { ReorderStyleModel } from "./types";
2
+ import { ReorderStyles } from "./internalTypes";
2
3
  declare const useReorderStyles: (styleModel: ReorderStyleModel | undefined) => ReorderStyles;
3
4
  export default useReorderStyles;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Width numerical value getter/setter pair that can support unspecified
3
+ * values.
4
+ *
5
+ * @internal
6
+ */
7
+ export interface ColResizeModel {
8
+ width: number | undefined;
9
+ setWidth: ((width: number) => void) | undefined;
10
+ }
11
+ /**
12
+ * {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type | Record}
13
+ * that contains {@link ColResizeModel} for each column.
14
+ *
15
+ * @typeParam ColName - type of the name of the column. Can specify a more
16
+ * restrictive type for type safety.
17
+ *
18
+ * @internal
19
+ */
20
+ export type ResizeModel<ColName extends string = string> = Record<ColName, ColResizeModel>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { ProColDef } from "../types";
2
2
  import { DisplayMode } from "../../table";
3
- import { ResizeModel } from "./types";
3
+ import { ResizeModel } from "./internalType";
4
4
  declare const useResizeModel: (cols: Pick<ProColDef, "resizeable" | "width" | "name">[], display: DisplayMode | undefined) => ResizeModel;
5
5
  export default useResizeModel;
@@ -1,25 +1,108 @@
1
- import { ColDef, ColDefBase, ColHeaderCellProps, TableProps, StyleModel } from "../table";
1
+ import { ColDef, ColDefBase, StyleModel, TableProps } from "../table";
2
2
  import { ReorderModel, ReorderStyleModel } from "./reorder/types";
3
- export type ProColDef<ValueType = any> = ColDefBase<ValueType> & {
3
+ /**
4
+ * Fields specific to {@link ProColDef}.
5
+ *
6
+ * @public
7
+ */
8
+ export interface ProColDefSpecificFields {
9
+ /**
10
+ * Configures whether the column is resizable.
11
+ *
12
+ * @defaultValue false
13
+ */
4
14
  resizeable?: boolean;
15
+ /**
16
+ * Configures the width of the column. The value can be a number in pixels or
17
+ * a state setter/getter object of type {@link WidthModel}.
18
+ *
19
+ * @defaultValue 100
20
+ */
5
21
  width?: ColDef["width"] | WidthModel;
22
+ /**
23
+ * When the column is resizable, configures the minimum width to which the
24
+ * column can be resized.
25
+ *
26
+ * @defaultValue 64 if the column is sortable, 32 if not
27
+ */
6
28
  minResizeWidth?: number;
29
+ /**
30
+ * When the column is resizable, configures the maximum width to which the
31
+ * column can be resized.
32
+ *
33
+ * @defaultValue {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE | Number.MAX_VALUE}
34
+ */
7
35
  maxResizeWidth?: number;
36
+ /**
37
+ * Configures the number of pixels to change the width per keypress when
38
+ * resizing.
39
+ *
40
+ * @defaultValue 10
41
+ */
8
42
  keyboardResizeStep?: number;
9
- };
10
- export type TableProProps = Omit<TableProps, "cols" | "styleModel"> & {
43
+ }
44
+ /**
45
+ * Type of the column definition object for the pro edition of the table
46
+ * feature.
47
+ *
48
+ * @public
49
+ */
50
+ export type ProColDef<ValueType = any> = ColDefBase<ValueType> & ProColDefSpecificFields;
51
+ /**
52
+ * Props that are specific to the pro edition of the table component.
53
+ *
54
+ * @public
55
+ */
56
+ export interface TableProSpecificProps {
57
+ /**
58
+ * Column definitions for the table.
59
+ */
11
60
  cols: ProColDef[];
61
+ /**
62
+ * Enables and configures the row reordering feature.
63
+ */
12
64
  reorder?: ReorderModel;
65
+ /**
66
+ * Applies custom CSS styles for elements specific to the pro edition of the
67
+ * table.
68
+ */
13
69
  styleModel?: ProStyleModel;
14
- };
15
- export type ColHeaderCellProProps = ColHeaderCellProps & Pick<TableProps, "displayMode"> & {
16
- setWidth?: (width: number) => void;
17
- } & Pick<ProColDef, "minResizeWidth" | "maxResizeWidth" | "keyboardResizeStep">;
70
+ }
71
+ /**
72
+ * Props object for the pro edition of the table component, {@link TablePro}.
73
+ *
74
+ * @public
75
+ */
76
+ export type TableProProps = Omit<TableProps, "cols" | "styleModel"> & TableProSpecificProps;
77
+ /**
78
+ * State object with getter and setter that represents the width of a column.
79
+ * Used as part of {@link ProColDefSpecificFields} to specify the width of a
80
+ * column in a way that can be changed externally.
81
+ *
82
+ * @public
83
+ */
18
84
  export interface WidthModel {
85
+ /**
86
+ * The current width value stored by the object.
87
+ */
19
88
  width: number;
89
+ /**
90
+ * Setter function to update the width value.
91
+ */
20
92
  setWidth: (width: number) => void;
21
93
  }
94
+ /**
95
+ * Style models specific the pro edition of the table component.
96
+ *
97
+ * @public
98
+ */
22
99
  export interface ProStyleSubmodels {
23
100
  reorderModel?: ReorderStyleModel;
24
101
  }
102
+ /**
103
+ * Type of the combined style model object for the pro edition of the table
104
+ * component.
105
+ *
106
+ * @public
107
+ */
25
108
  export type ProStyleModel = ProStyleSubmodels & StyleModel;
@@ -1,3 +1,16 @@
1
1
  import { RowDef, RowId, ValidRowData } from "../";
2
+ /**
3
+ * Utility function for implementing the reorder callback function for the
4
+ * row reordering feature.
5
+ *
6
+ * @param rows - an array of row data of the type {@link RowDef}.
7
+ * @param id - the id of the row to move.
8
+ * @param destIndex - the destination index of the row to move.
9
+ *
10
+ * @returns A new array where row to move is inserted into the destination
11
+ * index.
12
+ *
13
+ * @public
14
+ */
2
15
  declare const reorderRows: <Data extends ValidRowData>(rows: RowDef<Data>[], id: RowId, destIndex: number) => RowDef<Data>[];
3
16
  export default reorderRows;
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Utility function for implementing the reorder callback function for the
3
+ * row reordering feature.
4
+ *
5
+ * @param rows - an array of row data of the type {@link RowDef}.
6
+ * @param id - the id of the row to move.
7
+ * @param destIndex - the destination index of the row to move.
8
+ *
9
+ * @returns A new array where row to move is inserted into the destination
10
+ * index.
11
+ *
12
+ * @public
13
+ */
1
14
  const reorderRows = (rows, id, destIndex) => {
2
15
  const rowsCopy = rows.slice();
3
16
  const srcIndex = rowsCopy.findIndex((rowsCopy) => rowsCopy.id === id);
@@ -1,2 +0,0 @@
1
- declare const arrowPlaceholder: import("react/jsx-runtime").JSX.Element;
2
- export default arrowPlaceholder;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // Temporary solution to prevent column widths from changing when hovering over
3
- // columns with a mouse.
4
- // More ideal permanent solution would be to fix column widths based on preset
5
- // values.
6
- const arrowPlaceholder = (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("title", { children: "(not being sorted)" }), _jsx("desc", { children: "Empty transparent square for styling purposes" })] }));
7
- export default arrowPlaceholder;
@@ -1,2 +0,0 @@
1
- declare const downArrow: import("react/jsx-runtime").JSX.Element;
2
- export default downArrow;
@@ -1,3 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- const downArrow = (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("title", { children: "(sorted descending)" }), _jsx("desc", { children: "Down arrow indicating that the column is being sorted in an descending manner" }), _jsx("path", { fillRule: "evenodd", d: "M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1" })] }));
3
- export default downArrow;
@@ -1,2 +0,0 @@
1
- declare const upArrow: (grayed: boolean) => import("react/jsx-runtime").JSX.Element;
2
- export default upArrow;
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import classNames from "classnames";
3
- const upArrow = (grayed) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: classNames([...(grayed ? ["text-body-secondary"] : [])]), viewBox: "0 0 16 16", children: [!grayed && (_jsxs(_Fragment, { children: [_jsx("title", { children: "(sorted ascending)" }), _jsx("desc", { children: "Up arrow indicating that the column is being sorted in an ascending manner" })] })), _jsx("path", { fillRule: "evenodd", d: "M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5" })] }));
4
- export default upArrow;
@@ -1,5 +0,0 @@
1
- export interface ColResizeModel {
2
- width: number | undefined;
3
- setWidth: ((width: number) => void) | undefined;
4
- }
5
- export type ResizeModel<ColName extends string = string> = Record<ColName, ColResizeModel>;