@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,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import { NormalizedPaginationModel } from "./types";
2
+ import { NormalizedPaginationModel } from "./internalTypes";
3
3
  export interface PaginationProps {
4
4
  normalizedModel: NormalizedPaginationModel;
5
5
  prePagingNumRows: number;
@@ -0,0 +1,8 @@
1
+ import { ControlledPaginationModel } from "./types";
2
+ /**
3
+ * Effective value for the {@link PaginationModel} that takes in values
4
+ * depending on whether controlled or uncontrolled mode is selected.
5
+ *
6
+ * @internal
7
+ */
8
+ export type NormalizedPaginationModel = Required<Omit<ControlledPaginationModel, "type" | "pageSelectorAriaLabel" | "pageSelectorJustifyContent">> & Pick<ControlledPaginationModel, "pageSelectorAriaLabel" | "pageSelectorJustifyContent">;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,23 +1,123 @@
1
+ /**
2
+ * Strings representing different possible values of the
3
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/justify-content | justify-content CSS property}.
4
+ *
5
+ * @public
6
+ */
1
7
  export type JustifyContentSetting = "start" | "end" | "center" | "between" | "around" | "evenly";
8
+ /**
9
+ * Strings representing the different
10
+ * {@link https://getbootstrap.com/docs/5.3/components/pagination/#sizing | possible sizes of the Bootstrap pagination component}.
11
+ *
12
+ * @public
13
+ */
2
14
  export type Size = "small" | "medium" | "large";
15
+ /**
16
+ * Options for the pagination feature.
17
+ *
18
+ * @public
19
+ */
3
20
  export interface PaginationOptions {
21
+ /**
22
+ * An array of page sizes that can be selected by the user.
23
+ *
24
+ * @defaultValue [10, 25, 100]
25
+ */
4
26
  pageSizeOptions?: number[];
27
+ /**
28
+ * Maximum number of buttons pointing to numerically-indexed pages that can
29
+ * be displayed at once.
30
+ *
31
+ * @defaultValue 5
32
+ */
5
33
  maxPageButtons?: number;
34
+ /**
35
+ * The size of the pagination component. Set via CSS classes provided with
36
+ * Bootstrap.
37
+ *
38
+ * @defaultValue "medium" - corresponds to not specifying a CSS class for
39
+ * pagination component size
40
+ */
6
41
  componentSize?: Size;
42
+ /**
43
+ * The ARIA label for the nav element that represents the pagination
44
+ * component.
45
+ *
46
+ * @defaultValue undefined - no ARIA label
47
+ */
7
48
  pageSelectorAriaLabel?: string;
49
+ /**
50
+ * Justify-content CSS property for the ul element of the pagination
51
+ * component.
52
+ *
53
+ * @defaultValue undefined - no justify-content property is specified, which
54
+ * acts like "start" based on CSS standards. See
55
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/justify-content#syntax}.
56
+ */
8
57
  pageSelectorJustifyContent?: JustifyContentSetting;
9
58
  }
10
- export type ControlledPaginationModel = PaginationOptions & {
59
+ /**
60
+ * Properties specific to configuring pagination in a controlled manner.
61
+ *
62
+ * @public
63
+ */
64
+ export interface ControlledPaginationState {
65
+ /**
66
+ * A type discriminator.
67
+ */
11
68
  type?: "controlled";
69
+ /**
70
+ * The index of current page size setting in the array of settings.
71
+ */
12
72
  pageSizeIndex: number;
73
+ /**
74
+ * Setter function for the page size index.
75
+ */
13
76
  setPageSizeIndex: (pageSizeIndex: number) => void;
77
+ /**
78
+ * The 1-based index of the currently displayed page.
79
+ */
14
80
  currentPage: number;
81
+ /**
82
+ * Sets the current page index.
83
+ */
15
84
  setCurrentPage: (pageNum: number) => void;
16
- };
17
- export type UncontrolledPaginationModel = PaginationOptions & {
85
+ }
86
+ /**
87
+ * Object that enables and configures the pagination feature for a table or
88
+ * grid in an externally-controllable manner.
89
+ *
90
+ * @public
91
+ */
92
+ export type ControlledPaginationModel = PaginationOptions & ControlledPaginationState;
93
+ /**
94
+ * Initial values for pagination in uncontrolled mode.
95
+ *
96
+ * @public
97
+ */
98
+ export interface UncontrolledPaginationInitState {
99
+ /**
100
+ * A type discriminator.
101
+ */
18
102
  type: "uncontrolled";
103
+ /**
104
+ * Starting page size setting index of pageSizeOptions array.
105
+ */
19
106
  startingPageSizeIndex?: number;
107
+ /**
108
+ * Starting 1-based current page number.
109
+ */
20
110
  startingCurrentPage?: number;
21
- };
111
+ }
112
+ /**
113
+ * Object that enables and configures pagination in an uncontrolled manner.
114
+ *
115
+ * @public
116
+ */
117
+ export type UncontrolledPaginationModel = PaginationOptions & UncontrolledPaginationInitState;
118
+ /**
119
+ * Object that enables and configures pagination for a grid or table.
120
+ *
121
+ * @public
122
+ */
22
123
  export type PaginationModel = ControlledPaginationModel | UncontrolledPaginationModel;
23
- export type NormalizedPaginationModel = Required<Omit<ControlledPaginationModel, "type" | "pageSelectorAriaLabel" | "pageSelectorJustifyContent">> & Pick<ControlledPaginationModel, "pageSelectorAriaLabel" | "pageSelectorJustifyContent">;
@@ -1 +1,6 @@
1
+ /**
2
+ * A hash map that associates column name to a width setting.
3
+ *
4
+ * @internal
5
+ */
1
6
  export type ColNameToWidth<ColName extends string = string> = Record<ColName, number | undefined>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
- import { ColNameToWidth } from "./types";
2
- import { AugFormattedRow, FormattedRow } from "../";
1
+ import { ColNameToWidth } from "./internalTypes";
2
+ import { FormattedRow } from "../";
3
+ import { AugFormattedRow } from "../internalTypes";
3
4
  declare const useAugFormattedRows: (colNameToWidth: ColNameToWidth, rows: FormattedRow[]) => AugFormattedRow[];
4
5
  export default useAugFormattedRows;
@@ -1,3 +1,4 @@
1
- import { ColDef, ColNameToWidth } from "../";
1
+ import { ColDef } from "../";
2
+ import { ColNameToWidth } from "./internalTypes";
2
3
  declare const useColNameToWidth: (cols: ColDef[]) => ColNameToWidth;
3
4
  export default useColNameToWidth;
@@ -1,8 +1,9 @@
1
1
  import { SortedRowsOutput } from "./useSortedRows";
2
2
  import { CurrentPageRowsOutput } from "./useCurrentPageRows";
3
- import { NormalizedTableFilterModel, FilterState } from "../../";
4
- import { ColDefBase, FormattedRow, MainComponentSharedProps, RowDef } from "../../types";
5
- export type CombinedPipelineParams = Pick<MainComponentSharedProps, "rows" | "filterModel" | "sortModel" | "pagination" | "selectModel"> & {
3
+ import { NormalizedTableFilterModel, FilterState } from "../../filtering/internalTypes";
4
+ import { ColDefBase, FormattedRow, RowDef } from "../../types";
5
+ import { TableProps } from "../../../table";
6
+ export type CombinedPipelineParams = Pick<TableProps, "rows" | "filterModel" | "sortModel" | "pagination" | "selectModel"> & {
6
7
  cols: ColDefBase[];
7
8
  };
8
9
  export interface UseCombinedPipelineHook {
@@ -1,5 +1,6 @@
1
- import { NormalizedPaginationModel, PaginationModel } from "../../pagination/types";
1
+ import { PaginationModel } from "../../pagination/types";
2
2
  import { AugRowDef, PostPaginationRowDef } from "../../";
3
+ import { NormalizedPaginationModel } from "../../pagination/internalTypes";
3
4
  export interface CurrentPageRowsOutput {
4
5
  paginatedRows: PostPaginationRowDef[];
5
6
  normalizedModel: NormalizedPaginationModel | null;
@@ -1,4 +1,5 @@
1
1
  import { useMemo, useState } from "react";
2
+ import { DEFAULT_MAX_PAGE_BUTTONS, DEFAULT_PAGE_SIZES } from "../../constants";
2
3
  const useCurrentPageRows = (sortedRows, paginationModel) => {
3
4
  const componentSize = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.componentSize) || "medium";
4
5
  const isControlled = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.type) !== "uncontrolled";
@@ -16,7 +17,7 @@ const useCurrentPageRows = (sortedRows, paginationModel) => {
16
17
  const setCurrentPage = isControlled
17
18
  ? paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.setCurrentPage
18
19
  : setInternalPageNum;
19
- const maxPageButtons = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.maxPageButtons) || 5;
20
+ const maxPageButtons = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.maxPageButtons) || DEFAULT_MAX_PAGE_BUTTONS;
20
21
  return useMemo(() => {
21
22
  if (paginationModel === undefined) {
22
23
  return {
@@ -24,7 +25,7 @@ const useCurrentPageRows = (sortedRows, paginationModel) => {
24
25
  normalizedModel: null,
25
26
  };
26
27
  }
27
- const pageSizeOptions = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSizeOptions) || [10, 25, 100];
28
+ const pageSizeOptions = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSizeOptions) || DEFAULT_PAGE_SIZES;
28
29
  const normalizedModel = {
29
30
  pageSizeIndex,
30
31
  setPageSizeIndex: setPageSizeIndex,
@@ -1,4 +1,5 @@
1
- import { EditableFilterState, FilterState } from "../../filtering/types";
1
+ import { EditableFilterState } from "../../filtering/types";
2
2
  import { ColDef } from "../../types";
3
+ import { FilterState } from "../../filtering/internalTypes";
3
4
  declare const useFilterStateFromEditable: (colDefs: ColDef[], editableFilterState: EditableFilterState | null) => FilterState | null;
4
5
  export default useFilterStateFromEditable;
@@ -1,4 +1,5 @@
1
- import { FilterModel, NormalizedTableFilterModel } from "../../filtering/types";
1
+ import { FilterModel } from "../../filtering/types";
2
2
  import { ColDefBase } from "../../types";
3
+ import { NormalizedTableFilterModel } from "../../filtering/internalTypes";
3
4
  declare const useFilterStateStore: (filterModel: FilterModel | undefined, cols: ColDefBase[]) => NormalizedTableFilterModel | null;
4
5
  export default useFilterStateStore;
@@ -1,7 +1,8 @@
1
1
  import { MouseEventHandler } from "react";
2
- import { SelectionInfo, SelectModel } from "../selection/types";
2
+ import { SelectModel } from "../selection/types";
3
3
  import { SelectionInputModel } from "../../table/selection/SelectionInput";
4
4
  import { RowDef, RowId } from "../types";
5
+ import { SelectionInfo } from "../selection/internalTypes";
5
6
  export interface UseGridSelectionFnsHook {
6
7
  selectedSet: Set<RowId>;
7
8
  rowsAreSelectable: boolean | undefined;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Indicates whether a grid or table has all, some, or now rows selected when
3
+ * in multiselect mode.
4
+ *
5
+ * @internal
6
+ */
7
+ export type MultiExistingSelection = "full" | "partial" | "none";
8
+ /**
9
+ * Indicates the selection mode of a grid or table is in single selection mode.
10
+ * Also whether a selection exists.
11
+ *
12
+ * @internal
13
+ */
14
+ export interface SingleSelectionInfo {
15
+ selectType: "single";
16
+ existingSelection: boolean;
17
+ }
18
+ /**
19
+ * Indicates the selection mode of a grid or table is in multiselect mode.
20
+ * Also indicates whether a full, partial, or no selection exists.
21
+ *
22
+ * @internal
23
+ */
24
+ export interface MultiSelectionInfo {
25
+ selectType: "multi";
26
+ existingSelection: "full" | "partial" | "none";
27
+ }
28
+ /**
29
+ * Indicates the selection mode of a grid or table and contains metadata
30
+ * on whether selections exist.
31
+ *
32
+ * @internal
33
+ */
34
+ export type SelectionInfo = SingleSelectionInfo | MultiSelectionInfo;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,30 +1,104 @@
1
1
  import { RowId } from "../types";
2
+ /**
3
+ * Specifies whether the user can select rows by clicking on a control in a
4
+ * special column, by clicking on the row, or via either method.
5
+ *
6
+ * - column -- can only select by clicking on radio or checkbox input in special
7
+ * column
8
+ * - row -- selection column is hidden and selection can be done by clicking
9
+ * anywhere in a row
10
+ * - both -- selection can be done by either clicking on the input or row
11
+ *
12
+ * @public
13
+ */
2
14
  export type SelectMode = "column" | "row" | "both";
3
- export type SelectType = "single" | "multi";
4
- interface BaseSelectModel {
15
+ /**
16
+ * Properties shared between {@link SingleSelectModel} and
17
+ * {@link MultiSelectModel}.
18
+ *
19
+ * @public
20
+ */
21
+ export interface BaseSelectModel {
22
+ /**
23
+ * The means of selecting rows available to the user.
24
+ */
5
25
  mode: SelectMode;
26
+ /**
27
+ * The width of the select column. Set via CSS min-width and max-width
28
+ * properties. The column is only shown if mode is set to "column".
29
+ *
30
+ * @defaultValue undefined - no CSS properties will be set
31
+ */
6
32
  selectColWidth?: number;
7
33
  }
8
- export type MultiSelectModel = BaseSelectModel & {
34
+ /**
35
+ * Properties specific to the {@link MultiSelectModel}.
36
+ *
37
+ * @public
38
+ */
39
+ export interface MultiSelectState {
40
+ /**
41
+ * A type discriminator.
42
+ */
9
43
  type: "multi";
44
+ /**
45
+ * The ids of the currently selected rows.
46
+ */
10
47
  selected: RowId[];
48
+ /**
49
+ * Setter function for the selected ids.
50
+ */
11
51
  setSelected: (selected: RowId[]) => void;
12
- };
13
- export type SingleSelectModel = BaseSelectModel & {
52
+ }
53
+ /**
54
+ * Object to enable and configure the selection feature for a grid or table in
55
+ * the multiselect mode.
56
+ *
57
+ * @public
58
+ */
59
+ export type MultiSelectModel = BaseSelectModel & MultiSelectState;
60
+ /**
61
+ * Properties specific to the {@link SingleSelectModel}.
62
+ *
63
+ * @public
64
+ */
65
+ export interface SingleSelectState {
66
+ /**
67
+ * A type discriminator.
68
+ */
14
69
  type: "single";
70
+ /**
71
+ * The id of the currently selected row, or null if none is selected.
72
+ */
15
73
  selected: RowId | null;
74
+ /**
75
+ * Setter function for the "selected" property.
76
+ */
16
77
  setSelected: (selected: RowId | null) => void;
78
+ /**
79
+ * String to uniquely identify the group of radio buttons.
80
+ *
81
+ * @remarks
82
+ *
83
+ * If specified, must be unique across all radio button groups on the web
84
+ * page. Now optional because the
85
+ * {@link https://react.dev/reference/react/useId | useId hook}
86
+ * can be used to generate an ID.
87
+ *
88
+ * @defaultValue undefined - an id generated by the useId hook will be used
89
+ */
17
90
  groupName?: string;
18
- };
19
- export type SelectModel = SingleSelectModel | MultiSelectModel;
20
- export type MultiExistingSelection = "full" | "partial" | "none";
21
- export interface SingleSelectionInfo {
22
- selectType: "single";
23
- existingSelection: boolean;
24
91
  }
25
- export interface MultiSelectionInfo {
26
- selectType: "multi";
27
- existingSelection: "full" | "partial" | "none";
28
- }
29
- export type SelectionInfo = SingleSelectionInfo | MultiSelectionInfo;
30
- export {};
92
+ /**
93
+ * Object to enable and configure the selection feature for a grid or table in
94
+ * the single select mode.
95
+ *
96
+ * @public
97
+ */
98
+ export type SingleSelectModel = BaseSelectModel & SingleSelectState;
99
+ /**
100
+ * Object to enable and configure the selection feature for a grid or table.
101
+ *
102
+ * @public
103
+ */
104
+ export type SelectModel = SingleSelectModel | MultiSelectModel;
@@ -1,4 +1 @@
1
- // Selected indices are based on the id of the input rows. If
2
- // filtered-out items are included in the 'selected' property, there will be a
3
- // visual indication to the user of that fact.
4
1
  export {};
@@ -0,0 +1,3 @@
1
+ import { FC } from "react";
2
+ declare const ArrowPlaceholder: FC;
3
+ export default ArrowPlaceholder;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const ArrowPlaceholder = () => (_jsxs("svg", { "aria-hidden": "true", 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" })] }));
3
+ export default ArrowPlaceholder;
@@ -0,0 +1,6 @@
1
+ import { FC } from "react";
2
+ export interface DownArrowProps {
3
+ className?: string;
4
+ }
5
+ declare const DownArrow: FC<DownArrowProps>;
6
+ export default DownArrow;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const DownArrow = ({ className }) => (_jsxs("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", className: className, children: [_jsx("title", { children: "Down arrow" }), _jsx("desc", { children: "Downward-pointing arrow" }), _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;
@@ -0,0 +1,6 @@
1
+ import { FC } from "react";
2
+ export interface UpArrowProps {
3
+ className?: string;
4
+ }
5
+ declare const UpArrow: FC<UpArrowProps>;
6
+ export default UpArrow;
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const UpArrow = ({ className }) => (_jsxs("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", className: className, viewBox: "0 0 16 16", children: [_jsx("title", { children: "Up arrow" }), _jsx("desc", { children: "Upward-pointing arrow" }), _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" })] }));
3
+ export default UpArrow;
@@ -0,0 +1,10 @@
1
+ import { SortOrder } from "./types";
2
+ /**
3
+ * Value-setter pair for the sort settings for a single column.
4
+ *
5
+ * @internal
6
+ */
7
+ export interface ColSortModel {
8
+ sortOrder: SortOrder | null;
9
+ setSortOrder: (order: SortOrder | null) => void;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,19 +1,63 @@
1
+ /**
2
+ * Sort order setting for the sort feature.
3
+ *
4
+ * @public
5
+ */
1
6
  export type SortOrder = "asc" | "desc";
7
+ /**
8
+ * Specifies the column to sort on and order with which to sort.
9
+ *
10
+ * @public
11
+ */
2
12
  export interface SortColDef {
13
+ /**
14
+ * The name of the column. Corresponds to the name in the {@link ColDef}
15
+ * type.
16
+ */
3
17
  name: string;
18
+ /**
19
+ * Order with which sorting should be done.
20
+ */
4
21
  order: SortOrder;
5
22
  }
6
- export interface ColSortModel {
7
- sortOrder: SortOrder | null;
8
- setSortOrder: (order: SortOrder | null) => void;
9
- }
23
+ /**
24
+ * Externally-controllable variant of the {@link SortModel}.
25
+ *
26
+ * @public
27
+ */
10
28
  export interface ControlledSortModel {
29
+ /**
30
+ * A type discriminator.
31
+ */
11
32
  type?: "controlled";
33
+ /**
34
+ * Information on the column to sort on. Null means no column is being sorted
35
+ * and the rows shown be shown in their original order.
36
+ */
12
37
  sortColDef: SortColDef | null;
38
+ /**
39
+ * Setter function for sortColDef.
40
+ */
13
41
  setSortColDef: (sortColDef: SortColDef | null) => void;
14
42
  }
43
+ /**
44
+ * Uncontrolled variant of the {@link SortModel}.
45
+ *
46
+ * @public
47
+ */
15
48
  export interface UncontrolledSortModel {
49
+ /**
50
+ * A type discriminator.
51
+ */
16
52
  type: "uncontrolled";
53
+ /**
54
+ * Initial column to sort on, if any.
55
+ */
17
56
  initialSortColDef: SortColDef | null;
18
57
  }
58
+ /**
59
+ * Prop that enables and configures sorting on a grid or table.
60
+ *
61
+ * @public
62
+ */
19
63
  export type SortModel = ControlledSortModel | UncontrolledSortModel;
@@ -1,6 +1,6 @@
1
1
  import { UseControlledHoverHook } from "../util/useControlledHover";
2
2
  import { ReactNode } from "react";
3
- import { ColSortModel } from "./types";
3
+ import { ColSortModel } from "./internalTypes";
4
4
  export type UseSortHeaderStatesHook = UseControlledHoverHook<HTMLTableCellElement> & {
5
5
  handleClick: () => void;
6
6
  sortSymbol: ReactNode;
@@ -1,8 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import useControlledHover from "../util/useControlledHover";
2
3
  import { useMemo } from "react";
3
- import upArrow from "./upArrow";
4
- import arrowPlaceholder from "./arrowPlaceholder";
5
- import downArrow from "./downArrow";
4
+ import UpArrow from "./UpArrow";
5
+ import ArrowPlaceholder from "./ArrowPlaceholder";
6
+ import DownArrow from "./DownArrow";
6
7
  const useSortHeaderStates = (sortModel) => {
7
8
  const { isHovering, setIsHovering, handleMouseOver, handleMouseOut } = useControlledHover();
8
9
  const handleClick = () => {
@@ -30,15 +31,15 @@ const useSortHeaderStates = (sortModel) => {
30
31
  switch (sortModel.sortOrder) {
31
32
  case null: {
32
33
  if (isHovering) {
33
- return upArrow(true);
34
+ return _jsx(UpArrow, { className: "text-body-secondary" });
34
35
  }
35
- return arrowPlaceholder;
36
+ return _jsx(ArrowPlaceholder, {});
36
37
  }
37
38
  case "asc": {
38
- return upArrow(false);
39
+ return _jsx(UpArrow, {});
39
40
  }
40
41
  case "desc": {
41
- return downArrow;
42
+ return _jsx(DownArrow, {});
42
43
  }
43
44
  }
44
45
  }, [isHovering, sortModel]);
@@ -1,21 +1,78 @@
1
1
  import { AdditionalComponentsStyleModel, FilterInputTableStyleModel, TableStyleModel } from "../../table";
2
+ /**
3
+ * CSS styles for the toolbar.
4
+ *
5
+ * @public
6
+ */
2
7
  export interface ToolbarStyleModel {
8
+ /**
9
+ * Styles for the button of the currently selected tool.
10
+ */
3
11
  activeButton?: string[];
12
+ /**
13
+ * Styles for the buttons of tools that are not currently selected.
14
+ */
4
15
  inactiveButton?: string[];
16
+ /**
17
+ * Styles for the div element that contains the other elements of the toolbar.
18
+ */
5
19
  toolbar?: string[];
20
+ /**
21
+ * Styles for the div element that contains the interface for each tool.
22
+ */
6
23
  interfaceContainer?: string[];
7
24
  }
25
+ /**
26
+ * CSS styles for the UI for exporting data.
27
+ *
28
+ * @public
29
+ */
8
30
  export interface ExportFormStyleModel {
31
+ /**
32
+ * Styles for fieldset legend elements.
33
+ */
9
34
  legend?: string[];
35
+ /**
36
+ * Styles for the div elements that contain radio buttons.
37
+ */
10
38
  radioContainer?: string[];
39
+ /**
40
+ * Styles for the radio button input elements.
41
+ */
11
42
  radioInput?: string[];
43
+ /**
44
+ * Styles for the label elements for radio button input elements.
45
+ */
12
46
  radioLabel?: string[];
47
+ /**
48
+ * Styles for the submit button.
49
+ */
13
50
  submitButton?: string[];
14
51
  }
52
+ /**
53
+ * Top level object that is passed as a prop to a table to enable custom styles.
54
+ *
55
+ * @public
56
+ */
15
57
  export interface StyleModel {
58
+ /**
59
+ * Styles for the main table (as opposed to the filter options table).
60
+ */
16
61
  mainTableStyleModel?: TableStyleModel;
62
+ /**
63
+ * Styles for the filter options table.
64
+ */
17
65
  filterInputTableStyleModel?: FilterInputTableStyleModel;
66
+ /**
67
+ * Styles for components that don't fit into other categories.
68
+ */
18
69
  additionalComponentsStyleModel?: AdditionalComponentsStyleModel;
70
+ /**
71
+ * Styles for the toolbar.
72
+ */
19
73
  toolbarStyleModel?: ToolbarStyleModel;
74
+ /**
75
+ * Styles for the data export UI.
76
+ */
20
77
  exportFormStyleModel?: ExportFormStyleModel;
21
78
  }