@absreim/react-bootstrap-data-grid-pro 2.7.0 → 4.0.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 +7 -0
- package/{grid → common}/export/ExportForm.d.ts +1 -0
- package/{grid → common}/export/ExportForm.js +3 -3
- package/{grid → common}/filtering/DateFilterRow.d.ts +4 -4
- package/{grid → common}/filtering/DateFilterRow.js +1 -1
- package/common/filtering/FilterOptionsTable.d.ts +12 -0
- package/common/filtering/FilterOptionsTable.js +87 -0
- package/{grid → common}/filtering/FilterRow.d.ts +4 -4
- package/{grid → common}/filtering/FilterRow.js +1 -1
- package/{grid → common}/filtering/NumberFilterRow.d.ts +3 -3
- package/{grid → common}/filtering/NumberFilterRow.js +1 -1
- package/{grid → common}/filtering/StringFilterRow.d.ts +3 -3
- package/{grid → common}/filtering/StringFilterRow.js +1 -1
- package/{grid → common}/filtering/types.d.ts +6 -6
- package/common/filtering/useFilterFormState.d.ts +3 -0
- package/common/index.d.ts +11 -0
- package/common/index.js +11 -0
- package/{grid → common}/pagination/PageSelector.d.ts +1 -1
- package/{grid → common}/pagination/PageSizeSelector.d.ts +1 -1
- package/{grid → common}/pagination/Pagination.d.ts +1 -1
- package/{grid → common}/pagination/Pagination.js +6 -3
- package/{grid → common}/pagination/types.d.ts +3 -2
- package/{grid → common}/pipeline/useAugFormattedRows.d.ts +1 -1
- package/common/pipeline/useColNameToWidth.d.ts +3 -0
- package/common/pipeline/useColNameToWidth.js +7 -0
- package/{grid → common}/pipeline/useCombinedPipeline/index.d.ts +4 -4
- package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +3 -3
- package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.d.ts +1 -1
- package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.js +1 -2
- package/common/pipeline/useCombinedPipeline/useFilter.d.ts +4 -0
- package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +4 -0
- package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.d.ts +2 -2
- package/{grid → common}/pipeline/useGridSelectionFns.d.ts +2 -2
- package/{grid → common}/sorting/types.d.ts +3 -3
- package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.d.ts +2 -2
- package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.js +4 -4
- package/common/styling/types.d.ts +21 -0
- package/{grid → common}/toolbar/ToolbarContainer.d.ts +2 -2
- package/{grid → common}/toolbar/ToolbarContainer.js +11 -7
- package/common/toolbar/types.d.ts +11 -0
- package/common/toolbar/useInterfaces.d.ts +3 -0
- package/common/toolbar/useInterfaces.js +15 -0
- package/{grid → common}/types.d.ts +24 -34
- package/common/util/index.d.ts +5 -0
- package/common/util/index.js +5 -0
- package/grid/constants.d.ts +2 -0
- package/grid/constants.js +2 -0
- package/grid/index.d.ts +3 -10
- package/grid/index.js +3 -10
- package/grid/{Grid.d.ts → main/Grid.d.ts} +0 -1
- package/grid/main/Grid.js +59 -0
- package/grid/main/GridBody.d.ts +4 -0
- package/grid/main/GridBody.js +13 -0
- package/grid/main/GridHeader.d.ts +4 -0
- package/grid/main/GridHeader.js +11 -0
- package/grid/main/getWidthStyles.d.ts +3 -0
- package/grid/main/getWidthStyles.js +6 -0
- package/grid/main/types.d.ts +32 -0
- package/grid.css +1 -0
- package/grid.scss +231 -0
- package/package.json +1 -1
- package/pro/index.d.ts +5 -0
- package/pro/index.js +5 -0
- package/table/InternalTable.d.ts +21 -0
- package/table/InternalTable.js +58 -0
- package/table/Table.d.ts +5 -0
- package/{grid/Grid.js → table/Table.js} +11 -18
- package/{grid → table}/editing/EditControlsCell.d.ts +5 -5
- package/table/editing/EditControlsCell.js +10 -0
- package/{grid → table}/editing/EditableRow.d.ts +8 -9
- package/{grid → table}/editing/EditableRow.js +3 -3
- package/table/index.d.ts +5 -0
- package/table/index.js +5 -0
- package/table/main/BodyRows.d.ts +22 -0
- package/table/main/BodyRows.js +27 -0
- package/{grid → table}/main/ColHeaderCell/index.js +3 -3
- package/{grid → table}/selection/SelectAllHeaderCell.d.ts +2 -2
- package/{grid → table}/selection/SelectAllHeaderCell.js +2 -4
- package/{grid → table}/selection/SelectionInput.d.ts +1 -1
- package/table/style.scss +3 -0
- package/table/styling/types.d.ts +41 -0
- package/table/styling/types.js +1 -0
- package/table/types.d.ts +19 -0
- package/table/types.js +1 -0
- package/{grid-pro → table-pro}/ColHeaderCellPro.js +4 -4
- package/table-pro/TablePro.d.ts +4 -0
- package/{grid-pro/GridPro.js → table-pro/TablePro.js} +10 -13
- package/{grid-pro → table-pro}/index.d.ts +2 -2
- package/{grid-pro → table-pro}/index.js +2 -2
- package/{grid-pro → table-pro}/reorder/ReorderHandleCell.js +1 -1
- package/{grid-pro → table-pro}/reorder/useKeyboardReorder.js +1 -1
- package/{grid-pro → table-pro}/resize/useResizeModel.d.ts +1 -1
- package/table-pro/style.scss +69 -0
- package/{grid-pro → table-pro}/types.d.ts +3 -3
- package/table-pro/types.js +1 -0
- package/table-pro.scss +1 -0
- package/grid/InternalGrid.d.ts +0 -23
- package/grid/InternalGrid.js +0 -56
- package/grid/editing/EditControlsCell.js +0 -18
- package/grid/editing/types.d.ts +0 -16
- package/grid/filtering/FilterOptionsTable.d.ts +0 -11
- package/grid/filtering/FilterOptionsTable.js +0 -81
- package/grid/filtering/useFilterFormState.d.ts +0 -3
- package/grid/main/BodyRows.d.ts +0 -22
- package/grid/main/BodyRows.js +0 -11
- package/grid/main/ToggleButton.d.ts +0 -9
- package/grid/main/ToggleButton.js +0 -13
- package/grid/pipeline/useCombinedPipeline/useFilter.d.ts +0 -4
- package/grid/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +0 -4
- package/grid/pipeline/useUnwrappedGridStyles.d.ts +0 -7
- package/grid/pipeline/useUnwrappedGridStyles.js +0 -15
- package/grid/styling/styleModelUnwrappers.d.ts +0 -4
- package/grid/styling/styleModelUnwrappers.js +0 -47
- package/grid/styling/types.d.ts +0 -62
- package/grid/toolbar/types.d.ts +0 -3
- package/grid/toolbar/useInterfaces.d.ts +0 -9
- package/grid/toolbar/useInterfaces.js +0 -11
- package/grid-pro/GridPro.d.ts +0 -4
- /package/{grid → common}/editing/inputStrsToRowData.d.ts +0 -0
- /package/{grid → common}/editing/inputStrsToRowData.js +0 -0
- /package/{grid-pro/reorder → common/editing}/types.js +0 -0
- /package/{grid → common}/export/types.d.ts +0 -0
- /package/{grid-pro/resize → common/export}/types.js +0 -0
- /package/{grid → common}/export/useExportFn.d.ts +0 -0
- /package/{grid → common}/export/useExportFn.js +0 -0
- /package/{grid → common}/filtering/types.js +0 -0
- /package/{grid → common}/filtering/useFilterFormState.js +0 -0
- /package/{grid → common}/pagination/PageSelector.js +0 -0
- /package/{grid → common}/pagination/PageSizeSelector.js +0 -0
- /package/{grid-pro → common/pagination}/types.js +0 -0
- /package/{grid → common}/pipeline/types.d.ts +0 -0
- /package/{grid-pro/util → common/pipeline}/types.js +0 -0
- /package/{grid → common}/pipeline/useAugFormattedRows.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/index.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilter.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateFromEditable.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.js +0 -0
- /package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.js +0 -0
- /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.d.ts +0 -0
- /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.js +0 -0
- /package/{grid → common}/pipeline/useGridSelectionFns.js +0 -0
- /package/{grid → common}/selection/types.d.ts +0 -0
- /package/{grid → common}/selection/types.js +0 -0
- /package/{grid → common}/sorting/arrowPlaceholder.d.ts +0 -0
- /package/{grid → common}/sorting/arrowPlaceholder.js +0 -0
- /package/{grid → common}/sorting/downArrow.d.ts +0 -0
- /package/{grid → common}/sorting/downArrow.js +0 -0
- /package/{grid → common}/sorting/sortOrderToAriaSort.d.ts +0 -0
- /package/{grid → common}/sorting/sortOrderToAriaSort.js +0 -0
- /package/{grid/editing → common/sorting}/types.js +0 -0
- /package/{grid → common}/sorting/upArrow.d.ts +0 -0
- /package/{grid → common}/sorting/upArrow.js +0 -0
- /package/{grid/export → common/styling}/types.js +0 -0
- /package/{grid → common}/toolbar/Toolbar.d.ts +0 -0
- /package/{grid → common}/toolbar/Toolbar.js +0 -0
- /package/{grid/pagination → common/toolbar}/types.js +0 -0
- /package/{grid/pipeline → common}/types.js +0 -0
- /package/{grid → common}/util/datetime.d.ts +0 -0
- /package/{grid → common}/util/datetime.js +0 -0
- /package/{grid → common}/util/getWidthStyle.d.ts +0 -0
- /package/{grid → common}/util/getWidthStyle.js +0 -0
- /package/{grid → common}/util/isSubset.d.ts +0 -0
- /package/{grid → common}/util/isSubset.js +0 -0
- /package/{grid → common}/util/trueModulo.d.ts +0 -0
- /package/{grid → common}/util/trueModulo.js +0 -0
- /package/{grid → common}/util/useControlledHover.d.ts +0 -0
- /package/{grid → common}/util/useControlledHover.js +0 -0
- /package/grid/{sorting → main}/types.js +0 -0
- /package/{grid → table}/main/ColHeaderCell/index.d.ts +0 -0
- /package/{grid → table}/selection/SelectionInput.js +0 -0
- /package/{grid-pro → table-pro}/ColHeaderCellPro.d.ts +0 -0
- /package/{grid-pro → table-pro}/assets/HorizontalGrip.d.ts +0 -0
- /package/{grid-pro → table-pro}/assets/HorizontalGrip.js +0 -0
- /package/{grid-pro → table-pro}/assets/VerticalGrip.d.ts +0 -0
- /package/{grid-pro → table-pro}/assets/VerticalGrip.js +0 -0
- /package/{grid-pro/util → table-pro/lib}/regDragCleanup.d.ts +0 -0
- /package/{grid-pro/util → table-pro/lib}/regDragCleanup.js +0 -0
- /package/{grid-pro/util → table-pro/lib}/types.d.ts +0 -0
- /package/{grid/styling → table-pro/lib}/types.js +0 -0
- /package/{grid-pro → table-pro}/reorder/ReorderHandleCell.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.js +0 -0
- /package/{grid-pro → table-pro}/reorder/types.d.ts +0 -0
- /package/{grid/toolbar → table-pro/reorder}/types.js +0 -0
- /package/{grid-pro → table-pro}/reorder/useKeyboardReorder.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.js +0 -0
- /package/{grid-pro → table-pro}/reorder/useReorderStyles.d.ts +0 -0
- /package/{grid-pro → table-pro}/reorder/useReorderStyles.js +0 -0
- /package/{grid-pro → table-pro}/resize/types.d.ts +0 -0
- /package/{grid → table-pro/resize}/types.js +0 -0
- /package/{grid-pro → table-pro}/resize/useResizeModel.js +0 -0
- /package/{grid-pro → table-pro}/util/index.d.ts +0 -0
- /package/{grid-pro → table-pro}/util/index.js +0 -0
- /package/{grid-pro → table-pro}/util/reorderRows.d.ts +0 -0
- /package/{grid-pro → table-pro}/util/reorderRows.js +0 -0
- /package/{style.css → table-pro.css} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RowData, RowId } from "../types";
|
|
2
|
+
export type UpdateCallbackGenerator = (id: RowId) => (rowData: RowData) => void;
|
|
3
|
+
export interface EditModel {
|
|
4
|
+
getUpdateCallback: UpdateCallbackGenerator;
|
|
5
|
+
getDeleteCallback?: (id: RowId) => () => void;
|
|
6
|
+
editColWidth?: number;
|
|
7
|
+
}
|
|
@@ -3,6 +3,7 @@ import { FC } from "react";
|
|
|
3
3
|
import { ExportFormStyleModel } from "../styling/types";
|
|
4
4
|
export interface ExportFormProps {
|
|
5
5
|
exportFnInfo: ExportFnInfo;
|
|
6
|
+
closeCallback: () => void;
|
|
6
7
|
styleModel?: ExportFormStyleModel;
|
|
7
8
|
}
|
|
8
9
|
declare const ExportForm: FC<ExportFormProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useState } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
const ExportForm = ({ exportFnInfo: { exportFn, formattersExist, paginationEnabled, filteringEnabled, rowCounts, }, styleModel, }) => {
|
|
4
|
+
const ExportForm = ({ exportFnInfo: { exportFn, formattersExist, paginationEnabled, filteringEnabled, rowCounts, }, closeCallback, styleModel, }) => {
|
|
5
5
|
const formId = useId();
|
|
6
6
|
const [formState, setFormState] = useState({
|
|
7
7
|
stage: "original",
|
|
@@ -67,7 +67,7 @@ const ExportForm = ({ exportFnInfo: { exportFn, formattersExist, paginationEnabl
|
|
|
67
67
|
const radioContainerClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.radioContainer) || ["form-check"]);
|
|
68
68
|
const radioInputClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.radioInput) || ["form-check-input"]);
|
|
69
69
|
const radioLabelClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.radioLabel) || ["form-check-label"]);
|
|
70
|
-
const submitButtonClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.submitButton) || ["btn", "btn-
|
|
71
|
-
return (_jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose data to export" }), stageOptions.map(({ value, label, disabled }) => (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: `${formId}-${value}`, value: value, checked: formState.stage === value, onChange: getChangeHandler("stage", value), disabled: disabled }), _jsx("label", { className: radioLabelClasses, htmlFor: `${formId}-${value}`, children: label })] }, value)))] }), _jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose whether to apply formatters" }), formatOptions.map(({ formatted, label, disabled }) => (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: `${formId}-${formatted}`, value: String(formatted), checked: formState.formatted === formatted, onChange: getChangeHandler("formatted", formatted), disabled: disabled }), _jsx("label", { className: radioLabelClasses, htmlFor: `${formId}-${formatted}`, children: label })] }, String(formatted))))] }), _jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose the file type" }), fileTypeOptions.map(({ fileType, label }) => (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: `${formId}-${fileType}`, value: fileType, checked: formState.fileType === fileType, onChange: getChangeHandler("fileType", fileType) }), _jsx("label", { className: radioLabelClasses, htmlFor: `${formId}-${fileType}`, children: label })] }, fileType)))] }), _jsx("button", { type: "submit", className: submitButtonClasses, children: "Submit" })] }));
|
|
70
|
+
const submitButtonClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.submitButton) || ["btn", "btn-primary"]);
|
|
71
|
+
return (_jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose data to export" }), stageOptions.map(({ value, label, disabled }) => (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: `${formId}-${value}`, value: value, checked: formState.stage === value, onChange: getChangeHandler("stage", value), disabled: disabled }), _jsx("label", { className: radioLabelClasses, htmlFor: `${formId}-${value}`, children: label })] }, value)))] }), _jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose whether to apply formatters" }), formatOptions.map(({ formatted, label, disabled }) => (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: `${formId}-${formatted}`, value: String(formatted), checked: formState.formatted === formatted, onChange: getChangeHandler("formatted", formatted), disabled: disabled }), _jsx("label", { className: radioLabelClasses, htmlFor: `${formId}-${formatted}`, children: label })] }, String(formatted))))] }), _jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose the file type" }), fileTypeOptions.map(({ fileType, label }) => (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: `${formId}-${fileType}`, value: fileType, checked: formState.fileType === fileType, onChange: getChangeHandler("fileType", fileType) }), _jsx("label", { className: radioLabelClasses, htmlFor: `${formId}-${fileType}`, children: label })] }, fileType)))] }), _jsxs("div", { className: "hstack justify-content-end gap-2", children: [_jsx("button", { className: "btn btn-secondary", onClick: closeCallback, type: "button", children: "Cancel" }), _jsx("button", { type: "submit", className: submitButtonClasses, children: "Submit" })] })] }));
|
|
72
72
|
};
|
|
73
73
|
export default ExportForm;
|
|
@@ -7,10 +7,10 @@ export type DateFilterRowProps = {
|
|
|
7
7
|
columnLabel: string;
|
|
8
8
|
filterState: DateFormFilterState;
|
|
9
9
|
setFilterState: (filterState: DateFormFilterState) => void;
|
|
10
|
-
schemeSelectClasses: string[];
|
|
11
|
-
enableInputClasses: string[];
|
|
12
|
-
startDateInputClasses: string[];
|
|
13
|
-
endDateInputClasses: string[];
|
|
10
|
+
schemeSelectClasses: string[] | null | undefined;
|
|
11
|
+
enableInputClasses: string[] | null | undefined;
|
|
12
|
+
startDateInputClasses: string[] | null | undefined;
|
|
13
|
+
endDateInputClasses: string[] | null | undefined;
|
|
14
14
|
} & CommonFilterRowStyleProps;
|
|
15
15
|
declare const DateFilterRow: FC<DateFilterRowProps>;
|
|
16
16
|
export default DateFilterRow;
|
|
@@ -23,7 +23,7 @@ const DateFilterRow = ({ ariaRowIndex, includeTime, columnLabel, filterState, se
|
|
|
23
23
|
const endDateInputId = `$endDate-${inputId}`;
|
|
24
24
|
const startDateInputLabel = `${columnLabel} Column Filter Start Date`;
|
|
25
25
|
const endDateInputLabel = `${columnLabel} Column Filter End Date`;
|
|
26
|
-
const searchStringInputCellContents = (_jsxs(_Fragment, { children: [scheme !== "endAt" && (_jsxs(_Fragment, { children: [scheme === "between" && (_jsx("label", { htmlFor: startDateInputId, children: "Start Date" })), _jsx("input", { id: startDateInputId, className: classNames("form-control"
|
|
26
|
+
const searchStringInputCellContents = (_jsxs(_Fragment, { children: [scheme !== "endAt" && (_jsxs(_Fragment, { children: [scheme === "between" && (_jsx("label", { htmlFor: startDateInputId, children: "Start Date" })), _jsx("input", { id: startDateInputId, className: classNames(startDateInputClasses || "form-control"), type: inputType, required: enabled, disabled: !enabled, value: startDate, onChange: handleStartValueChange, "aria-label": startDateInputLabel })] })), scheme !== "startFrom" && (_jsxs(_Fragment, { children: [scheme === "between" && (_jsx("label", { htmlFor: endDateInputId, children: "End Date" })), _jsx("input", { id: endDateInputId, className: classNames(endDateInputClasses || "form-control"), type: inputType, required: enabled, disabled: !enabled, value: endDate, onChange: handleEndValueChange, "aria-label": endDateInputLabel })] }))] }));
|
|
27
27
|
return (_jsx(FilterRow, { ariaRowIndex: ariaRowIndex, columnLabel: columnLabel, typeLabel: filterState.type === "date" ? "Date" : "Datetime", enabled: enabled, enabledChangeHandler: handleEnabledChange, currentScheme: scheme, handleSchemeChange: handleOpChange, schemesToLabels: dateFilterSchemeNames, searchStringInputCellContents: searchStringInputCellContents, trClasses: trClasses, tdClasses: tdClasses, inputClasses: enableInputClasses, selectClasses: schemeSelectClasses }));
|
|
28
28
|
};
|
|
29
29
|
export default DateFilterRow;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { EditableFilterState, FilterState } from "./types";
|
|
3
|
+
import { FilterInputTableStyleModel } from "../../table/styling/types";
|
|
4
|
+
export interface FilterOptionsTableProps {
|
|
5
|
+
filterState: FilterState;
|
|
6
|
+
setFilterState: (filterState: EditableFilterState) => void;
|
|
7
|
+
closeFormCallback: () => void;
|
|
8
|
+
caption?: string;
|
|
9
|
+
styleModel?: FilterInputTableStyleModel;
|
|
10
|
+
}
|
|
11
|
+
declare const FilterOptionsTable: FC<FilterOptionsTableProps>;
|
|
12
|
+
export default FilterOptionsTable;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import StringFilterRow from "./StringFilterRow";
|
|
4
|
+
import NumberFilterRow from "./NumberFilterRow";
|
|
5
|
+
import useFilterFormState from "./useFilterFormState";
|
|
6
|
+
import DateFilterRow from "./DateFilterRow";
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
const convertFilterFormStateToEditableState = (filterFormState) => Object.keys(filterFormState).reduce((editableState, colName) => {
|
|
9
|
+
const rowFilterFormState = filterFormState[colName];
|
|
10
|
+
switch (rowFilterFormState.type) {
|
|
11
|
+
case "string": {
|
|
12
|
+
editableState[colName] = Object.assign({}, rowFilterFormState);
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
case "number": {
|
|
16
|
+
editableState[colName] = {
|
|
17
|
+
type: rowFilterFormState.type,
|
|
18
|
+
enabled: rowFilterFormState.enabled,
|
|
19
|
+
scheme: rowFilterFormState.scheme,
|
|
20
|
+
numValue: rowFilterFormState.inputValue === ""
|
|
21
|
+
? null
|
|
22
|
+
: Number(rowFilterFormState.inputValue),
|
|
23
|
+
};
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
default: {
|
|
27
|
+
// date or datetime
|
|
28
|
+
const partialFilterState = {
|
|
29
|
+
type: rowFilterFormState.type,
|
|
30
|
+
enabled: rowFilterFormState.enabled,
|
|
31
|
+
};
|
|
32
|
+
const inputStrToDate = (str) => str === "" ? null : new Date(str);
|
|
33
|
+
switch (rowFilterFormState.scheme) {
|
|
34
|
+
case "startFrom": {
|
|
35
|
+
editableState[colName] = Object.assign(Object.assign({}, partialFilterState), { scheme: rowFilterFormState.scheme, startDate: inputStrToDate(rowFilterFormState.startDate) });
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "endAt": {
|
|
39
|
+
editableState[colName] = Object.assign(Object.assign({}, partialFilterState), { scheme: rowFilterFormState.scheme, endDate: inputStrToDate(rowFilterFormState.endDate) });
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
default: {
|
|
43
|
+
editableState[colName] = Object.assign(Object.assign({}, partialFilterState), { scheme: rowFilterFormState.scheme, startDate: inputStrToDate(rowFilterFormState.startDate), endDate: inputStrToDate(rowFilterFormState.endDate) });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return editableState;
|
|
49
|
+
}, {});
|
|
50
|
+
const FilterOptionsTable = ({ filterState, setFilterState, caption, styleModel, closeFormCallback, }) => {
|
|
51
|
+
const formFilterState = useFilterFormState(filterState);
|
|
52
|
+
const [formState, setFormState] = useState(formFilterState);
|
|
53
|
+
const getRows = () => Object.keys(formState).map((colName, index) => {
|
|
54
|
+
function getColStateSetter(colName) {
|
|
55
|
+
return (rowState) => setFormState(Object.assign(Object.assign({}, formState), { [colName]: rowState }));
|
|
56
|
+
}
|
|
57
|
+
const colLabel = filterState[colName].label;
|
|
58
|
+
const colFilterState = formState[colName];
|
|
59
|
+
switch (colFilterState.type) {
|
|
60
|
+
case "string": {
|
|
61
|
+
return (_jsx(StringFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput) &&
|
|
62
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput(index)), enableInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput) &&
|
|
63
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput(index)), searchStringInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.searchStringInput) &&
|
|
64
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.searchStringInput(index)), trClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTr) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTr(index)), tdClasses: (colIndex) => (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd(index, colIndex)) }, colName));
|
|
65
|
+
}
|
|
66
|
+
case "number": {
|
|
67
|
+
return (_jsx(NumberFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput) &&
|
|
68
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput(index)), enableInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput) &&
|
|
69
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput(index)), numberInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.numberInput) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.numberInput(index)), trClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTr) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTr(index)), tdClasses: (colIndex) => (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd(index, colIndex)) }, colName));
|
|
70
|
+
}
|
|
71
|
+
default: {
|
|
72
|
+
// date or datetime
|
|
73
|
+
return (_jsx(DateFilterRow, { ariaRowIndex: index + 2, includeTime: colFilterState.type === "datetime", columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput) &&
|
|
74
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput(index)), enableInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput) &&
|
|
75
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput(index)), startDateInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.startDateInput) && styleModel.startDateInput(index), endDateInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.endDateInput) && styleModel.endDateInput(index), trClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTr) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTr(index)), tdClasses: (colIndex) => (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd(index, colIndex)) }, colName));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const onSubmit = (event) => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
const editableTableFilterState = convertFilterFormStateToEditableState(formState);
|
|
82
|
+
setFilterState(editableTableFilterState);
|
|
83
|
+
closeFormCallback();
|
|
84
|
+
};
|
|
85
|
+
return (_jsxs("form", { onSubmit: onSubmit, className: classNames(styleModel === null || styleModel === void 0 ? void 0 : styleModel.form), children: [_jsxs("table", { className: classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.table) || "table"), children: [caption && (_jsx("caption", { className: classNames(styleModel === null || styleModel === void 0 ? void 0 : styleModel.caption), children: caption })), _jsx("thead", { className: classNames(styleModel === null || styleModel === void 0 ? void 0 : styleModel.thead), children: _jsx("tr", { className: classNames(styleModel === null || styleModel === void 0 ? void 0 : styleModel.theadTr), children: ["Enabled", "Column", "Type", "Operator", "Value"].map((colName, index) => (_jsx("th", { className: classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.theadTh) && styleModel.theadTh(index)), children: colName }, index))) }) }), _jsx("tbody", { className: classNames(styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbody), children: getRows() })] }), _jsxs("div", { className: "hstack justify-content-end gap-2", children: [_jsx("button", { className: "btn btn-secondary", onClick: closeFormCallback, type: "button", children: "Cancel" }), _jsx("button", { className: classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.submitButton) || ["btn", "btn-primary"]), type: "submit", children: "Submit" })] })] }));
|
|
86
|
+
};
|
|
87
|
+
export default FilterOptionsTable;
|
|
@@ -9,10 +9,10 @@ export interface FilterRowProps<FilterScheme extends string> {
|
|
|
9
9
|
handleSchemeChange: ChangeEventHandler<HTMLSelectElement>;
|
|
10
10
|
schemesToLabels: Record<FilterScheme, string>;
|
|
11
11
|
searchStringInputCellContents: ReactNode;
|
|
12
|
-
trClasses: string[];
|
|
13
|
-
tdClasses: (colIndex: number) => string[];
|
|
14
|
-
inputClasses: string[];
|
|
15
|
-
selectClasses: string[];
|
|
12
|
+
trClasses: string[] | null | undefined;
|
|
13
|
+
tdClasses: (colIndex: number) => (string[] | null) | undefined;
|
|
14
|
+
inputClasses: string[] | null | undefined;
|
|
15
|
+
selectClasses: string[] | null | undefined;
|
|
16
16
|
}
|
|
17
17
|
export type CommonFilterRowStyleProps = Pick<FilterRowProps<string>, "trClasses" | "tdClasses">;
|
|
18
18
|
export declare function FilterRow<FilterScheme extends string = string>(props: FilterRowProps<FilterScheme>): ReactNode;
|
|
@@ -4,6 +4,6 @@ export function FilterRow(props) {
|
|
|
4
4
|
const { ariaRowIndex, columnLabel, typeLabel, enabled, enabledChangeHandler, currentScheme, handleSchemeChange, schemesToLabels, searchStringInputCellContents, trClasses, tdClasses, inputClasses, selectClasses, } = props;
|
|
5
5
|
const checkboxLabel = `${columnLabel} Column Filter Toggle`;
|
|
6
6
|
const opSelectLabel = `${columnLabel} Column Filter Operator Selection`;
|
|
7
|
-
return (_jsxs("tr", { className: classNames(trClasses), "aria-rowindex": ariaRowIndex, children: [_jsx("td", { className: classNames(tdClasses(0)), "aria-colindex": 1, children: _jsx("input", { className: classNames(inputClasses), name: checkboxLabel, "aria-label": checkboxLabel, type: "checkbox", checked: enabled, onChange: enabledChangeHandler }) }), _jsx("td", { className: classNames(tdClasses(1)), "aria-colindex": 2, children: columnLabel }), _jsx("td", { className: classNames(tdClasses(2)), "aria-colindex": 3, children: typeLabel }), _jsx("td", { className: classNames(tdClasses(3)), "aria-colindex": 4, children: _jsx("select", { name: opSelectLabel, "aria-label": opSelectLabel, disabled: !enabled, className: classNames("form-select"
|
|
7
|
+
return (_jsxs("tr", { className: classNames(trClasses), "aria-rowindex": ariaRowIndex, children: [_jsx("td", { className: classNames(tdClasses(0)), "aria-colindex": 1, children: _jsx("input", { className: classNames(inputClasses), name: checkboxLabel, "aria-label": checkboxLabel, type: "checkbox", checked: enabled, onChange: enabledChangeHandler }) }), _jsx("td", { className: classNames(tdClasses(1)), "aria-colindex": 2, children: columnLabel }), _jsx("td", { className: classNames(tdClasses(2)), "aria-colindex": 3, children: typeLabel }), _jsx("td", { className: classNames(tdClasses(3)), "aria-colindex": 4, children: _jsx("select", { name: opSelectLabel, "aria-label": opSelectLabel, disabled: !enabled, className: classNames(selectClasses || "form-select"), value: currentScheme, onChange: handleSchemeChange, children: Object.keys(schemesToLabels).map((scheme) => (_jsx("option", { value: scheme, children: schemesToLabels[scheme] }, scheme))) }) }), _jsx("td", { className: classNames(tdClasses(4)), "aria-colindex": 5, children: searchStringInputCellContents })] }));
|
|
8
8
|
}
|
|
9
9
|
export default FilterRow;
|
|
@@ -6,9 +6,9 @@ export type NumberFilterRowProps = {
|
|
|
6
6
|
columnLabel: string;
|
|
7
7
|
filterState: NumberFormFilterState;
|
|
8
8
|
setFilterState: (filterState: NumberFormFilterState) => void;
|
|
9
|
-
schemeSelectClasses: string[];
|
|
10
|
-
enableInputClasses: string[];
|
|
11
|
-
numberInputClasses: string[];
|
|
9
|
+
schemeSelectClasses: string[] | null | undefined;
|
|
10
|
+
enableInputClasses: string[] | null | undefined;
|
|
11
|
+
numberInputClasses: string[] | null | undefined;
|
|
12
12
|
} & CommonFilterRowStyleProps;
|
|
13
13
|
declare const NumberFilterRow: FC<NumberFilterRowProps>;
|
|
14
14
|
export default NumberFilterRow;
|
|
@@ -14,7 +14,7 @@ const NumberFilterRow = ({ ariaRowIndex, columnLabel, filterState, setFilterStat
|
|
|
14
14
|
};
|
|
15
15
|
const { enabled, scheme, inputValue } = filterState;
|
|
16
16
|
const valueInputLabel = `${columnLabel} Column Filter Value`;
|
|
17
|
-
const searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames("form-control"
|
|
17
|
+
const searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames(numberInputClasses || "form-control"), type: "number", required: enabled, disabled: !enabled, value: inputValue, onChange: handleNumInputValueChange }));
|
|
18
18
|
return (_jsx(FilterRow, { ariaRowIndex: ariaRowIndex, columnLabel: columnLabel, typeLabel: "Number", enabled: enabled, enabledChangeHandler: handleEnabledChange, currentScheme: scheme, handleSchemeChange: handleOpChange, schemesToLabels: numberFilterSchemeNames, searchStringInputCellContents: searchStringInputCellContents, trClasses: trClasses, tdClasses: tdClasses, inputClasses: enableInputClasses, selectClasses: schemeSelectClasses }));
|
|
19
19
|
};
|
|
20
20
|
export default NumberFilterRow;
|
|
@@ -6,9 +6,9 @@ type StringFilterRowProps = {
|
|
|
6
6
|
columnLabel: string;
|
|
7
7
|
filterState: StringFilterState;
|
|
8
8
|
setFilterState: (filterState: StringFilterState) => void;
|
|
9
|
-
schemeSelectClasses: string[];
|
|
10
|
-
enableInputClasses: string[];
|
|
11
|
-
searchStringInputClasses: string[];
|
|
9
|
+
schemeSelectClasses: string[] | null | undefined;
|
|
10
|
+
enableInputClasses: string[] | null | undefined;
|
|
11
|
+
searchStringInputClasses: string[] | null | undefined;
|
|
12
12
|
} & CommonFilterRowStyleProps;
|
|
13
13
|
declare const StringFilterRow: FC<StringFilterRowProps>;
|
|
14
14
|
export default StringFilterRow;
|
|
@@ -14,7 +14,7 @@ const StringFilterRow = ({ ariaRowIndex, columnLabel, filterState, setFilterStat
|
|
|
14
14
|
};
|
|
15
15
|
const { enabled, scheme, searchString } = filterState;
|
|
16
16
|
const valueInputLabel = `${columnLabel} Column Filter Value`;
|
|
17
|
-
const searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames("form-control"
|
|
17
|
+
const searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames(searchStringInputClasses || "form-control"), required: enabled, disabled: !enabled, value: searchString, onChange: handleSearchStringChange }));
|
|
18
18
|
return (_jsx(FilterRow, { ariaRowIndex: ariaRowIndex, columnLabel: columnLabel, typeLabel: "String", enabled: enabled, enabledChangeHandler: handleEnabledChange, currentScheme: scheme, handleSchemeChange: handleOpChange, schemesToLabels: stringFilterSchemeNames, searchStringInputCellContents: searchStringInputCellContents, trClasses: trClasses, tdClasses: tdClasses, inputClasses: enableInputClasses, selectClasses: schemeSelectClasses }));
|
|
19
19
|
};
|
|
20
20
|
export default StringFilterRow;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
1
|
+
export type FilterState = Record<string, ColFilterState>;
|
|
2
|
+
export type EditableFilterState = Record<string, EditableColFilterState>;
|
|
3
3
|
export interface ColFilterState {
|
|
4
|
-
editableState:
|
|
4
|
+
editableState: EditableColFilterState;
|
|
5
5
|
label: string;
|
|
6
6
|
}
|
|
7
7
|
export interface AbstractFilterState {
|
|
@@ -44,11 +44,11 @@ export interface BetweenDatesFilterState extends AbstractDateFilterState {
|
|
|
44
44
|
endDate: Date | null;
|
|
45
45
|
}
|
|
46
46
|
export type DateFilterState = StartDateFilterState | EndDateFilterState | BetweenDatesFilterState;
|
|
47
|
-
export type
|
|
47
|
+
export type EditableColFilterState = StringFilterState | NumberFilterState | DateFilterState;
|
|
48
48
|
export interface ControlledFilterModel {
|
|
49
49
|
type?: "controlled";
|
|
50
|
-
tableFilterState:
|
|
51
|
-
setTableFilterState: (state:
|
|
50
|
+
tableFilterState: EditableFilterState;
|
|
51
|
+
setTableFilterState: (state: EditableFilterState) => void;
|
|
52
52
|
filterTableCaption?: string;
|
|
53
53
|
}
|
|
54
54
|
export type UncontrolledFilterModel = Partial<Pick<ControlledFilterModel, "tableFilterState" | "filterTableCaption">> & {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./editing/types";
|
|
2
|
+
export * from "./export/types";
|
|
3
|
+
export * from "./filtering/types";
|
|
4
|
+
export * from "./pagination/types";
|
|
5
|
+
export * from "./pipeline/types";
|
|
6
|
+
export * from "./sorting/types";
|
|
7
|
+
export * from "./styling/types";
|
|
8
|
+
export * from "./toolbar/types";
|
|
9
|
+
export * from "./selection/types";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
export * from "./util";
|
package/common/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./editing/types";
|
|
2
|
+
export * from "./export/types";
|
|
3
|
+
export * from "./filtering/types";
|
|
4
|
+
export * from "./pagination/types";
|
|
5
|
+
export * from "./pipeline/types";
|
|
6
|
+
export * from "./sorting/types";
|
|
7
|
+
export * from "./styling/types";
|
|
8
|
+
export * from "./toolbar/types";
|
|
9
|
+
export * from "./selection/types";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
export * from "./util";
|
|
@@ -3,7 +3,7 @@ import { NormalizedPaginationModel } from "./types";
|
|
|
3
3
|
export interface PaginationProps {
|
|
4
4
|
normalizedModel: NormalizedPaginationModel;
|
|
5
5
|
prePagingNumRows: number;
|
|
6
|
-
containerDivClasses: string[];
|
|
6
|
+
containerDivClasses: string[] | undefined;
|
|
7
7
|
}
|
|
8
8
|
declare const Pagination: FC<PaginationProps>;
|
|
9
9
|
export default Pagination;
|
|
@@ -16,8 +16,11 @@ const Pagination = ({ normalizedModel, prePagingNumRows, containerDivClasses, })
|
|
|
16
16
|
setCurrentPage(maxPages);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
return (_jsxs("div", { "data-testid": "pagination ui container div", className: classNames(containerDivClasses
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return (_jsxs("div", { "data-testid": "pagination ui container div", className: classNames(containerDivClasses || [
|
|
20
|
+
"d-flex",
|
|
21
|
+
"justify-content-end",
|
|
22
|
+
"gap-2",
|
|
23
|
+
"px-2",
|
|
24
|
+
]), children: [_jsx(PageSizeSelector, { componentSize: componentSize, pageSizeOptions: pageSizeOptions, pageSizeIndex: pageSizeIndex, handleSetPageSize: pageIndexAwarePageSizeSetter }), _jsx(PageSelector, { numPages: numPages, pageNum: currentPage, numButtons: maxPageButtons, setPageNum: setCurrentPage, size: componentSize, ariaLabel: pageSelectorAriaLabel, alignment: pageSelectorJustifyContent })] }));
|
|
22
25
|
};
|
|
23
26
|
export default Pagination;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export type JustifyContentSetting = "start" | "end" | "center" | "between" | "around" | "evenly";
|
|
2
|
+
export type Size = "small" | "medium" | "large";
|
|
2
3
|
export interface PaginationOptions {
|
|
3
4
|
pageSizeOptions?: number[];
|
|
4
5
|
maxPageButtons?: number;
|
|
@@ -18,5 +19,5 @@ export type UncontrolledPaginationModel = PaginationOptions & {
|
|
|
18
19
|
startingPageSizeIndex?: number;
|
|
19
20
|
startingCurrentPage?: number;
|
|
20
21
|
};
|
|
21
|
-
export type
|
|
22
|
+
export type PaginationModel = ControlledPaginationModel | UncontrolledPaginationModel;
|
|
22
23
|
export type NormalizedPaginationModel = Required<Omit<ControlledPaginationModel, "type" | "pageSelectorAriaLabel" | "pageSelectorJustifyContent">> & Pick<ControlledPaginationModel, "pageSelectorAriaLabel" | "pageSelectorJustifyContent">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AugFormattedRow, FormattedRow } from "../types";
|
|
2
1
|
import { ColNameToWidth } from "./types";
|
|
2
|
+
import { AugFormattedRow, FormattedRow } from "../";
|
|
3
3
|
declare const useAugFormattedRows: (colNameToWidth: ColNameToWidth, rows: FormattedRow[]) => AugFormattedRow[];
|
|
4
4
|
export default useAugFormattedRows;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SortedRowsOutput } from "./useSortedRows";
|
|
2
2
|
import { CurrentPageRowsOutput } from "./useCurrentPageRows";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export type CombinedPipelineParams = Pick<
|
|
3
|
+
import { NormalizedTableFilterModel, FilterState } from "../../";
|
|
4
|
+
import { ColDefBase, FormattedRow, MainComponentSharedProps, RowDef } from "../../types";
|
|
5
|
+
export type CombinedPipelineParams = Pick<MainComponentSharedProps, "rows" | "filterModel" | "sortModel" | "pagination" | "selectModel"> & {
|
|
6
6
|
cols: ColDefBase[];
|
|
7
7
|
};
|
|
8
8
|
export interface UseCombinedPipelineHook {
|
|
9
9
|
normalizedTableFilterModel: NormalizedTableFilterModel | null;
|
|
10
10
|
filteredRows: RowDef[];
|
|
11
|
-
filterState:
|
|
11
|
+
filterState: FilterState | null;
|
|
12
12
|
sortedRowsOutput: SortedRowsOutput;
|
|
13
13
|
currentPageRowsOutput: CurrentPageRowsOutput;
|
|
14
14
|
showSelectCol: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { NormalizedPaginationModel, PaginationModel } from "../../pagination/types";
|
|
2
|
+
import { AugRowDef, PostPaginationRowDef } from "../../";
|
|
3
3
|
export interface CurrentPageRowsOutput {
|
|
4
4
|
paginatedRows: PostPaginationRowDef[];
|
|
5
5
|
normalizedModel: NormalizedPaginationModel | null;
|
|
6
6
|
}
|
|
7
|
-
declare const useCurrentPageRows: (sortedRows: AugRowDef[], paginationModel:
|
|
7
|
+
declare const useCurrentPageRows: (sortedRows: AugRowDef[], paginationModel: PaginationModel | undefined) => CurrentPageRowsOutput;
|
|
8
8
|
export default useCurrentPageRows;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColDef, FormattedRow, PostPaginationRowDef } from "../../types";
|
|
2
2
|
declare const useDisplayRows: (currentPageRows: PostPaginationRowDef[], cols: ColDef[], ariaColIndexOffset: number) => FormattedRow[];
|
|
3
3
|
export default useDisplayRows;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { dateToDatetimeInputStr, dateToInputStr } from "../../util
|
|
2
|
+
import { dateToDatetimeInputStr, dateToInputStr } from "../../util";
|
|
3
3
|
const getFormattedValue = (value, formatter, typeString) => {
|
|
4
4
|
if (formatter) {
|
|
5
5
|
return formatter(value);
|
|
@@ -31,7 +31,6 @@ const useDisplayRows = (currentPageRows, cols, ariaColIndexOffset) => useMemo(()
|
|
|
31
31
|
const displayRow = [];
|
|
32
32
|
Object.keys(row.data).forEach((name) => {
|
|
33
33
|
if (!nameToIndex.has(name)) {
|
|
34
|
-
console.error(`Warning: row data contains a property named "${name}", but it was not found among the column definitions.`);
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
36
|
const index = nameToIndex.get(name);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EditableFilterState, FilterState } from "../../filtering/types";
|
|
2
|
+
import { ColDef } from "../../types";
|
|
3
|
+
declare const useFilterStateFromEditable: (colDefs: ColDef[], editableFilterState: EditableFilterState | null) => FilterState | null;
|
|
4
|
+
export default useFilterStateFromEditable;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { SortColDef, SortModel } from "../../sorting/types";
|
|
1
2
|
import { AugRowDef, ColDefBase } from "../../types";
|
|
2
|
-
import { SortColDef, TableSortModel } from "../../sorting/types";
|
|
3
3
|
export interface SortedRowsOutput {
|
|
4
4
|
sortedRows: AugRowDef[];
|
|
5
5
|
sortingEnabled: boolean;
|
|
6
6
|
sortColDef: SortColDef | null | undefined;
|
|
7
7
|
setSortColDef: ((sortColDef: SortColDef | null) => void) | undefined;
|
|
8
8
|
}
|
|
9
|
-
declare const useSortedRows: (rows: AugRowDef[], cols: ColDefBase[], sortModel:
|
|
9
|
+
declare const useSortedRows: (rows: AugRowDef[], cols: ColDefBase[], sortModel: SortModel | undefined) => SortedRowsOutput;
|
|
10
10
|
export default useSortedRows;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RowDef, RowId } from "../types";
|
|
2
1
|
import { MouseEventHandler } from "react";
|
|
3
2
|
import { SelectionInfo, SelectModel } from "../selection/types";
|
|
4
|
-
import { SelectionInputModel } from "
|
|
3
|
+
import { SelectionInputModel } from "../../table/selection/SelectionInput";
|
|
4
|
+
import { RowDef, RowId } from "../types";
|
|
5
5
|
export interface UseGridSelectionFnsHook {
|
|
6
6
|
selectedSet: Set<RowId>;
|
|
7
7
|
rowsAreSelectable: boolean | undefined;
|
|
@@ -7,13 +7,13 @@ export interface ColSortModel {
|
|
|
7
7
|
sortOrder: SortOrder | null;
|
|
8
8
|
setSortOrder: (order: SortOrder | null) => void;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface ControlledSortModel {
|
|
11
11
|
type?: "controlled";
|
|
12
12
|
sortColDef: SortColDef | null;
|
|
13
13
|
setSortColDef: (sortColDef: SortColDef | null) => void;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface UncontrolledSortModel {
|
|
16
16
|
type: "uncontrolled";
|
|
17
17
|
initialSortColDef: SortColDef | null;
|
|
18
18
|
}
|
|
19
|
-
export type
|
|
19
|
+
export type SortModel = ControlledSortModel | UncontrolledSortModel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UseControlledHoverHook } from "
|
|
1
|
+
import { UseControlledHoverHook } from "../util/useControlledHover";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import { ColSortModel } from "
|
|
3
|
+
import { ColSortModel } from "./types";
|
|
4
4
|
export type UseSortHeaderStatesHook = UseControlledHoverHook<HTMLTableCellElement> & {
|
|
5
5
|
handleClick: () => void;
|
|
6
6
|
sortSymbol: ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import useControlledHover from "
|
|
1
|
+
import useControlledHover from "../util/useControlledHover";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import upArrow from "
|
|
4
|
-
import arrowPlaceholder from "
|
|
5
|
-
import downArrow from "
|
|
3
|
+
import upArrow from "./upArrow";
|
|
4
|
+
import arrowPlaceholder from "./arrowPlaceholder";
|
|
5
|
+
import downArrow from "./downArrow";
|
|
6
6
|
const useSortHeaderStates = (sortModel) => {
|
|
7
7
|
const { isHovering, setIsHovering, handleMouseOver, handleMouseOut } = useControlledHover();
|
|
8
8
|
const handleClick = () => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AdditionalComponentsStyleModel, FilterInputTableStyleModel, TableStyleModel } from "../../table";
|
|
2
|
+
export interface ToolbarStyleModel {
|
|
3
|
+
activeButton?: string[];
|
|
4
|
+
inactiveButton?: string[];
|
|
5
|
+
toolbar?: string[];
|
|
6
|
+
interfaceContainer?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ExportFormStyleModel {
|
|
9
|
+
legend?: string[];
|
|
10
|
+
radioContainer?: string[];
|
|
11
|
+
radioInput?: string[];
|
|
12
|
+
radioLabel?: string[];
|
|
13
|
+
submitButton?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface StyleModel {
|
|
16
|
+
mainTableStyleModel?: TableStyleModel;
|
|
17
|
+
filterInputTableStyleModel?: FilterInputTableStyleModel;
|
|
18
|
+
additionalComponentsStyleModel?: AdditionalComponentsStyleModel;
|
|
19
|
+
toolbarStyleModel?: ToolbarStyleModel;
|
|
20
|
+
exportFormStyleModel?: ExportFormStyleModel;
|
|
21
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InterfaceNodeGenerator } from "./types";
|
|
2
2
|
import { FC } from "react";
|
|
3
3
|
import { ToolbarStyleModel } from "../styling/types";
|
|
4
4
|
interface ToolbarContainerProps {
|
|
5
|
-
|
|
5
|
+
interfaceGen: InterfaceNodeGenerator;
|
|
6
6
|
styleModel?: ToolbarStyleModel;
|
|
7
7
|
}
|
|
8
8
|
declare const ToolbarContainer: FC<ToolbarContainerProps>;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import Toolbar from "./Toolbar";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
const ToolbarContainer = ({
|
|
5
|
+
const ToolbarContainer = ({ interfaceGen, styleModel, }) => {
|
|
6
6
|
const [option, setOption] = useState(null);
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return prev
|
|
11
|
-
|
|
7
|
+
const closeUiCallback = useCallback(() => setOption(null), []);
|
|
8
|
+
const interfaces = useMemo(() => interfaceGen(closeUiCallback), [closeUiCallback, interfaceGen]);
|
|
9
|
+
const enabledFeatures = useMemo(() => {
|
|
10
|
+
return Object.keys(interfaces).reduce((prev, toolbarOption) => {
|
|
11
|
+
prev[toolbarOption] =
|
|
12
|
+
!!interfaces[toolbarOption];
|
|
13
|
+
return prev;
|
|
14
|
+
}, {});
|
|
15
|
+
}, [interfaces]);
|
|
12
16
|
return (_jsxs("div", { className: "vstack", "data-testid": "toolbar container", children: [_jsx(Toolbar, { enabledFeatures: enabledFeatures, option: option, setOption: setOption, toolbarClasses: styleModel === null || styleModel === void 0 ? void 0 : styleModel.toolbar, activeClasses: styleModel === null || styleModel === void 0 ? void 0 : styleModel.activeButton, inactiveClasses: styleModel === null || styleModel === void 0 ? void 0 : styleModel.inactiveButton }), _jsx("div", { className: "position-relative", children: option !== null && (_jsx("div", { "data-testid": "toolbar feature interface content container", className: classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.interfaceContainer) || [
|
|
13
17
|
"position-absolute",
|
|
14
18
|
"z-1",
|