@absreim/react-bootstrap-data-grid 2.7.0 → 3.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/Grid.js +1 -4
- package/InternalGrid.d.ts +0 -2
- package/InternalGrid.js +32 -30
- package/editing/EditControlsCell.d.ts +5 -5
- package/editing/EditControlsCell.js +1 -9
- package/editing/EditableRow.d.ts +7 -7
- package/editing/EditableRow.js +1 -1
- package/export/ExportForm.d.ts +1 -0
- package/export/ExportForm.js +3 -3
- package/filtering/DateFilterRow.d.ts +4 -4
- package/filtering/DateFilterRow.js +1 -1
- package/filtering/FilterOptionsTable.d.ts +1 -0
- package/filtering/FilterOptionsTable.js +17 -20
- package/filtering/FilterRow.d.ts +4 -4
- package/filtering/FilterRow.js +1 -10
- package/filtering/NumberFilterRow.d.ts +3 -3
- package/filtering/NumberFilterRow.js +1 -1
- package/filtering/StringFilterRow.d.ts +3 -3
- package/filtering/StringFilterRow.js +1 -1
- package/main/BodyRows.d.ts +2 -2
- package/main/BodyRows.js +21 -5
- package/package.json +1 -1
- package/pagination/Pagination.d.ts +1 -1
- package/pagination/Pagination.js +6 -3
- package/pagination/types.d.ts +1 -1
- package/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +2 -2
- package/selection/SelectAllHeaderCell.d.ts +1 -1
- package/selection/SelectAllHeaderCell.js +2 -4
- package/selection/SelectionInput.d.ts +1 -1
- package/styling/types.d.ts +20 -21
- package/toolbar/ToolbarContainer.d.ts +2 -2
- package/toolbar/ToolbarContainer.js +11 -7
- package/toolbar/types.d.ts +8 -0
- package/toolbar/useInterfaces.d.ts +2 -8
- package/toolbar/useInterfaces.js +9 -6
- package/types.d.ts +5 -6
- package/pipeline/useUnwrappedGridStyles.d.ts +0 -7
- package/pipeline/useUnwrappedGridStyles.js +0 -17
- package/styling/styleModelUnwrappers.d.ts +0 -4
- package/styling/styleModelUnwrappers.js +0 -58
package/Grid.js
CHANGED
|
@@ -5,7 +5,6 @@ import InternalGrid from "./InternalGrid";
|
|
|
5
5
|
import ColHeaderCell from "./main/ColHeaderCell";
|
|
6
6
|
import useCombinedPipeline from "./pipeline/useCombinedPipeline";
|
|
7
7
|
import useGridSelectionFns from "./pipeline/useGridSelectionFns";
|
|
8
|
-
import useUnwrappedGridStyles from "./pipeline/useUnwrappedGridStyles";
|
|
9
8
|
import useGetInputStrSubmitCallback from "./pipeline/useGetInputStrSubmitCallback";
|
|
10
9
|
import useAugFormattedRows from "./pipeline/useAugFormattedRows";
|
|
11
10
|
import BodyRows from "./main/BodyRows";
|
|
@@ -21,7 +20,6 @@ var Grid = function (props) {
|
|
|
21
20
|
});
|
|
22
21
|
var _a = combinedPipelineOutput.sortedRowsOutput, sortColDef = _a.sortColDef, setSortColDef = _a.setSortColDef, sortingEnabled = _a.sortingEnabled, showSelectCol = combinedPipelineOutput.showSelectCol, displayRows = combinedPipelineOutput.displayRows;
|
|
23
22
|
var gridSelectionFns = useGridSelectionFns(selectModel, rows);
|
|
24
|
-
var unwrappedStyles = useUnwrappedGridStyles(styleModel);
|
|
25
23
|
var getInputStrSubmitCallback = useGetInputStrSubmitCallback(editModel, cols);
|
|
26
24
|
var colNameToWidth = useMemo(function () {
|
|
27
25
|
var map = {};
|
|
@@ -46,11 +44,10 @@ var Grid = function (props) {
|
|
|
46
44
|
return (_jsx(ColHeaderCell, { label: label, sortModel: colSortModel, ariaColIndex: index + 1 + (showSelectCol ? 1 : 0), additionalClasses: ((_b = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _b === void 0 ? void 0 : _b.theadTh) &&
|
|
47
45
|
styleModel.mainTableStyleModel.theadTh(index), width: width }, name));
|
|
48
46
|
});
|
|
49
|
-
var bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel,
|
|
47
|
+
var bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, tableStyleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel }));
|
|
50
48
|
return (_jsx(InternalGrid, { gridProps: props, hooks: {
|
|
51
49
|
pipelineOutput: combinedPipelineOutput,
|
|
52
50
|
selectFns: gridSelectionFns,
|
|
53
|
-
unwrappedStyles: unwrappedStyles,
|
|
54
51
|
}, slots: { colHeaderCells: colHeaderCells, bodyRows: bodyRows } }));
|
|
55
52
|
};
|
|
56
53
|
export default Grid;
|
package/InternalGrid.d.ts
CHANGED
|
@@ -2,13 +2,11 @@ import { FC, ReactNode } from "react";
|
|
|
2
2
|
import { BaseGridProps } from "./types";
|
|
3
3
|
import { UseCombinedPipelineHook } from "./pipeline/useCombinedPipeline";
|
|
4
4
|
import { UseGridSelectionFnsHook } from "./pipeline/useGridSelectionFns";
|
|
5
|
-
import { UseUnwrappedGridStylesHook } from "./pipeline/useUnwrappedGridStyles";
|
|
6
5
|
export interface InternalGridProps {
|
|
7
6
|
gridProps: BaseGridProps;
|
|
8
7
|
hooks: {
|
|
9
8
|
selectFns: UseGridSelectionFnsHook;
|
|
10
9
|
pipelineOutput: UseCombinedPipelineHook;
|
|
11
|
-
unwrappedStyles: UseUnwrappedGridStylesHook;
|
|
12
10
|
};
|
|
13
11
|
slots: {
|
|
14
12
|
colHeaderCells: ReactNode;
|
package/InternalGrid.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
3
|
-
import { useMemo
|
|
4
|
-
import ToggleButton from "./main/ToggleButton";
|
|
5
|
-
import FilterOptionsTable from "./filtering/FilterOptionsTable";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
6
4
|
import SelectAllHeaderCell from "./selection/SelectAllHeaderCell";
|
|
7
5
|
import Pagination from "./pagination/Pagination";
|
|
8
6
|
import classNames from "classnames";
|
|
@@ -11,47 +9,51 @@ import ToolbarContainer from "./toolbar/ToolbarContainer";
|
|
|
11
9
|
import useExportFn from "./export/useExportFn";
|
|
12
10
|
import getWidthStyle from "./util/getWidthStyle";
|
|
13
11
|
var InternalGrid = function (_a) {
|
|
14
|
-
var _b;
|
|
15
|
-
var
|
|
16
|
-
var normalizedTableFilterModel = pipelineOutput.normalizedTableFilterModel, filteredRows = pipelineOutput.filteredRows, filterState = pipelineOutput.filterState, sortedRows = pipelineOutput.sortedRowsOutput.sortedRows,
|
|
17
|
-
var _g = useState(false), filterOptionsVisible = _g[0], setFilterOptionsVisible = _g[1];
|
|
12
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
13
|
+
var _o = _a.gridProps, rows = _o.rows, cols = _o.cols, pagination = _o.pagination, filterModel = _o.filterModel, selectModel = _o.selectModel, editModel = _o.editModel, caption = _o.caption, styleModel = _o.styleModel, displayMode = _o.displayMode, allowExport = _o.allowExport, _p = _a.hooks, pipelineOutput = _p.pipelineOutput, selectFns = _p.selectFns, _q = _a.slots, colHeaderCells = _q.colHeaderCells, bodyRows = _q.bodyRows, prefixHeader = _q.prefixHeader, classes = _a.classes;
|
|
14
|
+
var normalizedTableFilterModel = pipelineOutput.normalizedTableFilterModel, filteredRows = pipelineOutput.filteredRows, filterState = pipelineOutput.filterState, sortedRows = pipelineOutput.sortedRowsOutput.sortedRows, _r = pipelineOutput.currentPageRowsOutput, paginatedRows = _r.paginatedRows, normalizedModel = _r.normalizedModel, showSelectCol = pipelineOutput.showSelectCol;
|
|
18
15
|
var exportFnInfo = useExportFn({
|
|
19
16
|
rows: rows,
|
|
20
17
|
cols: cols,
|
|
21
18
|
filteredRows: filterModel && filteredRows,
|
|
22
19
|
currentPageRows: pagination && paginatedRows,
|
|
23
20
|
});
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
var showToolbar = filterModel || allowExport;
|
|
22
|
+
var toolbarPropGen = useMemo(function () { return function (closeUiCallback) {
|
|
23
|
+
return {
|
|
24
|
+
filtering: filterState && filterModel && normalizedTableFilterModel
|
|
25
|
+
? {
|
|
26
|
+
filterState: filterState,
|
|
27
|
+
setFilterState: normalizedTableFilterModel.setTableFilterState,
|
|
28
|
+
caption: filterModel.filterTableCaption,
|
|
29
|
+
styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel,
|
|
30
|
+
closeFormCallback: closeUiCallback,
|
|
31
|
+
}
|
|
32
|
+
: undefined,
|
|
33
|
+
exporting: allowExport
|
|
34
|
+
? {
|
|
35
|
+
exportFnInfo: exportFnInfo,
|
|
36
|
+
styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.exportFormStyleModel,
|
|
37
|
+
closeCallback: closeUiCallback,
|
|
38
|
+
}
|
|
39
|
+
: undefined,
|
|
40
|
+
};
|
|
41
|
+
}; }, [
|
|
42
|
+
allowExport,
|
|
37
43
|
exportFnInfo,
|
|
38
44
|
filterModel,
|
|
39
45
|
filterState,
|
|
40
46
|
normalizedTableFilterModel,
|
|
41
47
|
styleModel === null || styleModel === void 0 ? void 0 : styleModel.exportFormStyleModel,
|
|
42
48
|
styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel,
|
|
43
|
-
useToolbar,
|
|
44
49
|
]);
|
|
45
|
-
var toolbarInterfaces = useInterfaces(
|
|
46
|
-
var handleToggleFilterOptions = function () {
|
|
47
|
-
setFilterOptionsVisible(!filterOptionsVisible);
|
|
48
|
-
};
|
|
50
|
+
var toolbarInterfaces = useInterfaces(toolbarPropGen);
|
|
49
51
|
var rowsAreSelectable = selectFns.rowsAreSelectable, selectionInfo = selectFns.selectionInfo, selectAllOnClick = selectFns.selectAllOnClick;
|
|
50
|
-
var
|
|
51
|
-
var mainTable = (_jsxs("table", { className: classNames("table", {
|
|
52
|
+
var mainTable = (_jsxs("table", { className: classNames({
|
|
52
53
|
"table-hover": rowsAreSelectable,
|
|
53
54
|
"d-block": displayMode === "block",
|
|
54
|
-
},
|
|
55
|
-
return (_jsxs("div", { "data-testid": "rbdg-top-level-div", className: classNames(
|
|
55
|
+
}, ((_b = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _b === void 0 ? void 0 : _b.table) || "table"), "aria-rowcount": filteredRows.length + 1, children: [caption !== undefined && (_jsx("caption", { className: classNames((_c = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _c === void 0 ? void 0 : _c.caption), children: caption })), _jsx("thead", { className: classNames((_d = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _d === void 0 ? void 0 : _d.thead), children: _jsxs("tr", { "aria-rowindex": 1, className: classNames((_e = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _e === void 0 ? void 0 : _e.theadTr, (classes === null || classes === void 0 ? void 0 : classes.headerRow) || []), children: [prefixHeader, showSelectCol && (_jsx(SelectAllHeaderCell, { style: getWidthStyle(selectModel === null || selectModel === void 0 ? void 0 : selectModel.selectColWidth), selectionInfo: selectionInfo, onClick: selectAllOnClick, totalRows: rows.length, customClasses: (_f = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _f === void 0 ? void 0 : _f.rowSelectColTh, colIndexOffset: prefixHeader ? 1 : 0 })), colHeaderCells, editModel && (_jsx("th", { "aria-colindex": cols.length + 1 + (showSelectCol ? 1 : 0), className: classNames((_g = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _g === void 0 ? void 0 : _g.editColTh), style: getWidthStyle(editModel === null || editModel === void 0 ? void 0 : editModel.editColWidth), children: "Edit Controls" }))] }) }), _jsx("tbody", { className: classNames(classNames((_h = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _h === void 0 ? void 0 : _h.tbody)), children: bodyRows })] }));
|
|
56
|
+
return (_jsxs("div", { "data-testid": "rbdg-top-level-div", className: classNames((_j = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _j === void 0 ? void 0 : _j.topLevelDiv), children: [showToolbar && (_jsx(ToolbarContainer, { interfaceGen: toolbarInterfaces, styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.toolbarStyleModel })), _jsxs("div", { "data-testid": "rbdg-table-and-pagination-div", className: classNames((_k = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _k === void 0 ? void 0 : _k.tableAndPaginationDiv), children: [_jsx("div", { "data-testid": "rbdg-table-div", className: classNames(((_l = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _l === void 0 ? void 0 : _l.tableDiv) ||
|
|
57
|
+
"table-responsive"), children: mainTable }), normalizedModel && (_jsx(Pagination, { normalizedModel: normalizedModel, prePagingNumRows: sortedRows.length, containerDivClasses: (_m = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _m === void 0 ? void 0 : _m.paginationUiDiv }))] })] }));
|
|
56
58
|
};
|
|
57
59
|
export default InternalGrid;
|
|
@@ -6,11 +6,11 @@ export interface EditControlsCellProps {
|
|
|
6
6
|
isEditing: boolean;
|
|
7
7
|
saveCallback: () => void;
|
|
8
8
|
deleteCallback?: () => void;
|
|
9
|
-
editControlsCellClasses: string[];
|
|
10
|
-
saveButtonClasses: string[];
|
|
11
|
-
deleteButtonClasses: string[];
|
|
12
|
-
startButtonClasses: string[];
|
|
13
|
-
cancelButtonClasses: string[];
|
|
9
|
+
editControlsCellClasses: string[] | null;
|
|
10
|
+
saveButtonClasses: string[] | null;
|
|
11
|
+
deleteButtonClasses: string[] | null;
|
|
12
|
+
startButtonClasses: string[] | null;
|
|
13
|
+
cancelButtonClasses: string[] | null;
|
|
14
14
|
style?: CSSProperties;
|
|
15
15
|
}
|
|
16
16
|
declare const EditControlsCell: FC<EditControlsCellProps>;
|
|
@@ -6,14 +6,6 @@ var stopPropagationWrapper = function (fn) { return function (event) {
|
|
|
6
6
|
}; };
|
|
7
7
|
var EditControlsCell = function (_a) {
|
|
8
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", { "aria-label": "Cancel", className: classNames("btn",
|
|
10
|
-
? ["btn-secondary"]
|
|
11
|
-
: cancelButtonClasses), onClick: stopPropagationWrapper(cancelEditingCallback), title: "Cancel", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: _jsx("path", { d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z" }) }) }), _jsx("button", { "aria-label": "Save", className: classNames("btn", saveButtonClasses.length === 0
|
|
12
|
-
? ["btn-primary"]
|
|
13
|
-
: saveButtonClasses), onClick: stopPropagationWrapper(saveCallback), title: "Save", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("path", { d: "M12 2h-2v3h2z" }), _jsx("path", { d: "M1.5 0A1.5 1.5 0 0 0 0 1.5v13A1.5 1.5 0 0 0 1.5 16h13a1.5 1.5 0 0 0 1.5-1.5V2.914a1.5 1.5 0 0 0-.44-1.06L14.147.439A1.5 1.5 0 0 0 13.086 0zM4 6a1 1 0 0 1-1-1V1h10v4a1 1 0 0 1-1 1zM3 9h10a1 1 0 0 1 1 1v5H2v-5a1 1 0 0 1 1-1" })] }) })] })) : (_jsxs(_Fragment, { children: [deleteCallback && (_jsx("button", { "aria-label": "Delete", className: classNames("btn", deleteButtonClasses.length === 0
|
|
14
|
-
? ["btn-secondary"]
|
|
15
|
-
: deleteButtonClasses), onClick: stopPropagationWrapper(deleteCallback), title: "Delete", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: _jsx("path", { d: "M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" }) }) })), _jsx("button", { "aria-label": "Edit", className: classNames("btn", startButtonClasses.length === 0
|
|
16
|
-
? ["btn-primary"]
|
|
17
|
-
: startButtonClasses), onClick: stopPropagationWrapper(beginEditingCallback), title: "Edit", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("path", { d: "M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" }), _jsx("path", { fillRule: "evenodd", d: "M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5z" })] }) })] })) }) }));
|
|
9
|
+
return (_jsx("td", { "aria-colindex": ariaColIndex, className: classNames(editControlsCellClasses), children: _jsx("div", { className: "hstack gap-2", children: isEditing ? (_jsxs(_Fragment, { children: [_jsx("button", { "aria-label": "Cancel", className: classNames(cancelButtonClasses || ["btn", "btn-secondary"]), onClick: stopPropagationWrapper(cancelEditingCallback), title: "Cancel", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: _jsx("path", { d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z" }) }) }), _jsx("button", { "aria-label": "Save", className: classNames(saveButtonClasses || ["btn", "btn-primary"]), onClick: stopPropagationWrapper(saveCallback), title: "Save", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("path", { d: "M12 2h-2v3h2z" }), _jsx("path", { d: "M1.5 0A1.5 1.5 0 0 0 0 1.5v13A1.5 1.5 0 0 0 1.5 16h13a1.5 1.5 0 0 0 1.5-1.5V2.914a1.5 1.5 0 0 0-.44-1.06L14.147.439A1.5 1.5 0 0 0 13.086 0zM4 6a1 1 0 0 1-1-1V1h10v4a1 1 0 0 1-1 1zM3 9h10a1 1 0 0 1 1 1v5H2v-5a1 1 0 0 1 1-1" })] }) })] })) : (_jsxs(_Fragment, { children: [deleteCallback && (_jsx("button", { "aria-label": "Delete", className: classNames(deleteButtonClasses || ["btn", "btn-secondary"]), onClick: stopPropagationWrapper(deleteCallback), title: "Delete", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: _jsx("path", { d: "M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0" }) }) })), _jsx("button", { "aria-label": "Edit", className: classNames(startButtonClasses || ["btn", "btn-primary"]), onClick: stopPropagationWrapper(beginEditingCallback), title: "Edit", children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "currentColor", viewBox: "0 0 16 16", children: [_jsx("path", { d: "M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" }), _jsx("path", { fillRule: "evenodd", d: "M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5z" })] }) })] })) }) }));
|
|
18
10
|
};
|
|
19
11
|
export default EditControlsCell;
|
package/editing/EditableRow.d.ts
CHANGED
|
@@ -9,13 +9,13 @@ export type EditableRowProps = Pick<React.ComponentProps<"tr">, "onClick" | "cla
|
|
|
9
9
|
cellData: CellData[];
|
|
10
10
|
updateCallback?: (values: string[]) => void;
|
|
11
11
|
deleteCallback?: () => void;
|
|
12
|
-
dataCellClasses: (colIndex: number) => string[];
|
|
13
|
-
dataCellInputClasses: (colIndex: number) => string[];
|
|
14
|
-
editCellClasses: string[];
|
|
15
|
-
deleteButtonClasses: string[];
|
|
16
|
-
cancelButtonClasses: string[];
|
|
17
|
-
startButtonClasses: string[];
|
|
18
|
-
saveButtonClasses: string[];
|
|
12
|
+
dataCellClasses: (colIndex: number) => string[] | null;
|
|
13
|
+
dataCellInputClasses: (colIndex: number) => string[] | null;
|
|
14
|
+
editCellClasses: string[] | null;
|
|
15
|
+
deleteButtonClasses: string[] | null;
|
|
16
|
+
cancelButtonClasses: string[] | null;
|
|
17
|
+
startButtonClasses: string[] | null;
|
|
18
|
+
saveButtonClasses: string[] | null;
|
|
19
19
|
editControlCellStyles?: CSSProperties;
|
|
20
20
|
};
|
|
21
21
|
declare const EditableRow: FC<EditableRowProps>;
|
package/editing/EditableRow.js
CHANGED
|
@@ -62,7 +62,7 @@ var EditableRow = function (_a) {
|
|
|
62
62
|
};
|
|
63
63
|
return (_jsxs("tr", { ref: trRef, onClick: onClick, className: className, "aria-rowindex": ariaRowIndex, "aria-selected": ariaSelected, "data-rowid": dataRowId, children: [children, cellData.map(function (_a, index) {
|
|
64
64
|
var type = _a.type, value = _a.value, formattedValue = _a.formattedValue, label = _a.label, width = _a.width;
|
|
65
|
-
return (_jsx("td", { "aria-colindex": index + ariaColIndexOffset + 1, className: classNames(dataCellClasses(index)), style: getWidthStyle(width), children: isEditing && !!updateCallback ? (_jsx("input", { "aria-label": label, name: "editable-cell-input-".concat(dataRowId, "-").concat(index), className: classNames("form-control"
|
|
65
|
+
return (_jsx("td", { "aria-colindex": index + ariaColIndexOffset + 1, className: classNames(dataCellClasses(index)), style: getWidthStyle(width), children: isEditing && !!updateCallback ? (_jsx("input", { "aria-label": label, name: "editable-cell-input-".concat(dataRowId, "-").concat(index), className: classNames(dataCellInputClasses(index) || "form-control"), type: colDataTypeToInputType(type), defaultValue: initValueToFormValue(value, type), required: type !== "string" })) : (formattedValue) }, index));
|
|
66
66
|
}), 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, style: editControlCellStyles }))] }));
|
|
67
67
|
};
|
|
68
68
|
export default EditableRow;
|
package/export/ExportForm.d.ts
CHANGED
|
@@ -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>;
|
package/export/ExportForm.js
CHANGED
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useId, useState } from "react";
|
|
14
14
|
import classNames from "classnames";
|
|
15
15
|
var ExportForm = function (_a) {
|
|
16
|
-
var _b = _a.exportFnInfo, exportFn = _b.exportFn, formattersExist = _b.formattersExist, paginationEnabled = _b.paginationEnabled, filteringEnabled = _b.filteringEnabled, rowCounts = _b.rowCounts, styleModel = _a.styleModel;
|
|
16
|
+
var _b = _a.exportFnInfo, exportFn = _b.exportFn, formattersExist = _b.formattersExist, paginationEnabled = _b.paginationEnabled, filteringEnabled = _b.filteringEnabled, rowCounts = _b.rowCounts, closeCallback = _a.closeCallback, styleModel = _a.styleModel;
|
|
17
17
|
var formId = useId();
|
|
18
18
|
var _c = useState({
|
|
19
19
|
stage: "original",
|
|
@@ -82,7 +82,7 @@ var ExportForm = function (_a) {
|
|
|
82
82
|
var radioContainerClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.radioContainer) || ["form-check"]);
|
|
83
83
|
var radioInputClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.radioInput) || ["form-check-input"]);
|
|
84
84
|
var radioLabelClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.radioLabel) || ["form-check-label"]);
|
|
85
|
-
var submitButtonClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.submitButton) || ["btn", "btn-
|
|
85
|
+
var submitButtonClasses = classNames((styleModel === null || styleModel === void 0 ? void 0 : styleModel.submitButton) || ["btn", "btn-primary"]);
|
|
86
86
|
return (_jsxs("form", { onSubmit: handleSubmit, children: [_jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose data to export" }), stageOptions.map(function (_a) {
|
|
87
87
|
var value = _a.value, label = _a.label, disabled = _a.disabled;
|
|
88
88
|
return (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: "".concat(formId, "-").concat(value), value: value, checked: formState.stage === value, onChange: getChangeHandler("stage", value), disabled: disabled }), _jsx("label", { className: radioLabelClasses, htmlFor: "".concat(formId, "-").concat(value), children: label })] }, value));
|
|
@@ -92,6 +92,6 @@ var ExportForm = function (_a) {
|
|
|
92
92
|
})] }), _jsxs("fieldset", { children: [_jsx("legend", { className: legendClasses, children: "Choose the file type" }), fileTypeOptions.map(function (_a) {
|
|
93
93
|
var fileType = _a.fileType, label = _a.label;
|
|
94
94
|
return (_jsxs("div", { className: radioContainerClasses, children: [_jsx("input", { className: radioInputClasses, type: "radio", id: "".concat(formId, "-").concat(fileType), value: fileType, checked: formState.fileType === fileType, onChange: getChangeHandler("fileType", fileType) }), _jsx("label", { className: radioLabelClasses, htmlFor: "".concat(formId, "-").concat(fileType), children: label })] }, fileType));
|
|
95
|
-
})] }), _jsx("button", { type: "submit", className: submitButtonClasses, children: "Submit" })] }));
|
|
95
|
+
})] }), _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" })] })] }));
|
|
96
96
|
};
|
|
97
97
|
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;
|
|
@@ -39,7 +39,7 @@ var DateFilterRow = function (_a) {
|
|
|
39
39
|
var endDateInputId = "$endDate-".concat(inputId);
|
|
40
40
|
var startDateInputLabel = "".concat(columnLabel, " Column Filter Start Date");
|
|
41
41
|
var endDateInputLabel = "".concat(columnLabel, " Column Filter End Date");
|
|
42
|
-
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"
|
|
42
|
+
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(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 })] }))] }));
|
|
43
43
|
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 }));
|
|
44
44
|
};
|
|
45
45
|
export default DateFilterRow;
|
|
@@ -4,6 +4,7 @@ import { FilterInputTableStyleModel } from "../styling/types";
|
|
|
4
4
|
export interface FilterOptionsTableProps {
|
|
5
5
|
filterState: TableFilterState;
|
|
6
6
|
setFilterState: (filterState: EditableTableFilterState) => void;
|
|
7
|
+
closeFormCallback: () => void;
|
|
7
8
|
caption?: string;
|
|
8
9
|
styleModel?: FilterInputTableStyleModel;
|
|
9
10
|
}
|
|
@@ -9,23 +9,13 @@ 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
|
-
};
|
|
21
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import {
|
|
13
|
+
import { useState } from "react";
|
|
23
14
|
import StringFilterRow from "./StringFilterRow";
|
|
24
15
|
import NumberFilterRow from "./NumberFilterRow";
|
|
25
16
|
import useFilterFormState from "./useFilterFormState";
|
|
26
17
|
import DateFilterRow from "./DateFilterRow";
|
|
27
18
|
import classNames from "classnames";
|
|
28
|
-
import { unwrapFilterInputTableStyleModel } from "../styling/styleModelUnwrappers";
|
|
29
19
|
var convertFilterFormStateToEditableState = function (filterFormState) {
|
|
30
20
|
return Object.keys(filterFormState).reduce(function (editableState, colName) {
|
|
31
21
|
var rowFilterFormState = filterFormState[colName];
|
|
@@ -73,10 +63,9 @@ var convertFilterFormStateToEditableState = function (filterFormState) {
|
|
|
73
63
|
}, {});
|
|
74
64
|
};
|
|
75
65
|
var FilterOptionsTable = function (_a) {
|
|
76
|
-
var filterState = _a.filterState, setFilterState = _a.setFilterState, caption = _a.caption, styleModel = _a.styleModel;
|
|
66
|
+
var filterState = _a.filterState, setFilterState = _a.setFilterState, caption = _a.caption, styleModel = _a.styleModel, closeFormCallback = _a.closeFormCallback;
|
|
77
67
|
var formFilterState = useFilterFormState(filterState);
|
|
78
68
|
var _b = useState(formFilterState), formState = _b[0], setFormState = _b[1];
|
|
79
|
-
var unwrappedStyleModel = useMemo(function () { return unwrapFilterInputTableStyleModel(styleModel); }, [styleModel]);
|
|
80
69
|
var getRows = function () {
|
|
81
70
|
return Object.keys(formState).map(function (colName, index) {
|
|
82
71
|
function getColStateSetter(colName) {
|
|
@@ -89,19 +78,26 @@ var FilterOptionsTable = function (_a) {
|
|
|
89
78
|
var colFilterState = formState[colName];
|
|
90
79
|
switch (colFilterState.type) {
|
|
91
80
|
case "string": {
|
|
92
|
-
return (_jsx(StringFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses:
|
|
93
|
-
|
|
81
|
+
return (_jsx(StringFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput) &&
|
|
82
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput(index)), enableInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput) &&
|
|
83
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput(index)), searchStringInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.searchStringInput) &&
|
|
84
|
+
(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: function (colIndex) {
|
|
85
|
+
return (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd(index, colIndex));
|
|
94
86
|
} }, colName));
|
|
95
87
|
}
|
|
96
88
|
case "number": {
|
|
97
|
-
return (_jsx(NumberFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses:
|
|
98
|
-
|
|
89
|
+
return (_jsx(NumberFilterRow, { ariaRowIndex: index + 2, columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput) &&
|
|
90
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput(index)), enableInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput) &&
|
|
91
|
+
(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: function (colIndex) {
|
|
92
|
+
return (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd(index, colIndex));
|
|
99
93
|
} }, colName));
|
|
100
94
|
}
|
|
101
95
|
default: {
|
|
102
96
|
// date or datetime
|
|
103
|
-
return (_jsx(DateFilterRow, { ariaRowIndex: index + 2, includeTime: colFilterState.type === "datetime", columnLabel: colLabel, filterState: colFilterState, setFilterState: getColStateSetter(colName), schemeSelectClasses:
|
|
104
|
-
|
|
97
|
+
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) &&
|
|
98
|
+
(styleModel === null || styleModel === void 0 ? void 0 : styleModel.schemeSelectionInput(index)), enableInputClasses: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.enablementInput) &&
|
|
99
|
+
(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: function (colIndex) {
|
|
100
|
+
return (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd) && (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tbodyTd(index, colIndex));
|
|
105
101
|
} }, colName));
|
|
106
102
|
}
|
|
107
103
|
}
|
|
@@ -111,7 +107,8 @@ var FilterOptionsTable = function (_a) {
|
|
|
111
107
|
event.preventDefault();
|
|
112
108
|
var editableTableFilterState = convertFilterFormStateToEditableState(formState);
|
|
113
109
|
setFilterState(editableTableFilterState);
|
|
110
|
+
closeFormCallback();
|
|
114
111
|
};
|
|
115
|
-
return (_jsxs("form", { onSubmit: onSubmit, className: classNames(styleModel === null || styleModel === void 0 ? void 0 : styleModel.form), children: [_jsxs("table", { className: classNames
|
|
112
|
+
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(function (colName, index) { return (_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" })] })] }));
|
|
116
113
|
};
|
|
117
114
|
export default FilterOptionsTable;
|
package/filtering/FilterRow.d.ts
CHANGED
|
@@ -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;
|
package/filtering/FilterRow.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
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
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
2
|
import classNames from "classnames";
|
|
12
3
|
export function FilterRow(props) {
|
|
13
4
|
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
5
|
var checkboxLabel = "".concat(columnLabel, " Column Filter Toggle");
|
|
15
6
|
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
|
|
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(function (scheme) { return (_jsx("option", { value: scheme, children: schemesToLabels[scheme] }, scheme)); }) }) }), _jsx("td", { className: classNames(tdClasses(4)), "aria-colindex": 5, children: searchStringInputCellContents })] }));
|
|
17
8
|
}
|
|
18
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;
|
|
@@ -29,7 +29,7 @@ var NumberFilterRow = function (_a) {
|
|
|
29
29
|
};
|
|
30
30
|
var enabled = filterState.enabled, scheme = filterState.scheme, inputValue = filterState.inputValue;
|
|
31
31
|
var valueInputLabel = "".concat(columnLabel, " Column Filter Value");
|
|
32
|
-
var searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames("form-control"
|
|
32
|
+
var searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames(numberInputClasses || "form-control"), type: "number", required: enabled, disabled: !enabled, value: inputValue, onChange: handleNumInputValueChange }));
|
|
33
33
|
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 }));
|
|
34
34
|
};
|
|
35
35
|
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;
|
|
@@ -29,7 +29,7 @@ var StringFilterRow = function (_a) {
|
|
|
29
29
|
};
|
|
30
30
|
var enabled = filterState.enabled, scheme = filterState.scheme, searchString = filterState.searchString;
|
|
31
31
|
var valueInputLabel = "".concat(columnLabel, " Column Filter Value");
|
|
32
|
-
var searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames("form-control"
|
|
32
|
+
var searchStringInputCellContents = (_jsx("input", { name: valueInputLabel, "aria-label": valueInputLabel, className: classNames(searchStringInputClasses || "form-control"), required: enabled, disabled: !enabled, value: searchString, onChange: handleSearchStringChange }));
|
|
33
33
|
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 }));
|
|
34
34
|
};
|
|
35
35
|
export default StringFilterRow;
|
package/main/BodyRows.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AugFormattedRow, RowId } from "../types";
|
|
2
2
|
import { FC, ReactNode } from "react";
|
|
3
3
|
import { UseGridSelectionFnsHook } from "../pipeline/useGridSelectionFns";
|
|
4
|
-
import { UseUnwrappedGridStylesHook } from "../pipeline/useUnwrappedGridStyles";
|
|
5
4
|
import { UseCombinedPipelineHook } from "../pipeline/useCombinedPipeline";
|
|
6
5
|
import { SelectModel } from "../selection/types";
|
|
7
6
|
import { EditModel } from "../editing/types";
|
|
8
7
|
import { UseGetInputStrSubmitCallbackHook } from "../pipeline/useGetInputStrSubmitCallback";
|
|
8
|
+
import { TableStyleModel } from "../styling/types";
|
|
9
9
|
interface BodyRowsProps {
|
|
10
10
|
augFormattedRows: AugFormattedRow[];
|
|
11
11
|
gridSelectionFns: UseGridSelectionFnsHook;
|
|
12
|
-
|
|
12
|
+
tableStyleModel: TableStyleModel | undefined;
|
|
13
13
|
combinedPipelineOutput: UseCombinedPipelineHook;
|
|
14
14
|
selectModel: SelectModel | undefined;
|
|
15
15
|
editModel: EditModel | undefined;
|
package/main/BodyRows.js
CHANGED
|
@@ -4,15 +4,31 @@ import classNames from "classnames";
|
|
|
4
4
|
import getWidthStyle from "../util/getWidthStyle";
|
|
5
5
|
import SelectionInput from "../selection/SelectionInput";
|
|
6
6
|
var BodyRows = function (_a) {
|
|
7
|
-
var augFormattedRows = _a.augFormattedRows, _b = _a.gridSelectionFns, selectedSet = _b.selectedSet, getSelectInputModel = _b.getSelectInputModel, getSelectHandler = _b.getSelectHandler, getRowClickHandler = _b.getRowClickHandler, getAriaSelectedValue = _b.getAriaSelectedValue,
|
|
7
|
+
var augFormattedRows = _a.augFormattedRows, _b = _a.gridSelectionFns, selectedSet = _b.selectedSet, getSelectInputModel = _b.getSelectInputModel, getSelectHandler = _b.getSelectHandler, getRowClickHandler = _b.getRowClickHandler, getAriaSelectedValue = _b.getAriaSelectedValue, tableStyleModel = _a.tableStyleModel, _c = _a.combinedPipelineOutput, showSelectCol = _c.showSelectCol, ariaColIndexOffset = _c.ariaColIndexOffset, selectModel = _a.selectModel, editModel = _a.editModel, getInputStrSubmitCallback = _a.getInputStrSubmitCallback, additionalColIndexOffset = _a.additionalColIndexOffset, renderPrefixCells = _a.renderPrefixCells, additionalRowStyles = _a.additionalRowStyles;
|
|
8
8
|
return augFormattedRows.map(function (row, index) {
|
|
9
9
|
return (_jsxs(EditableRow, { onClick: getRowClickHandler(row.id), className: classNames({
|
|
10
10
|
"table-active": selectedSet.has(row.id),
|
|
11
|
-
},
|
|
12
|
-
return
|
|
11
|
+
}, (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTr) && (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTr(row.id, index)), additionalRowStyles ? additionalRowStyles(row.id, index) : []), "aria-rowindex": row.prePaginationIndex + 2, dataRowId: row.id, "aria-selected": getAriaSelectedValue(row.id), ariaColIndexOffset: ariaColIndexOffset + (additionalColIndexOffset || 0), cellData: row.contents, updateCallback: getInputStrSubmitCallback && getInputStrSubmitCallback(row.id), deleteCallback: (editModel === null || editModel === void 0 ? void 0 : editModel.getDeleteCallback) && editModel.getDeleteCallback(row.id), dataCellClasses: function (colIndex) {
|
|
12
|
+
return (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTd)
|
|
13
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTd(row.id, index, colIndex)
|
|
14
|
+
: null;
|
|
13
15
|
}, dataCellInputClasses: function (colIndex) {
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
+
return (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTdInput)
|
|
17
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTdInput(row.id, index, colIndex)
|
|
18
|
+
: null;
|
|
19
|
+
}, editCellClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editColTd)
|
|
20
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editColTd(row.id, index)
|
|
21
|
+
: null, saveButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editSaveButton)
|
|
22
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editSaveButton(row.id, index)
|
|
23
|
+
: null, deleteButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editDeleteButton)
|
|
24
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editDeleteButton(row.id, index)
|
|
25
|
+
: null, startButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editStartButton)
|
|
26
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editStartButton(row.id, index)
|
|
27
|
+
: null, cancelButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editCancelButton)
|
|
28
|
+
? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editCancelButton(row.id, index)
|
|
29
|
+
: null, children: [renderPrefixCells && renderPrefixCells(row), showSelectCol && (_jsx("td", { className: classNames((tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectColTd) &&
|
|
30
|
+
(tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectColTd(row.id, index))), "aria-colindex": 1 + (additionalColIndexOffset || 0), style: getWidthStyle(selectModel.selectColWidth), children: _jsx(SelectionInput, { index: index, selected: selectedSet.has(row.id), selectionInputModel: getSelectInputModel(row.id, selectModel), selectCallback: getSelectHandler(row.id), additionalClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectInput) &&
|
|
31
|
+
(tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectInput(row.id, index)) }) }))] }, row.id));
|
|
16
32
|
});
|
|
17
33
|
};
|
|
18
34
|
export default BodyRows;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absreim/react-bootstrap-data-grid",
|
|
3
3
|
"description": "Data grid UI component for use with web apps using React and Bootstrap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
|
@@ -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;
|
package/pagination/Pagination.js
CHANGED
|
@@ -17,8 +17,11 @@ var Pagination = function (_a) {
|
|
|
17
17
|
setCurrentPage(maxPages);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
return (_jsxs("div", { "data-testid": "pagination ui container div", className: classNames(containerDivClasses
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
return (_jsxs("div", { "data-testid": "pagination ui container div", className: classNames(containerDivClasses || [
|
|
21
|
+
"d-flex",
|
|
22
|
+
"justify-content-end",
|
|
23
|
+
"gap-2",
|
|
24
|
+
"px-2",
|
|
25
|
+
]), 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 })] }));
|
|
23
26
|
};
|
|
24
27
|
export default Pagination;
|
package/pagination/types.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export type UncontrolledPaginationModel = PaginationOptions & {
|
|
|
18
18
|
startingPageSizeIndex?: number;
|
|
19
19
|
startingCurrentPage?: number;
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type PaginationModel = ControlledPaginationModel | UncontrolledPaginationModel;
|
|
22
22
|
export type NormalizedPaginationModel = Required<Omit<ControlledPaginationModel, "type" | "pageSelectorAriaLabel" | "pageSelectorJustifyContent">> & Pick<ControlledPaginationModel, "pageSelectorAriaLabel" | "pageSelectorJustifyContent">;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AugRowDef, PostPaginationRowDef } from "../../types";
|
|
2
|
-
import { NormalizedPaginationModel,
|
|
2
|
+
import { NormalizedPaginationModel, PaginationModel } from "../../pagination/types";
|
|
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;
|
|
@@ -41,15 +41,13 @@ var getCheckboxState = function (selectionInfo, noRows) {
|
|
|
41
41
|
return disabledState;
|
|
42
42
|
};
|
|
43
43
|
var SelectAllHeaderCell = function (_a) {
|
|
44
|
-
var onClick = _a.onClick, selectionInfo = _a.selectionInfo, totalRows = _a.totalRows,
|
|
44
|
+
var onClick = _a.onClick, selectionInfo = _a.selectionInfo, totalRows = _a.totalRows, customClasses = _a.customClasses, style = _a.style, colIndexOffset = _a.colIndexOffset;
|
|
45
45
|
var noRows = totalRows === 0;
|
|
46
46
|
var _b = getCheckboxState(selectionInfo, noRows), indeterminate = _b.indeterminate, checked = _b.checked, disabled = _b.disabled, description = _b.description;
|
|
47
47
|
var ref = useRef(null);
|
|
48
48
|
useEffect(function () {
|
|
49
49
|
ref.current.indeterminate = indeterminate;
|
|
50
50
|
}, [indeterminate]);
|
|
51
|
-
return (_jsx("th", { style: style, "aria-colindex": 1 + (colIndexOffset || 0), title: description, "aria-description": description, className: classNames({
|
|
52
|
-
"btn-primary": !additionalClasses || additionalClasses.length === 0,
|
|
53
|
-
}, additionalClasses || []), children: _jsx("input", { tabIndex: 0, type: "checkbox", checked: checked, ref: ref, disabled: disabled, "aria-label": description, onChange: onClick }) }));
|
|
51
|
+
return (_jsx("th", { style: style, "aria-colindex": 1 + (colIndexOffset || 0), title: description, "aria-description": description, className: classNames(customClasses || "btn-primary"), children: _jsx("input", { tabIndex: 0, type: "checkbox", checked: checked, ref: ref, disabled: disabled, "aria-label": description, onChange: onClick }) }));
|
|
54
52
|
};
|
|
55
53
|
export default SelectAllHeaderCell;
|
|
@@ -13,7 +13,7 @@ export interface SelectionInputProps {
|
|
|
13
13
|
selected: boolean;
|
|
14
14
|
selectionInputModel: SelectionInputModel;
|
|
15
15
|
selectCallback: () => void;
|
|
16
|
-
additionalClasses?: string[];
|
|
16
|
+
additionalClasses?: string[] | null;
|
|
17
17
|
index: number;
|
|
18
18
|
}
|
|
19
19
|
declare const SelectionInput: FC<SelectionInputProps>;
|
package/styling/types.d.ts
CHANGED
|
@@ -4,40 +4,39 @@ export interface SharedTableStyleModel {
|
|
|
4
4
|
tbody?: string[];
|
|
5
5
|
thead?: string[];
|
|
6
6
|
theadTr?: string[];
|
|
7
|
-
theadTh?: (colIndex: number) => string[];
|
|
7
|
+
theadTh?: (colIndex: number) => string[] | null;
|
|
8
8
|
caption?: string[];
|
|
9
9
|
}
|
|
10
10
|
export type TableStyleModel = SharedTableStyleModel & {
|
|
11
|
-
tbodyTr?: (rowId: RowId, displayIndex: number) => string[];
|
|
12
|
-
tbodyTd?: (rowId: RowId, displayRowIndex: number, colIndex: number) => string[];
|
|
13
|
-
tbodyTdInput?: (rowId: RowId, displayRowIndex: number, colIndex: number) => string[];
|
|
11
|
+
tbodyTr?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
12
|
+
tbodyTd?: (rowId: RowId, displayRowIndex: number, colIndex: number) => string[] | null;
|
|
13
|
+
tbodyTdInput?: (rowId: RowId, displayRowIndex: number, colIndex: number) => string[] | null;
|
|
14
14
|
editColTh?: string[];
|
|
15
|
-
editColTd?: (rowId: RowId, displayIndex: number) => string[];
|
|
16
|
-
editStartButton?: (rowId: RowId, displayIndex: number) => string[];
|
|
17
|
-
editDeleteButton?: (rowId: RowId, displayIndex: number) => string[];
|
|
18
|
-
editSaveButton?: (rowId: RowId, displayIndex: number) => string[];
|
|
19
|
-
editCancelButton?: (rowId: RowId, displayIndex: number) => string[];
|
|
15
|
+
editColTd?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
16
|
+
editStartButton?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
17
|
+
editDeleteButton?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
18
|
+
editSaveButton?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
19
|
+
editCancelButton?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
20
20
|
rowSelectColTh?: string[];
|
|
21
|
-
rowSelectColTd?: (rowId: RowId, displayIndex: number) => string[];
|
|
22
|
-
rowSelectInput?: (rowId: RowId, displayIndex: number) => string[];
|
|
21
|
+
rowSelectColTd?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
22
|
+
rowSelectInput?: (rowId: RowId, displayIndex: number) => string[] | null;
|
|
23
23
|
};
|
|
24
24
|
export type FilterInputTableStyleModel = SharedTableStyleModel & {
|
|
25
|
-
tbodyTr?: (rowIndex: number) => string[];
|
|
26
|
-
tbodyTd?: (rowIndex: number, colIndex: number) => string[];
|
|
27
|
-
enablementInput?: (rowIndex: number) => string[];
|
|
28
|
-
schemeSelectionInput?: (rowIndex: number) => string[];
|
|
29
|
-
searchStringInput?: (rowIndex: number) => string[];
|
|
30
|
-
numberInput?: (rowIndex: number) => string[];
|
|
31
|
-
startDateInput?: (rowIndex: number) => string[];
|
|
32
|
-
endDateInput?: (rowIndex: number) => string[];
|
|
25
|
+
tbodyTr?: (rowIndex: number) => string[] | null;
|
|
26
|
+
tbodyTd?: (rowIndex: number, colIndex: number) => string[] | null;
|
|
27
|
+
enablementInput?: (rowIndex: number) => string[] | null;
|
|
28
|
+
schemeSelectionInput?: (rowIndex: number) => string[] | null;
|
|
29
|
+
searchStringInput?: (rowIndex: number) => string[] | null;
|
|
30
|
+
numberInput?: (rowIndex: number) => string[] | null;
|
|
31
|
+
startDateInput?: (rowIndex: number) => string[] | null;
|
|
32
|
+
endDateInput?: (rowIndex: number) => string[] | null;
|
|
33
33
|
submitButton?: string[];
|
|
34
34
|
form?: string[];
|
|
35
35
|
};
|
|
36
36
|
export interface AdditionalComponentsStyleModel {
|
|
37
37
|
topLevelDiv?: string[];
|
|
38
|
-
filterInputsDiv?: string[];
|
|
39
38
|
tableAndPaginationDiv?: string[];
|
|
40
|
-
|
|
39
|
+
tableDiv?: string[];
|
|
41
40
|
paginationUiDiv?: string[];
|
|
42
41
|
}
|
|
43
42
|
export interface ToolbarStyleModel {
|
|
@@ -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,15 +1,19 @@
|
|
|
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
5
|
var ToolbarContainer = function (_a) {
|
|
6
|
-
var
|
|
6
|
+
var interfaceGen = _a.interfaceGen, styleModel = _a.styleModel;
|
|
7
7
|
var _b = useState(null), option = _b[0], setOption = _b[1];
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return prev
|
|
12
|
-
|
|
8
|
+
var closeUiCallback = useCallback(function () { return setOption(null); }, []);
|
|
9
|
+
var interfaces = useMemo(function () { return interfaceGen(closeUiCallback); }, [closeUiCallback, interfaceGen]);
|
|
10
|
+
var enabledFeatures = useMemo(function () {
|
|
11
|
+
return Object.keys(interfaces).reduce(function (prev, toolbarOption) {
|
|
12
|
+
prev[toolbarOption] =
|
|
13
|
+
!!interfaces[toolbarOption];
|
|
14
|
+
return prev;
|
|
15
|
+
}, {});
|
|
16
|
+
}, [interfaces]);
|
|
13
17
|
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) || [
|
|
14
18
|
"position-absolute",
|
|
15
19
|
"z-1",
|
package/toolbar/types.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { FilterOptionsTableProps } from "../filtering/FilterOptionsTable";
|
|
3
|
+
import { ExportFormProps } from "../export/ExportForm";
|
|
2
4
|
export type ToolbarOption = "filtering" | "exporting";
|
|
3
5
|
export type ToolbarInterfaces = Partial<Record<ToolbarOption, ReactNode>>;
|
|
6
|
+
export interface InterfaceParams {
|
|
7
|
+
filtering?: FilterOptionsTableProps;
|
|
8
|
+
exporting?: ExportFormProps;
|
|
9
|
+
}
|
|
10
|
+
export type InterfacePropGenerator = (closeUiCallback: () => void) => InterfaceParams;
|
|
11
|
+
export type InterfaceNodeGenerator = (closeUiCallback: () => void) => ToolbarInterfaces;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ExportFormProps } from "../export/ExportForm";
|
|
4
|
-
export interface InterfaceParams {
|
|
5
|
-
filtering?: FilterOptionsTableProps;
|
|
6
|
-
exporting?: ExportFormProps;
|
|
7
|
-
}
|
|
8
|
-
declare const useInterfaces: (params: InterfaceParams) => ToolbarInterfaces;
|
|
1
|
+
import { InterfacePropGenerator, ToolbarInterfaces } from "./types";
|
|
2
|
+
declare const useInterfaces: (gen: InterfacePropGenerator) => (closeCallback: () => void) => ToolbarInterfaces;
|
|
9
3
|
export default useInterfaces;
|
package/toolbar/useInterfaces.js
CHANGED
|
@@ -13,11 +13,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import FilterOptionsTable from "../filtering/FilterOptionsTable";
|
|
14
14
|
import { useMemo } from "react";
|
|
15
15
|
import ExportForm from "../export/ExportForm";
|
|
16
|
-
var useInterfaces = function (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
var useInterfaces = function (gen) {
|
|
17
|
+
return useMemo(function () { return function (closeCallback) {
|
|
18
|
+
var props = gen(closeCallback);
|
|
19
|
+
var exporting = props.exporting, filtering = props.filtering;
|
|
20
|
+
return {
|
|
21
|
+
filtering: filtering ? (_jsx(FilterOptionsTable, __assign({}, filtering))) : undefined,
|
|
22
|
+
exporting: exporting ? _jsx(ExportForm, __assign({}, exporting)) : undefined,
|
|
23
|
+
};
|
|
24
|
+
}; }, [gen]);
|
|
22
25
|
};
|
|
23
26
|
export default useInterfaces;
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellData, EditModel } from "./editing/types";
|
|
2
|
-
import {
|
|
2
|
+
import { PaginationModel } from "./pagination/types";
|
|
3
3
|
import { ColSortModel, TableSortModel } from "./sorting/types";
|
|
4
4
|
import { FilterModel } from "./filtering/types";
|
|
5
5
|
import { SelectModel } from "./selection/types";
|
|
@@ -26,7 +26,7 @@ export interface RowDef<Data extends ValidRowData = ValidRowData> {
|
|
|
26
26
|
export type AugRowDef<Data extends ValidRowData = ValidRowData> = RowDef<Data> & {
|
|
27
27
|
origIndex: number;
|
|
28
28
|
};
|
|
29
|
-
export type PostPaginationRowDef<Data extends ValidRowData = ValidRowData> = AugRowDef & {
|
|
29
|
+
export type PostPaginationRowDef<Data extends ValidRowData = ValidRowData> = AugRowDef<Data> & {
|
|
30
30
|
prePaginationIndex: number;
|
|
31
31
|
};
|
|
32
32
|
export type FormattedRow = {
|
|
@@ -44,16 +44,15 @@ export type DisplayMode = "table" | "block";
|
|
|
44
44
|
export interface GridProps {
|
|
45
45
|
rows: RowDef[];
|
|
46
46
|
cols: ColDef[];
|
|
47
|
-
pagination?:
|
|
47
|
+
pagination?: PaginationModel;
|
|
48
48
|
sortModel?: TableSortModel;
|
|
49
49
|
filterModel?: FilterModel;
|
|
50
50
|
selectModel?: SelectModel;
|
|
51
51
|
editModel?: EditModel;
|
|
52
52
|
caption?: string;
|
|
53
53
|
styleModel?: StyleModel;
|
|
54
|
-
useToolbar?: boolean;
|
|
55
|
-
responsive?: boolean;
|
|
56
54
|
displayMode?: DisplayMode;
|
|
55
|
+
allowExport?: boolean;
|
|
57
56
|
}
|
|
58
57
|
export type BaseGridProps = Omit<GridProps, "cols"> & {
|
|
59
58
|
cols: ColDefBase[];
|
|
@@ -62,6 +61,6 @@ export interface ColHeaderCellProps {
|
|
|
62
61
|
label: string;
|
|
63
62
|
sortModel?: ColSortModel;
|
|
64
63
|
ariaColIndex: number;
|
|
65
|
-
additionalClasses?: string[];
|
|
64
|
+
additionalClasses?: string[] | null;
|
|
66
65
|
width?: number;
|
|
67
66
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AdditionalComponentsStyleModel, StyleModel, TableStyleModel } from "../styling/types";
|
|
2
|
-
export interface UseUnwrappedGridStylesHook {
|
|
3
|
-
unwrappedTableModel: Required<TableStyleModel>;
|
|
4
|
-
unwrappedAdditionalStyleModel: Required<AdditionalComponentsStyleModel>;
|
|
5
|
-
}
|
|
6
|
-
declare const UseUnwrappedGridStyles: (styleModel: StyleModel | undefined) => UseUnwrappedGridStylesHook;
|
|
7
|
-
export default UseUnwrappedGridStyles;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { unwrapAdditionalComponentsStyleModel, unwrapTableStyleModel, } from "../styling/styleModelUnwrappers";
|
|
3
|
-
var UseUnwrappedGridStyles = function (styleModel) {
|
|
4
|
-
// To give the developer the ability to specify between removing existing styles
|
|
5
|
-
// and simply adding additional ones, we should migrate off of this "unwrapped"
|
|
6
|
-
// design over time and instead apply logic based on the original params that
|
|
7
|
-
// can be undefined.
|
|
8
|
-
var unwrappedTableModel = useMemo(function () { return unwrapTableStyleModel(styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel); }, [styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel]);
|
|
9
|
-
var unwrappedAdditionalStyleModel = useMemo(function () {
|
|
10
|
-
return unwrapAdditionalComponentsStyleModel(styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel);
|
|
11
|
-
}, [styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel]);
|
|
12
|
-
return {
|
|
13
|
-
unwrappedTableModel: unwrappedTableModel,
|
|
14
|
-
unwrappedAdditionalStyleModel: unwrappedAdditionalStyleModel,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export default UseUnwrappedGridStyles;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AdditionalComponentsStyleModel, FilterInputTableStyleModel, TableStyleModel } from "./types";
|
|
2
|
-
export declare const unwrapTableStyleModel: (tableStyleModel: TableStyleModel | undefined) => Required<TableStyleModel>;
|
|
3
|
-
export declare const unwrapFilterInputTableStyleModel: (filterTableStyleModel: FilterInputTableStyleModel | undefined) => Required<FilterInputTableStyleModel>;
|
|
4
|
-
export declare const unwrapAdditionalComponentsStyleModel: (styleModel: AdditionalComponentsStyleModel | undefined) => Required<AdditionalComponentsStyleModel>;
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
var unwrapSharedStyleModel = function (sharedStyleModel) { return ({
|
|
13
|
-
table: (sharedStyleModel === null || sharedStyleModel === void 0 ? void 0 : sharedStyleModel.table) || [],
|
|
14
|
-
tbody: (sharedStyleModel === null || sharedStyleModel === void 0 ? void 0 : sharedStyleModel.tbody) || [],
|
|
15
|
-
thead: (sharedStyleModel === null || sharedStyleModel === void 0 ? void 0 : sharedStyleModel.thead) || [],
|
|
16
|
-
theadTr: (sharedStyleModel === null || sharedStyleModel === void 0 ? void 0 : sharedStyleModel.theadTr) || [],
|
|
17
|
-
theadTh: (sharedStyleModel === null || sharedStyleModel === void 0 ? void 0 : sharedStyleModel.theadTh) ? sharedStyleModel.theadTh : function () { return []; },
|
|
18
|
-
caption: (sharedStyleModel === null || sharedStyleModel === void 0 ? void 0 : sharedStyleModel.caption) || [],
|
|
19
|
-
}); };
|
|
20
|
-
export var unwrapTableStyleModel = function (tableStyleModel) { return (__assign(__assign({}, unwrapSharedStyleModel(tableStyleModel)), { tbodyTr: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTr) ? tableStyleModel.tbodyTr : function () { return []; }, tbodyTd: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTd) ? tableStyleModel.tbodyTd : function () { return []; }, tbodyTdInput: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTdInput)
|
|
21
|
-
? tableStyleModel.tbodyTdInput
|
|
22
|
-
: function () { return []; }, editColTh: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editColTh) || [], editColTd: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editColTd) ? tableStyleModel.editColTd : function () { return []; }, editCancelButton: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editCancelButton)
|
|
23
|
-
? tableStyleModel.editCancelButton
|
|
24
|
-
: function () { return []; }, editDeleteButton: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editDeleteButton)
|
|
25
|
-
? tableStyleModel.editDeleteButton
|
|
26
|
-
: function () { return []; }, editSaveButton: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editSaveButton)
|
|
27
|
-
? tableStyleModel.editSaveButton
|
|
28
|
-
: function () { return []; }, editStartButton: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editStartButton)
|
|
29
|
-
? tableStyleModel.editStartButton
|
|
30
|
-
: function () { return []; }, rowSelectColTh: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectColTh) || [], rowSelectColTd: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectColTd)
|
|
31
|
-
? tableStyleModel.rowSelectColTd
|
|
32
|
-
: function () { return []; }, rowSelectInput: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectInput)
|
|
33
|
-
? tableStyleModel.rowSelectInput
|
|
34
|
-
: function () { return []; } })); };
|
|
35
|
-
export var unwrapFilterInputTableStyleModel = function (filterTableStyleModel) { return (__assign(__assign({}, unwrapSharedStyleModel(filterTableStyleModel)), { tbodyTr: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.tbodyTr)
|
|
36
|
-
? filterTableStyleModel.tbodyTr
|
|
37
|
-
: function () { return []; }, tbodyTd: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.tbodyTd)
|
|
38
|
-
? filterTableStyleModel.tbodyTd
|
|
39
|
-
: function () { return []; }, enablementInput: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.enablementInput)
|
|
40
|
-
? filterTableStyleModel.enablementInput
|
|
41
|
-
: function () { return []; }, schemeSelectionInput: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.schemeSelectionInput)
|
|
42
|
-
? filterTableStyleModel.schemeSelectionInput
|
|
43
|
-
: function () { return []; }, searchStringInput: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.searchStringInput)
|
|
44
|
-
? filterTableStyleModel.searchStringInput
|
|
45
|
-
: function () { return []; }, numberInput: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.numberInput)
|
|
46
|
-
? filterTableStyleModel.numberInput
|
|
47
|
-
: function () { return []; }, startDateInput: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.startDateInput)
|
|
48
|
-
? filterTableStyleModel.startDateInput
|
|
49
|
-
: function () { return []; }, endDateInput: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.endDateInput)
|
|
50
|
-
? filterTableStyleModel.endDateInput
|
|
51
|
-
: function () { return []; }, submitButton: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.submitButton) || [], form: (filterTableStyleModel === null || filterTableStyleModel === void 0 ? void 0 : filterTableStyleModel.form) || [] })); };
|
|
52
|
-
export var unwrapAdditionalComponentsStyleModel = function (styleModel) { return ({
|
|
53
|
-
topLevelDiv: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.topLevelDiv) || [],
|
|
54
|
-
filterInputsDiv: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputsDiv) || [],
|
|
55
|
-
tableAndPaginationDiv: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.tableAndPaginationDiv) || [],
|
|
56
|
-
filterUiToggleButton: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterUiToggleButton) || [],
|
|
57
|
-
paginationUiDiv: (styleModel === null || styleModel === void 0 ? void 0 : styleModel.paginationUiDiv) || [],
|
|
58
|
-
}); };
|