@absreim/react-bootstrap-data-grid 1.4.2 → 2.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 +20 -22
- package/README.md +1 -1
- package/editing/EditableRow.d.ts +2 -1
- package/editing/EditableRow.js +3 -3
- package/editing/inputStrsToRowData.d.ts +3 -0
- package/editing/{inputStrsToRowDef.js → inputStrsToRowData.js} +2 -2
- package/editing/types.d.ts +3 -3
- package/package.json +1 -1
- package/pipeline/useCurrentPageRows.d.ts +2 -2
- package/pipeline/useDisplayRows.d.ts +2 -2
- package/pipeline/useDisplayRows.js +5 -4
- package/pipeline/useFilter.d.ts +2 -2
- package/pipeline/useSortedRows.d.ts +2 -2
- package/selection/types.d.ts +6 -5
- package/selection/types.js +1 -1
- package/style.scss +1 -1
- package/styling/types.d.ts +11 -10
- package/types.d.ts +10 -10
- package/util/isSubset.d.ts +1 -1
- package/util/isSubset.js +2 -2
- package/editing/inputStrsToRowDef.d.ts +0 -3
- package/pipeline/useAugmentedRows.d.ts +0 -3
- package/pipeline/useAugmentedRows.js +0 -12
package/Grid.js
CHANGED
|
@@ -6,7 +6,6 @@ import useFilter from "./pipeline/useFilter";
|
|
|
6
6
|
import ToggleButton from "./ToggleButton";
|
|
7
7
|
import FilterOptionsTable from "./filtering/FilterOptionsTable";
|
|
8
8
|
import useFilterStateFromEditable from "./pipeline/useFilterStateFromEditable";
|
|
9
|
-
import useAugmentedRows from "./pipeline/useAugmentedRows";
|
|
10
9
|
import useSortedRows from "./pipeline/useSortedRows";
|
|
11
10
|
import useDisplayRows from "./pipeline/useDisplayRows";
|
|
12
11
|
import SelectAllHeaderCell from "./selection/SelectAllHeaderCell";
|
|
@@ -14,7 +13,7 @@ import SelectionInput from "./selection/SelectionInput";
|
|
|
14
13
|
import Pagination from "./pagination/Pagination";
|
|
15
14
|
import classNames from "classnames";
|
|
16
15
|
import EditableRow from "./editing/EditableRow";
|
|
17
|
-
import
|
|
16
|
+
import inputStrsToRowData from "./editing/inputStrsToRowData";
|
|
18
17
|
import { unwrapAdditionalComponentsStyleModel, unwrapTableStyleModel, } from "./styling/styleModelUnwrappers";
|
|
19
18
|
import useCurrentPageRows from "./pipeline/useCurrentPageRows";
|
|
20
19
|
import isSubset from "./util/isSubset";
|
|
@@ -23,8 +22,7 @@ var Grid = function (_a) {
|
|
|
23
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;
|
|
24
23
|
var editableFilterState = (filterModel === null || filterModel === void 0 ? void 0 : filterModel.tableFilterState) || null;
|
|
25
24
|
var filterState = useFilterStateFromEditable(cols, editableFilterState);
|
|
26
|
-
var
|
|
27
|
-
var filteredRows = useFilter(augmentedRows, editableFilterState);
|
|
25
|
+
var filteredRows = useFilter(rows, editableFilterState);
|
|
28
26
|
var sortedRows = useSortedRows(filteredRows, cols, sortModel);
|
|
29
27
|
var currentPageRows = useCurrentPageRows(sortedRows, pagination);
|
|
30
28
|
var showSelectCol = selectModel && selectModel.mode !== "row";
|
|
@@ -81,7 +79,7 @@ var Grid = function (_a) {
|
|
|
81
79
|
selectModel.setSelected(selectModel.selected.filter(function (num) { return num !== index; }));
|
|
82
80
|
}; };
|
|
83
81
|
// used to group radio buttons for selection
|
|
84
|
-
var getSelectInputModel = function (
|
|
82
|
+
var getSelectInputModel = function (id, selectModel) {
|
|
85
83
|
if (selectModel.type === "single") {
|
|
86
84
|
return {
|
|
87
85
|
type: "radio",
|
|
@@ -90,7 +88,7 @@ var Grid = function (_a) {
|
|
|
90
88
|
}
|
|
91
89
|
return {
|
|
92
90
|
type: "checkbox",
|
|
93
|
-
deselectCallback: getDeselectHandler(
|
|
91
|
+
deselectCallback: getDeselectHandler(id),
|
|
94
92
|
};
|
|
95
93
|
};
|
|
96
94
|
var selectedSet = new Set();
|
|
@@ -110,7 +108,7 @@ var Grid = function (_a) {
|
|
|
110
108
|
if (selectModel.type === "single") {
|
|
111
109
|
return {
|
|
112
110
|
selectType: "single",
|
|
113
|
-
existingSelection: selectionExists
|
|
111
|
+
existingSelection: selectionExists,
|
|
114
112
|
};
|
|
115
113
|
}
|
|
116
114
|
var getMultiExistingSelection = function (selectionExists, rows) {
|
|
@@ -128,7 +126,7 @@ var Grid = function (_a) {
|
|
|
128
126
|
};
|
|
129
127
|
return {
|
|
130
128
|
selectType: "multi",
|
|
131
|
-
existingSelection: getMultiExistingSelection(selectionExists, rows)
|
|
129
|
+
existingSelection: getMultiExistingSelection(selectionExists, rows),
|
|
132
130
|
};
|
|
133
131
|
}, [selectModel, selectionExists, rows]);
|
|
134
132
|
var getRowClickHandler = function (index) { return function () {
|
|
@@ -141,18 +139,18 @@ var Grid = function (_a) {
|
|
|
141
139
|
}
|
|
142
140
|
getSelectHandler(index)();
|
|
143
141
|
}; };
|
|
144
|
-
var getAriaSelectedValue = function (
|
|
142
|
+
var getAriaSelectedValue = function (id) {
|
|
145
143
|
if (!selectModel) {
|
|
146
144
|
return undefined;
|
|
147
145
|
}
|
|
148
|
-
return String(selectedSet.has(
|
|
146
|
+
return String(selectedSet.has(id));
|
|
149
147
|
};
|
|
150
148
|
var getInputStrSubmitCallback = editModel &&
|
|
151
|
-
(function (
|
|
152
|
-
var
|
|
149
|
+
(function (id) {
|
|
150
|
+
var idSpecificCallback = editModel.getUpdateCallback(id);
|
|
153
151
|
return function (inputStrs) {
|
|
154
|
-
var
|
|
155
|
-
|
|
152
|
+
var rowData = inputStrsToRowData(cols, inputStrs);
|
|
153
|
+
idSpecificCallback(rowData);
|
|
156
154
|
};
|
|
157
155
|
});
|
|
158
156
|
var unwrappedTableModel = useMemo(function () { return unwrapTableStyleModel(styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel); }, [styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel]);
|
|
@@ -176,15 +174,15 @@ var Grid = function (_a) {
|
|
|
176
174
|
: undefined;
|
|
177
175
|
return (_jsx(ColHeaderCell, { label: label, sortModel: colSortModel, ariaColIndex: index + 1 + (showSelectCol ? 1 : 0), additionalClasses: unwrappedTableModel.theadTh(index) }, name));
|
|
178
176
|
}), 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) {
|
|
179
|
-
return (_jsx(EditableRow, { onClick: getRowClickHandler(row.
|
|
180
|
-
"table-active": selectedSet.has(row.
|
|
181
|
-
}, unwrappedTableModel.tbodyTr(row.
|
|
182
|
-
getInputStrSubmitCallback(row.
|
|
183
|
-
editModel.getDeleteCallback(row.
|
|
184
|
-
return unwrappedTableModel.tbodyTd(row.
|
|
177
|
+
return (_jsx(EditableRow, { onClick: getRowClickHandler(row.id), className: classNames({
|
|
178
|
+
"table-active": selectedSet.has(row.id),
|
|
179
|
+
}, unwrappedTableModel.tbodyTr(row.id, index)), "aria-rowindex": index + 2, dataRowId: row.id, "aria-selected": getAriaSelectedValue(row.id), ariaColIndexOffset: ariaColIndexOffset, cellData: row.contents, updateCallback: getInputStrSubmitCallback &&
|
|
180
|
+
getInputStrSubmitCallback(row.id), deleteCallback: (editModel === null || editModel === void 0 ? void 0 : editModel.getDeleteCallback) &&
|
|
181
|
+
editModel.getDeleteCallback(row.id), dataCellClasses: function (colIndex) {
|
|
182
|
+
return unwrappedTableModel.tbodyTd(row.id, index, colIndex);
|
|
185
183
|
}, dataCellInputClasses: function (colIndex) {
|
|
186
|
-
return unwrappedTableModel.tbodyTdInput(row.
|
|
187
|
-
}, editCellClasses: unwrappedTableModel.editColTd(row.
|
|
184
|
+
return unwrappedTableModel.tbodyTdInput(row.id, index, colIndex);
|
|
185
|
+
}, editCellClasses: unwrappedTableModel.editColTd(row.id, index), saveButtonClasses: unwrappedTableModel.editSaveButton(row.id, index), deleteButtonClasses: unwrappedTableModel.editDeleteButton(row.id, index), startButtonClasses: unwrappedTableModel.editStartButton(row.id, index), cancelButtonClasses: unwrappedTableModel.editCancelButton(row.id, index), children: showSelectCol && (_jsx("td", { className: classNames(unwrappedTableModel.rowSelectColTd(row.id, index)), "aria-colindex": 1, children: _jsx(SelectionInput, { selected: selectedSet.has(row.id), selectionInputModel: getSelectInputModel(row.id, selectModel), selectCallback: getSelectHandler(row.id), additionalClasses: unwrappedTableModel.rowSelectInput(row.id, index) }) })) }, row.id));
|
|
188
186
|
}) })] }), 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 }))] })] }));
|
|
189
187
|
};
|
|
190
188
|
export default Grid;
|
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
See the documentation site at https://react-bootstrap-data-grid.vercel.app/ for instructions on usage.
|
|
4
4
|
|
|
5
|
-
See the source repository at https://github.com/absreim/react-bootstrap-data-grid to view the source code.
|
|
5
|
+
See the source repository at https://github.com/absreim/react-bootstrap-data-grid to view the source code.
|
package/editing/EditableRow.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
+
import { RowId } from "../types";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { CellData } from "./types";
|
|
4
5
|
export type EditableRowProps = Pick<React.ComponentProps<"tr">, "onClick" | "className" | "aria-rowindex" | "aria-selected"> & {
|
|
5
6
|
ariaColIndexOffset: number;
|
|
6
|
-
|
|
7
|
+
dataRowId: RowId;
|
|
7
8
|
children: ReactNode;
|
|
8
9
|
cellData: CellData[];
|
|
9
10
|
updateCallback?: (values: string[]) => void;
|
package/editing/EditableRow.js
CHANGED
|
@@ -29,7 +29,7 @@ var colDataTypeToInputType = function (colDataType) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
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"],
|
|
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"], dataRowId = _a.dataRowId, dataCellClasses = _a.dataCellClasses, dataCellInputClasses = _a.dataCellInputClasses, editCellClasses = _a.editCellClasses, saveButtonClasses = _a.saveButtonClasses, startButtonClasses = _a.startButtonClasses, cancelButtonClasses = _a.cancelButtonClasses, deleteButtonClasses = _a.deleteButtonClasses;
|
|
33
33
|
var trRef = useRef(null);
|
|
34
34
|
var _b = useState(false), isEditing = _b[0], setIsEditing = _b[1];
|
|
35
35
|
var handleSave = function () {
|
|
@@ -59,9 +59,9 @@ var EditableRow = function (_a) {
|
|
|
59
59
|
setIsEditing(false);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
return (_jsxs("tr", { ref: trRef, onClick: onClick, className: className, "aria-rowindex": ariaRowIndex, "aria-selected": ariaSelected, "data-
|
|
62
|
+
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) {
|
|
63
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(
|
|
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(dataRowId, "-").concat(index), className: classNames("form-control", dataCellInputClasses(index)), type: colDataTypeToInputType(type), defaultValue: initValueToFormValue(value, type), required: type !== "string" })) : (formattedValue) }, index));
|
|
65
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
66
|
};
|
|
67
67
|
export default EditableRow;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var inputStrsToRowData = function (cols, inputStrs) {
|
|
2
2
|
var newRow = {};
|
|
3
3
|
inputStrs.forEach(function (value, index) {
|
|
4
4
|
var col = cols[index];
|
|
@@ -15,4 +15,4 @@ var inputStrsToRowDef = function (cols, inputStrs) {
|
|
|
15
15
|
});
|
|
16
16
|
return newRow;
|
|
17
17
|
};
|
|
18
|
-
export default
|
|
18
|
+
export default inputStrsToRowData;
|
package/editing/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColDataType, ColDataTypeStrings,
|
|
1
|
+
import { ColDataType, ColDataTypeStrings, RowData, RowId } from "../types";
|
|
2
2
|
export interface CellData {
|
|
3
3
|
fieldName: string;
|
|
4
4
|
value: ColDataType;
|
|
@@ -7,8 +7,8 @@ export interface CellData {
|
|
|
7
7
|
formattedValue: string;
|
|
8
8
|
label: string;
|
|
9
9
|
}
|
|
10
|
-
export type UpdateCallbackGenerator = (
|
|
10
|
+
export type UpdateCallbackGenerator = (id: RowId) => (rowData: RowData) => void;
|
|
11
11
|
export interface EditModel {
|
|
12
12
|
getUpdateCallback: UpdateCallbackGenerator;
|
|
13
|
-
getDeleteCallback?: (
|
|
13
|
+
getDeleteCallback?: (id: RowId) => () => void;
|
|
14
14
|
}
|
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": "2.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brook Li",
|
|
7
7
|
"homepage": "https://react-bootstrap-data-grid.vercel.app/",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RowDef } from "../types";
|
|
2
2
|
import { GridPaginationState } from "../pagination/types";
|
|
3
|
-
declare const useCurrentPageRows: (sortedRows:
|
|
3
|
+
declare const useCurrentPageRows: (sortedRows: RowDef[], pagination: GridPaginationState | undefined) => RowDef[];
|
|
4
4
|
export default useCurrentPageRows;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const useDisplayRows: (currentPageRows:
|
|
1
|
+
import { RowDef, FormattedRow, ColDef } from "../types";
|
|
2
|
+
declare const useDisplayRows: (currentPageRows: RowDef[], cols: ColDef[], ariaColIndexOffset: number) => FormattedRow[];
|
|
3
3
|
export default useDisplayRows;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
+
import { dateToDatetimeInputStr, dateToInputStr } from "../util/datetime";
|
|
2
3
|
var getFormattedValue = function (value, formatter, typeString) {
|
|
3
4
|
if (formatter) {
|
|
4
5
|
return formatter(value);
|
|
5
6
|
}
|
|
6
7
|
if (typeString === "date") {
|
|
7
|
-
return value
|
|
8
|
+
return dateToInputStr(value);
|
|
8
9
|
}
|
|
9
10
|
if (typeString === "datetime") {
|
|
10
|
-
return value
|
|
11
|
+
return dateToDatetimeInputStr(value);
|
|
11
12
|
}
|
|
12
13
|
if (typeString === "number") {
|
|
13
|
-
return value.
|
|
14
|
+
return value.toString();
|
|
14
15
|
}
|
|
15
16
|
return value;
|
|
16
17
|
};
|
|
@@ -52,7 +53,7 @@ var useDisplayRows = function (currentPageRows, cols, ariaColIndexOffset) {
|
|
|
52
53
|
label: cols[index].label,
|
|
53
54
|
};
|
|
54
55
|
});
|
|
55
|
-
return { contents: displayRow,
|
|
56
|
+
return { contents: displayRow, id: row.id };
|
|
56
57
|
});
|
|
57
58
|
}, [currentPageRows, cols, ariaColIndexOffset]);
|
|
58
59
|
};
|
package/pipeline/useFilter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RowDef } from "../types";
|
|
2
2
|
import { EditableTableFilterState } from "../filtering/types";
|
|
3
|
-
declare const useFilter: (rows:
|
|
3
|
+
declare const useFilter: (rows: RowDef[], filterState: EditableTableFilterState | null) => RowDef[];
|
|
4
4
|
export default useFilter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColDef, RowDef } from "../types";
|
|
2
2
|
import { TableSortModel } from "../sorting/types";
|
|
3
|
-
declare const useSortedRows: (rows:
|
|
3
|
+
declare const useSortedRows: (rows: RowDef[], cols: ColDef[], sortModel: TableSortModel | undefined) => RowDef[];
|
|
4
4
|
export default useSortedRows;
|
package/selection/types.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { RowId } from "../types";
|
|
1
2
|
export type SelectMode = "column" | "row" | "both";
|
|
2
3
|
export type SelectType = "single" | "multi";
|
|
3
4
|
export interface MultiSelectModel {
|
|
4
5
|
mode: SelectMode;
|
|
5
6
|
type: "multi";
|
|
6
|
-
selected:
|
|
7
|
-
setSelected: (selected:
|
|
7
|
+
selected: RowId[];
|
|
8
|
+
setSelected: (selected: RowId[]) => void;
|
|
8
9
|
}
|
|
9
10
|
export interface SingleSelectModel {
|
|
10
11
|
mode: SelectMode;
|
|
11
12
|
type: "single";
|
|
12
|
-
selected:
|
|
13
|
-
setSelected: (selected:
|
|
13
|
+
selected: RowId | null;
|
|
14
|
+
setSelected: (selected: RowId | null) => void;
|
|
14
15
|
groupName: string;
|
|
15
16
|
}
|
|
16
17
|
export type SelectModel = SingleSelectModel | MultiSelectModel;
|
|
@@ -21,6 +22,6 @@ export interface SingleSelectionInfo {
|
|
|
21
22
|
}
|
|
22
23
|
export interface MultiSelectionInfo {
|
|
23
24
|
selectType: "multi";
|
|
24
|
-
existingSelection:
|
|
25
|
+
existingSelection: "full" | "partial" | "none";
|
|
25
26
|
}
|
|
26
27
|
export type SelectionInfo = SingleSelectionInfo | MultiSelectionInfo;
|
package/selection/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Selected indices are based on the
|
|
1
|
+
// Selected indices are based on the id of the input rows. If
|
|
2
2
|
// filtered-out items are included in the 'selected' property, there will be a
|
|
3
3
|
// visual indication to the user of that fact.
|
|
4
4
|
export {};
|
package/style.scss
CHANGED
package/styling/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RowId } from "../types";
|
|
1
2
|
export interface SharedTableStyleModel {
|
|
2
3
|
table?: string[];
|
|
3
4
|
tbody?: string[];
|
|
@@ -7,18 +8,18 @@ export interface SharedTableStyleModel {
|
|
|
7
8
|
caption?: string[];
|
|
8
9
|
}
|
|
9
10
|
export type TableStyleModel = SharedTableStyleModel & {
|
|
10
|
-
tbodyTr?: (
|
|
11
|
-
tbodyTd?: (
|
|
12
|
-
tbodyTdInput?: (
|
|
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[];
|
|
13
14
|
editColTh?: string[];
|
|
14
|
-
editColTd?: (
|
|
15
|
-
editStartButton?: (
|
|
16
|
-
editDeleteButton?: (
|
|
17
|
-
editSaveButton?: (
|
|
18
|
-
editCancelButton?: (
|
|
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[];
|
|
19
20
|
rowSelectColTh?: string[];
|
|
20
|
-
rowSelectColTd?: (
|
|
21
|
-
rowSelectInput?: (
|
|
21
|
+
rowSelectColTd?: (rowId: RowId, displayIndex: number) => string[];
|
|
22
|
+
rowSelectInput?: (rowId: RowId, displayIndex: number) => string[];
|
|
22
23
|
};
|
|
23
24
|
export type FilterInputTableStyleModel = SharedTableStyleModel & {
|
|
24
25
|
tbodyTr?: (rowIndex: number) => string[];
|
package/types.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { CellData } from "./editing/types";
|
|
2
2
|
export type ColDataType = string | number | Date;
|
|
3
3
|
export type ColDataTypeStrings = "string" | "number" | "date" | "datetime";
|
|
4
|
-
export interface ColDef {
|
|
4
|
+
export interface ColDef<ValueType = any> {
|
|
5
5
|
type: ColDataTypeStrings;
|
|
6
6
|
name: string;
|
|
7
7
|
label: string;
|
|
8
|
-
formatter?: (value:
|
|
8
|
+
formatter?: (value: ValueType) => string;
|
|
9
9
|
sortable?: boolean;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
data:
|
|
17
|
-
meta: RowMetadata;
|
|
11
|
+
type ValidRowData = Record<string, any>;
|
|
12
|
+
export type RowData<Data extends ValidRowData = ValidRowData> = Data;
|
|
13
|
+
export type RowId = string | number;
|
|
14
|
+
export interface RowDef<Data extends ValidRowData = ValidRowData> {
|
|
15
|
+
id: RowId;
|
|
16
|
+
data: RowData<Data>;
|
|
18
17
|
}
|
|
19
18
|
export interface FormattedRow {
|
|
20
19
|
contents: CellData[];
|
|
21
|
-
|
|
20
|
+
id: RowId;
|
|
22
21
|
}
|
|
23
22
|
export type JustifyContentSetting = "start" | "end" | "center" | "between" | "around" | "evenly";
|
|
24
23
|
export type Size = "small" | "medium" | "large";
|
|
24
|
+
export {};
|
package/util/isSubset.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const isSubset: (subset:
|
|
1
|
+
declare const isSubset: <T>(subset: T[], superSet: T[]) => boolean;
|
|
2
2
|
export default isSubset;
|
package/util/isSubset.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var isSubset = function (subset, superSet) {
|
|
2
2
|
var supersetSet = new Set(superSet);
|
|
3
3
|
for (var _i = 0, subset_1 = subset; _i < subset_1.length; _i++) {
|
|
4
|
-
var
|
|
5
|
-
if (!supersetSet.has(
|
|
4
|
+
var member = subset_1[_i];
|
|
5
|
+
if (!supersetSet.has(member)) {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
var useAugmentedRows = function (rows) {
|
|
3
|
-
return useMemo(function () {
|
|
4
|
-
return rows.map(function (row, index) { return ({
|
|
5
|
-
data: row,
|
|
6
|
-
meta: {
|
|
7
|
-
origIndex: index,
|
|
8
|
-
},
|
|
9
|
-
}); });
|
|
10
|
-
}, [rows]);
|
|
11
|
-
};
|
|
12
|
-
export default useAugmentedRows;
|