@absreim/react-bootstrap-data-grid 1.2.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/ColHeaderCell.d.ts +2 -1
  2. package/ColHeaderCell.js +6 -6
  3. package/Grid.d.ts +10 -10
  4. package/Grid.js +56 -43
  5. package/ToggleButton.d.ts +1 -0
  6. package/ToggleButton.js +5 -3
  7. package/editing/EditControlsCell.d.ts +16 -0
  8. package/editing/EditControlsCell.js +19 -0
  9. package/editing/EditableRow.d.ts +20 -0
  10. package/editing/EditableRow.js +67 -0
  11. package/editing/inputStrsToRowDef.d.ts +3 -0
  12. package/editing/inputStrsToRowDef.js +18 -0
  13. package/editing/types.d.ts +14 -0
  14. package/{FilterOptionsTable → filtering}/DateFilterRow.d.ts +8 -2
  15. package/filtering/DateFilterRow.js +46 -0
  16. package/{FilterOptionsTable → filtering}/FilterOptionsTable.d.ts +4 -1
  17. package/{FilterOptionsTable → filtering}/FilterOptionsTable.js +26 -7
  18. package/filtering/FilterRow.d.ts +19 -0
  19. package/filtering/FilterRow.js +18 -0
  20. package/{FilterOptionsTable → filtering}/NumberFilterRow.d.ts +7 -2
  21. package/filtering/NumberFilterRow.js +35 -0
  22. package/filtering/StringFilterRow.d.ts +14 -0
  23. package/filtering/StringFilterRow.js +35 -0
  24. package/filtering/types.d.ts +64 -0
  25. package/filtering/types.js +30 -0
  26. package/{FilterOptionsTable → filtering}/useFormStateFromTableFilterState.d.ts +1 -2
  27. package/index.d.ts +6 -1
  28. package/index.js +6 -1
  29. package/package.json +3 -2
  30. package/pagination/PageSelector.d.ts +2 -2
  31. package/pagination/Pagination.d.ts +3 -1
  32. package/pagination/Pagination.js +2 -2
  33. package/pagination/types.d.ts +12 -0
  34. package/pagination/types.js +1 -0
  35. package/pipeline/useCurrentPageRows.d.ts +4 -0
  36. package/pipeline/useCurrentPageRows.js +14 -0
  37. package/{hooks → pipeline}/useDisplayRows.d.ts +1 -1
  38. package/{hooks → pipeline}/useDisplayRows.js +28 -21
  39. package/{hooks → pipeline}/useEditableFromFilterState.d.ts +1 -1
  40. package/{hooks → pipeline}/useFilter.d.ts +2 -1
  41. package/{hooks → pipeline}/useFilterStateFromEditable.d.ts +2 -1
  42. package/{hooks → pipeline}/useSortedRows.d.ts +2 -1
  43. package/selection/SelectAllHeaderCell.d.ts +2 -1
  44. package/selection/SelectAllHeaderCell.js +7 -6
  45. package/selection/SelectionInput.d.ts +1 -0
  46. package/selection/SelectionInput.js +3 -2
  47. package/selection/types.d.ts +16 -0
  48. package/selection/types.js +4 -0
  49. package/sorting/types.d.ts +13 -0
  50. package/sorting/types.js +1 -0
  51. package/style.scss +4 -4
  52. package/styling/styleModelUnwrappers.d.ts +4 -0
  53. package/styling/styleModelUnwrappers.js +57 -0
  54. package/styling/types.d.ts +44 -0
  55. package/styling/types.js +1 -0
  56. package/types.d.ts +2 -83
  57. package/types.js +1 -30
  58. package/{hooks → util}/useControlledHover.js +3 -7
  59. package/FilterOptionsTable/DateFilterRow.js +0 -45
  60. package/FilterOptionsTable/NumberFilterRow.js +0 -34
  61. package/FilterOptionsTable/StringFilterRow.d.ts +0 -9
  62. package/FilterOptionsTable/StringFilterRow.js +0 -34
  63. package/FilterOptionsTable/types.d.ts +0 -13
  64. /package/{FilterOptionsTable → editing}/types.js +0 -0
  65. /package/{FilterOptionsTable → filtering}/useFormStateFromTableFilterState.js +0 -0
  66. /package/{hooks → pipeline}/useAugmentedRows.d.ts +0 -0
  67. /package/{hooks → pipeline}/useAugmentedRows.js +0 -0
  68. /package/{hooks → pipeline}/useEditableFromFilterState.js +0 -0
  69. /package/{hooks → pipeline}/useFilter.js +0 -0
  70. /package/{hooks → pipeline}/useFilterStateFromEditable.js +0 -0
  71. /package/{hooks → pipeline}/useSortedRows.js +0 -0
  72. /package/{icons → selection}/deselectAll.d.ts +0 -0
  73. /package/{icons → selection}/deselectAll.js +0 -0
  74. /package/{icons → selection}/selectAll.d.ts +0 -0
  75. /package/{icons → selection}/selectAll.js +0 -0
  76. /package/{icons → sorting}/arrowPlaceholder.d.ts +0 -0
  77. /package/{icons → sorting}/arrowPlaceholder.js +0 -0
  78. /package/{icons → sorting}/downArrow.d.ts +0 -0
  79. /package/{icons → sorting}/downArrow.js +0 -0
  80. /package/{icons → sorting}/upArrow.d.ts +0 -0
  81. /package/{icons → sorting}/upArrow.js +0 -0
  82. /package/{hooks → util}/useControlledHover.d.ts +0 -0
@@ -1,9 +1,10 @@
1
1
  import { FC } from "react";
2
- import { ColSortModel } from "./types";
2
+ import { ColSortModel } from "./sorting/types";
3
3
  interface ColHeaderCellProps {
4
4
  label: string;
5
5
  sortModel?: ColSortModel;
6
6
  ariaColIndex: number;
7
+ additionalClasses?: string[];
7
8
  }
8
9
  declare const ColHeaderCell: FC<ColHeaderCellProps>;
9
10
  export default ColHeaderCell;
package/ColHeaderCell.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { jsxs as _jsxs } from "react/jsx-runtime";
3
- import downArrow from "./icons/downArrow";
4
- import upArrow from "./icons/upArrow";
5
- import arrowPlaceholder from "./icons/arrowPlaceholder";
3
+ import downArrow from "./sorting/downArrow";
4
+ import upArrow from "./sorting/upArrow";
5
+ import arrowPlaceholder from "./sorting/arrowPlaceholder";
6
6
  import classNames from "classnames";
7
- import useControlledHover from "./hooks/useControlledHover";
7
+ import useControlledHover from "./util/useControlledHover";
8
8
  var ColHeaderCell = function (_a) {
9
- var label = _a.label, sortModel = _a.sortModel, ariaColIndex = _a.ariaColIndex;
9
+ var label = _a.label, sortModel = _a.sortModel, ariaColIndex = _a.ariaColIndex, additionalClasses = _a.additionalClasses;
10
10
  var _b = useControlledHover(), isHovering = _b.isHovering, handleMouseOver = _b.handleMouseOver, handleMouseOut = _b.handleMouseOut;
11
11
  var handleClick = function () {
12
12
  if (!sortModel) {
@@ -48,7 +48,7 @@ var ColHeaderCell = function (_a) {
48
48
  return (_jsxs("th", { className: classNames({
49
49
  "rbdg-clickable-grid-header-cell": sortModel,
50
50
  "table-active": sortModel === null || sortModel === void 0 ? void 0 : sortModel.sortOrder,
51
- }), onClick: sortModel && handleClick, onMouseOver: handleMouseOver, onMouseOut: handleMouseOut, "aria-description": sortModel
51
+ }, additionalClasses || []), onClick: sortModel && handleClick, onMouseOver: handleMouseOver, onMouseOut: handleMouseOut, "aria-description": sortModel
52
52
  ? "Column header"
53
53
  : "Column header that can be clicked to change the sorting mode", "aria-colindex": ariaColIndex, children: [label, getSortSymbol()] }));
54
54
  };
package/Grid.d.ts CHANGED
@@ -1,14 +1,11 @@
1
1
  import { FC } from "react";
2
- import { ColDef, FilterModel, RowDef, SelectModel, Size, TableSortModel } from "./types";
3
- export interface GridPaginationState {
4
- pageSizeOptions: number[];
5
- pageSizeIndex: number;
6
- setPageSizeIndex: (pageSizeIndex: number) => void;
7
- currentPage: number;
8
- setCurrentPage: (pageNum: number) => void;
9
- maxPageButtons: number;
10
- componentSize?: Size;
11
- }
2
+ import { ColDef, RowDef } from "./types";
3
+ import { StyleModel } from "./styling/types";
4
+ import { EditModel } from "./editing/types";
5
+ import { SelectModel } from "./selection/types";
6
+ import { FilterModel } from "./filtering/types";
7
+ import { TableSortModel } from "./sorting/types";
8
+ import { GridPaginationState } from "./pagination/types";
12
9
  export interface GridProps {
13
10
  rows: RowDef[];
14
11
  cols: ColDef[];
@@ -16,6 +13,9 @@ export interface GridProps {
16
13
  sortModel?: TableSortModel;
17
14
  filterModel?: FilterModel;
18
15
  selectModel?: SelectModel;
16
+ editModel?: EditModel;
17
+ caption?: string;
18
+ styleModel?: StyleModel;
19
19
  }
20
20
  declare const Grid: FC<GridProps>;
21
21
  export default Grid;
package/Grid.js CHANGED
@@ -2,36 +2,34 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from "react";
4
4
  import ColHeaderCell from "./ColHeaderCell";
5
- import useFilter from "./hooks/useFilter";
5
+ import useFilter from "./pipeline/useFilter";
6
6
  import ToggleButton from "./ToggleButton";
7
- import FilterOptionsTable from "./FilterOptionsTable/FilterOptionsTable";
8
- import useFilterStateFromEditable from "./hooks/useFilterStateFromEditable";
9
- import useAugmentedRows from "./hooks/useAugmentedRows";
10
- import useSortedRows from "./hooks/useSortedRows";
11
- import useDisplayRows from "./hooks/useDisplayRows";
7
+ import FilterOptionsTable from "./filtering/FilterOptionsTable";
8
+ import useFilterStateFromEditable from "./pipeline/useFilterStateFromEditable";
9
+ import useAugmentedRows from "./pipeline/useAugmentedRows";
10
+ import useSortedRows from "./pipeline/useSortedRows";
11
+ import useDisplayRows from "./pipeline/useDisplayRows";
12
12
  import SelectAllHeaderCell from "./selection/SelectAllHeaderCell";
13
13
  import SelectionInput from "./selection/SelectionInput";
14
14
  import Pagination from "./pagination/Pagination";
15
15
  import classNames from "classnames";
16
+ import EditableRow from "./editing/EditableRow";
17
+ import inputStrsToRowDef from "./editing/inputStrsToRowDef";
18
+ import { unwrapAdditionalComponentsStyleModel, unwrapTableStyleModel, } from "./styling/styleModelUnwrappers";
19
+ import useCurrentPageRows from "./pipeline/useCurrentPageRows";
16
20
  var Grid = function (_a) {
17
- var rows = _a.rows, cols = _a.cols, pagination = _a.pagination, sortModel = _a.sortModel, filterModel = _a.filterModel, selectModel = _a.selectModel;
21
+ var _b;
22
+ var rows = _a.rows, cols = _a.cols, pagination = _a.pagination, sortModel = _a.sortModel, filterModel = _a.filterModel, selectModel = _a.selectModel, editModel = _a.editModel, caption = _a.caption, styleModel = _a.styleModel;
18
23
  var editableFilterState = (filterModel === null || filterModel === void 0 ? void 0 : filterModel.tableFilterState) || null;
19
24
  var filterState = useFilterStateFromEditable(cols, editableFilterState);
20
25
  var augmentedRows = useAugmentedRows(rows);
21
26
  var filteredRows = useFilter(augmentedRows, editableFilterState);
22
27
  var sortedRows = useSortedRows(filteredRows, cols, sortModel);
23
- var currentPageRows = useMemo(function () {
24
- if (pagination === undefined) {
25
- return sortedRows;
26
- }
27
- var pageSizeOptions = pagination.pageSizeOptions, pageSizeIndex = pagination.pageSizeIndex, currentPage = pagination.currentPage;
28
- var pageSize = pageSizeOptions[pageSizeIndex];
29
- var lowerIndex = pageSize * (currentPage - 1);
30
- var upperIndex = lowerIndex + pageSize;
31
- return sortedRows.slice(lowerIndex, upperIndex);
32
- }, [sortedRows, pagination]);
33
- var displayRows = useDisplayRows(currentPageRows, cols);
34
- var _b = useState(false), filterOptionsVisible = _b[0], setFilterOptionsVisible = _b[1];
28
+ var currentPageRows = useCurrentPageRows(sortedRows, pagination);
29
+ var showSelectCol = selectModel && selectModel.mode !== "row";
30
+ var ariaColIndexOffset = showSelectCol ? 1 : 0;
31
+ var displayRows = useDisplayRows(currentPageRows, cols, ariaColIndexOffset);
32
+ var _c = useState(false), filterOptionsVisible = _c[0], setFilterOptionsVisible = _c[1];
35
33
  var handleToggleFilterOptions = function () {
36
34
  setFilterOptionsVisible(!filterOptionsVisible);
37
35
  };
@@ -94,7 +92,6 @@ var Grid = function (_a) {
94
92
  deselectCallback: getDeselectHandler(index),
95
93
  };
96
94
  };
97
- var showSelectCol = selectModel && selectModel.mode !== "row";
98
95
  var selectedSet = new Set();
99
96
  if (selectModel && selectModel.type === "multi") {
100
97
  selectModel.selected.forEach(function (value) { return selectedSet.add(value); });
@@ -106,7 +103,6 @@ var Grid = function (_a) {
106
103
  }
107
104
  var rowsAreSelectable = !!(selectModel && selectModel.mode !== "column");
108
105
  var getRowClickHandler = function (index) { return function (event) {
109
- event.preventDefault();
110
106
  if (!rowsAreSelectable) {
111
107
  return;
112
108
  }
@@ -122,27 +118,44 @@ var Grid = function (_a) {
122
118
  }
123
119
  return String(selectedSet.has(index));
124
120
  };
125
- // Once this component implements selection state, and if such interactivity is enabled, (conditionally) change the
126
- // aria role to "grid".
127
- // TODO: implement the above described features: conditionally changing aria role to grid
128
- return (_jsxs("div", { children: [filterState && filterModel && (_jsxs("div", { children: [_jsx(ToggleButton, { isActive: filterOptionsVisible, label: "".concat(filterOptionsVisible ? "Hide" : "Show ", " Filter Options"), onClick: handleToggleFilterOptions }), filterOptionsVisible && (_jsx(FilterOptionsTable, { filterState: filterState, setFilterState: filterModel.setTableFilterState }))] })), _jsxs("table", { className: classNames("table", {
129
- "table-hover": rowsAreSelectable,
130
- }), "aria-rowcount": filteredRows.length + 1, children: [_jsx("thead", { children: _jsxs("tr", { "aria-rowindex": 1, children: [showSelectCol && (_jsx(SelectAllHeaderCell, { selectType: selectModel.type, onClick: selectAllOnClick, selectionExists: selectionExists })), cols.map(function (_a, index) {
131
- var _b;
132
- var name = _a.name, label = _a.label, sortable = _a.sortable;
133
- var colSortModel = sortModel && sortable
134
- ? {
135
- sortOrder: ((_b = sortModel.sortColDef) === null || _b === void 0 ? void 0 : _b.name) === name
136
- ? sortModel.sortColDef.order
137
- : null,
138
- setSortOrder: function (order) {
139
- sortModel.setSortColDef(order && { name: name, order: order });
140
- },
141
- }
142
- : undefined;
143
- return (_jsx(ColHeaderCell, { label: label, sortModel: colSortModel, ariaColIndex: index + 1 + (showSelectCol ? 1 : 0) }, name));
144
- })] }) }), _jsx("tbody", { children: displayRows.map(function (row, index) { return (_jsxs("tr", { onClick: getRowClickHandler(row.origIndex), className: classNames({
145
- "table-active": selectedSet.has(row.origIndex),
146
- }), "aria-rowindex": index + 2, "data-rowindex": row.origIndex, "aria-selected": getAriaSelectedValue(row.origIndex), children: [showSelectCol && (_jsx("td", { children: _jsx(SelectionInput, { selected: selectedSet.has(row.origIndex), selectionInputModel: getSelectInputModel(row.origIndex, selectModel), selectCallback: getSelectHandler(row.origIndex) }) })), row.contents.map(function (value, index) { return (_jsx("td", { "aria-colindex": index + 1 + (showSelectCol ? 1 : 0), children: value }, index)); })] }, row.origIndex)); }) })] }), pagination && (_jsx(Pagination, { componentSize: pagination.componentSize || "medium", pageSizeOptions: pagination.pageSizeOptions, pageSizeIndex: pagination.pageSizeIndex, handleSetPageSizeIndex: pagination.setPageSizeIndex, handleSetPageNum: pagination.setCurrentPage, prePagingNumRows: sortedRows.length, maxPageButtons: pagination.maxPageButtons, currentPage: pagination.currentPage }))] }));
121
+ var getInputStrSubmitCallback = editModel &&
122
+ (function (origIndex) {
123
+ var indexSpecificCallback = editModel.getUpdateCallback(origIndex);
124
+ return function (inputStrs) {
125
+ var rowDef = inputStrsToRowDef(cols, inputStrs);
126
+ indexSpecificCallback(rowDef);
127
+ };
128
+ });
129
+ var unwrappedTableModel = useMemo(function () { return unwrapTableStyleModel(styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel); }, [styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel]);
130
+ var unwrappedAdditionalStyleModel = useMemo(function () {
131
+ return unwrapAdditionalComponentsStyleModel(styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel);
132
+ }, [styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel]);
133
+ return (_jsxs("div", { "data-testid": "rbdg-top-level-div", className: classNames(unwrappedAdditionalStyleModel.topLevelDiv), children: [filterState && filterModel && (_jsxs("div", { "data-testid": "rbdg-filter-inputs-div", className: classNames(unwrappedAdditionalStyleModel.filterInputsDiv), children: [_jsx(ToggleButton, { isActive: filterOptionsVisible, label: "".concat(filterOptionsVisible ? "Hide" : "Show ", " Filter Options"), onClick: handleToggleFilterOptions, classes: (_b = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _b === void 0 ? void 0 : _b.filterUiToggleButton }), filterOptionsVisible && (_jsx(FilterOptionsTable, { caption: filterModel.filterTableCaption, filterState: filterState, setFilterState: filterModel.setTableFilterState, styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel }))] })), _jsxs("div", { "data-testid": "rbdg-table-and-pagination-div", className: classNames(unwrappedAdditionalStyleModel.tableAndPaginationDiv), children: [_jsxs("table", { className: classNames("table", {
134
+ "table-hover": rowsAreSelectable,
135
+ }, unwrappedTableModel.table), "aria-rowcount": filteredRows.length + 1, children: [caption !== undefined && (_jsx("caption", { className: classNames(unwrappedTableModel.caption), children: caption })), _jsx("thead", { className: classNames(unwrappedTableModel.thead), children: _jsxs("tr", { "aria-rowindex": 1, className: classNames(unwrappedTableModel.theadTr), children: [showSelectCol && (_jsx(SelectAllHeaderCell, { selectType: selectModel.type, onClick: selectAllOnClick, selectionExists: selectionExists, additionalClasses: unwrappedTableModel.rowSelectColTh })), cols.map(function (_a, index) {
136
+ var _b;
137
+ var name = _a.name, label = _a.label, sortable = _a.sortable;
138
+ var colSortModel = sortModel && sortable
139
+ ? {
140
+ sortOrder: ((_b = sortModel.sortColDef) === null || _b === void 0 ? void 0 : _b.name) === name
141
+ ? sortModel.sortColDef.order
142
+ : null,
143
+ setSortOrder: function (order) {
144
+ sortModel.setSortColDef(order && { name: name, order: order });
145
+ },
146
+ }
147
+ : undefined;
148
+ return (_jsx(ColHeaderCell, { label: label, sortModel: colSortModel, ariaColIndex: index + 1 + (showSelectCol ? 1 : 0), additionalClasses: unwrappedTableModel.theadTh(index) }, name));
149
+ }), editModel && (_jsx("th", { "aria-colindex": cols.length + 1 + (showSelectCol ? 1 : 0), className: classNames(unwrappedTableModel.editColTh), children: "Edit Controls" }))] }) }), _jsx("tbody", { className: classNames(unwrappedTableModel.tbody), children: displayRows.map(function (row, index) {
150
+ return (_jsx(EditableRow, { onClick: getRowClickHandler(row.origIndex), className: classNames({
151
+ "table-active": selectedSet.has(row.origIndex),
152
+ }, unwrappedTableModel.tbodyTr(row.origIndex, index)), "aria-rowindex": index + 2, dataRowIndex: row.origIndex, "aria-selected": getAriaSelectedValue(row.origIndex), ariaColIndexOffset: ariaColIndexOffset, cellData: row.contents, updateCallback: getInputStrSubmitCallback &&
153
+ getInputStrSubmitCallback(row.origIndex), deleteCallback: (editModel === null || editModel === void 0 ? void 0 : editModel.getDeleteCallback) &&
154
+ editModel.getDeleteCallback(row.origIndex), dataCellClasses: function (colIndex) {
155
+ return unwrappedTableModel.tbodyTd(row.origIndex, index, colIndex);
156
+ }, dataCellInputClasses: function (colIndex) {
157
+ return unwrappedTableModel.tbodyTdInput(row.origIndex, index, colIndex);
158
+ }, editCellClasses: unwrappedTableModel.editColTd(row.origIndex, index), saveButtonClasses: unwrappedTableModel.editSaveButton(row.origIndex, index), deleteButtonClasses: unwrappedTableModel.editDeleteButton(row.origIndex, index), startButtonClasses: unwrappedTableModel.editStartButton(row.origIndex, index), cancelButtonClasses: unwrappedTableModel.editCancelButton(row.origIndex, index), children: showSelectCol && (_jsx("td", { className: classNames(unwrappedTableModel.rowSelectColTd(row.origIndex, index)), "aria-colindex": 1, children: _jsx(SelectionInput, { selected: selectedSet.has(row.origIndex), selectionInputModel: getSelectInputModel(row.origIndex, selectModel), selectCallback: getSelectHandler(row.origIndex), additionalClasses: unwrappedTableModel.rowSelectInput(row.origIndex, index) }) })) }, row.origIndex));
159
+ }) })] }), pagination && (_jsx(Pagination, { componentSize: pagination.componentSize || "medium", pageSizeOptions: pagination.pageSizeOptions, pageSizeIndex: pagination.pageSizeIndex, handleSetPageSizeIndex: pagination.setPageSizeIndex, handleSetPageNum: pagination.setCurrentPage, prePagingNumRows: sortedRows.length, maxPageButtons: pagination.maxPageButtons, currentPage: pagination.currentPage, pageSelectorJustifyContent: pagination.pageSelectorJustifyContent, pageSelectorAriaLabel: pagination.pageSelectorAriaLabel }))] })] }));
147
160
  };
148
161
  export default Grid;
package/ToggleButton.d.ts CHANGED
@@ -3,6 +3,7 @@ export interface ToggleButtonProps {
3
3
  isActive: boolean;
4
4
  label: string;
5
5
  onClick: () => void;
6
+ classes?: string[];
6
7
  }
7
8
  declare const ToggleButton: FC<ToggleButtonProps>;
8
9
  export default ToggleButton;
package/ToggleButton.js CHANGED
@@ -2,11 +2,13 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import classNames from "classnames";
4
4
  var ToggleButton = function (_a) {
5
- var isActive = _a.isActive, label = _a.label, onClick = _a.onClick;
6
- var baseClasses = ["btn", "btn-primary"];
5
+ var isActive = _a.isActive, label = _a.label, onClick = _a.onClick, classes = _a.classes;
6
+ var baseClasses = ["btn"];
7
7
  var variableClasses = {
8
8
  active: isActive,
9
9
  };
10
- return (_jsx("button", { type: "button", className: classNames(baseClasses, variableClasses), "aria-pressed": isActive, onClick: onClick, children: label }));
10
+ return (_jsx("button", { type: "button", className: classNames(baseClasses, variableClasses, classes, {
11
+ "btn-primary": !(classes && classes.length > 0),
12
+ }), "aria-pressed": isActive, onClick: onClick, children: label }));
11
13
  };
12
14
  export default ToggleButton;
@@ -0,0 +1,16 @@
1
+ import { FC } from "react";
2
+ export interface EditControlsCellProps {
3
+ ariaColIndex: number;
4
+ beginEditingCallback: () => void;
5
+ cancelEditingCallback: () => void;
6
+ isEditing: boolean;
7
+ saveCallback: () => void;
8
+ deleteCallback?: () => void;
9
+ editControlsCellClasses: string[];
10
+ saveButtonClasses: string[];
11
+ deleteButtonClasses: string[];
12
+ startButtonClasses: string[];
13
+ cancelButtonClasses: string[];
14
+ }
15
+ declare const EditControlsCell: FC<EditControlsCellProps>;
16
+ export default EditControlsCell;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ var stopPropagationWrapper = function (fn) { return function (event) {
4
+ event.stopPropagation();
5
+ fn();
6
+ }; };
7
+ var EditControlsCell = function (_a) {
8
+ var ariaColIndex = _a.ariaColIndex, beginEditingCallback = _a.beginEditingCallback, cancelEditingCallback = _a.cancelEditingCallback, isEditing = _a.isEditing, saveCallback = _a.saveCallback, deleteCallback = _a.deleteCallback, editControlsCellClasses = _a.editControlsCellClasses, saveButtonClasses = _a.saveButtonClasses, deleteButtonClasses = _a.deleteButtonClasses, startButtonClasses = _a.startButtonClasses, cancelButtonClasses = _a.cancelButtonClasses;
9
+ return (_jsx("td", { "aria-colindex": ariaColIndex, className: classNames(editControlsCellClasses), children: _jsx("div", { className: "hstack gap-2", children: isEditing ? (_jsxs(_Fragment, { children: [_jsx("button", { className: classNames("btn", cancelButtonClasses.length === 0
10
+ ? ["btn-secondary"]
11
+ : cancelButtonClasses), onClick: stopPropagationWrapper(cancelEditingCallback), children: "Cancel" }), _jsx("button", { className: classNames("btn", saveButtonClasses.length === 0
12
+ ? ["btn-primary"]
13
+ : saveButtonClasses), onClick: stopPropagationWrapper(saveCallback), children: "Save" })] })) : (_jsxs(_Fragment, { children: [deleteCallback && (_jsx("button", { className: classNames("btn", deleteButtonClasses.length === 0
14
+ ? ["btn-primary"]
15
+ : deleteButtonClasses), onClick: stopPropagationWrapper(deleteCallback), children: "Delete" })), _jsx("button", { className: classNames("btn", startButtonClasses.length === 0
16
+ ? ["btn-primary"]
17
+ : startButtonClasses), onClick: stopPropagationWrapper(beginEditingCallback), children: "Edit" })] })) }) }));
18
+ };
19
+ export default EditControlsCell;
@@ -0,0 +1,20 @@
1
+ import { FC, ReactNode } from "react";
2
+ import React from "react";
3
+ import { CellData } from "./types";
4
+ export type EditableRowProps = Pick<React.ComponentProps<"tr">, "onClick" | "className" | "aria-rowindex" | "aria-selected"> & {
5
+ ariaColIndexOffset: number;
6
+ dataRowIndex: number;
7
+ children: ReactNode;
8
+ cellData: CellData[];
9
+ updateCallback?: (values: string[]) => void;
10
+ deleteCallback?: () => void;
11
+ dataCellClasses: (colIndex: number) => string[];
12
+ dataCellInputClasses: (colIndex: number) => string[];
13
+ editCellClasses: string[];
14
+ deleteButtonClasses: string[];
15
+ cancelButtonClasses: string[];
16
+ startButtonClasses: string[];
17
+ saveButtonClasses: string[];
18
+ };
19
+ declare const EditableRow: FC<EditableRowProps>;
20
+ export default EditableRow;
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef, useState } from "react";
4
+ import { dateToDatetimeInputStr, dateToInputStr } from "../util/datetime";
5
+ import EditControlsCell from "./EditControlsCell";
6
+ import classNames from "classnames";
7
+ var initValueToFormValue = function (value, type) {
8
+ switch (type) {
9
+ case "date":
10
+ return dateToInputStr(value);
11
+ case "datetime":
12
+ return dateToDatetimeInputStr(value);
13
+ case "number":
14
+ return String(value);
15
+ default:
16
+ return value;
17
+ }
18
+ };
19
+ var colDataTypeToInputType = function (colDataType) {
20
+ switch (colDataType) {
21
+ case "date":
22
+ return "date";
23
+ case "datetime":
24
+ return "datetime-local";
25
+ case "number":
26
+ return "number";
27
+ default:
28
+ return "text";
29
+ }
30
+ };
31
+ var EditableRow = function (_a) {
32
+ var ariaColIndexOffset = _a.ariaColIndexOffset, cellData = _a.cellData, children = _a.children, updateCallback = _a.updateCallback, deleteCallback = _a.deleteCallback, onClick = _a.onClick, className = _a.className, ariaRowIndex = _a["aria-rowindex"], ariaSelected = _a["aria-selected"], dataRowIndex = _a.dataRowIndex, dataCellClasses = _a.dataCellClasses, dataCellInputClasses = _a.dataCellInputClasses, editCellClasses = _a.editCellClasses, saveButtonClasses = _a.saveButtonClasses, startButtonClasses = _a.startButtonClasses, cancelButtonClasses = _a.cancelButtonClasses, deleteButtonClasses = _a.deleteButtonClasses;
33
+ var trRef = useRef(null);
34
+ var _b = useState(false), isEditing = _b[0], setIsEditing = _b[1];
35
+ var handleSave = function () {
36
+ var failedValidationFound = false;
37
+ var formValues = [];
38
+ for (var _i = 0, _a = Array.from(trRef.current.children); _i < _a.length; _i++) {
39
+ var rowChild = _a[_i];
40
+ if (!(rowChild instanceof HTMLTableCellElement)) {
41
+ console.warn("Found non-td element inside EditableRow");
42
+ continue;
43
+ }
44
+ for (var _b = 0, _c = Array.from(rowChild.children); _b < _c.length; _b++) {
45
+ var cellChild = _c[_b];
46
+ if (!(cellChild instanceof HTMLInputElement) ||
47
+ cellChild.type === "checkbox" ||
48
+ cellChild.type === "radio") {
49
+ continue;
50
+ }
51
+ formValues.push(cellChild.value);
52
+ failedValidationFound =
53
+ !cellChild.reportValidity() || failedValidationFound;
54
+ break; // Each cell should only have one input element
55
+ }
56
+ }
57
+ if (!failedValidationFound) {
58
+ updateCallback(formValues);
59
+ setIsEditing(false);
60
+ }
61
+ };
62
+ return (_jsxs("tr", { ref: trRef, onClick: onClick, className: className, "aria-rowindex": ariaRowIndex, "aria-selected": ariaSelected, "data-rowindex": dataRowIndex, children: [children, cellData.map(function (_a, index) {
63
+ var type = _a.type, value = _a.value, formattedValue = _a.formattedValue, label = _a.label;
64
+ return (_jsx("td", { "aria-colindex": index + ariaColIndexOffset + 1, className: classNames(dataCellClasses(index)), children: isEditing && !!updateCallback ? (_jsx("input", { "aria-label": label, name: "editable-cell-input-".concat(dataRowIndex, "-").concat(index), className: classNames("form-control", dataCellInputClasses(index)), type: colDataTypeToInputType(type), defaultValue: initValueToFormValue(value, type), required: type !== "string" })) : (formattedValue) }, index));
65
+ }), updateCallback && (_jsx(EditControlsCell, { ariaColIndex: ariaColIndexOffset + cellData.length + 1, beginEditingCallback: function () { return setIsEditing(true); }, cancelEditingCallback: function () { return setIsEditing(false); }, isEditing: isEditing, saveCallback: handleSave, deleteCallback: deleteCallback, editControlsCellClasses: editCellClasses, startButtonClasses: startButtonClasses, deleteButtonClasses: deleteButtonClasses, cancelButtonClasses: cancelButtonClasses, saveButtonClasses: saveButtonClasses }))] }));
66
+ };
67
+ export default EditableRow;
@@ -0,0 +1,3 @@
1
+ import { ColDef, RowDef } from "../types";
2
+ declare const inputStrsToRowDef: (cols: ColDef[], inputStrs: string[]) => RowDef;
3
+ export default inputStrsToRowDef;
@@ -0,0 +1,18 @@
1
+ var inputStrsToRowDef = function (cols, inputStrs) {
2
+ var newRow = {};
3
+ inputStrs.forEach(function (value, index) {
4
+ var col = cols[index];
5
+ switch (col.type) {
6
+ case "string":
7
+ newRow[col.name] = value;
8
+ return;
9
+ case "number":
10
+ newRow[col.name] = Number(value);
11
+ return;
12
+ default:
13
+ newRow[col.name] = new Date(value);
14
+ }
15
+ });
16
+ return newRow;
17
+ };
18
+ export default inputStrsToRowDef;
@@ -0,0 +1,14 @@
1
+ import { ColDataType, ColDataTypeStrings, RowDef } from "../types";
2
+ export interface CellData {
3
+ fieldName: string;
4
+ value: ColDataType;
5
+ type: ColDataTypeStrings;
6
+ ariaColIndex: number;
7
+ formattedValue: string;
8
+ label: string;
9
+ }
10
+ export type UpdateCallbackGenerator = (origIndex: number) => (rowDef: RowDef) => void;
11
+ export interface EditModel {
12
+ getUpdateCallback: UpdateCallbackGenerator;
13
+ getDeleteCallback?: (origIndex: number) => () => void;
14
+ }
@@ -1,10 +1,16 @@
1
1
  import { FC } from "react";
2
2
  import { DateFormFilterState } from "./types";
3
- interface DateFilterRowProps {
3
+ import { CommonFilterRowStyleProps } from "./FilterRow";
4
+ export type DateFilterRowProps = {
5
+ ariaRowIndex: number;
4
6
  includeTime: boolean;
5
7
  columnLabel: string;
6
8
  filterState: DateFormFilterState;
7
9
  setFilterState: (filterState: DateFormFilterState) => void;
8
- }
10
+ schemeSelectClasses: string[];
11
+ enableInputClasses: string[];
12
+ startDateInputClasses: string[];
13
+ endDateInputClasses: string[];
14
+ } & CommonFilterRowStyleProps;
9
15
  declare const DateFilterRow: FC<DateFilterRowProps>;
10
16
  export default DateFilterRow;
@@ -0,0 +1,46 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useMemo } from "react";
14
+ import { dateFilterSchemeNames, } from "./types";
15
+ import { nanoid } from "nanoid/non-secure";
16
+ import FilterRow from "./FilterRow";
17
+ import classNames from "classnames";
18
+ var DateFilterRow = function (_a) {
19
+ var ariaRowIndex = _a.ariaRowIndex, includeTime = _a.includeTime, columnLabel = _a.columnLabel, filterState = _a.filterState, setFilterState = _a.setFilterState, schemeSelectClasses = _a.schemeSelectClasses, enableInputClasses = _a.enableInputClasses, startDateInputClasses = _a.startDateInputClasses, endDateInputClasses = _a.endDateInputClasses, tdClasses = _a.tdClasses, trClasses = _a.trClasses;
20
+ var handleOpChange = function (_a) {
21
+ var target = _a.target;
22
+ setFilterState(__assign(__assign({}, filterState), { scheme: target.value }));
23
+ };
24
+ var handleEnabledChange = function (_a) {
25
+ var target = _a.target;
26
+ setFilterState(__assign(__assign({}, filterState), { enabled: target.checked }));
27
+ };
28
+ var handleStartValueChange = function (_a) {
29
+ var target = _a.target;
30
+ setFilterState(__assign(__assign({}, filterState), { startDate: target.value }));
31
+ };
32
+ var handleEndValueChange = function (_a) {
33
+ var target = _a.target;
34
+ setFilterState(__assign(__assign({}, filterState), { endDate: target.value }));
35
+ };
36
+ var enabled = filterState.enabled, scheme = filterState.scheme, startDate = filterState.startDate, endDate = filterState.endDate;
37
+ var inputType = includeTime ? "datetime-local" : "date";
38
+ var inputId = useMemo(function () { return nanoid(); }, []);
39
+ var startDateInputId = "$startDate-".concat(inputId);
40
+ var endDateInputId = "$endDate-".concat(inputId);
41
+ var startDateInputLabel = "".concat(columnLabel, " Column Filter Start Date");
42
+ var endDateInputLabel = "".concat(columnLabel, " Column Filter End Date");
43
+ var 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", startDateInputClasses), 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("form-control", endDateInputClasses), type: inputType, required: enabled, disabled: !enabled, value: endDate, onChange: handleEndValueChange, "aria-label": endDateInputLabel })] }))] }));
44
+ 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 }));
45
+ };
46
+ export default DateFilterRow;
@@ -1,8 +1,11 @@
1
1
  import { FC } from "react";
2
- import { EditableTableFilterState, TableFilterState } from "../types";
2
+ import { EditableTableFilterState, TableFilterState } from "./types";
3
+ import { FilterInputTableStyleModel } from "../styling/types";
3
4
  interface FilterOptionsTableProps {
4
5
  filterState: TableFilterState;
5
6
  setFilterState: (filterState: EditableTableFilterState) => void;
7
+ caption?: string;
8
+ styleModel?: FilterInputTableStyleModel;
6
9
  }
7
10
  declare const FilterOptionsTable: FC<FilterOptionsTableProps>;
8
11
  export default FilterOptionsTable;
@@ -9,12 +9,23 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
12
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState } from "react";
22
+ import { useMemo, useState } from "react";
14
23
  import StringFilterRow from "./StringFilterRow";
15
24
  import NumberFilterRow from "./NumberFilterRow";
16
25
  import useFormStateFromTableFilterState from "./useFormStateFromTableFilterState";
17
26
  import DateFilterRow from "./DateFilterRow";
27
+ import classNames from "classnames";
28
+ import { unwrapFilterInputTableStyleModel } from "../styling/styleModelUnwrappers";
18
29
  var convertFilterFormStateToEditableState = function (filterFormState) {
19
30
  return Object.keys(filterFormState).reduce(function (editableState, colName) {
20
31
  var rowFilterFormState = filterFormState[colName];
@@ -62,11 +73,12 @@ var convertFilterFormStateToEditableState = function (filterFormState) {
62
73
  }, {});
63
74
  };
64
75
  var FilterOptionsTable = function (_a) {
65
- var filterState = _a.filterState, setFilterState = _a.setFilterState;
76
+ var filterState = _a.filterState, setFilterState = _a.setFilterState, caption = _a.caption, styleModel = _a.styleModel;
66
77
  var formFilterState = useFormStateFromTableFilterState(filterState);
67
78
  var _b = useState(formFilterState), formState = _b[0], setFormState = _b[1];
79
+ var unwrappedStyleModel = useMemo(function () { return unwrapFilterInputTableStyleModel(styleModel); }, [styleModel]);
68
80
  var getRows = function () {
69
- return Object.keys(formState).map(function (colName) {
81
+ return Object.keys(formState).map(function (colName, index) {
70
82
  function getColStateSetter(colName) {
71
83
  return function (rowState) {
72
84
  var _a;
@@ -77,14 +89,20 @@ var FilterOptionsTable = function (_a) {
77
89
  var colFilterState = formState[colName];
78
90
  switch (colFilterState.type) {
79
91
  case "string": {
80
- return (_jsx(StringFilterRow, { columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName) }, colName));
92
+ return (_jsx(StringFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: unwrappedStyleModel.schemeSelectionInput(index), enableInputClasses: unwrappedStyleModel.enablementInput(index), searchStringInputClasses: unwrappedStyleModel.searchStringInput(index), trClasses: unwrappedStyleModel.tbodyTr(index), tdClasses: function (colIndex) {
93
+ return unwrappedStyleModel.tbodyTd(index, colIndex);
94
+ } }, colName));
81
95
  }
82
96
  case "number": {
83
- return (_jsx(NumberFilterRow, { columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName) }, colName));
97
+ return (_jsx(NumberFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: unwrappedStyleModel.schemeSelectionInput(index), enableInputClasses: unwrappedStyleModel.enablementInput(index), numberInputClasses: unwrappedStyleModel.numberInput(index), trClasses: unwrappedStyleModel.tbodyTr(index), tdClasses: function (colIndex) {
98
+ return unwrappedStyleModel.tbodyTd(index, colIndex);
99
+ } }, colName));
84
100
  }
85
101
  default: {
86
102
  // date or datetime
87
- return (_jsx(DateFilterRow, { includeTime: colFilterState.type === "datetime", columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName) }, colName));
103
+ return (_jsx(DateFilterRow, { ariaRowIndex: index + 2, includeTime: colFilterState.type === "datetime", columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: unwrappedStyleModel.schemeSelectionInput(index), enableInputClasses: unwrappedStyleModel.enablementInput(index), startDateInputClasses: unwrappedStyleModel.startDateInput(index), endDateInputClasses: unwrappedStyleModel.endDateInput(index), trClasses: unwrappedStyleModel.tbodyTr(index), tdClasses: function (colIndex) {
104
+ return unwrappedStyleModel.tbodyTd(index, colIndex);
105
+ } }, colName));
88
106
  }
89
107
  }
90
108
  });
@@ -94,6 +112,7 @@ var FilterOptionsTable = function (_a) {
94
112
  var editableTableFilterState = convertFilterFormStateToEditableState(formState);
95
113
  setFilterState(editableTableFilterState);
96
114
  };
97
- return (_jsxs("form", { onSubmit: onSubmit, children: [_jsxs("table", { className: "table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Enabled" }), _jsx("th", { children: "Column" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Operator" }), _jsx("th", { children: "Value" })] }) }), _jsx("tbody", { children: getRows() })] }), _jsx("button", { className: "btn btn-secondary", type: "submit", children: "Submit" })] }));
115
+ // TODO: consider using an accordion to show and hide this component
116
+ return (_jsxs("form", { onSubmit: onSubmit, children: [_jsxs("table", { className: classNames.apply(void 0, __spreadArray(["table"], unwrappedStyleModel.table, false)), children: [caption && (_jsx("caption", { className: classNames(unwrappedStyleModel.caption), children: caption })), _jsx("thead", { className: classNames.apply(void 0, unwrappedStyleModel.thead), children: _jsx("tr", { className: classNames.apply(void 0, unwrappedStyleModel.theadTr), children: ["Enabled", "Column", "Type", "Operator", "Value"].map(function (colName, index) { return (_jsx("th", { className: classNames.apply(void 0, unwrappedStyleModel.theadTh(index)), children: colName }, index)); }) }) }), _jsx("tbody", { className: classNames.apply(void 0, unwrappedStyleModel.tbody), children: getRows() })] }), _jsx("button", { className: classNames("btn", { "btn-secondary": unwrappedStyleModel.submitButton.length === 0 }, unwrappedStyleModel.submitButton), type: "submit", children: "Submit" })] }));
98
117
  };
99
118
  export default FilterOptionsTable;
@@ -0,0 +1,19 @@
1
+ import { ChangeEventHandler, ReactNode } from "react";
2
+ export interface FilterRowProps<FilterScheme extends string> {
3
+ ariaRowIndex: number;
4
+ columnLabel: string;
5
+ typeLabel: string;
6
+ enabled: boolean;
7
+ enabledChangeHandler: ChangeEventHandler<HTMLInputElement>;
8
+ currentScheme: string;
9
+ handleSchemeChange: ChangeEventHandler<HTMLSelectElement>;
10
+ schemesToLabels: Record<FilterScheme, string>;
11
+ searchStringInputCellContents: ReactNode;
12
+ trClasses: string[];
13
+ tdClasses: (colIndex: number) => string[];
14
+ inputClasses: string[];
15
+ selectClasses: string[];
16
+ }
17
+ export type CommonFilterRowStyleProps = Pick<FilterRowProps<string>, "trClasses" | "tdClasses">;
18
+ export declare function FilterRow<FilterScheme extends string = string>(props: FilterRowProps<FilterScheme>): ReactNode;
19
+ export default FilterRow;
@@ -0,0 +1,18 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import classNames from "classnames";
12
+ export function FilterRow(props) {
13
+ var ariaRowIndex = props.ariaRowIndex, columnLabel = props.columnLabel, typeLabel = props.typeLabel, enabled = props.enabled, enabledChangeHandler = props.enabledChangeHandler, currentScheme = props.currentScheme, handleSchemeChange = props.handleSchemeChange, schemesToLabels = props.schemesToLabels, searchStringInputCellContents = props.searchStringInputCellContents, trClasses = props.trClasses, tdClasses = props.tdClasses, inputClasses = props.inputClasses, selectClasses = props.selectClasses;
14
+ var checkboxLabel = "".concat(columnLabel, " Column Filter Toggle");
15
+ var opSelectLabel = "".concat(columnLabel, " Column Filter Operator Selection");
16
+ 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.apply(void 0, __spreadArray(["form-select"], selectClasses, false)), value: currentScheme, onChange: handleSchemeChange, children: Object.keys(schemesToLabels).map(function (scheme) { return (_jsx("option", { value: scheme, children: schemesToLabels[scheme] }, scheme)); }) }) }), _jsx("td", { className: classNames(tdClasses(4)), "aria-colindex": 5, children: searchStringInputCellContents })] }));
17
+ }
18
+ export default FilterRow;