@absreim/react-bootstrap-data-grid 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.
- 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/icons/CaretDownFill.d.ts +4 -0
- package/common/icons/CaretDownFill.js +6 -0
- package/common/icons/CaretUp.d.ts +4 -0
- package/common/icons/CaretUp.js +6 -0
- package/common/icons/CaretUpFill.d.ts +4 -0
- package/common/icons/CaretUpFill.js +6 -0
- package/common/icons/internalTypes.d.ts +3 -0
- package/common/index.d.ts +0 -3
- package/common/index.js +0 -3
- package/common/internalTypes.d.ts +10 -0
- package/common/internalTypes.js +1 -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/ArrowPlaceholder.d.ts +3 -0
- package/common/sorting/ArrowPlaceholder.js +3 -0
- package/common/sorting/DownArrow.d.ts +6 -0
- package/common/sorting/DownArrow.js +6 -0
- package/common/sorting/UpArrow.d.ts +6 -0
- package/common/sorting/UpArrow.js +6 -0
- 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/sorting/useSortHeaderStates.js +8 -7
- 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 +169 -16
- 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/focus/useGridFocus.d.ts +1 -1
- package/grid/focus/useGridFocus.js +20 -5
- package/grid/main/Grid.d.ts +5 -0
- package/grid/main/Grid.js +14 -7
- package/grid/main/GridBody.d.ts +1 -1
- package/grid/main/GridHeader.d.ts +1 -1
- package/grid/main/GridHeader.js +29 -2
- package/grid/main/internalTypes.d.ts +31 -0
- package/grid/main/internalTypes.js +1 -0
- package/grid/main/types.d.ts +120 -19
- package/grid/sort/HeaderToggleButton.d.ts +11 -0
- package/grid/sort/HeaderToggleButton.js +30 -0
- package/grid.css +1 -1
- package/grid.scss +95 -33
- 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 +57 -15
- package/common/sorting/arrowPlaceholder.d.ts +0 -2
- package/common/sorting/arrowPlaceholder.js +0 -7
- package/common/sorting/downArrow.d.ts +0 -2
- package/common/sorting/downArrow.js +0 -3
- package/common/sorting/upArrow.d.ts +0 -2
- package/common/sorting/upArrow.js +0 -13
- 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 → icons/internalTypes.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CellData, PostPaginationRowDef } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Like {@link FormattedRow}, but additionally contains the "width" property
|
|
4
|
+
* for the column definition related to each cell.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export type AugFormattedRow = {
|
|
9
|
+
contents: CellData[];
|
|
10
|
+
} & Omit<PostPaginationRowDef, "data">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ColNameToWidth } from "./
|
|
2
|
-
import {
|
|
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,8 +1,9 @@
|
|
|
1
1
|
import { SortedRowsOutput } from "./useSortedRows";
|
|
2
2
|
import { CurrentPageRowsOutput } from "./useCurrentPageRows";
|
|
3
|
-
import { NormalizedTableFilterModel, FilterState } from "../../";
|
|
4
|
-
import { ColDefBase, FormattedRow,
|
|
5
|
-
|
|
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 {
|
|
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;
|
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { useMemo, useState } from "react";
|
|
13
|
+
import { DEFAULT_MAX_PAGE_BUTTONS, DEFAULT_PAGE_SIZES } from "../../constants";
|
|
13
14
|
var useCurrentPageRows = function (sortedRows, paginationModel) {
|
|
14
15
|
var componentSize = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.componentSize) || "medium";
|
|
15
16
|
var isControlled = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.type) !== "uncontrolled";
|
|
@@ -27,7 +28,7 @@ var useCurrentPageRows = function (sortedRows, paginationModel) {
|
|
|
27
28
|
var setCurrentPage = isControlled
|
|
28
29
|
? paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.setCurrentPage
|
|
29
30
|
: setInternalPageNum;
|
|
30
|
-
var maxPageButtons = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.maxPageButtons) ||
|
|
31
|
+
var maxPageButtons = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.maxPageButtons) || DEFAULT_MAX_PAGE_BUTTONS;
|
|
31
32
|
return useMemo(function () {
|
|
32
33
|
if (paginationModel === undefined) {
|
|
33
34
|
return {
|
|
@@ -35,7 +36,7 @@ var useCurrentPageRows = function (sortedRows, paginationModel) {
|
|
|
35
36
|
normalizedModel: null,
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
var pageSizeOptions = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSizeOptions) ||
|
|
39
|
+
var pageSizeOptions = (paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.pageSizeOptions) || DEFAULT_PAGE_SIZES;
|
|
39
40
|
var normalizedModel = {
|
|
40
41
|
pageSizeIndex: pageSizeIndex,
|
|
41
42
|
setPageSizeIndex: setPageSizeIndex,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EditableFilterState
|
|
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
|
|
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 {
|
|
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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var ArrowPlaceholder = function () { return (_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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var DownArrow = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_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" })] }));
|
|
5
|
+
};
|
|
6
|
+
export default DownArrow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var UpArrow = function (_a) {
|
|
3
|
+
var className = _a.className;
|
|
4
|
+
return (_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" })] }));
|
|
5
|
+
};
|
|
6
|
+
export default UpArrow;
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 "./
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import UpArrow from "./UpArrow";
|
|
5
|
+
import ArrowPlaceholder from "./ArrowPlaceholder";
|
|
6
|
+
import DownArrow from "./DownArrow";
|
|
6
7
|
var useSortHeaderStates = function (sortModel) {
|
|
7
8
|
var _a = useControlledHover(), isHovering = _a.isHovering, setIsHovering = _a.setIsHovering, handleMouseOver = _a.handleMouseOver, handleMouseOut = _a.handleMouseOut;
|
|
8
9
|
var handleClick = function () {
|
|
@@ -30,15 +31,15 @@ var useSortHeaderStates = function (sortModel) {
|
|
|
30
31
|
switch (sortModel.sortOrder) {
|
|
31
32
|
case null: {
|
|
32
33
|
if (isHovering) {
|
|
33
|
-
return
|
|
34
|
+
return _jsx(UpArrow, { className: "text-body-secondary" });
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return _jsx(ArrowPlaceholder, {});
|
|
36
37
|
}
|
|
37
38
|
case "asc": {
|
|
38
|
-
return
|
|
39
|
+
return _jsx(UpArrow, {});
|
|
39
40
|
}
|
|
40
41
|
case "desc": {
|
|
41
|
-
return
|
|
42
|
+
return _jsx(DownArrow, {});
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}, [isHovering, sortModel]);
|