@macrostrat/data-sheet 4.1.1 → 4.2.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 (303) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/actions/builtin.cjs +1 -1
  3. package/dist/actions/builtin.cjs.map +1 -1
  4. package/dist/actions/builtin.d.ts +0 -2
  5. package/dist/actions/builtin.js +1 -1
  6. package/dist/actions/builtin.js.map +1 -1
  7. package/dist/actions/clipboard.cjs +1 -1
  8. package/dist/actions/clipboard.cjs.map +1 -1
  9. package/dist/actions/clipboard.d.ts +3 -2
  10. package/dist/actions/clipboard.js +1 -1
  11. package/dist/actions/clipboard.js.map +1 -1
  12. package/dist/actions/column-controls.cjs +7 -196
  13. package/dist/actions/column-controls.cjs.map +1 -1
  14. package/dist/actions/column-controls.d.ts +1 -1
  15. package/dist/actions/column-controls.js +5 -194
  16. package/dist/actions/column-controls.js.map +1 -1
  17. package/dist/actions/column-filter.cjs +24 -73
  18. package/dist/actions/column-filter.cjs.map +1 -1
  19. package/dist/actions/column-filter.d.ts +6 -4
  20. package/dist/actions/column-filter.js +25 -74
  21. package/dist/actions/column-filter.js.map +1 -1
  22. package/dist/actions/context.cjs +147 -0
  23. package/dist/actions/context.cjs.map +1 -0
  24. package/dist/actions/context.d.ts +93 -0
  25. package/dist/actions/context.js +145 -0
  26. package/dist/actions/context.js.map +1 -0
  27. package/dist/actions/edit-actions.cjs.map +1 -1
  28. package/dist/actions/edit-actions.d.ts +3 -1
  29. package/dist/actions/edit-actions.js.map +1 -1
  30. package/dist/actions/index.d.ts +2 -3
  31. package/dist/actions/selection.cjs +70 -115
  32. package/dist/actions/selection.cjs.map +1 -1
  33. package/dist/actions/selection.d.ts +22 -12
  34. package/dist/actions/selection.js +71 -114
  35. package/dist/actions/selection.js.map +1 -1
  36. package/dist/actions/table-actions.cjs +41 -0
  37. package/dist/actions/table-actions.cjs.map +1 -0
  38. package/dist/actions/{table-controls.d.ts → table-actions.d.ts} +0 -4
  39. package/dist/actions/{table-controls.js → table-actions.js} +2 -23
  40. package/dist/actions/table-actions.js.map +1 -0
  41. package/dist/actions/types.d.ts +11 -89
  42. package/dist/components/cell-detail.cjs +6 -6
  43. package/dist/components/cell-detail.cjs.map +1 -1
  44. package/dist/components/cell-detail.js +1 -1
  45. package/dist/components/colors.cjs.map +1 -1
  46. package/dist/components/colors.js.map +1 -1
  47. package/dist/components/editor-popup.cjs +7 -7
  48. package/dist/components/editor-popup.cjs.map +1 -1
  49. package/dist/components/editor-popup.js +1 -1
  50. package/dist/components/index.d.ts +2 -1
  51. package/dist/components/indicators/filter-and-sort.cjs +378 -0
  52. package/dist/components/indicators/filter-and-sort.cjs.map +1 -0
  53. package/dist/components/indicators/filter-and-sort.d.ts +59 -0
  54. package/dist/components/indicators/filter-and-sort.js +376 -0
  55. package/dist/components/indicators/filter-and-sort.js.map +1 -0
  56. package/dist/components/indicators/filter-and-sort.module.sass.cjs +16 -0
  57. package/dist/components/indicators/filter-and-sort.module.sass.cjs.map +1 -0
  58. package/dist/components/indicators/filter-and-sort.module.sass.js +14 -0
  59. package/dist/components/indicators/filter-and-sort.module.sass.js.map +1 -0
  60. package/dist/components/indicators/index.d.ts +4 -0
  61. package/dist/components/indicators/selection.cjs +113 -0
  62. package/dist/components/indicators/selection.cjs.map +1 -0
  63. package/dist/components/indicators/selection.d.ts +3 -0
  64. package/dist/components/indicators/selection.js +111 -0
  65. package/dist/components/indicators/selection.js.map +1 -0
  66. package/dist/components/indicators/selection.module.sass.cjs +19 -0
  67. package/dist/components/indicators/selection.module.sass.cjs.map +1 -0
  68. package/dist/components/indicators/selection.module.sass.js +17 -0
  69. package/dist/components/indicators/selection.module.sass.js.map +1 -0
  70. package/dist/components/indicators/unified-filters.cjs +130 -0
  71. package/dist/components/indicators/unified-filters.cjs.map +1 -0
  72. package/dist/components/indicators/unified-filters.d.ts +10 -0
  73. package/dist/components/indicators/unified-filters.js +130 -0
  74. package/dist/components/indicators/unified-filters.js.map +1 -0
  75. package/dist/components/indicators/view-info.cjs +59 -0
  76. package/dist/components/indicators/view-info.cjs.map +1 -0
  77. package/dist/components/{view-info.d.ts → indicators/view-info.d.ts} +1 -0
  78. package/dist/components/{view-info.js → indicators/view-info.js} +17 -13
  79. package/dist/components/indicators/view-info.js.map +1 -0
  80. package/dist/components/text-areas.cjs +5 -5
  81. package/dist/components/text-areas.cjs.map +1 -1
  82. package/dist/components/text-areas.js +1 -1
  83. package/dist/components/toolbars/actions-toolbar.cjs +185 -0
  84. package/dist/components/toolbars/actions-toolbar.cjs.map +1 -0
  85. package/dist/{actions/toolbar.d.ts → components/toolbars/actions-toolbar.d.ts} +9 -5
  86. package/dist/{actions/toolbar.js → components/toolbars/actions-toolbar.js} +37 -112
  87. package/dist/components/toolbars/actions-toolbar.js.map +1 -0
  88. package/dist/components/toolbars/actions-toolbar.module.sass.cjs +29 -0
  89. package/dist/components/toolbars/actions-toolbar.module.sass.cjs.map +1 -0
  90. package/dist/components/toolbars/actions-toolbar.module.sass.js +27 -0
  91. package/dist/components/toolbars/actions-toolbar.module.sass.js.map +1 -0
  92. package/dist/components/toolbars/active-filters.cjs +120 -0
  93. package/dist/components/toolbars/active-filters.cjs.map +1 -0
  94. package/dist/{actions/filters.d.ts → components/toolbars/active-filters.d.ts} +3 -3
  95. package/dist/components/toolbars/active-filters.js +120 -0
  96. package/dist/components/toolbars/active-filters.js.map +1 -0
  97. package/dist/components/toolbars/index.d.ts +2 -0
  98. package/dist/data-panel.cjs +291 -0
  99. package/dist/data-panel.cjs.map +1 -0
  100. package/dist/data-panel.d.ts +110 -0
  101. package/dist/data-panel.js +289 -0
  102. package/dist/data-panel.js.map +1 -0
  103. package/dist/data-panel.module.sass.cjs +40 -0
  104. package/dist/data-panel.module.sass.cjs.map +1 -0
  105. package/dist/data-panel.module.sass.js +38 -0
  106. package/dist/data-panel.module.sass.js.map +1 -0
  107. package/dist/{core.cjs → data-sheet.cjs} +123 -190
  108. package/dist/data-sheet.cjs.map +1 -0
  109. package/dist/data-sheet.css +241 -13
  110. package/dist/data-sheet.d.ts +16 -0
  111. package/dist/{core.js → data-sheet.js} +92 -159
  112. package/dist/data-sheet.js.map +1 -0
  113. package/dist/data-view.cjs +47 -0
  114. package/dist/data-view.cjs.map +1 -0
  115. package/dist/data-view.d.ts +15 -0
  116. package/dist/data-view.js +45 -0
  117. package/dist/data-view.js.map +1 -0
  118. package/dist/filters/operators.cjs +19 -2
  119. package/dist/filters/operators.cjs.map +1 -1
  120. package/dist/filters/operators.d.ts +4 -3
  121. package/dist/filters/operators.js +19 -2
  122. package/dist/filters/operators.js.map +1 -1
  123. package/dist/index.cjs +106 -47
  124. package/dist/index.cjs.map +1 -1
  125. package/dist/index.d.ts +4 -3
  126. package/dist/index.js +76 -17
  127. package/dist/index.js.map +1 -1
  128. package/dist/notifications.cjs +4 -4
  129. package/dist/notifications.cjs.map +1 -1
  130. package/dist/notifications.js +1 -1
  131. package/dist/postgrest-table/data-loaders.cjs +128 -95
  132. package/dist/postgrest-table/data-loaders.cjs.map +1 -1
  133. package/dist/postgrest-table/data-loaders.d.ts +52 -82
  134. package/dist/postgrest-table/data-loaders.js +109 -76
  135. package/dist/postgrest-table/data-loaders.js.map +1 -1
  136. package/dist/postgrest-table/index.cjs +18 -17
  137. package/dist/postgrest-table/index.cjs.map +1 -1
  138. package/dist/postgrest-table/index.d.ts +4 -3
  139. package/dist/postgrest-table/index.js +9 -8
  140. package/dist/postgrest-table/index.js.map +1 -1
  141. package/dist/{utils → provider}/column-spec.cjs +23 -9
  142. package/dist/provider/column-spec.cjs.map +1 -0
  143. package/dist/{utils → provider}/column-spec.d.ts +73 -2
  144. package/dist/{utils → provider}/column-spec.js +24 -10
  145. package/dist/provider/column-spec.js.map +1 -0
  146. package/dist/provider/core.cjs +382 -0
  147. package/dist/provider/core.cjs.map +1 -0
  148. package/dist/provider/core.d.ts +74 -0
  149. package/dist/provider/core.js +380 -0
  150. package/dist/provider/core.js.map +1 -0
  151. package/dist/provider/index.d.ts +7 -0
  152. package/dist/provider/interactions.cjs +128 -0
  153. package/dist/provider/interactions.cjs.map +1 -0
  154. package/dist/provider/interactions.d.ts +39 -0
  155. package/dist/provider/interactions.js +128 -0
  156. package/dist/provider/interactions.js.map +1 -0
  157. package/dist/provider/selection.cjs +29 -0
  158. package/dist/provider/selection.cjs.map +1 -0
  159. package/dist/provider/selection.d.ts +9 -0
  160. package/dist/provider/selection.js +29 -0
  161. package/dist/provider/selection.js.map +1 -0
  162. package/dist/provider/table-data.cjs +92 -0
  163. package/dist/provider/table-data.cjs.map +1 -0
  164. package/dist/provider/table-data.d.ts +81 -0
  165. package/dist/provider/table-data.js +92 -0
  166. package/dist/provider/table-data.js.map +1 -0
  167. package/dist/provider/types.cjs +22 -0
  168. package/dist/provider/types.cjs.map +1 -0
  169. package/dist/provider/types.d.ts +256 -0
  170. package/dist/provider/types.js +22 -0
  171. package/dist/provider/types.js.map +1 -0
  172. package/dist/{zustand-store.cjs → provider/zustand-store.cjs} +36 -23
  173. package/dist/provider/zustand-store.cjs.map +1 -0
  174. package/dist/{zustand-store.js → provider/zustand-store.js} +21 -8
  175. package/dist/provider/zustand-store.js.map +1 -0
  176. package/dist/{cell-renderer.cjs → renderers/cell-renderer.cjs} +67 -34
  177. package/dist/renderers/cell-renderer.cjs.map +1 -0
  178. package/dist/{cell-renderer.d.ts → renderers/cell-renderer.d.ts} +1 -2
  179. package/dist/{cell-renderer.js → renderers/cell-renderer.js} +65 -32
  180. package/dist/renderers/cell-renderer.js.map +1 -0
  181. package/dist/renderers/column-header-cell.cjs +21 -13
  182. package/dist/renderers/column-header-cell.cjs.map +1 -1
  183. package/dist/renderers/column-header-cell.d.ts +3 -2
  184. package/dist/renderers/column-header-cell.js +20 -12
  185. package/dist/renderers/column-header-cell.js.map +1 -1
  186. package/dist/renderers/index.d.ts +1 -0
  187. package/dist/types.cjs +7 -19
  188. package/dist/types.cjs.map +1 -1
  189. package/dist/types.d.ts +117 -229
  190. package/dist/types.js +7 -19
  191. package/dist/types.js.map +1 -1
  192. package/dist/utils/atoms.cjs +24 -0
  193. package/dist/utils/atoms.cjs.map +1 -0
  194. package/dist/utils/atoms.d.ts +4 -0
  195. package/dist/utils/atoms.js +24 -0
  196. package/dist/utils/atoms.js.map +1 -0
  197. package/dist/utils/debug-overlay.cjs.map +1 -1
  198. package/dist/utils/debug-overlay.js.map +1 -1
  199. package/dist/utils/index.d.ts +2 -3
  200. package/dist/utils/key-handling.cjs +140 -139
  201. package/dist/utils/key-handling.cjs.map +1 -1
  202. package/dist/utils/key-handling.d.ts +4 -2
  203. package/dist/utils/key-handling.js +136 -135
  204. package/dist/utils/key-handling.js.map +1 -1
  205. package/dist/utils/validation.cjs +6 -1
  206. package/dist/utils/validation.cjs.map +1 -1
  207. package/dist/utils/validation.d.ts +1 -1
  208. package/dist/utils/validation.js +6 -1
  209. package/dist/utils/validation.js.map +1 -1
  210. package/package.json +4 -3
  211. package/src/actions/builtin.ts +1 -4
  212. package/src/actions/clipboard.ts +4 -3
  213. package/src/actions/column-controls.ts +12 -245
  214. package/src/actions/column-filter.ts +28 -92
  215. package/src/actions/context.ts +299 -0
  216. package/src/actions/edit-actions.ts +3 -1
  217. package/src/actions/index.ts +2 -3
  218. package/src/actions/selection.ts +109 -156
  219. package/src/actions/{table-controls.ts → table-actions.ts} +0 -24
  220. package/src/actions/types.ts +17 -101
  221. package/src/components/colors.ts +1 -1
  222. package/src/components/index.ts +2 -1
  223. package/src/components/indicators/filter-and-sort.module.sass +13 -0
  224. package/src/components/indicators/filter-and-sort.ts +478 -0
  225. package/src/components/indicators/index.ts +4 -0
  226. package/src/components/indicators/selection.module.sass +22 -0
  227. package/src/components/indicators/selection.ts +141 -0
  228. package/src/components/indicators/unified-filters.ts +161 -0
  229. package/src/components/{view-info.ts → indicators/view-info.ts} +16 -27
  230. package/src/{actions/toolbar.module.sass → components/toolbars/actions-toolbar.module.sass} +17 -4
  231. package/src/{actions/toolbar.ts → components/toolbars/actions-toolbar.ts} +49 -150
  232. package/src/components/toolbars/active-filters.ts +150 -0
  233. package/src/components/toolbars/index.ts +2 -0
  234. package/src/data-panel.module.sass +185 -0
  235. package/src/data-panel.ts +556 -0
  236. package/src/{core.ts → data-sheet.ts} +145 -330
  237. package/src/data-view.ts +70 -0
  238. package/src/filters/operators.ts +33 -3
  239. package/src/index.ts +4 -3
  240. package/src/postgrest-table/data-loaders.ts +244 -171
  241. package/src/postgrest-table/index.ts +10 -9
  242. package/src/{utils → provider}/column-spec.ts +30 -15
  243. package/src/provider/core.ts +585 -0
  244. package/src/provider/index.ts +7 -0
  245. package/src/provider/interactions.ts +161 -0
  246. package/src/provider/selection.ts +31 -0
  247. package/src/provider/table-data.ts +178 -0
  248. package/src/provider/types.ts +273 -0
  249. package/src/{zustand-store.ts → provider/zustand-store.ts} +35 -14
  250. package/src/{cell-renderer.ts → renderers/cell-renderer.ts} +140 -57
  251. package/src/renderers/column-header-cell.ts +21 -14
  252. package/src/renderers/index.ts +1 -0
  253. package/src/types.ts +137 -239
  254. package/src/utils/atoms.ts +28 -0
  255. package/src/utils/debug-overlay.ts +1 -1
  256. package/src/utils/index.ts +2 -8
  257. package/src/utils/key-handling.ts +170 -164
  258. package/src/utils/validation.ts +7 -2
  259. package/dist/actions/filters.cjs +0 -139
  260. package/dist/actions/filters.cjs.map +0 -1
  261. package/dist/actions/filters.js +0 -139
  262. package/dist/actions/filters.js.map +0 -1
  263. package/dist/actions/table-controls.cjs +0 -62
  264. package/dist/actions/table-controls.cjs.map +0 -1
  265. package/dist/actions/table-controls.js.map +0 -1
  266. package/dist/actions/toolbar.cjs +0 -260
  267. package/dist/actions/toolbar.cjs.map +0 -1
  268. package/dist/actions/toolbar.js.map +0 -1
  269. package/dist/actions/toolbar.module.sass.cjs +0 -27
  270. package/dist/actions/toolbar.module.sass.cjs.map +0 -1
  271. package/dist/actions/toolbar.module.sass.js +0 -25
  272. package/dist/actions/toolbar.module.sass.js.map +0 -1
  273. package/dist/cell-renderer.cjs.map +0 -1
  274. package/dist/cell-renderer.js.map +0 -1
  275. package/dist/components/view-info.cjs +0 -55
  276. package/dist/components/view-info.cjs.map +0 -1
  277. package/dist/components/view-info.js.map +0 -1
  278. package/dist/core.cjs.map +0 -1
  279. package/dist/core.d.ts +0 -117
  280. package/dist/core.js.map +0 -1
  281. package/dist/provider.cjs +0 -197
  282. package/dist/provider.cjs.map +0 -1
  283. package/dist/provider.d.ts +0 -26
  284. package/dist/provider.js +0 -195
  285. package/dist/provider.js.map +0 -1
  286. package/dist/table-updates/data-parameter.d.ts +0 -14
  287. package/dist/table-updates/filter.d.ts +0 -16
  288. package/dist/table-updates/index.d.ts +0 -19
  289. package/dist/utils/column-spec.cjs.map +0 -1
  290. package/dist/utils/column-spec.js.map +0 -1
  291. package/dist/utils/index.cjs +0 -9
  292. package/dist/utils/index.cjs.map +0 -1
  293. package/dist/utils/index.js +0 -9
  294. package/dist/utils/index.js.map +0 -1
  295. package/dist/zustand-store.cjs.map +0 -1
  296. package/dist/zustand-store.js.map +0 -1
  297. package/src/actions/filters.ts +0 -176
  298. package/src/components/actions.module.sass +0 -8
  299. package/src/provider.ts +0 -267
  300. package/src/table-updates/data-parameter.ts +0 -44
  301. package/src/table-updates/filter.ts +0 -124
  302. package/src/table-updates/index.ts +0 -239
  303. /package/dist/{zustand-store.d.ts → provider/zustand-store.d.ts} +0 -0
@@ -1,189 +1,78 @@
1
1
  import { useHotkeys } from "@blueprintjs/core";
2
2
  import {
3
3
  Column,
4
- Region,
5
4
  RegionCardinality,
6
5
  RowHeaderCell,
7
6
  Table,
8
- TableProps,
9
7
  } from "@blueprintjs/table";
10
8
  import "@blueprintjs/table/lib/css/table.css";
11
- import { ReactNode, useCallback, useEffect, useMemo, useRef } from "react";
12
- import { LoadProgressIndicator } from "./components";
13
- import { renderColumnHeaderCell } from "./renderers";
9
+ import {
10
+ CSSProperties,
11
+ ReactNode,
12
+ useCallback,
13
+ useEffect,
14
+ useMemo,
15
+ useRef,
16
+ } from "react";
17
+ import {
18
+ LoadProgressIndicator,
19
+ ActionsToolbar,
20
+ ActiveFiltersList,
21
+ } from "./components";
22
+ import { basicCellRenderer, renderColumnHeaderCell } from "./renderers";
14
23
  import h from "./main.module.sass";
15
24
  import {
16
25
  columnSpecAtom,
17
26
  ctx,
27
+ dataProviderAtom,
28
+ dataRefreshTokenAtom,
18
29
  DataSheetProvider,
30
+ DataViewRendererType,
31
+ DEFAULT_ROW_STATUS_STYLES,
32
+ FetchData,
33
+ persistViaProvider,
34
+ RowStatusStyles,
35
+ splitDataProviderProps,
19
36
  storeAtom,
20
37
  tableActionsAtom,
38
+ TableElementStatus,
21
39
  useSelector,
22
40
  useStoreAPI,
41
+ VisibleCells,
23
42
  } from "./provider";
24
43
  import { atom } from "jotai";
44
+ import { CellRendererDebugOverlay, tableHotkeysAtom } from "./utils";
25
45
  import {
26
- DataSheetProviderProps,
27
- DEFAULT_ROW_STATUS_STYLES,
28
- EditEvent,
29
- RowHeaderRenderContext,
30
- RowStatusStyles,
31
- TableElementStatus,
32
- VisibleCells,
33
- } from "./types.ts";
34
- import { basicCellRenderer } from "./cell-renderer.ts";
35
- import {
36
- CellRendererDebugOverlay,
37
- tableHotkeysAtom,
38
- type ColumnSpec,
39
- } from "./utils";
40
- import {
41
- ActionsToolbar,
42
46
  clipboardActions,
43
47
  columnControlActions,
44
48
  createSaveAction,
45
- FilterBar,
46
49
  resetChangesAction,
47
50
  TableAction,
48
51
  TableActionContext,
49
- TableFilter,
50
52
  } from "./actions";
51
53
  import {
52
- createLocalProvider,
53
- dataRefreshTokenAtom,
54
- FetchData,
55
- FetchDataOptions,
56
54
  tableFooterAtom,
57
- TableDataProvider,
58
- useScrollHandler,
59
55
  useDataLoader,
56
+ useScrollHandler,
60
57
  } from "./postgrest-table";
58
+ import {
59
+ CellInteraction,
60
+ DataSheetDensity,
61
+ DataSheetProps,
62
+ DataSheetRendererProps,
63
+ FetchDataOptions,
64
+ } from "./types.ts";
65
+ import { ErrorCallout } from "@macrostrat/ui-components";
61
66
 
62
67
  // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
63
68
 
64
69
  // TODO: add a "copy to selection" tool (the little square in the bottom right corner of a cell)
65
70
  // This should copy the value of a cell (or a set of cells in the same row) downwards.
66
71
 
67
- export enum DataSheetDensity {
68
- HIGH = "high",
69
- MEDIUM = "medium",
70
- LOW = "low",
71
- }
72
-
73
72
  /** Approximate column-header + scrollbar allowance, used to size the table to
74
73
  * its content in paged mode. */
75
74
  const COLUMN_HEADER_HEIGHT = 34;
76
75
 
77
- /**
78
- * How selecting a cell activates its surface (an editor, or a read-only detail
79
- * panel):
80
- * - `"auto"` (default when `autoFocusEditor` is `true`): open the surface on
81
- * selection and, for editors, focus it. Editors relinquish focus at their
82
- * edges — arrow past the start/end of a text cell, or press Escape, and focus
83
- * returns to the table — so the keyboard stays operable without the mouse.
84
- * Pressing Escape drops into navigation mode (surfaces stop auto-opening)
85
- * until the next click.
86
- * - `"manual"` (default when `autoFocusEditor` is `false`): the surface stays
87
- * closed until the cell is clicked; arrow keys always navigate the table.
88
- */
89
- export type CellInteraction = "auto" | "manual";
90
-
91
- interface DataSheetInternalProps<T> extends TableProps, FetchDataOptions {
92
- /** In-memory rows. Internally wrapped in a local `TableDataProvider` and
93
- * driven through the same loader as any other source. */
94
- data?: T[];
95
- /** Passed through from the public props so a function form can be derived
96
- * from the loaded rows here (a static array is handled by the provider). */
97
- columnSpec?: ColumnSpec[] | ((rows: T[]) => ColumnSpec[]);
98
- // function to fetch a chunk of data (the read side of a data provider)
99
- fetchData?: FetchData<T>;
100
- /** A data provider instantiated separately and passed in — bundles the read
101
- * side (`fetchData` + `identity`) and, optionally, the persistence side
102
- * (`saveRows` / `deleteRows` / `insertRow`) that drives the Save action. An
103
- * explicit alternative to the loose `data` / `fetchData` / `identity` props;
104
- * takes precedence when given. */
105
- provider?: TableDataProvider<T>;
106
- // An optional table name that will be used in toolbars if given
107
- name?: string;
108
- onVisibleCellsChange?: (visibleCells: VisibleCells) => void;
109
- onUpdateData?: (updatedData: any[], data: T[]) => void;
110
- /** Observer called for every user edit as a structured `EditEvent`
111
- * (Workstream A). Additive: the built-in `updatedData` overlay still
112
- * applies. */
113
- onEdit?: (event: EditEvent<T>) => void;
114
- /** Controlled edited-cell overlay (Workstream A). When provided, it is
115
- * synced into the store as the source of truth for edited values — pair with
116
- * `onEdit` to own edit state externally (e.g. an ops model). Optimistic
117
- * in-table edits are superseded by the next value you pass back. */
118
- updatedData?: T[];
119
- /** Controlled row-status overlay (edited / added / deleted), the companion
120
- * to `updatedData`. */
121
- rowStatus?: TableElementStatus[];
122
- /** Row identity for the edit overlay — stable across a provider re-sort (a
123
- * data provider supplies its own; defaults to `(row) => row?.id`). Lets edits
124
- * survive a re-ordered re-fetch. */
125
- identity?: (row: T) => string | number | null | undefined;
126
- /** Derive the controlled edit overlay from the loaded rows, *inside* the
127
- * sheet. For provider-backed tables whose overlay is a function of the loaded
128
- * data plus external edit state (e.g. an ops stack): the library owns the
129
- * rows, so it calls this with them and uses the result as the controlled
130
- * overlay, re-deriving when the rows — or this function's identity (close it
131
- * over your edit state) — change. Supersedes `updatedData`/`rowStatus`. */
132
- deriveOverlay?: (rows: T[]) => {
133
- updatedData: T[];
134
- rowStatus: TableElementStatus[];
135
- };
136
- /** Bump to force the data provider to re-fetch from scratch (e.g. after a
137
- * save/delete that invalidated the loaded rows). */
138
- refreshToken?: number | string;
139
- /** Persistence handler for the built-in Save action. When provided, a Save
140
- * control is added to the toolbar (always visible, disabled when there are
141
- * no pending changes). */
142
- onSave?: (ctx: TableActionContext<T>) => void | Promise<void>;
143
- onDeleteRows?: (selection: Region[]) => void;
144
- verbose?: boolean;
145
- enableColumnReordering?: boolean;
146
- enableClipboard?: boolean;
147
- enableFocusedCell?: boolean;
148
- editable?: boolean;
149
- /** @deprecated Prefer `cellInteraction`. `true` maps to `"auto"`,
150
- * `false` to `"manual"`. */
151
- autoFocusEditor?: boolean;
152
- /** How selecting a cell activates its surface (editor or detail panel).
153
- * Defaults from `autoFocusEditor` for backward compatibility. */
154
- cellInteraction?: CellInteraction;
155
- density?: DataSheetDensity;
156
- /** Configurable table actions shown in a selection-aware toolbar.
157
- * When provided, the actions toolbar renders alongside the existing
158
- * edit toolbar. Actions are filtered by the current selection cardinality. */
159
- actions?: TableAction<T>[];
160
- /** Available column/table filters shown in a filter bar.
161
- * Filters can also be defined per-column via `ColumnSpec.filters`. */
162
- filters?: TableFilter<T>[];
163
- /** Optional custom column header cell renderer, called for each column.
164
- * Receives the ColumnSpec and column index; should return a React element
165
- * (typically a Blueprint ColumnHeaderCell). */
166
- columnHeaderCellRenderer?: (col: any, colIndex: number) => ReactNode;
167
- /** Arbitrary nodes for the bottom status bar (left group), rendered beside
168
- * the active sort/filter tags — the home for view-state controls (show/hide
169
- * omitted rows/columns, a group-by indicator, etc.). */
170
- statusBar?: ReactNode;
171
- /** Presentation per row-status value, merged over the built-in defaults
172
- * (which style `"deleted"`). Supply styles for consumer-defined statuses
173
- * (e.g. `"omitted"`) and/or override the defaults. Each entry may set the
174
- * cells' style/intent and the row header's style. */
175
- rowStatusStyles?: RowStatusStyles;
176
- /** Render the content of a row's header cell (the left gutter). Receives the
177
- * row, its status, and the default 1-based label; return a node to use, or a
178
- * nullish value to keep the default. For group-key labels, omit indicators,
179
- * etc. Header-cell *styling* still comes from `rowStatusStyles`. */
180
- rowHeaderRenderer?: (ctx: RowHeaderRenderContext<T>) => ReactNode;
181
- }
182
-
183
- type DataSheetProps<T> = DataSheetProviderProps<T> & DataSheetInternalProps<T>;
184
-
185
- const emptyData: any[] = [];
186
-
187
76
  export function DataSheet<T>(props: DataSheetProps<T>) {
188
77
  const {
189
78
  data,
@@ -194,75 +83,27 @@ export function DataSheet<T>(props: DataSheetProps<T>) {
194
83
  enableFocusedCell = false,
195
84
  defaultColumnWidth = 150,
196
85
  children,
86
+ name,
197
87
  ...rest
198
88
  } = props;
199
89
 
90
+ const [providerProps, rendererProps] = splitDataProviderProps<T>({
91
+ ...props,
92
+ viewType: DataViewRendererType.TABLE,
93
+ });
200
94
  return h(
201
95
  DataSheetProvider<T>,
202
- {
203
- data: data ?? emptyData,
204
- columnSpec,
205
- columnSpecOptions,
206
- enableColumnReordering,
207
- defaultColumnWidth,
208
- editable,
209
- ...rest,
210
- },
211
- h(_DataSheet<any>, {
212
- ...rest,
213
- data: data ?? emptyData,
214
- columnSpec,
215
- children,
216
- editable,
217
- enableColumnReordering,
218
- enableFocusedCell,
219
- }),
96
+ providerProps,
97
+ h(DataSheetRenderer<any>, rendererProps),
220
98
  );
221
99
  }
222
100
 
223
- /** Persist all pending changes through a data provider: added rows via
224
- * `insertRow`, edited rows via `saveRows`, deleted rows via `deleteRows`
225
- * (addressed by `provider.identity`). Used by the built-in Save action when an
226
- * explicit provider owns persistence. */
227
- async function persistViaProvider<T>(
228
- provider: TableDataProvider<T>,
229
- ctx: TableActionContext<T>,
230
- ): Promise<void> {
231
- const base = (ctx.data ?? []) as any[];
232
- const updates = (ctx.updatedData ?? []) as any[];
233
- const status = (ctx.rowStatus ?? []) as any[];
234
- const n = Math.max(base.length, updates.length, status.length);
235
- const toSave: T[] = [];
236
- const toInsert: T[] = [];
237
- const toDelete: Array<string | number> = [];
238
- for (let i = 0; i < n; i++) {
239
- if (status[i] === TableElementStatus.DELETED) {
240
- const id = provider.identity(base[i]);
241
- if (id != null) toDelete.push(id);
242
- continue;
243
- }
244
- const upd = updates[i];
245
- const hasEdit =
246
- upd != null && typeof upd === "object" && Object.keys(upd).length > 0;
247
- if (status[i] === TableElementStatus.ADDED) {
248
- toInsert.push({ ...base[i], ...upd } as T);
249
- } else if (hasEdit) {
250
- toSave.push({ ...base[i], ...upd } as T);
251
- }
252
- }
253
- if (toDelete.length > 0 && provider.deleteRows != null) {
254
- await provider.deleteRows(toDelete);
255
- }
256
- for (const row of toInsert) {
257
- if (provider.insertRow != null) await provider.insertRow(row);
258
- }
259
- if (toSave.length > 0 && provider.saveRows != null) {
260
- await provider.saveRows(toSave);
261
- }
262
- }
101
+ const verboseAtom = atom(false);
263
102
 
264
- function _DataSheet<T>({
265
- data: sourceData,
103
+ /** The table (cell-grid) renderer. Assumes it is rendered inside a
104
+ * `DataSheetProvider` (the `DataSheet` wrapper, or `DataView`). Exported so a
105
+ * shared-store `DataView` can mount it directly alongside `_DataPanel`. */
106
+ export function DataSheetRenderer<T>({
266
107
  fetchData,
267
108
  provider,
268
109
  pageSize,
@@ -273,12 +114,16 @@ function _DataSheet<T>({
273
114
  onSave,
274
115
  updatedData: updatedDataProp,
275
116
  rowStatus: rowStatusProp,
276
- identity,
117
+ // Identity/canDeleteRows sync (was here) is now handled by the provider
118
+ // (`DataSheetProviderInner`); still destructured so `identity`/`refreshToken`
119
+ // don't leak into `...rest` (spread onto the Blueprint `Table` below).
120
+ identity: _identity,
277
121
  deriveOverlay,
278
- refreshToken,
122
+ refreshToken: _refreshToken,
279
123
  onDeleteRows,
280
124
  name,
281
125
  verbose = false,
126
+ debug = false,
282
127
  enableFocusedCell,
283
128
  autoFocusEditor = true,
284
129
  cellInteraction,
@@ -288,43 +133,29 @@ function _DataSheet<T>({
288
133
  actions,
289
134
  filters,
290
135
  columnHeaderCellRenderer,
291
- columnSpec: columnSpecProp,
292
136
  statusBar,
293
137
  rowStatusStyles,
294
138
  rowHeaderRenderer,
295
139
  children,
296
- ...rest
297
- }: DataSheetInternalProps<T>) {
140
+ ...tableProps
141
+ }: DataSheetRendererProps<T>) {
298
142
  /**
299
143
  * @param data: The data to be displayed in the table
300
144
  * @param columnSpec: The specification for all columns in the table. If not provided, the column spec will be generated from the data.
301
145
  * @param columnSpecOptions: Options for generating a column spec from data
302
146
  */
303
147
 
304
- // Turn on debug features
305
- const debugMode = false;
148
+ ctx.useSync(verboseAtom, verbose);
306
149
 
307
150
  const editable = useSelector((state) => state.editable);
308
151
 
309
- // Resolve the active data provider: an explicit `provider` prop wins; else a
310
- // loose `fetchData` (+ identity) is wrapped as one; else in-memory `data`
311
- // becomes a local provider. Local and remote thus share one path, and the
312
- // provider is an explicit contract rather than a set of scattered props.
313
- const isLocalProvider = provider == null && fetchData == null;
314
- const activeProvider = useMemo<TableDataProvider<any> | null>(() => {
315
- if (provider != null) return provider;
316
- if (fetchData != null) {
317
- return { fetchData, identity: identity ?? ((r: any) => r?.id) };
318
- }
319
- if (sourceData != null && sourceData.length > 0) {
320
- return createLocalProvider(
321
- sourceData,
322
- identity != null ? { identity } : undefined,
323
- );
324
- }
325
- return null;
326
- // eslint-disable-next-line react-hooks/exhaustive-deps
327
- }, [provider, fetchData, sourceData, identity]);
152
+ // The active data source is resolved in the wrapper (`DataSheet`) and held in
153
+ // the provider layer; read it here rather than resolving per render.
154
+ const {
155
+ provider: activeProvider,
156
+ isLocalProvider,
157
+ localCount,
158
+ } = ctx.useValue(dataProviderAtom);
328
159
 
329
160
  // When an explicit provider owns persistence, its methods drive the built-in
330
161
  // Save (batch: edits→saveRows, added→insertRow, deleted→deleteRows), then a
@@ -369,9 +200,15 @@ function _DataSheet<T>({
369
200
  return _actions;
370
201
  }, [actions, enableClipboard, editable, saveHandler]);
371
202
 
203
+ /*** TODO: generalize this, probably shouldn't need 'set' */
372
204
  ctx.useSync(tableActionsAtom, _actions);
205
+ const getHotkeys = ctx.useSet(tableHotkeysAtom);
206
+
207
+ // This is quite hacky!
208
+ const hotkeysConfig = useMemo(() => {
209
+ return getHotkeys();
210
+ }, [_actions]);
373
211
 
374
- const hotkeysConfig = ctx.useValue(tableHotkeysAtom);
375
212
  const { handleKeyDown, handleKeyUp } = useHotkeys(hotkeysConfig);
376
213
 
377
214
  // For now, we only consider a single cell "focused" when we have one cell selected.
@@ -440,13 +277,13 @@ function _DataSheet<T>({
440
277
  // In paged mode the row count is small and fixed, so let the table size to
441
278
  // its content (header + rows) instead of filling the viewport.
442
279
  const footerInfo = ctx.useValue(tableFooterAtom);
443
- const holderStyle =
444
- footerInfo.mode === "paged"
445
- ? {
446
- flex: "0 0 auto" as const,
447
- height: numRows * rowHeight + COLUMN_HEADER_HEIGHT,
448
- }
449
- : undefined;
280
+ let holderStyle: CSSProperties | undefined = undefined;
281
+ if (footerInfo.mode === "paged") {
282
+ holderStyle = {
283
+ flex: "0 0 auto" as const,
284
+ height: numRows * rowHeight + COLUMN_HEADER_HEIGHT,
285
+ };
286
+ }
450
287
 
451
288
  const onColumnsReordered = useSelector((state) => state.onColumnsReordered);
452
289
 
@@ -508,57 +345,21 @@ function _DataSheet<T>({
508
345
  // when the rows load/change or the function's identity changes (close it over
509
346
  // your external edit state). The `controlledOverlay` flag above suppresses the
510
347
  // loader-boundary identity remap so this derivation is authoritative.
511
- const loadedData = useSelector((state) => state.data);
512
348
  useEffect(() => {
513
349
  if (deriveOverlay == null) return;
514
- const overlay = deriveOverlay(loadedData);
350
+ const overlay = deriveOverlay(data);
515
351
  storeState.setState({
516
352
  updatedData: overlay.updatedData,
517
353
  rowStatus: overlay.rowStatus,
518
354
  });
519
- }, [deriveOverlay, loadedData, storeState]);
520
-
521
- // Function `columnSpec`: derive the spec from the loaded rows (no separate
522
- // fetch of sample data). Derive once the first rows arrive, and re-derive
523
- // when the function's identity changes (a consumer memoizes it over its
524
- // own view state — hidden columns, order, overrides). Not re-run as more
525
- // rows page in (guarded by the function identity), so it never clobbers
526
- // in-store column state on scroll.
527
- const derivedSpecFor = useRef<unknown>(null);
528
- useEffect(() => {
529
- if (typeof columnSpecProp !== "function") return;
530
- if (derivedSpecFor.current === columnSpecProp) return;
531
- const rows = loadedData.filter((r) => r != null);
532
- if (rows.length === 0) return;
533
- derivedSpecFor.current = columnSpecProp;
534
- storeState.setState({ columnSpec: columnSpecProp(rows) });
535
- }, [columnSpecProp, loadedData, storeState]);
536
-
537
- // Imperative re-fetch: bump `refreshToken` to reload the provider (e.g. after
538
- // a save). Skips the initial mount (the loader does its own first fetch).
539
- const bumpRefreshFromToken = ctx.useSet(dataRefreshTokenAtom);
540
- const firstRefreshToken = useRef(true);
541
- useEffect(() => {
542
- if (firstRefreshToken.current) {
543
- firstRefreshToken.current = false;
544
- return;
545
- }
546
- bumpRefreshFromToken((v) => v + 1);
547
- }, [refreshToken, bumpRefreshFromToken]);
355
+ }, [deriveOverlay, data, storeState]);
548
356
 
549
- // The active provider supplies the row identity for the edit overlay.
550
- useEffect(() => {
551
- const id = activeProvider?.identity ?? identity;
552
- if (id != null) storeState.setState({ identity: id });
553
- }, [storeState, activeProvider, identity]);
357
+ // Function `columnSpec` derivation is hoisted to the provider
358
+ // (`DataSheetProviderInner`), shared by both renderers.
554
359
 
555
- // Row deletion is a provider capability: an explicit `provider` without
556
- // `deleteRows` disables deletion entirely. (Local / loose sources keep the
557
- // local delete overlay.)
558
- useEffect(() => {
559
- const canDeleteRows = provider == null || provider.deleteRows != null;
560
- storeState.setState({ canDeleteRows });
561
- }, [storeState, provider]);
360
+ // Identity and canDeleteRows sync are hoisted to the provider
361
+ // (`DataSheetProviderInner`), shared with `_DataPanel` — both depend only on
362
+ // the resolved data provider, not any sheet-specific state.
562
363
 
563
364
  // Merge consumer `rowStatusStyles` over the built-in defaults and hand the
564
365
  // result to the store, where the cell renderer and row-header renderer read
@@ -574,11 +375,11 @@ function _DataSheet<T>({
574
375
  const realizedColumns = useMemo(() => {
575
376
  return columnSpec.map((col, colIndex) => {
576
377
  let fn =
577
- col.headerCellRenderer ??
378
+ col.headerRenderer ??
578
379
  columnHeaderCellRenderer ??
579
380
  renderColumnHeaderCell;
580
- let activeSort = null;
581
- let activeFilter = null;
381
+ let activeSort: any = null;
382
+ let activeFilter: any = null;
582
383
  if (col.sortable) {
583
384
  activeSort = columnSorts?.find((s) => s.key === col.key);
584
385
  }
@@ -592,19 +393,22 @@ function _DataSheet<T>({
592
393
  }
593
394
  }
594
395
 
595
- const _columnHeaderCellRenderer = (colIndex) => {
596
- return fn({
597
- col,
396
+ const _columnHeaderCellRenderer: any = (colIndex) => {
397
+ return fn(
398
+ {
399
+ col,
400
+ colIndex,
401
+ activeSort,
402
+ activeFilter,
403
+ },
598
404
  colIndex,
599
- activeSort,
600
- activeFilter,
601
- });
405
+ );
602
406
  };
603
407
 
604
408
  return h(Column, {
605
409
  id: col.key,
606
410
  name: col.name,
607
- columnHeaderCellRenderer: _columnHeaderCellRenderer,
411
+ columnHeaderCellRenderer: _columnHeaderCellRenderer as any,
608
412
  cellRenderer: (rowIndex) => {
609
413
  const state = storeAPI.getState();
610
414
  return basicCellRenderer<T>(
@@ -632,20 +436,20 @@ function _DataSheet<T>({
632
436
 
633
437
  const rowHeaderCellRenderer = useCallback(
634
438
  (rowIndex: number) => {
635
- const dataRowIndex =
636
- filteredRowIndices != null
637
- ? (filteredRowIndices[rowIndex] ?? rowIndex)
638
- : rowIndex;
439
+ let dataRowIndex = rowIndex;
440
+ if (filteredRowIndices != null) {
441
+ dataRowIndex = filteredRowIndices[rowIndex] ?? rowIndex;
442
+ }
639
443
  const statusVal = rowStatus[dataRowIndex];
640
- const style =
641
- (statusVal != null
642
- ? mergedRowStatusStyles[statusVal]?.headerStyle
643
- : null) ?? null;
444
+ let style: CSSProperties | undefined;
445
+ if (statusVal != null) {
446
+ style = mergedRowStatusStyles[statusVal]?.headerStyle;
447
+ }
644
448
 
645
449
  const defaultLabel = `${dataRowIndex + 1}`;
646
- let name: ReactNode = defaultLabel;
450
+ let name: string = defaultLabel;
647
451
  if (rowHeaderRenderer != null) {
648
- const custom = rowHeaderRenderer({
452
+ return rowHeaderRenderer({
649
453
  rowIndex: dataRowIndex,
650
454
  visibleIndex: rowIndex,
651
455
  row: data[dataRowIndex] ?? updatedData[dataRowIndex],
@@ -653,7 +457,6 @@ function _DataSheet<T>({
653
457
  isDeleted: statusVal === TableElementStatus.DELETED,
654
458
  defaultLabel,
655
459
  });
656
- if (custom != null) name = custom;
657
460
  }
658
461
 
659
462
  return h(RowHeaderCell, {
@@ -673,6 +476,23 @@ function _DataSheet<T>({
673
476
  ],
674
477
  );
675
478
 
479
+ // Done with hooks!
480
+ /** Guard for unacceptable state combinations:
481
+ * editable = true requires selectionModes to include cells, else the user cannot select a cell to edit.
482
+ * TODO: make this an impossible state to enter.
483
+ */
484
+ if (
485
+ editable &&
486
+ selectionModes &&
487
+ !selectionModes.includes(RegionCardinality.CELLS)
488
+ ) {
489
+ return h(ErrorCallout, {
490
+ title: "Invalid selection mode",
491
+ description: "Editable sheet requires cell selection",
492
+ });
493
+ }
494
+
495
+ // TODO: hoist this
676
496
  let _selectionModes = selectionModes;
677
497
  if (
678
498
  editable &&
@@ -698,12 +518,13 @@ function _DataSheet<T>({
698
518
  let dataLoader: ReactNode = null;
699
519
  if (activeProvider != null) {
700
520
  _showLoadProgress = !isLocalProvider;
521
+ // A local (in-memory) source loads all its rows in one page; its count
522
+ // rides on the resolved provider (`localCount`), so `_DataSheet` no longer
523
+ // takes a `data` prop — live rows come only from the store.
701
524
  dataLoader = h(_DataLoaderManager, {
702
525
  key: "__data_loader",
703
526
  fetchData: activeProvider.fetchData,
704
- pageSize: isLocalProvider
705
- ? Math.max(sourceData?.length ?? 1, 1)
706
- : pageSize,
527
+ pageSize: isLocalProvider ? Math.max(localCount, 1) : pageSize,
707
528
  fetchMode: isLocalProvider ? undefined : fetchMode,
708
529
  });
709
530
  }
@@ -712,13 +533,13 @@ function _DataSheet<T>({
712
533
 
713
534
  let filterStatus: ReactNode = null;
714
535
  if (showFilterBar) {
715
- filterStatus = h(FilterBar, { filters: filters ?? [] });
536
+ filterStatus = h(ActiveFiltersList, { filters: filters ?? [] });
716
537
  }
717
538
 
718
539
  return h("div.data-sheet-container", { className, style }, [
719
540
  // The actions/tools toolbar (selection-modal). Table-scoped controls like
720
541
  // scroll-to-row / full-text search live here as ordinary actions.
721
- h(ActionsToolbar, { actions: _actions, tableName: name }),
542
+ h(ActionsToolbar, { actions: _actions }),
722
543
  dataLoader,
723
544
  children,
724
545
  h(
@@ -731,7 +552,7 @@ function _DataSheet<T>({
731
552
  style: holderStyle,
732
553
  },
733
554
  h(
734
- Table,
555
+ Table as any, // Some sort of hyperscript type error
735
556
  {
736
557
  ref,
737
558
  numRows,
@@ -741,11 +562,10 @@ function _DataSheet<T>({
741
562
  focusedCell,
742
563
  selectedRegions,
743
564
  defaultRowHeight: rowHeight,
744
- minRowHeight: rowHeight,
745
565
  columnWidths,
746
566
  onColumnWidthChanged,
747
567
  onSelection,
748
- /** TODO: we could enable this, but we need a use-case first... */
568
+ /** TODO: we could enable this if we had a use-case */
749
569
  enableRowReordering: false,
750
570
  enableRowResizing: false,
751
571
  // The cell renderer is memoized internally based on these data dependencies
@@ -753,7 +573,7 @@ function _DataSheet<T>({
753
573
  onVisibleCellsChange: _onVisibleCellsChange,
754
574
  rowHeaderCellRenderer,
755
575
  selectionModes: _selectionModes,
756
- ...rest,
576
+ ...tableProps,
757
577
  getCellClipboardData: null,
758
578
  },
759
579
  realizedColumns,
@@ -765,7 +585,7 @@ function _DataSheet<T>({
765
585
  h("div.spacer"),
766
586
  h.if(_showLoadProgress)(LoadProgressIndicator),
767
587
  ]),
768
- h.if(debugMode)(CellRendererDebugOverlay, {
588
+ h.if(debug)(CellRendererDebugOverlay, {
769
589
  cellRendererDependencies,
770
590
  names: [
771
591
  "data",
@@ -778,8 +598,14 @@ function _DataSheet<T>({
778
598
  ]);
779
599
  }
780
600
 
781
- const columnWidthsIndexAtom = atom((get) => get(storeAtom).columnWidthsIndex);
782
- const defaultColumnWidthAtom = atom((get) => get(storeAtom).defaultColumnWidth);
601
+ const EMPTY_MAP = new Map<string, number>();
602
+
603
+ const columnWidthsIndexAtom = atom(
604
+ (get) => get(storeAtom)?.columnWidthsIndex ?? EMPTY_MAP,
605
+ );
606
+ const defaultColumnWidthAtom = atom(
607
+ (get) => get(storeAtom)?.defaultColumnWidth ?? 150,
608
+ );
783
609
 
784
610
  const columnWidthsAtom = atom((get) => {
785
611
  const ix = get(columnWidthsIndexAtom);
@@ -788,7 +614,10 @@ const columnWidthsAtom = atom((get) => {
788
614
  );
789
615
  });
790
616
 
791
- function styleParamsForDensity(density: DataSheetDensity) {
617
+ function styleParamsForDensity(density: DataSheetDensity): {
618
+ rowHeight: number;
619
+ style: Record<string, string>;
620
+ } {
792
621
  switch (density) {
793
622
  case DataSheetDensity.MEDIUM:
794
623
  return {
@@ -829,17 +658,3 @@ function _DataLoaderManager<T = any>({
829
658
  useDataLoader(fetchData, rest);
830
659
  return null;
831
660
  }
832
-
833
- export function getRowsToDelete(selection) {
834
- let rowIndices: number[] = [];
835
- for (const sel of selection) {
836
- // This isn't a full-row selection
837
- if (sel.cols != null) continue;
838
- if (sel.rows == null) continue;
839
- const [startIndex, endIndex] = sel.rows;
840
- for (let i = startIndex; i <= endIndex; i++) {
841
- rowIndices.push(i);
842
- }
843
- }
844
- return rowIndices;
845
- }