@absreim/react-bootstrap-data-grid-pro 4.0.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/constants.d.ts +2 -0
- package/common/constants.js +2 -0
- package/common/editing/types.d.ts +30 -0
- package/common/export/types.d.ts +6 -0
- package/common/export/useExportFn.js +1 -1
- package/common/filtering/DateFilterRow.d.ts +1 -1
- package/common/filtering/DateFilterRow.js +1 -1
- package/common/filtering/FilterOptionsTable.d.ts +3 -2
- package/common/filtering/NumberFilterRow.d.ts +1 -1
- package/common/filtering/NumberFilterRow.js +1 -1
- package/common/filtering/StringFilterRow.js +1 -1
- package/common/filtering/constants.d.ts +19 -0
- package/common/filtering/constants.js +44 -0
- package/common/filtering/internalTypes.d.ts +77 -0
- package/common/filtering/types.d.ts +165 -22
- package/common/filtering/types.js +46 -17
- package/common/filtering/useFilterFormState.d.ts +1 -1
- package/common/index.d.ts +0 -3
- package/common/index.js +0 -3
- package/common/internalTypes.d.ts +10 -0
- package/common/pagination/Pagination.d.ts +1 -1
- package/common/pagination/internalTypes.d.ts +8 -0
- package/common/pagination/types.d.ts +105 -5
- package/common/pipeline/{types.d.ts → internalTypes.d.ts} +5 -0
- package/common/pipeline/internalTypes.js +1 -0
- package/common/pipeline/useAugFormattedRows.d.ts +3 -2
- package/common/pipeline/useColNameToWidth.d.ts +2 -1
- package/common/pipeline/useCombinedPipeline/index.d.ts +4 -3
- package/common/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +2 -1
- package/common/pipeline/useCombinedPipeline/useCurrentPageRows.js +3 -2
- package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +2 -1
- package/common/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +2 -1
- package/common/pipeline/useGridSelectionFns.d.ts +2 -1
- package/common/selection/internalTypes.d.ts +34 -0
- package/common/selection/internalTypes.js +1 -0
- package/common/selection/types.d.ts +91 -17
- package/common/selection/types.js +0 -3
- package/common/sorting/internalTypes.d.ts +10 -0
- package/common/sorting/internalTypes.js +1 -0
- package/common/sorting/types.d.ts +48 -4
- package/common/sorting/useSortHeaderStates.d.ts +1 -1
- package/common/styling/types.d.ts +57 -0
- package/common/toolbar/Toolbar.d.ts +1 -1
- package/common/toolbar/ToolbarContainer.d.ts +1 -1
- package/common/toolbar/{types.d.ts → internalTypes.d.ts} +27 -0
- package/common/toolbar/internalTypes.js +1 -0
- package/common/toolbar/useInterfaces.d.ts +1 -1
- package/common/types.d.ts +165 -18
- package/common/util/datetime.d.ts +17 -0
- package/common/util/datetime.js +17 -0
- package/common/util/getWidthStyle.d.ts +9 -0
- package/common/util/getWidthStyle.js +9 -0
- package/common/util/index.d.ts +0 -4
- package/common/util/index.js +0 -4
- package/common/util/isSubset.d.ts +12 -1
- package/common/util/isSubset.js +13 -2
- package/common/util/trueModulo.d.ts +8 -0
- package/common/util/trueModulo.js +8 -0
- package/common/util/useControlledHover.d.ts +5 -0
- package/common/util/useControlledHover.js +5 -0
- package/grid/focus/types.d.ts +15 -0
- package/grid/focus/types.js +1 -0
- package/grid/focus/useGridFocus.d.ts +10 -0
- package/grid/focus/useGridFocus.js +130 -0
- package/grid/main/Grid.d.ts +5 -0
- package/grid/main/Grid.js +26 -8
- package/grid/main/GridBody.d.ts +1 -1
- package/grid/main/GridBody.js +19 -6
- package/grid/main/GridHeader.d.ts +1 -1
- package/grid/main/GridHeader.js +8 -4
- package/grid/main/internalTypes.d.ts +29 -0
- package/grid/main/internalTypes.js +1 -0
- package/grid/main/types.d.ts +114 -16
- package/grid.css +1 -1
- package/grid.scss +26 -14
- package/package.json +5 -5
- package/table/InternalTable.d.ts +1 -1
- package/table/Table.d.ts +5 -1
- package/table/Table.js +5 -0
- package/table/editing/EditableRow.d.ts +1 -1
- package/table/editing/EditableRow.js +1 -1
- package/table/internalTypes.d.ts +23 -0
- package/table/internalTypes.js +1 -0
- package/table/main/BodyRows.d.ts +4 -3
- package/table/main/ColHeaderCell/index.d.ts +1 -1
- package/table/selection/SelectAllHeaderCell.d.ts +1 -1
- package/table/styling/types.d.ts +122 -5
- package/table/types.d.ts +62 -15
- package/table-pro/ColHeaderCellPro.d.ts +1 -1
- package/table-pro/TablePro.d.ts +5 -0
- package/table-pro/TablePro.js +5 -0
- package/table-pro/index.d.ts +0 -1
- package/table-pro/index.js +0 -1
- package/table-pro/internalTypes.d.ts +11 -0
- package/table-pro/internalTypes.js +1 -0
- package/table-pro/reorder/ReorderHandleCell.d.ts +2 -1
- package/table-pro/reorder/internalTypes.d.ts +53 -0
- package/table-pro/reorder/internalTypes.js +1 -0
- package/table-pro/reorder/types.d.ts +36 -15
- package/table-pro/reorder/useKeyboardReorder.d.ts +1 -1
- package/table-pro/reorder/useKeyboardReorderListener.d.ts +2 -1
- package/table-pro/reorder/useReorderStyles.d.ts +2 -1
- package/table-pro/resize/internalType.d.ts +20 -0
- package/table-pro/resize/internalType.js +1 -0
- package/table-pro/resize/useResizeModel.d.ts +1 -1
- package/table-pro/types.d.ts +91 -8
- package/table-pro/util/reorderRows.d.ts +13 -0
- package/table-pro/util/reorderRows.js +13 -0
- package/table-pro/resize/types.d.ts +0 -5
- /package/common/{pipeline/types.js → filtering/internalTypes.js} +0 -0
- /package/common/{toolbar/types.js → internalTypes.js} +0 -0
- /package/{table-pro/resize/types.js → common/pagination/internalTypes.js} +0 -0
package/common/constants.d.ts
CHANGED
package/common/constants.js
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import { RowData, RowId } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Function that returns a callback function that responds to a row being
|
|
4
|
+
* updated with the editing feature.
|
|
5
|
+
*
|
|
6
|
+
* @param id - the id of the row being updated
|
|
7
|
+
* @param rowData - the contents of the edited row
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
2
11
|
export type UpdateCallbackGenerator = (id: RowId) => (rowData: RowData) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Object that enables and configures the row editing feature.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
3
17
|
export interface EditModel {
|
|
18
|
+
/**
|
|
19
|
+
* Function that generates a callback function that responds to a row update.
|
|
20
|
+
* Use this property to specify how row updates affect the state outside
|
|
21
|
+
* the table component.
|
|
22
|
+
*/
|
|
4
23
|
getUpdateCallback: UpdateCallbackGenerator;
|
|
24
|
+
/**
|
|
25
|
+
* Callback function for deleting rows via the UI. Omit this property or pass
|
|
26
|
+
* undefined to disallow deletions via the UI.
|
|
27
|
+
*/
|
|
5
28
|
getDeleteCallback?: (id: RowId) => () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Specifies a fixed width in pixels for the column that contains the buttons
|
|
31
|
+
* for editing a row. In particular, the min-width and max-width CSS
|
|
32
|
+
* properties will be set.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue undefined - no CSS will be specified
|
|
35
|
+
*/
|
|
6
36
|
editColWidth?: number;
|
|
7
37
|
}
|
package/common/export/types.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { RowId } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Intermediary object that represents a single row that is formatted in a
|
|
4
|
+
* manner suitable for CSV export.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
2
8
|
export type FormattedExportRow = {
|
|
3
9
|
id: RowId;
|
|
4
10
|
data: Record<string, string | number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dateToDatetimeInputStr, dateToInputStr } from "../util
|
|
1
|
+
import { dateToDatetimeInputStr, dateToInputStr } from "../util";
|
|
2
2
|
import Papa from "papaparse";
|
|
3
3
|
import { useCallback, useMemo } from "react";
|
|
4
4
|
const downloadFile = (data, filename, type) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { DateFormFilterState } from "./types";
|
|
3
2
|
import { CommonFilterRowStyleProps } from "./FilterRow";
|
|
3
|
+
import { DateFormFilterState } from "./internalTypes";
|
|
4
4
|
export type DateFilterRowProps = {
|
|
5
5
|
ariaRowIndex: number;
|
|
6
6
|
includeTime: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
|
-
import { dateFilterSchemeNames, } from "./types";
|
|
4
3
|
import FilterRow from "./FilterRow";
|
|
5
4
|
import classNames from "classnames";
|
|
5
|
+
import { dateFilterSchemeNames } from "./constants";
|
|
6
6
|
const DateFilterRow = ({ ariaRowIndex, includeTime, columnLabel, filterState, setFilterState, schemeSelectClasses, enableInputClasses, startDateInputClasses, endDateInputClasses, tdClasses, trClasses, }) => {
|
|
7
7
|
const handleOpChange = ({ target, }) => {
|
|
8
8
|
setFilterState(Object.assign(Object.assign({}, filterState), { scheme: target.value }));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { EditableFilterState
|
|
3
|
-
import { FilterInputTableStyleModel } from "../../table
|
|
2
|
+
import { EditableFilterState } from "./types";
|
|
3
|
+
import { FilterInputTableStyleModel } from "../../table";
|
|
4
|
+
import { FilterState } from "./internalTypes";
|
|
4
5
|
export interface FilterOptionsTableProps {
|
|
5
6
|
filterState: FilterState;
|
|
6
7
|
setFilterState: (filterState: EditableFilterState) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import { NumberFormFilterState } from "./types";
|
|
3
2
|
import { CommonFilterRowStyleProps } from "./FilterRow";
|
|
3
|
+
import { NumberFormFilterState } from "./internalTypes";
|
|
4
4
|
export type NumberFilterRowProps = {
|
|
5
5
|
ariaRowIndex: number;
|
|
6
6
|
columnLabel: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { numberFilterSchemeNames, } from "./types";
|
|
3
2
|
import FilterRow from "./FilterRow";
|
|
4
3
|
import classNames from "classnames";
|
|
4
|
+
import { numberFilterSchemeNames } from "./constants";
|
|
5
5
|
const NumberFilterRow = ({ ariaRowIndex, columnLabel, filterState, setFilterState, schemeSelectClasses, enableInputClasses, numberInputClasses, tdClasses, trClasses, }) => {
|
|
6
6
|
const handleOpChange = ({ target, }) => {
|
|
7
7
|
setFilterState(Object.assign(Object.assign({}, filterState), { scheme: target.value }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import FilterRow from "./FilterRow";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
import { stringFilterSchemeNames
|
|
4
|
+
import { stringFilterSchemeNames } from "./constants";
|
|
5
5
|
const StringFilterRow = ({ ariaRowIndex, columnLabel, filterState, setFilterState, schemeSelectClasses, enableInputClasses, searchStringInputClasses, tdClasses, trClasses, }) => {
|
|
6
6
|
const handleOpChange = ({ target, }) => {
|
|
7
7
|
setFilterState(Object.assign(Object.assign({}, filterState), { scheme: target.value }));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DateFilterScheme, NumberFilterScheme, StringFilterScheme } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A mapping of {@link StringFilterScheme} to display names.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const stringFilterSchemeNames: Record<StringFilterScheme, string>;
|
|
8
|
+
/**
|
|
9
|
+
* A mapping of display names for {@link NumberFilterScheme}.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const numberFilterSchemeNames: Record<NumberFilterScheme, string>;
|
|
14
|
+
/**
|
|
15
|
+
* A mapping of display names for {@link DateFilterScheme}.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateFilterSchemeNames: Record<DateFilterScheme, string>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A mapping of {@link StringFilterScheme} to display names.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export const stringFilterSchemeNames = {
|
|
7
|
+
contains: "Contains",
|
|
8
|
+
startsWith: "Starts With",
|
|
9
|
+
endsWith: "Ends With",
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A mapping of display names for {@link NumberFilterScheme}.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export const numberFilterSchemeNames = {
|
|
17
|
+
equals: "=",
|
|
18
|
+
greaterThan: ">",
|
|
19
|
+
lessThan: "<",
|
|
20
|
+
greaterOrEqual: ">=",
|
|
21
|
+
lessOrEqual: "<=",
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A mapping of display names for {@link DateFilterScheme}.
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export const dateFilterSchemeNames = {
|
|
29
|
+
/**
|
|
30
|
+
* Displays the row only if {@link Date} value occurs on or after the
|
|
31
|
+
* inputted {@link Date}.
|
|
32
|
+
*/
|
|
33
|
+
startFrom: "Start Form",
|
|
34
|
+
/**
|
|
35
|
+
* Displays the row only if {@link Date} value occurs on or before the
|
|
36
|
+
* inputted {@link Date}.
|
|
37
|
+
*/
|
|
38
|
+
endAt: "End At",
|
|
39
|
+
/**
|
|
40
|
+
* Displays the row only if {@link Date} value occurs between the
|
|
41
|
+
* inputted before and end dates, inclusive.
|
|
42
|
+
*/
|
|
43
|
+
between: "Between",
|
|
44
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AbstractDateFilterState, AbstractFilterState, ControlledFilterModel, DateFilterScheme, EditableColFilterState, NumberFilterScheme, StringFilterState } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Like {@link EditableColFilterState}, but includes additional metadata.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface ColFilterState {
|
|
8
|
+
editableState: EditableColFilterState;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Like {@link EditableFilterState}, but includes additional metadata.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export type FilterState = Record<string, ColFilterState>;
|
|
17
|
+
/**
|
|
18
|
+
* An effective value for the filter model of a grid or table based on
|
|
19
|
+
* whether the controlled or uncontrolled mode was chosen.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export type NormalizedTableFilterModel = Pick<ControlledFilterModel, "tableFilterState" | "setTableFilterState">;
|
|
24
|
+
/**
|
|
25
|
+
* Represents the form state for a number column in the filter settings UI.
|
|
26
|
+
* This interface differs from {@link NumberFilterState} because numerical
|
|
27
|
+
* HTML input elements are better represented by strings.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export interface NumberFormFilterState extends AbstractFilterState {
|
|
32
|
+
type: "number";
|
|
33
|
+
scheme: NumberFilterScheme;
|
|
34
|
+
inputValue: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Represents the form state for a date or datetime column in the filter
|
|
38
|
+
* settings UI. This interface differs from {@link NumberFilterState} because
|
|
39
|
+
* numerical HTML input elements are better represented by strings.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
*
|
|
43
|
+
* For schemes startFrom and endAt that do not use both date input fields, the
|
|
44
|
+
* unused field still serves the purpose of remembering the previous value. That
|
|
45
|
+
* way, the user can switch between filtering schemes in the UI without losing
|
|
46
|
+
* their previously entered date.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export interface DateFormFilterState extends AbstractDateFilterState {
|
|
51
|
+
scheme: DateFilterScheme;
|
|
52
|
+
startDate: string;
|
|
53
|
+
endDate: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Represents the actual form state for a column in the filtering settings UI.
|
|
57
|
+
* Differs from {@link EditableColFilterState} because the HTML input fields
|
|
58
|
+
* for number and dates are better represented by strings.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
*
|
|
62
|
+
* The string type in JavaScript already encompasses the full range of
|
|
63
|
+
* possibilities of the value of HTML text inputs. Therefore, unlike
|
|
64
|
+
* {@link NumberFilterState} and {@link DateFilterState},
|
|
65
|
+
* {@link StringFilterState} is usable as it is to represent the state of a form
|
|
66
|
+
* input.
|
|
67
|
+
*
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export type FilterFormRowState = StringFilterState | NumberFormFilterState | DateFormFilterState;
|
|
71
|
+
/**
|
|
72
|
+
* Represents the form state for filter settings for all columns in a grid or
|
|
73
|
+
* table.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export type FilterFormState = Record<string, FilterFormRowState>;
|
|
@@ -1,70 +1,213 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The form state object for the filtering feature for a column.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type EditableColFilterState = StringFilterState | NumberFilterState | DateFilterState;
|
|
7
|
+
/**
|
|
8
|
+
* State object that represents the filter settings for all of the columns in a
|
|
9
|
+
* grid or table.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
2
13
|
export type EditableFilterState = Record<string, EditableColFilterState>;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Base interface for various objects that represent the form state for the
|
|
16
|
+
* filter settings of a single column.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
7
20
|
export interface AbstractFilterState {
|
|
21
|
+
/**
|
|
22
|
+
* Indicates whether filtering is enabled on the associated row.
|
|
23
|
+
*/
|
|
8
24
|
enabled: boolean;
|
|
9
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* An array of all possible values of {@link StringFilterScheme}.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
10
31
|
export declare const stringFilterSchemes: readonly ["contains", "startsWith", "endsWith"];
|
|
32
|
+
/**
|
|
33
|
+
* Represents all possible filter schemes for a string column.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
11
37
|
export type StringFilterScheme = (typeof stringFilterSchemes)[number];
|
|
12
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Form state for the filter settings for a string column.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
13
43
|
export interface StringFilterState extends AbstractFilterState {
|
|
44
|
+
/**
|
|
45
|
+
* A type discriminator.
|
|
46
|
+
*/
|
|
14
47
|
type: "string";
|
|
48
|
+
/**
|
|
49
|
+
* The filter scheme to apply.
|
|
50
|
+
*/
|
|
15
51
|
scheme: StringFilterScheme;
|
|
52
|
+
/**
|
|
53
|
+
* The search string to filter on.
|
|
54
|
+
*/
|
|
16
55
|
searchString: string;
|
|
17
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* An array of all possible values of {@link NumberFilterScheme}.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
18
62
|
export declare const numberFilterSchemes: readonly ["equals", "greaterThan", "lessThan", "greaterOrEqual", "lessOrEqual"];
|
|
63
|
+
/**
|
|
64
|
+
* Indicates the filtering scheme to apply to a number column.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
19
68
|
export type NumberFilterScheme = (typeof numberFilterSchemes)[number];
|
|
20
|
-
|
|
69
|
+
/**
|
|
70
|
+
* The form state for filter settings on a number column.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
21
74
|
export interface NumberFilterState extends AbstractFilterState {
|
|
22
75
|
type: "number";
|
|
23
76
|
scheme: NumberFilterScheme;
|
|
24
77
|
numValue: number | null;
|
|
25
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* An array of all possible values for {@link DateFilterScheme}.
|
|
81
|
+
*
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
26
84
|
export declare const dateFilterSchemes: readonly ["startFrom", "endAt", "between"];
|
|
85
|
+
/**
|
|
86
|
+
* Indicates the filtering scheme to apply to date and datetime columns.
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
27
90
|
export type DateFilterScheme = (typeof dateFilterSchemes)[number];
|
|
28
|
-
|
|
91
|
+
/**
|
|
92
|
+
* A base interface for {@link DateFilterState}.
|
|
93
|
+
*
|
|
94
|
+
* @remarks
|
|
95
|
+
*
|
|
96
|
+
* Date and datetime input elements can have a state where there is no input.
|
|
97
|
+
* Nulls in the date fields correspond to this empty state.
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
29
101
|
export interface AbstractDateFilterState extends AbstractFilterState {
|
|
102
|
+
/**
|
|
103
|
+
* A type discriminator.
|
|
104
|
+
*/
|
|
30
105
|
type: "date" | "datetime";
|
|
106
|
+
/**
|
|
107
|
+
* The filter scheme to apply.
|
|
108
|
+
*/
|
|
31
109
|
scheme: DateFilterScheme;
|
|
32
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Object that holds the form state for date or datetime column filtered via the
|
|
113
|
+
* "startFrom" scheme.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
33
117
|
export interface StartDateFilterState extends AbstractDateFilterState {
|
|
118
|
+
/**
|
|
119
|
+
* A type discriminator.
|
|
120
|
+
*/
|
|
34
121
|
scheme: "startFrom";
|
|
122
|
+
/**
|
|
123
|
+
* The start date to filter against.
|
|
124
|
+
*/
|
|
35
125
|
startDate: Date | null;
|
|
36
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Object that holds the form state for date or datetime column filtered via the
|
|
129
|
+
* "endAt" scheme.
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
37
133
|
export interface EndDateFilterState extends AbstractDateFilterState {
|
|
134
|
+
/**
|
|
135
|
+
* A type discriminator.
|
|
136
|
+
*/
|
|
38
137
|
scheme: "endAt";
|
|
138
|
+
/**
|
|
139
|
+
* The end date to filter against.
|
|
140
|
+
*/
|
|
39
141
|
endDate: Date | null;
|
|
40
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Object that holds the form state for date or datetime column filtered via the
|
|
145
|
+
* "between" scheme.
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
41
149
|
export interface BetweenDatesFilterState extends AbstractDateFilterState {
|
|
150
|
+
/**
|
|
151
|
+
* A type discriminator.
|
|
152
|
+
*/
|
|
42
153
|
scheme: "between";
|
|
154
|
+
/**
|
|
155
|
+
* The start date to filter against.
|
|
156
|
+
*/
|
|
43
157
|
startDate: Date | null;
|
|
158
|
+
/**
|
|
159
|
+
* The end date to filter against.
|
|
160
|
+
*/
|
|
44
161
|
endDate: Date | null;
|
|
45
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The form state object for the filtering feature for a date or datetime
|
|
165
|
+
* column.
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
46
169
|
export type DateFilterState = StartDateFilterState | EndDateFilterState | BetweenDatesFilterState;
|
|
47
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Object that enables the filtering feature on a grid or table in an
|
|
172
|
+
* externally controllable manner.
|
|
173
|
+
*
|
|
174
|
+
* @public
|
|
175
|
+
*/
|
|
48
176
|
export interface ControlledFilterModel {
|
|
177
|
+
/**
|
|
178
|
+
* A type discriminator.
|
|
179
|
+
*/
|
|
49
180
|
type?: "controlled";
|
|
181
|
+
/**
|
|
182
|
+
* State object that represents the filters currently being applied to the
|
|
183
|
+
* table or grid.
|
|
184
|
+
*/
|
|
50
185
|
tableFilterState: EditableFilterState;
|
|
186
|
+
/**
|
|
187
|
+
* Update callback function for the tableFilterState property. This function
|
|
188
|
+
* is called when the user submits the filter settings form.
|
|
189
|
+
*/
|
|
51
190
|
setTableFilterState: (state: EditableFilterState) => void;
|
|
191
|
+
/**
|
|
192
|
+
* Caption for the filter settings table element.
|
|
193
|
+
*
|
|
194
|
+
* @defaultValue undefined - no caption will be displayed
|
|
195
|
+
*/
|
|
52
196
|
filterTableCaption?: string;
|
|
53
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Object that enables the filtering feature on a grid or table in manner that
|
|
200
|
+
* cannot be controlled externally. In this mode, "tableFilterState" is the
|
|
201
|
+
* initial set of filtering settings.
|
|
202
|
+
*
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
54
205
|
export type UncontrolledFilterModel = Partial<Pick<ControlledFilterModel, "tableFilterState" | "filterTableCaption">> & {
|
|
55
206
|
type: "uncontrolled";
|
|
56
207
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
208
|
+
/**
|
|
209
|
+
* Object used to enable and configure filtering for a grid or table.
|
|
210
|
+
*
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
63
213
|
export type FilterModel = ControlledFilterModel | UncontrolledFilterModel;
|
|
64
|
-
export interface DateFormFilterState extends AbstractDateFilterState {
|
|
65
|
-
scheme: DateFilterScheme;
|
|
66
|
-
startDate: string;
|
|
67
|
-
endDate: string;
|
|
68
|
-
}
|
|
69
|
-
export type FilterFormRowState = StringFilterState | NumberFormFilterState | DateFormFilterState;
|
|
70
|
-
export type FilterFormState = Record<string, FilterFormRowState>;
|
|
@@ -1,30 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An array of all possible values of {@link StringFilterScheme}.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
1
6
|
export const stringFilterSchemes = [
|
|
7
|
+
/**
|
|
8
|
+
* Displays the row as long as the search string exists anywhere in the
|
|
9
|
+
* associated cell's value.
|
|
10
|
+
*/
|
|
2
11
|
"contains",
|
|
12
|
+
/**
|
|
13
|
+
* Displays the row only if the search string is at the beginning of the
|
|
14
|
+
* associated cell's value.
|
|
15
|
+
*/
|
|
3
16
|
"startsWith",
|
|
17
|
+
/**
|
|
18
|
+
* Displays the row only if the search string is at the end of the
|
|
19
|
+
* associated cell's value.
|
|
20
|
+
*/
|
|
4
21
|
"endsWith",
|
|
5
22
|
];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
23
|
+
/**
|
|
24
|
+
* An array of all possible values of {@link NumberFilterScheme}.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
11
28
|
export const numberFilterSchemes = [
|
|
29
|
+
/**
|
|
30
|
+
* Displays the row only if the value of the cell equals the inputted number.
|
|
31
|
+
*/
|
|
12
32
|
"equals",
|
|
33
|
+
/**
|
|
34
|
+
* Displays the row only if the value of the cell is greater than the inputted
|
|
35
|
+
* number.
|
|
36
|
+
*/
|
|
13
37
|
"greaterThan",
|
|
38
|
+
/**
|
|
39
|
+
* Displays the row only if the value of the cell is less than the inputted
|
|
40
|
+
* number.
|
|
41
|
+
*/
|
|
14
42
|
"lessThan",
|
|
43
|
+
/**
|
|
44
|
+
* Displays the row only if the value of the cell is greater than or equal
|
|
45
|
+
* to the inputted number.
|
|
46
|
+
*/
|
|
15
47
|
"greaterOrEqual",
|
|
48
|
+
/**
|
|
49
|
+
* Displays the row only if the value of the cell is less than or equal to
|
|
50
|
+
* the inputted number.
|
|
51
|
+
*/
|
|
16
52
|
"lessOrEqual",
|
|
17
53
|
];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
lessOrEqual: "<=",
|
|
24
|
-
};
|
|
54
|
+
/**
|
|
55
|
+
* An array of all possible values for {@link DateFilterScheme}.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
25
59
|
export const dateFilterSchemes = ["startFrom", "endAt", "between"];
|
|
26
|
-
export const dateFilterSchemeNames = {
|
|
27
|
-
startFrom: "Start Form",
|
|
28
|
-
endAt: "End At",
|
|
29
|
-
between: "Between",
|
|
30
|
-
};
|
package/common/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from "./editing/types";
|
|
2
|
-
export * from "./export/types";
|
|
3
2
|
export * from "./filtering/types";
|
|
4
3
|
export * from "./pagination/types";
|
|
5
|
-
export * from "./pipeline/types";
|
|
6
4
|
export * from "./sorting/types";
|
|
7
5
|
export * from "./styling/types";
|
|
8
|
-
export * from "./toolbar/types";
|
|
9
6
|
export * from "./selection/types";
|
|
10
7
|
export * from "./types";
|
|
11
8
|
export * from "./util";
|
package/common/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
export * from "./editing/types";
|
|
2
|
-
export * from "./export/types";
|
|
3
2
|
export * from "./filtering/types";
|
|
4
3
|
export * from "./pagination/types";
|
|
5
|
-
export * from "./pipeline/types";
|
|
6
4
|
export * from "./sorting/types";
|
|
7
5
|
export * from "./styling/types";
|
|
8
|
-
export * from "./toolbar/types";
|
|
9
6
|
export * from "./selection/types";
|
|
10
7
|
export * from "./types";
|
|
11
8
|
export * from "./util";
|
|
@@ -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,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">;
|