@absreim/react-bootstrap-data-grid-pro 2.7.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/common/constants.d.ts +2 -0
  2. package/common/constants.js +2 -0
  3. package/common/editing/types.d.ts +7 -0
  4. package/{grid → common}/export/ExportForm.d.ts +1 -0
  5. package/{grid → common}/export/ExportForm.js +3 -3
  6. package/{grid → common}/filtering/DateFilterRow.d.ts +4 -4
  7. package/{grid → common}/filtering/DateFilterRow.js +1 -1
  8. package/common/filtering/FilterOptionsTable.d.ts +12 -0
  9. package/common/filtering/FilterOptionsTable.js +87 -0
  10. package/{grid → common}/filtering/FilterRow.d.ts +4 -4
  11. package/{grid → common}/filtering/FilterRow.js +1 -1
  12. package/{grid → common}/filtering/NumberFilterRow.d.ts +3 -3
  13. package/{grid → common}/filtering/NumberFilterRow.js +1 -1
  14. package/{grid → common}/filtering/StringFilterRow.d.ts +3 -3
  15. package/{grid → common}/filtering/StringFilterRow.js +1 -1
  16. package/{grid → common}/filtering/types.d.ts +6 -6
  17. package/common/filtering/useFilterFormState.d.ts +3 -0
  18. package/common/index.d.ts +11 -0
  19. package/common/index.js +11 -0
  20. package/{grid → common}/pagination/PageSelector.d.ts +1 -1
  21. package/{grid → common}/pagination/PageSizeSelector.d.ts +1 -1
  22. package/{grid → common}/pagination/Pagination.d.ts +1 -1
  23. package/{grid → common}/pagination/Pagination.js +6 -3
  24. package/{grid → common}/pagination/types.d.ts +3 -2
  25. package/{grid → common}/pipeline/useAugFormattedRows.d.ts +1 -1
  26. package/common/pipeline/useColNameToWidth.d.ts +3 -0
  27. package/common/pipeline/useColNameToWidth.js +7 -0
  28. package/{grid → common}/pipeline/useCombinedPipeline/index.d.ts +4 -4
  29. package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.d.ts +3 -3
  30. package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.d.ts +1 -1
  31. package/{grid → common}/pipeline/useCombinedPipeline/useDisplayRows.js +1 -2
  32. package/common/pipeline/useCombinedPipeline/useFilter.d.ts +4 -0
  33. package/common/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +4 -0
  34. package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.d.ts +2 -2
  35. package/{grid → common}/pipeline/useGridSelectionFns.d.ts +2 -2
  36. package/{grid → common}/sorting/types.d.ts +3 -3
  37. package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.d.ts +2 -2
  38. package/{grid/main/ColHeaderCell → common/sorting}/useSortHeaderStates.js +4 -4
  39. package/common/styling/types.d.ts +21 -0
  40. package/{grid → common}/toolbar/ToolbarContainer.d.ts +2 -2
  41. package/{grid → common}/toolbar/ToolbarContainer.js +11 -7
  42. package/common/toolbar/types.d.ts +11 -0
  43. package/common/toolbar/useInterfaces.d.ts +3 -0
  44. package/common/toolbar/useInterfaces.js +15 -0
  45. package/{grid → common}/types.d.ts +24 -34
  46. package/common/util/index.d.ts +5 -0
  47. package/common/util/index.js +5 -0
  48. package/grid/constants.d.ts +2 -0
  49. package/grid/constants.js +2 -0
  50. package/grid/index.d.ts +3 -10
  51. package/grid/index.js +3 -10
  52. package/grid/{Grid.d.ts → main/Grid.d.ts} +0 -1
  53. package/grid/main/Grid.js +59 -0
  54. package/grid/main/GridBody.d.ts +4 -0
  55. package/grid/main/GridBody.js +13 -0
  56. package/grid/main/GridHeader.d.ts +4 -0
  57. package/grid/main/GridHeader.js +11 -0
  58. package/grid/main/getWidthStyles.d.ts +3 -0
  59. package/grid/main/getWidthStyles.js +6 -0
  60. package/grid/main/types.d.ts +32 -0
  61. package/grid.css +1 -0
  62. package/grid.scss +231 -0
  63. package/package.json +1 -1
  64. package/pro/index.d.ts +5 -0
  65. package/pro/index.js +5 -0
  66. package/table/InternalTable.d.ts +21 -0
  67. package/table/InternalTable.js +58 -0
  68. package/table/Table.d.ts +5 -0
  69. package/{grid/Grid.js → table/Table.js} +11 -18
  70. package/{grid → table}/editing/EditControlsCell.d.ts +5 -5
  71. package/table/editing/EditControlsCell.js +10 -0
  72. package/{grid → table}/editing/EditableRow.d.ts +8 -9
  73. package/{grid → table}/editing/EditableRow.js +3 -3
  74. package/table/index.d.ts +5 -0
  75. package/table/index.js +5 -0
  76. package/table/main/BodyRows.d.ts +22 -0
  77. package/table/main/BodyRows.js +27 -0
  78. package/{grid → table}/main/ColHeaderCell/index.js +3 -3
  79. package/{grid → table}/selection/SelectAllHeaderCell.d.ts +2 -2
  80. package/{grid → table}/selection/SelectAllHeaderCell.js +2 -4
  81. package/{grid → table}/selection/SelectionInput.d.ts +1 -1
  82. package/table/style.scss +3 -0
  83. package/table/styling/types.d.ts +41 -0
  84. package/table/styling/types.js +1 -0
  85. package/table/types.d.ts +19 -0
  86. package/table/types.js +1 -0
  87. package/{grid-pro → table-pro}/ColHeaderCellPro.js +4 -4
  88. package/table-pro/TablePro.d.ts +4 -0
  89. package/{grid-pro/GridPro.js → table-pro/TablePro.js} +10 -13
  90. package/{grid-pro → table-pro}/index.d.ts +2 -2
  91. package/{grid-pro → table-pro}/index.js +2 -2
  92. package/{grid-pro → table-pro}/reorder/ReorderHandleCell.js +1 -1
  93. package/{grid-pro → table-pro}/reorder/useKeyboardReorder.js +1 -1
  94. package/{grid-pro → table-pro}/resize/useResizeModel.d.ts +1 -1
  95. package/table-pro/style.scss +69 -0
  96. package/{grid-pro → table-pro}/types.d.ts +3 -3
  97. package/table-pro/types.js +1 -0
  98. package/table-pro.scss +1 -0
  99. package/grid/InternalGrid.d.ts +0 -23
  100. package/grid/InternalGrid.js +0 -56
  101. package/grid/editing/EditControlsCell.js +0 -18
  102. package/grid/editing/types.d.ts +0 -16
  103. package/grid/filtering/FilterOptionsTable.d.ts +0 -11
  104. package/grid/filtering/FilterOptionsTable.js +0 -81
  105. package/grid/filtering/useFilterFormState.d.ts +0 -3
  106. package/grid/main/BodyRows.d.ts +0 -22
  107. package/grid/main/BodyRows.js +0 -11
  108. package/grid/main/ToggleButton.d.ts +0 -9
  109. package/grid/main/ToggleButton.js +0 -13
  110. package/grid/pipeline/useCombinedPipeline/useFilter.d.ts +0 -4
  111. package/grid/pipeline/useCombinedPipeline/useFilterStateFromEditable.d.ts +0 -4
  112. package/grid/pipeline/useUnwrappedGridStyles.d.ts +0 -7
  113. package/grid/pipeline/useUnwrappedGridStyles.js +0 -15
  114. package/grid/styling/styleModelUnwrappers.d.ts +0 -4
  115. package/grid/styling/styleModelUnwrappers.js +0 -47
  116. package/grid/styling/types.d.ts +0 -62
  117. package/grid/toolbar/types.d.ts +0 -3
  118. package/grid/toolbar/useInterfaces.d.ts +0 -9
  119. package/grid/toolbar/useInterfaces.js +0 -11
  120. package/grid-pro/GridPro.d.ts +0 -4
  121. /package/{grid → common}/editing/inputStrsToRowData.d.ts +0 -0
  122. /package/{grid → common}/editing/inputStrsToRowData.js +0 -0
  123. /package/{grid-pro/reorder → common/editing}/types.js +0 -0
  124. /package/{grid → common}/export/types.d.ts +0 -0
  125. /package/{grid-pro/resize → common/export}/types.js +0 -0
  126. /package/{grid → common}/export/useExportFn.d.ts +0 -0
  127. /package/{grid → common}/export/useExportFn.js +0 -0
  128. /package/{grid → common}/filtering/types.js +0 -0
  129. /package/{grid → common}/filtering/useFilterFormState.js +0 -0
  130. /package/{grid → common}/pagination/PageSelector.js +0 -0
  131. /package/{grid → common}/pagination/PageSizeSelector.js +0 -0
  132. /package/{grid-pro → common/pagination}/types.js +0 -0
  133. /package/{grid → common}/pipeline/types.d.ts +0 -0
  134. /package/{grid-pro/util → common/pipeline}/types.js +0 -0
  135. /package/{grid → common}/pipeline/useAugFormattedRows.js +0 -0
  136. /package/{grid → common}/pipeline/useCombinedPipeline/index.js +0 -0
  137. /package/{grid → common}/pipeline/useCombinedPipeline/useCurrentPageRows.js +0 -0
  138. /package/{grid → common}/pipeline/useCombinedPipeline/useFilter.js +0 -0
  139. /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateFromEditable.js +0 -0
  140. /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.d.ts +0 -0
  141. /package/{grid → common}/pipeline/useCombinedPipeline/useFilterStateStore.js +0 -0
  142. /package/{grid → common}/pipeline/useCombinedPipeline/useSortedRows.js +0 -0
  143. /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.d.ts +0 -0
  144. /package/{grid → common}/pipeline/useGetInputStrSubmitCallback.js +0 -0
  145. /package/{grid → common}/pipeline/useGridSelectionFns.js +0 -0
  146. /package/{grid → common}/selection/types.d.ts +0 -0
  147. /package/{grid → common}/selection/types.js +0 -0
  148. /package/{grid → common}/sorting/arrowPlaceholder.d.ts +0 -0
  149. /package/{grid → common}/sorting/arrowPlaceholder.js +0 -0
  150. /package/{grid → common}/sorting/downArrow.d.ts +0 -0
  151. /package/{grid → common}/sorting/downArrow.js +0 -0
  152. /package/{grid → common}/sorting/sortOrderToAriaSort.d.ts +0 -0
  153. /package/{grid → common}/sorting/sortOrderToAriaSort.js +0 -0
  154. /package/{grid/editing → common/sorting}/types.js +0 -0
  155. /package/{grid → common}/sorting/upArrow.d.ts +0 -0
  156. /package/{grid → common}/sorting/upArrow.js +0 -0
  157. /package/{grid/export → common/styling}/types.js +0 -0
  158. /package/{grid → common}/toolbar/Toolbar.d.ts +0 -0
  159. /package/{grid → common}/toolbar/Toolbar.js +0 -0
  160. /package/{grid/pagination → common/toolbar}/types.js +0 -0
  161. /package/{grid/pipeline → common}/types.js +0 -0
  162. /package/{grid → common}/util/datetime.d.ts +0 -0
  163. /package/{grid → common}/util/datetime.js +0 -0
  164. /package/{grid → common}/util/getWidthStyle.d.ts +0 -0
  165. /package/{grid → common}/util/getWidthStyle.js +0 -0
  166. /package/{grid → common}/util/isSubset.d.ts +0 -0
  167. /package/{grid → common}/util/isSubset.js +0 -0
  168. /package/{grid → common}/util/trueModulo.d.ts +0 -0
  169. /package/{grid → common}/util/trueModulo.js +0 -0
  170. /package/{grid → common}/util/useControlledHover.d.ts +0 -0
  171. /package/{grid → common}/util/useControlledHover.js +0 -0
  172. /package/grid/{sorting → main}/types.js +0 -0
  173. /package/{grid → table}/main/ColHeaderCell/index.d.ts +0 -0
  174. /package/{grid → table}/selection/SelectionInput.js +0 -0
  175. /package/{grid-pro → table-pro}/ColHeaderCellPro.d.ts +0 -0
  176. /package/{grid-pro → table-pro}/assets/HorizontalGrip.d.ts +0 -0
  177. /package/{grid-pro → table-pro}/assets/HorizontalGrip.js +0 -0
  178. /package/{grid-pro → table-pro}/assets/VerticalGrip.d.ts +0 -0
  179. /package/{grid-pro → table-pro}/assets/VerticalGrip.js +0 -0
  180. /package/{grid-pro/util → table-pro/lib}/regDragCleanup.d.ts +0 -0
  181. /package/{grid-pro/util → table-pro/lib}/regDragCleanup.js +0 -0
  182. /package/{grid-pro/util → table-pro/lib}/types.d.ts +0 -0
  183. /package/{grid/styling → table-pro/lib}/types.js +0 -0
  184. /package/{grid-pro → table-pro}/reorder/ReorderHandleCell.d.ts +0 -0
  185. /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.d.ts +0 -0
  186. /package/{grid-pro → table-pro}/reorder/ReorderHeaderCell.js +0 -0
  187. /package/{grid-pro → table-pro}/reorder/types.d.ts +0 -0
  188. /package/{grid/toolbar → table-pro/reorder}/types.js +0 -0
  189. /package/{grid-pro → table-pro}/reorder/useKeyboardReorder.d.ts +0 -0
  190. /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.d.ts +0 -0
  191. /package/{grid-pro → table-pro}/reorder/useKeyboardReorderListener.js +0 -0
  192. /package/{grid-pro → table-pro}/reorder/useReorderStyles.d.ts +0 -0
  193. /package/{grid-pro → table-pro}/reorder/useReorderStyles.js +0 -0
  194. /package/{grid-pro → table-pro}/resize/types.d.ts +0 -0
  195. /package/{grid → table-pro/resize}/types.js +0 -0
  196. /package/{grid-pro → table-pro}/resize/useResizeModel.js +0 -0
  197. /package/{grid-pro → table-pro}/util/index.d.ts +0 -0
  198. /package/{grid-pro → table-pro}/util/index.js +0 -0
  199. /package/{grid-pro → table-pro}/util/reorderRows.d.ts +0 -0
  200. /package/{grid-pro → table-pro}/util/reorderRows.js +0 -0
  201. /package/{style.css → table-pro.css} +0 -0
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ import SelectAllHeaderCell from "./selection/SelectAllHeaderCell";
5
+ import Pagination from "../common/pagination/Pagination";
6
+ import classNames from "classnames";
7
+ import useInterfaces from "../common/toolbar/useInterfaces";
8
+ import ToolbarContainer from "../common/toolbar/ToolbarContainer";
9
+ import useExportFn from "../common/export/useExportFn";
10
+ import getWidthStyle from "../common/util/getWidthStyle";
11
+ const InternalTable = ({ gridProps: { rows, cols, pagination, filterModel, selectModel, editModel, caption, styleModel, displayMode, allowExport, }, hooks: { pipelineOutput, selectFns }, slots: { colHeaderCells, bodyRows, prefixHeader }, classes, }) => {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13
+ const { normalizedTableFilterModel, filteredRows, filterState, sortedRowsOutput: { sortedRows }, currentPageRowsOutput: { paginatedRows, normalizedModel }, showSelectCol, } = pipelineOutput;
14
+ const exportFnInfo = useExportFn({
15
+ rows,
16
+ cols,
17
+ filteredRows: filterModel && filteredRows,
18
+ currentPageRows: pagination && paginatedRows,
19
+ });
20
+ const showToolbar = filterModel || allowExport;
21
+ const toolbarPropGen = useMemo(() => (closeUiCallback) => {
22
+ return {
23
+ filtering: filterState && filterModel && normalizedTableFilterModel
24
+ ? {
25
+ filterState: filterState,
26
+ setFilterState: normalizedTableFilterModel.setTableFilterState,
27
+ caption: filterModel.filterTableCaption,
28
+ styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel,
29
+ closeFormCallback: closeUiCallback,
30
+ }
31
+ : undefined,
32
+ exporting: allowExport
33
+ ? {
34
+ exportFnInfo,
35
+ styleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.exportFormStyleModel,
36
+ closeCallback: closeUiCallback,
37
+ }
38
+ : undefined,
39
+ };
40
+ }, [
41
+ allowExport,
42
+ exportFnInfo,
43
+ filterModel,
44
+ filterState,
45
+ normalizedTableFilterModel,
46
+ styleModel === null || styleModel === void 0 ? void 0 : styleModel.exportFormStyleModel,
47
+ styleModel === null || styleModel === void 0 ? void 0 : styleModel.filterInputTableStyleModel,
48
+ ]);
49
+ const toolbarInterfaces = useInterfaces(toolbarPropGen);
50
+ const { rowsAreSelectable, selectionInfo, selectAllOnClick } = selectFns;
51
+ const mainTable = (_jsxs("table", { className: classNames({
52
+ "table-hover": rowsAreSelectable,
53
+ "d-block": displayMode === "block",
54
+ }, ((_a = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _a === void 0 ? void 0 : _a.table) || "table"), "aria-rowcount": filteredRows.length + 1, children: [caption !== undefined && (_jsx("caption", { className: classNames((_b = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _b === void 0 ? void 0 : _b.caption), children: caption })), _jsx("thead", { className: classNames((_c = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _c === void 0 ? void 0 : _c.thead), children: _jsxs("tr", { "aria-rowindex": 1, className: classNames((_d = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _d === void 0 ? void 0 : _d.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: (_e = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _e === void 0 ? void 0 : _e.rowSelectColTh, colIndexOffset: prefixHeader ? 1 : 0 })), colHeaderCells, editModel && (_jsx("th", { "aria-colindex": cols.length + 1 + (showSelectCol ? 1 : 0), className: classNames((_f = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _f === void 0 ? void 0 : _f.editColTh), style: getWidthStyle(editModel === null || editModel === void 0 ? void 0 : editModel.editColWidth), children: "Edit Controls" }))] }) }), _jsx("tbody", { className: classNames(classNames((_g = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _g === void 0 ? void 0 : _g.tbody)), children: bodyRows })] }));
55
+ return (_jsxs("div", { "data-testid": "rbdg-top-level-div", className: classNames((_h = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _h === void 0 ? void 0 : _h.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((_j = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _j === void 0 ? void 0 : _j.tableAndPaginationDiv), children: [_jsx("div", { "data-testid": "rbdg-table-div", className: classNames(((_k = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _k === void 0 ? void 0 : _k.tableDiv) ||
56
+ "table-responsive"), children: mainTable }), normalizedModel && (_jsx(Pagination, { normalizedModel: normalizedModel, prePagingNumRows: sortedRows.length, containerDivClasses: (_l = styleModel === null || styleModel === void 0 ? void 0 : styleModel.additionalComponentsStyleModel) === null || _l === void 0 ? void 0 : _l.paginationUiDiv }))] })] }));
57
+ };
58
+ export default InternalTable;
@@ -0,0 +1,5 @@
1
+ import { FC } from "react";
2
+ import { TableProps } from "./types";
3
+ declare const Table: FC<TableProps>;
4
+ export default Table;
5
+ export type { TableProps } from "./types";
@@ -1,15 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useMemo } from "react";
4
- import InternalGrid from "./InternalGrid";
3
+ import InternalTable from "./InternalTable";
5
4
  import ColHeaderCell from "./main/ColHeaderCell";
6
- import useCombinedPipeline from "./pipeline/useCombinedPipeline";
7
- import useGridSelectionFns from "./pipeline/useGridSelectionFns";
8
- import useUnwrappedGridStyles from "./pipeline/useUnwrappedGridStyles";
9
- import useGetInputStrSubmitCallback from "./pipeline/useGetInputStrSubmitCallback";
10
- import useAugFormattedRows from "./pipeline/useAugFormattedRows";
5
+ import useCombinedPipeline from "../common/pipeline/useCombinedPipeline";
6
+ import useGridSelectionFns from "../common/pipeline/useGridSelectionFns";
7
+ import useGetInputStrSubmitCallback from "../common/pipeline/useGetInputStrSubmitCallback";
8
+ import useAugFormattedRows from "../common/pipeline/useAugFormattedRows";
11
9
  import BodyRows from "./main/BodyRows";
12
- const Grid = (props) => {
10
+ import useColNameToWidth from "../common/pipeline/useColNameToWidth";
11
+ const Table = (props) => {
13
12
  const { rows, cols, filterModel, sortModel, pagination, selectModel, styleModel, editModel, } = props;
14
13
  const combinedPipelineOutput = useCombinedPipeline({
15
14
  rows,
@@ -21,13 +20,8 @@ const Grid = (props) => {
21
20
  });
22
21
  const { sortedRowsOutput: { sortColDef, setSortColDef, sortingEnabled }, showSelectCol, displayRows, } = combinedPipelineOutput;
23
22
  const gridSelectionFns = useGridSelectionFns(selectModel, rows);
24
- const unwrappedStyles = useUnwrappedGridStyles(styleModel);
25
23
  const getInputStrSubmitCallback = useGetInputStrSubmitCallback(editModel, cols);
26
- const colNameToWidth = useMemo(() => {
27
- const map = {};
28
- cols.forEach(({ name, width }) => (map[name] = width));
29
- return map;
30
- }, [cols]);
24
+ const colNameToWidth = useColNameToWidth(cols);
31
25
  const augFormattedRows = useAugFormattedRows(colNameToWidth, displayRows);
32
26
  const colHeaderCells = cols.map(({ name, label, sortable, width }, index) => {
33
27
  var _a;
@@ -42,11 +36,10 @@ const Grid = (props) => {
42
36
  return (_jsx(ColHeaderCell, { label: label, sortModel: colSortModel, ariaColIndex: index + 1 + (showSelectCol ? 1 : 0), additionalClasses: ((_a = styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel) === null || _a === void 0 ? void 0 : _a.theadTh) &&
43
37
  styleModel.mainTableStyleModel.theadTh(index), width: width }, name));
44
38
  });
45
- const bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, unwrappedStyles: unwrappedStyles, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback }));
46
- return (_jsx(InternalGrid, { gridProps: props, hooks: {
39
+ const 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 }));
40
+ return (_jsx(InternalTable, { gridProps: props, hooks: {
47
41
  pipelineOutput: combinedPipelineOutput,
48
42
  selectFns: gridSelectionFns,
49
- unwrappedStyles,
50
43
  }, slots: { colHeaderCells, bodyRows } }));
51
44
  };
52
- export default Grid;
45
+ export default Table;
@@ -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>;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ const stopPropagationWrapper = (fn) => (event) => {
4
+ event.stopPropagation();
5
+ fn();
6
+ };
7
+ const EditControlsCell = ({ ariaColIndex, beginEditingCallback, cancelEditingCallback, isEditing, saveCallback, deleteCallback, editControlsCellClasses, saveButtonClasses, deleteButtonClasses, startButtonClasses, cancelButtonClasses, }) => {
8
+ 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" })] }) })] })) }) }));
9
+ };
10
+ export default EditControlsCell;
@@ -1,7 +1,6 @@
1
1
  import { CSSProperties, FC, ReactNode } from "react";
2
- import { RowId } from "../types";
3
2
  import React from "react";
4
- import { CellData } from "./types";
3
+ import { CellData, RowId } from "../../common/types";
5
4
  export type EditableRowProps = Pick<React.ComponentProps<"tr">, "onClick" | "className" | "aria-rowindex" | "aria-selected"> & {
6
5
  ariaColIndexOffset: number;
7
6
  dataRowId: RowId;
@@ -9,13 +8,13 @@ export type EditableRowProps = Pick<React.ComponentProps<"tr">, "onClick" | "cla
9
8
  cellData: CellData[];
10
9
  updateCallback?: (values: string[]) => void;
11
10
  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[];
11
+ dataCellClasses: (colIndex: number) => string[] | null;
12
+ dataCellInputClasses: (colIndex: number) => string[] | null;
13
+ editCellClasses: string[] | null;
14
+ deleteButtonClasses: string[] | null;
15
+ cancelButtonClasses: string[] | null;
16
+ startButtonClasses: string[] | null;
17
+ saveButtonClasses: string[] | null;
19
18
  editControlCellStyles?: CSSProperties;
20
19
  };
21
20
  declare const EditableRow: FC<EditableRowProps>;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useRef, useState } from "react";
4
- import { dateToDatetimeInputStr, dateToInputStr } from "../util/datetime";
4
+ import { dateToDatetimeInputStr, dateToInputStr, } from "../../common/util/datetime";
5
5
  import EditControlsCell from "./EditControlsCell";
6
6
  import classNames from "classnames";
7
- import getWidthStyle from "../util/getWidthStyle";
7
+ import getWidthStyle from "../../common/util/getWidthStyle";
8
8
  const initValueToFormValue = (value, type) => {
9
9
  switch (type) {
10
10
  case "date":
@@ -57,6 +57,6 @@ const EditableRow = ({ ariaColIndexOffset, cellData, children, updateCallback, d
57
57
  setIsEditing(false);
58
58
  }
59
59
  };
60
- return (_jsxs("tr", { ref: trRef, onClick: onClick, className: className, "aria-rowindex": ariaRowIndex, "aria-selected": ariaSelected, "data-rowid": dataRowId, children: [children, cellData.map(({ type, value, formattedValue, label, width }, index) => (_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-${dataRowId}-${index}`, className: classNames("form-control", dataCellInputClasses(index)), type: colDataTypeToInputType(type), defaultValue: initValueToFormValue(value, type), required: type !== "string" })) : (formattedValue) }, index))), updateCallback && (_jsx(EditControlsCell, { ariaColIndex: ariaColIndexOffset + cellData.length + 1, beginEditingCallback: () => setIsEditing(true), cancelEditingCallback: () => setIsEditing(false), isEditing: isEditing, saveCallback: handleSave, deleteCallback: deleteCallback, editControlsCellClasses: editCellClasses, startButtonClasses: startButtonClasses, deleteButtonClasses: deleteButtonClasses, cancelButtonClasses: cancelButtonClasses, saveButtonClasses: saveButtonClasses, style: editControlCellStyles }))] }));
60
+ return (_jsxs("tr", { ref: trRef, onClick: onClick, className: className, "aria-rowindex": ariaRowIndex, "aria-selected": ariaSelected, "data-rowid": dataRowId, children: [children, cellData.map(({ type, value, formattedValue, label, width }, index) => (_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-${dataRowId}-${index}`, className: classNames(dataCellInputClasses(index) || "form-control"), type: colDataTypeToInputType(type), defaultValue: initValueToFormValue(value, type), required: type !== "string" })) : (formattedValue) }, index))), updateCallback && (_jsx(EditControlsCell, { ariaColIndex: ariaColIndexOffset + cellData.length + 1, beginEditingCallback: () => setIsEditing(true), cancelEditingCallback: () => setIsEditing(false), isEditing: isEditing, saveCallback: handleSave, deleteCallback: deleteCallback, editControlsCellClasses: editCellClasses, startButtonClasses: startButtonClasses, deleteButtonClasses: deleteButtonClasses, cancelButtonClasses: cancelButtonClasses, saveButtonClasses: saveButtonClasses, style: editControlCellStyles }))] }));
61
61
  };
62
62
  export default EditableRow;
@@ -0,0 +1,5 @@
1
+ export * from "./types";
2
+ export * from "./styling/types";
3
+ export * from "../common/selection/types";
4
+ export * from "../common";
5
+ export { default } from "./Table";
package/table/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./types";
2
+ export * from "./styling/types";
3
+ export * from "../common/selection/types";
4
+ export * from "../common";
5
+ export { default } from "./Table";
@@ -0,0 +1,22 @@
1
+ import { FC, ReactNode } from "react";
2
+ import { UseGridSelectionFnsHook } from "../../common/pipeline/useGridSelectionFns";
3
+ import { UseCombinedPipelineHook } from "../../common/pipeline/useCombinedPipeline";
4
+ import { SelectModel } from "../../common/selection/types";
5
+ import { UseGetInputStrSubmitCallbackHook } from "../../common/pipeline/useGetInputStrSubmitCallback";
6
+ import { TableStyleModel } from "../styling/types";
7
+ import { AugFormattedRow, FormattedRow, RowId } from "../../common/types";
8
+ import { EditModel } from "../../common/editing/types";
9
+ interface BodyRowsProps {
10
+ augFormattedRows: AugFormattedRow[];
11
+ gridSelectionFns: UseGridSelectionFnsHook;
12
+ tableStyleModel: TableStyleModel | undefined;
13
+ combinedPipelineOutput: UseCombinedPipelineHook;
14
+ selectModel: SelectModel | undefined;
15
+ editModel: EditModel | undefined;
16
+ getInputStrSubmitCallback: UseGetInputStrSubmitCallbackHook;
17
+ additionalColIndexOffset?: number;
18
+ renderPrefixCells?: (augFormattedRows: FormattedRow) => ReactNode;
19
+ additionalRowStyles?: (rowId: RowId, displayIndex: number) => string[];
20
+ }
21
+ declare const BodyRows: FC<BodyRowsProps>;
22
+ export default BodyRows;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import EditableRow from "../editing/EditableRow";
3
+ import classNames from "classnames";
4
+ import getWidthStyle from "../../common/util/getWidthStyle";
5
+ import SelectionInput from "../selection/SelectionInput";
6
+ const BodyRows = ({ augFormattedRows, gridSelectionFns: { selectedSet, getSelectInputModel, getSelectHandler, getRowClickHandler, getAriaSelectedValue, }, tableStyleModel, combinedPipelineOutput: { showSelectCol, ariaColIndexOffset }, selectModel, editModel, getInputStrSubmitCallback, additionalColIndexOffset, renderPrefixCells, additionalRowStyles, }) => augFormattedRows.map((row, index) => {
7
+ return (_jsxs(EditableRow, { onClick: getRowClickHandler(row.id), className: classNames({
8
+ "table-active": selectedSet.has(row.id),
9
+ }, (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: (colIndex) => (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTd)
10
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTd(row.id, index, colIndex)
11
+ : null, dataCellInputClasses: (colIndex) => (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTdInput)
12
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.tbodyTdInput(row.id, index, colIndex)
13
+ : null, editCellClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editColTd)
14
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editColTd(row.id, index)
15
+ : null, saveButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editSaveButton)
16
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editSaveButton(row.id, index)
17
+ : null, deleteButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editDeleteButton)
18
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editDeleteButton(row.id, index)
19
+ : null, startButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editStartButton)
20
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editStartButton(row.id, index)
21
+ : null, cancelButtonClasses: (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editCancelButton)
22
+ ? tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.editCancelButton(row.id, index)
23
+ : null, children: [renderPrefixCells && renderPrefixCells(row), showSelectCol && (_jsx("td", { className: classNames((tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectColTd) &&
24
+ (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) &&
25
+ (tableStyleModel === null || tableStyleModel === void 0 ? void 0 : tableStyleModel.rowSelectInput(row.id, index)) }) }))] }, row.id));
26
+ });
27
+ export default BodyRows;
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import classNames from "classnames";
4
- import getWidthStyle from "../../util/getWidthStyle";
5
- import useSortHeaderStates from "./useSortHeaderStates";
6
- import sortOrderToAriaSort from "../../sorting/sortOrderToAriaSort";
4
+ import getWidthStyle from "../../../common/util/getWidthStyle";
5
+ import useSortHeaderStates from "../../../common/sorting/useSortHeaderStates";
6
+ import sortOrderToAriaSort from "../../../common/sorting/sortOrderToAriaSort";
7
7
  const ColHeaderCell = ({ label, sortModel, ariaColIndex, additionalClasses, width, }) => {
8
8
  const { handleClick, handleMouseOver, handleMouseOut, sortSymbol } = useSortHeaderStates(sortModel);
9
9
  return (_jsxs("th", { className: classNames({
@@ -1,10 +1,10 @@
1
1
  import { CSSProperties, FC } from "react";
2
- import { SelectionInfo } from "./types";
2
+ import { SelectionInfo } from "../../common/selection/types";
3
3
  interface SelectAllHeaderCellProps {
4
4
  onClick: () => void;
5
5
  selectionInfo: SelectionInfo;
6
6
  totalRows: number;
7
- additionalClasses?: string[];
7
+ customClasses?: string[];
8
8
  style?: CSSProperties;
9
9
  colIndexOffset?: number;
10
10
  }
@@ -40,15 +40,13 @@ const getCheckboxState = (selectionInfo, noRows) => {
40
40
  // single select mode and none selected
41
41
  return disabledState;
42
42
  };
43
- const SelectAllHeaderCell = ({ onClick, selectionInfo, totalRows, additionalClasses, style, colIndexOffset, }) => {
43
+ const SelectAllHeaderCell = ({ onClick, selectionInfo, totalRows, customClasses, style, colIndexOffset, }) => {
44
44
  const noRows = totalRows === 0;
45
45
  const { indeterminate, checked, disabled, description } = getCheckboxState(selectionInfo, noRows);
46
46
  const ref = useRef(null);
47
47
  useEffect(() => {
48
48
  ref.current.indeterminate = indeterminate;
49
49
  }, [indeterminate]);
50
- return (_jsx("th", { style: style, "aria-colindex": 1 + (colIndexOffset || 0), title: description, "aria-description": description, className: classNames({
51
- "btn-primary": !additionalClasses || additionalClasses.length === 0,
52
- }, additionalClasses || []), children: _jsx("input", { tabIndex: 0, type: "checkbox", checked: checked, ref: ref, disabled: disabled, "aria-label": description, onChange: onClick }) }));
50
+ 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 }) }));
53
51
  };
54
52
  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>;
@@ -0,0 +1,3 @@
1
+ .rbdg-sort-toggler {
2
+ cursor: pointer;
3
+ }
@@ -0,0 +1,41 @@
1
+ import { RowId } from "../../common/types";
2
+ export interface SharedTableStyleModel {
3
+ table?: string[];
4
+ tbody?: string[];
5
+ thead?: string[];
6
+ theadTr?: string[];
7
+ theadTh?: (colIndex: number) => string[] | null;
8
+ caption?: string[];
9
+ }
10
+ export type TableStyleModel = SharedTableStyleModel & {
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
+ editColTh?: 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
+ rowSelectColTh?: string[];
21
+ rowSelectColTd?: (rowId: RowId, displayIndex: number) => string[] | null;
22
+ rowSelectInput?: (rowId: RowId, displayIndex: number) => string[] | null;
23
+ };
24
+ export type FilterInputTableStyleModel = SharedTableStyleModel & {
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
+ submitButton?: string[];
34
+ form?: string[];
35
+ };
36
+ export interface AdditionalComponentsStyleModel {
37
+ topLevelDiv?: string[];
38
+ tableAndPaginationDiv?: string[];
39
+ tableDiv?: string[];
40
+ paginationUiDiv?: string[];
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ColSortModel } from "../common/sorting/types";
2
+ import { ColDefBase, MainComponentSharedProps } from "../common/types";
3
+ import { StyleModel } from "../common/styling/types";
4
+ export type DisplayMode = "table" | "block";
5
+ export type TableProps = MainComponentSharedProps & {
6
+ caption?: string;
7
+ styleModel?: StyleModel;
8
+ displayMode?: DisplayMode;
9
+ };
10
+ export type BaseTableProps = Omit<TableProps, "cols"> & {
11
+ cols: ColDefBase[];
12
+ };
13
+ export interface ColHeaderCellProps {
14
+ label: string;
15
+ sortModel?: ColSortModel;
16
+ ariaColIndex: number;
17
+ additionalClasses?: string[] | null;
18
+ width?: number;
19
+ }
package/table/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -2,11 +2,11 @@
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useCallback, useMemo, useRef, } from "react";
4
4
  import classNames from "classnames";
5
- import getWidthStyle from "../grid/util/getWidthStyle";
6
- import useSortHeaderStates from "../grid/main/ColHeaderCell/useSortHeaderStates";
5
+ import getWidthStyle from "../common/util/getWidthStyle";
6
+ import useSortHeaderStates from "../common/sorting/useSortHeaderStates";
7
7
  import VerticalGrip from "./assets/VerticalGrip";
8
- import regDragCleanup from "./util/regDragCleanup";
9
- import sortOrderToAriaSort from "../grid/sorting/sortOrderToAriaSort";
8
+ import regDragCleanup from "./lib/regDragCleanup";
9
+ import sortOrderToAriaSort from "../common/sorting/sortOrderToAriaSort";
10
10
  const setWidthStyle = (cells, width) => {
11
11
  cells.forEach((cell) => {
12
12
  cell.style.minWidth = `${width}px`;
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { TableProProps } from "./types";
3
+ declare const TablePro: FC<TableProProps>;
4
+ export default TablePro;
@@ -1,21 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect, useMemo } from "react";
4
- import useCombinedPipeline from "../grid/pipeline/useCombinedPipeline";
5
- import InternalGrid from "../grid/InternalGrid";
4
+ import useCombinedPipeline from "../common/pipeline/useCombinedPipeline";
5
+ import InternalTable from "../table/InternalTable";
6
6
  import ColHeaderCellPro from "./ColHeaderCellPro";
7
- import useGridSelectionFns from "../grid/pipeline/useGridSelectionFns";
8
- import useUnwrappedGridStyles from "../grid/pipeline/useUnwrappedGridStyles";
9
- import useGetInputStrSubmitCallback from "../grid/pipeline/useGetInputStrSubmitCallback";
10
- import useAugFormattedRows from "../grid/pipeline/useAugFormattedRows";
7
+ import useGridSelectionFns from "../common/pipeline/useGridSelectionFns";
8
+ import useGetInputStrSubmitCallback from "../common/pipeline/useGetInputStrSubmitCallback";
9
+ import useAugFormattedRows from "../common/pipeline/useAugFormattedRows";
11
10
  import useResizeModel from "./resize/useResizeModel";
12
- import BodyRows from "../grid/main/BodyRows";
11
+ import BodyRows from "../table/main/BodyRows";
13
12
  import ReorderHeaderCell from "./reorder/ReorderHeaderCell";
14
13
  import ReorderHandleCell from "./reorder/ReorderHandleCell";
15
14
  import useKeyboardReorder from "./reorder/useKeyboardReorder";
16
15
  import useReorderStyles from "./reorder/useReorderStyles";
17
16
  import useKeyboardReorderListener from "./reorder/useKeyboardReorderListener";
18
- const GridPro = (props) => {
17
+ const TablePro = (props) => {
19
18
  const { rows, cols, editModel, filterModel, sortModel, pagination, selectModel, styleModel, displayMode, reorder, } = props;
20
19
  const combinedPipelineOutput = useCombinedPipeline({
21
20
  rows,
@@ -27,7 +26,6 @@ const GridPro = (props) => {
27
26
  });
28
27
  const { sortedRowsOutput: { sortColDef, setSortColDef, sortingEnabled }, showSelectCol, displayRows, filterState, } = combinedPipelineOutput;
29
28
  const gridSelectionFns = useGridSelectionFns(selectModel, rows);
30
- const unwrappedStyles = useUnwrappedGridStyles(styleModel);
31
29
  const getInputStrSubmitCallback = useGetInputStrSubmitCallback(editModel, cols);
32
30
  const resizeModel = useResizeModel(cols, displayMode);
33
31
  const colNameToWidth = useMemo(() => Object.keys(resizeModel).reduce((prev, fieldName) => {
@@ -117,14 +115,13 @@ const GridPro = (props) => {
117
115
  setDragee,
118
116
  sortingOccurring,
119
117
  ]);
120
- const bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, unwrappedStyles: unwrappedStyles, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, renderPrefixCells: renderPrefixCells, additionalColIndexOffset: reorder ? 1 : 0, additionalRowStyles: additionalBodyRowStyles }));
118
+ const bodyRows = (_jsx(BodyRows, { augFormattedRows: augFormattedRows, gridSelectionFns: gridSelectionFns, selectModel: selectModel, combinedPipelineOutput: combinedPipelineOutput, editModel: editModel, getInputStrSubmitCallback: getInputStrSubmitCallback, renderPrefixCells: renderPrefixCells, additionalColIndexOffset: reorder ? 1 : 0, additionalRowStyles: additionalBodyRowStyles, tableStyleModel: styleModel === null || styleModel === void 0 ? void 0 : styleModel.mainTableStyleModel }));
121
119
  const prefixHeader = reorder ? _jsx(ReorderHeaderCell, {}) : null;
122
- return (_jsx(InternalGrid, { gridProps: props, hooks: {
120
+ return (_jsx(InternalTable, { gridProps: props, hooks: {
123
121
  pipelineOutput: combinedPipelineOutput,
124
122
  selectFns: gridSelectionFns,
125
- unwrappedStyles,
126
123
  }, slots: { colHeaderCells, bodyRows, prefixHeader }, classes: {
127
124
  headerRow: additionalHeaderRowStyles,
128
125
  } }));
129
126
  };
130
- export default GridPro;
127
+ export default TablePro;
@@ -1,5 +1,5 @@
1
- export * from "../grid";
2
- export { default } from "./GridPro";
1
+ export * from "../table";
2
+ export { default } from "./TablePro";
3
3
  export * from "./types";
4
4
  export * from "./util";
5
5
  export * from "./reorder/types";
@@ -1,5 +1,5 @@
1
- export * from "../grid";
2
- export { default } from "./GridPro";
1
+ export * from "../table";
2
+ export { default } from "./TablePro";
3
3
  export * from "./types";
4
4
  export * from "./util";
5
5
  export * from "./reorder/types";
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback, } from "react";
3
3
  import HorizontalGrip from "../assets/HorizontalGrip";
4
- import regDragCleanup from "../util/regDragCleanup";
4
+ import regDragCleanup from "../lib/regDragCleanup";
5
5
  import classNames from "classnames";
6
6
  function dropTargetRefValuesEqual(first, second) {
7
7
  if (first === null && second === null) {
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useMemo, useState } from "react";
2
- import trueModulo from "../../grid/util/trueModulo";
2
+ import trueModulo from "../../common/util/trueModulo";
3
3
  const useKeyboardReorder = (displayRowIds) => {
4
4
  const [state, setState] = useState(null);
5
5
  // A change the displayed rows can suddenly make the existing state invalid.
@@ -1,5 +1,5 @@
1
1
  import { ProColDef } from "../types";
2
- import { DisplayMode } from "../../grid";
2
+ import { DisplayMode } from "../../table";
3
3
  import { ResizeModel } from "./types";
4
4
  declare const useResizeModel: (cols: Pick<ProColDef, "resizeable" | "width" | "name">[], display: DisplayMode | undefined) => ResizeModel;
5
5
  export default useResizeModel;
@@ -0,0 +1,69 @@
1
+ @use "../table/style";
2
+
3
+ .rbdg-draggable-container {
4
+ width: 1rem;
5
+ height: 1rem;
6
+ touch-action: none;
7
+ }
8
+
9
+ .rbdg-draggable-icon {
10
+ pointer-events: none;
11
+ }
12
+
13
+ .rbdg-resize-container {
14
+ cursor: col-resize;
15
+ }
16
+
17
+ .rbdg-reorder-container {
18
+ cursor: grab !important;
19
+
20
+ &:active {
21
+ cursor: grabbing !important;
22
+ }
23
+ }
24
+
25
+ // Typical button reset to make it look like a plain div
26
+ .rbdg-plain-icon-button {
27
+ display: inline-flex;
28
+ padding: 0;
29
+ margin: 0;
30
+ border: none;
31
+
32
+ background: none;
33
+ color: inherit;
34
+ font: inherit;
35
+
36
+ -webkit-appearance: none;
37
+ appearance: none;
38
+
39
+ &:disabled {
40
+ pointer-events: none;
41
+ opacity: 0.65;
42
+ }
43
+ }
44
+
45
+ .rbdg-drag-ghost {
46
+ opacity: 75%;
47
+ position: fixed;
48
+ padding: 0.5rem;
49
+ z-index: 2; // float above toolbar panels
50
+ }
51
+
52
+ .rbdg-reorder-dragged-row-pred {
53
+ border-bottom-color: var(--bs-success);
54
+ }
55
+
56
+ .rbdg-reorder-dragged-row {
57
+ border-top-width: 1px;
58
+ opacity: 50%;
59
+ border-color: var(--bs-success);
60
+ }
61
+
62
+ .rbdg-reorder-above-drag-target-row {
63
+ border-bottom-color: var(--bs-primary);
64
+ }
65
+
66
+ .rbdg-reorder-below-drag-target-row {
67
+ border-top-width: 1px;
68
+ border-top-color: var(--bs-primary);
69
+ }