@infinite-table/infinite-react 0.4.12 → 0.5.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 (282) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/API.md +0 -0
  3. package/build/buildPackageJson.js +43 -0
  4. package/build/scripts/test.js +37 -0
  5. package/bundler.config.js +25 -0
  6. package/globals.d.ts +7 -0
  7. package/package.json +95 -3
  8. package/rollup.config.js +15 -0
  9. package/run-build-deepmap.js +47 -0
  10. package/run-build.js +45 -0
  11. package/run-dts-concat.js +21 -0
  12. package/src/components/CSSVariableWatch.tsx +82 -0
  13. package/src/components/DataSource/BooleanCollectionState.ts +214 -0
  14. package/src/components/DataSource/BooleanDeepCollectionState.ts +208 -0
  15. package/src/components/DataSource/DataSourceContext.ts +20 -0
  16. package/src/components/DataSource/GroupRowsState.ts +74 -0
  17. package/src/components/DataSource/Indexer.ts +27 -0
  18. package/src/components/DataSource/RowSelectionState.ts +763 -0
  19. package/src/components/DataSource/defaultFilterTypes.ts +64 -0
  20. package/src/components/DataSource/index.tsx +108 -0
  21. package/src/components/DataSource/privateHooks/getChangeDetect.ts +7 -0
  22. package/src/components/DataSource/privateHooks/useLoadData.ts +783 -0
  23. package/src/components/DataSource/publicHooks/useDataSource.ts +19 -0
  24. package/src/components/DataSource/publicHooks/useDataSourceActions.ts +14 -0
  25. package/src/components/DataSource/state/getInitialState.ts +494 -0
  26. package/src/components/DataSource/state/normalizeSortInfo.ts +35 -0
  27. package/src/components/DataSource/state/reducer.ts +466 -0
  28. package/src/components/DataSource/state/rowInfoStatus.ts +27 -0
  29. package/src/components/DataSource/types.ts +548 -0
  30. package/src/components/HeadlessTable/HeadlessTableWithPinnedContainers.tsx +142 -0
  31. package/src/components/HeadlessTable/MappedCells.ts +251 -0
  32. package/src/components/HeadlessTable/RawTable.tsx +98 -0
  33. package/src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx +1516 -0
  34. package/src/components/HeadlessTable/index.tsx +234 -0
  35. package/src/components/InfiniteTable/InfiniteCls.css.ts +164 -0
  36. package/src/components/InfiniteTable/InfiniteTableContext.ts +16 -0
  37. package/src/components/InfiniteTable/api/getImperativeApi.ts +391 -0
  38. package/src/components/InfiniteTable/api/getSelectionApi.ts +364 -0
  39. package/src/components/InfiniteTable/api/type.ts +11 -0
  40. package/src/components/InfiniteTable/components/ActiveCellIndicator.css.ts +51 -0
  41. package/src/components/InfiniteTable/components/ActiveCellIndicator.tsx +116 -0
  42. package/src/components/InfiniteTable/components/ActiveRowIndicator.css.ts +56 -0
  43. package/src/components/InfiniteTable/components/ActiveRowIndicator.tsx +94 -0
  44. package/src/components/InfiniteTable/components/CheckBox.css.ts +13 -0
  45. package/src/components/InfiniteTable/components/CheckBox.tsx +96 -0
  46. package/src/components/InfiniteTable/components/FilterEditors.tsx +52 -0
  47. package/src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx +27 -0
  48. package/src/components/InfiniteTable/components/InfiniteTableBody/index.tsx +1 -0
  49. package/src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx +31 -0
  50. package/src/components/InfiniteTable/components/InfiniteTableFooter/index.tsx +1 -0
  51. package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx +102 -0
  52. package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx +163 -0
  53. package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx +574 -0
  54. package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx +79 -0
  55. package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderTypes.tsx +25 -0
  56. package/src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx +185 -0
  57. package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx +159 -0
  58. package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts +124 -0
  59. package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts +166 -0
  60. package/src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx +146 -0
  61. package/src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts +240 -0
  62. package/src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts +358 -0
  63. package/src/components/InfiniteTable/components/InfiniteTableHeader/index.tsx +1 -0
  64. package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx +114 -0
  65. package/src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx +146 -0
  66. package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/footer.css.ts +7 -0
  67. package/src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx +110 -0
  68. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx +120 -0
  69. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCellTypes.ts +74 -0
  70. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx +457 -0
  71. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx +107 -0
  72. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts +6 -0
  73. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowTypes.ts +32 -0
  74. package/src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx +75 -0
  75. package/src/components/InfiniteTable/components/InfiniteTableRow/columnRendering.tsx +263 -0
  76. package/src/components/InfiniteTable/components/InfiniteTableRow/index.tsx +1 -0
  77. package/src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts +74 -0
  78. package/src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts +199 -0
  79. package/src/components/InfiniteTable/components/LoadMask.css.ts +34 -0
  80. package/src/components/InfiniteTable/components/LoadMask.tsx +27 -0
  81. package/src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx +56 -0
  82. package/src/components/InfiniteTable/components/cell.css.ts +192 -0
  83. package/src/components/InfiniteTable/components/icons/ArrowDown.tsx +14 -0
  84. package/src/components/InfiniteTable/components/icons/ArrowUp.tsx +14 -0
  85. package/src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts +31 -0
  86. package/src/components/InfiniteTable/components/icons/ExpanderIcon.tsx +63 -0
  87. package/src/components/InfiniteTable/components/icons/Icon.tsx +18 -0
  88. package/src/components/InfiniteTable/components/icons/InfiniteTableIconClassName.ts +1 -0
  89. package/src/components/InfiniteTable/components/icons/LoadingIcon.css.ts +8 -0
  90. package/src/components/InfiniteTable/components/icons/LoadingIcon.tsx +45 -0
  91. package/src/components/InfiniteTable/components/icons/MenuIcon.tsx +50 -0
  92. package/src/components/InfiniteTable/components/icons/SortIcon.tsx +113 -0
  93. package/src/components/InfiniteTable/eventHandlers/eventHandlerTypes.ts +57 -0
  94. package/src/components/InfiniteTable/eventHandlers/index.ts +95 -0
  95. package/src/components/InfiniteTable/eventHandlers/keyboardNavigation.ts +232 -0
  96. package/src/components/InfiniteTable/eventHandlers/keyboardSelection.ts +110 -0
  97. package/src/components/InfiniteTable/eventHandlers/onCellClick.ts +94 -0
  98. package/src/components/InfiniteTable/eventHandlers/onKeyDown.ts +25 -0
  99. package/src/components/InfiniteTable/hooks/adjustColumnOrderForAllColumns.ts +70 -0
  100. package/src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts +476 -0
  101. package/src/components/InfiniteTable/hooks/useAutoSizeColumns.ts +206 -0
  102. package/src/components/InfiniteTable/hooks/useCellClassName.ts +80 -0
  103. package/src/components/InfiniteTable/hooks/useCellRendering.tsx +217 -0
  104. package/src/components/InfiniteTable/hooks/useColumnGroups.ts +71 -0
  105. package/src/components/InfiniteTable/hooks/useColumnMenu.ts +72 -0
  106. package/src/components/InfiniteTable/hooks/useColumnPointerEvents.ts +258 -0
  107. package/src/components/InfiniteTable/hooks/useColumnRowspan.ts +43 -0
  108. package/src/components/InfiniteTable/hooks/useColumnSizeFn.ts +24 -0
  109. package/src/components/InfiniteTable/hooks/useColumnsWhen.ts +582 -0
  110. package/src/components/InfiniteTable/hooks/useComputed.ts +186 -0
  111. package/src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts +219 -0
  112. package/src/components/InfiniteTable/hooks/useDOMProps.ts +306 -0
  113. package/src/components/InfiniteTable/hooks/useEffectWithRaf.ts +47 -0
  114. package/src/components/InfiniteTable/hooks/useInfiniteTable.ts +10 -0
  115. package/src/components/InfiniteTable/hooks/useInfiniteTableState.ts +11 -0
  116. package/src/components/InfiniteTable/hooks/useInternalProps.ts +8 -0
  117. package/src/components/InfiniteTable/hooks/useLicense/LicenseDetails.ts +13 -0
  118. package/src/components/InfiniteTable/hooks/useLicense/crc32.ts +56 -0
  119. package/src/components/InfiniteTable/hooks/useLicense/decode.ts +147 -0
  120. package/src/components/InfiniteTable/hooks/useLicense/useLicense.ts +39 -0
  121. package/src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts +21 -0
  122. package/src/components/InfiniteTable/hooks/useRowHover.ts +18 -0
  123. package/src/components/InfiniteTable/hooks/useScrollToActiveCell.ts +48 -0
  124. package/src/components/InfiniteTable/hooks/useScrollToActiveRow.ts +44 -0
  125. package/src/components/InfiniteTable/hooks/useScrollbars.ts +51 -0
  126. package/src/components/InfiniteTable/hooks/useToggleGroupRow.ts +56 -0
  127. package/src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx +165 -0
  128. package/src/components/InfiniteTable/hooks/useYourBrain.ts +55 -0
  129. package/src/components/InfiniteTable/index.tsx +352 -0
  130. package/src/components/InfiniteTable/internalProps.ts +4 -0
  131. package/src/components/InfiniteTable/state/computeColumnGroupsDepths.ts +29 -0
  132. package/src/components/InfiniteTable/state/getColumnVisibilityForHideEmptyGroupColumns.ts +127 -0
  133. package/src/components/InfiniteTable/state/getInitialState.ts +375 -0
  134. package/src/components/InfiniteTable/theme.css.ts +556 -0
  135. package/src/components/InfiniteTable/types/InfiniteTableAction.ts +6 -0
  136. package/src/components/InfiniteTable/types/InfiniteTableActionType.ts +12 -0
  137. package/src/components/InfiniteTable/types/InfiniteTableColumn.ts +478 -0
  138. package/src/components/InfiniteTable/types/InfiniteTableComputedValues.ts +43 -0
  139. package/src/components/InfiniteTable/types/InfiniteTableContextValue.ts +12 -0
  140. package/src/components/InfiniteTable/types/InfiniteTableInternalProps.ts +3 -0
  141. package/src/components/InfiniteTable/types/InfiniteTableProps.ts +511 -0
  142. package/src/components/InfiniteTable/types/InfiniteTableState.ts +195 -0
  143. package/src/components/InfiniteTable/types/Utility.ts +35 -0
  144. package/src/components/InfiniteTable/types/index.ts +96 -0
  145. package/src/components/InfiniteTable/utilities.css.ts +179 -0
  146. package/src/components/InfiniteTable/utils/MultiRowSelector.ts +111 -0
  147. package/src/components/InfiniteTable/utils/RenderHookComponentForInfinite.tsx +52 -0
  148. package/src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts +33 -0
  149. package/src/components/InfiniteTable/utils/assignFiltered.ts +29 -0
  150. package/src/components/InfiniteTable/utils/defaultGetColumContextMenuItems.tsx +108 -0
  151. package/src/components/InfiniteTable/utils/getColumnComputedType.ts +33 -0
  152. package/src/components/InfiniteTable/utils/getColumnForGroupBy.tsx +313 -0
  153. package/src/components/InfiniteTable/utils/getComputedVisibleColumns.ts +773 -0
  154. package/src/components/InfiniteTable/utils/getContextMenuForColumn.tsx +72 -0
  155. package/src/components/InfiniteTable/utils/infiniteDOMUtils.ts +189 -0
  156. package/src/components/InfiniteTable/utils/mapToObject.ts +20 -0
  157. package/src/components/InfiniteTable/utils/moveXatY.ts +25 -0
  158. package/src/components/InfiniteTable/utils/objectValuesExcept.ts +9 -0
  159. package/src/components/InfiniteTable/utils/progressiveSpeedScroller.ts +158 -0
  160. package/src/components/InfiniteTable/utils/rafFn.ts +13 -0
  161. package/src/components/InfiniteTable/utils/toCSSVarName.ts +1 -0
  162. package/src/components/InfiniteTable/utils/toMap.ts +24 -0
  163. package/src/components/Menu/Menu.tsx +750 -0
  164. package/src/components/Menu/MenuCls.css.ts +139 -0
  165. package/src/components/Menu/MenuContext.ts +10 -0
  166. package/src/components/Menu/MenuContextValue.ts +15 -0
  167. package/src/components/Menu/MenuProps.ts +98 -0
  168. package/src/components/Menu/MenuState.ts +56 -0
  169. package/src/components/Menu/MenuTriangleContext.ts +352 -0
  170. package/src/components/Menu/childrenToRuntimeItems.tsx +103 -0
  171. package/src/components/Menu/getMenuState.tsx +119 -0
  172. package/src/components/Menu/index.tsx +88 -0
  173. package/src/components/Menu/propToIdentifyMenu.ts +1 -0
  174. package/src/components/RawList/AvoidReactDiff.tsx +48 -0
  175. package/src/components/RawList/MappedItems.ts +143 -0
  176. package/src/components/RawList/ReactVirtualRenderer.tsx +307 -0
  177. package/src/components/RawList/index.tsx +42 -0
  178. package/src/components/RawList/types.ts +23 -0
  179. package/src/components/RawList/useVirtualRenderer.ts +36 -0
  180. package/src/components/RenderHookComponent.tsx +10 -0
  181. package/src/components/ResizeObserver/index.tsx +170 -0
  182. package/src/components/VirtualBrain/MatrixBrain.ts +1621 -0
  183. package/src/components/VirtualBrain/ScrollListener.ts +39 -0
  184. package/src/components/VirtualBrain/index.ts +664 -0
  185. package/src/components/VirtualList/ColumnListWithExternalScrolling.tsx +78 -0
  186. package/src/components/VirtualList/InfiniteListRootClassName.ts +1 -0
  187. package/src/components/VirtualList/RowListWithExternalScrolling.tsx +120 -0
  188. package/src/components/VirtualList/SpacePlaceholder.tsx +32 -0
  189. package/src/components/VirtualList/VirtualList.css.ts +29 -0
  190. package/src/components/VirtualList/VirtualList.tsx +141 -0
  191. package/src/components/VirtualList/VirtualRowList.tsx +34 -0
  192. package/src/components/VirtualList/types.ts +56 -0
  193. package/src/components/VirtualList/useCorrectHeightForRowElements.ts +14 -0
  194. package/src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts +51 -0
  195. package/src/components/VirtualScrollContainer/getScrollableClassName.ts +30 -0
  196. package/src/components/VirtualScrollContainer/index.tsx +63 -0
  197. package/src/components/flexbox/index.ts +562 -0
  198. package/src/components/hooks/useComponentState/index.tsx +562 -0
  199. package/src/components/hooks/useComponentState/types.ts +32 -0
  200. package/src/components/hooks/useEffectOnceWithProperUnmount.ts +33 -0
  201. package/src/components/hooks/useEffectWithChanges.ts +56 -0
  202. package/src/components/hooks/useImmutableRef.ts +7 -0
  203. package/src/components/hooks/useInterceptedMap.ts +71 -0
  204. package/src/components/hooks/useLatest.tsx +8 -0
  205. package/src/components/hooks/useLazyLatest.ts +23 -0
  206. package/src/components/hooks/useMemoShallowObjectMerge.ts +16 -0
  207. package/src/components/hooks/useMounted.ts +18 -0
  208. package/src/components/hooks/useOnMount.ts +21 -0
  209. package/src/components/hooks/useOnScroll.ts +34 -0
  210. package/src/components/hooks/useOnce.ts +10 -0
  211. package/src/components/hooks/useOverlay/index.tsx +418 -0
  212. package/src/components/hooks/usePrevious.ts +8 -0
  213. package/src/components/hooks/usePropertyOld.ts +168 -0
  214. package/src/components/hooks/useRerender.ts +12 -0
  215. package/src/components/hooks/xuseProperty.ts +165 -0
  216. package/src/components/types/CellPosition.ts +4 -0
  217. package/src/components/types/NonUndefined.ts +1 -0
  218. package/src/components/types/RemoveObject.ts +22 -0
  219. package/src/components/types/Renderable.ts +3 -0
  220. package/src/components/types/ScrollPosition.ts +7 -0
  221. package/src/components/types/Setter.ts +2 -0
  222. package/src/components/types/Size.ts +6 -0
  223. package/src/components/types/SubscriptionCallback.ts +10 -0
  224. package/src/components/types/VoidFn.ts +1 -0
  225. package/src/components/utils/buildSubscriptionCallback.tsx +60 -0
  226. package/src/components/utils/clamp.ts +3 -0
  227. package/src/components/utils/debounce.ts +16 -0
  228. package/src/components/utils/decamelize.ts +11 -0
  229. package/src/components/utils/discardCallsWithEqualArg.ts +42 -0
  230. package/src/components/utils/getRenderIndexes.ts +33 -0
  231. package/src/components/utils/getScrollbarWidth.ts +31 -0
  232. package/src/components/utils/getVirtualRenderCount.ts +21 -0
  233. package/src/components/utils/isControlled.ts +12 -0
  234. package/src/components/utils/isControlledValue.ts +5 -0
  235. package/src/index.tsx +34 -0
  236. package/src/test.tsx +18 -0
  237. package/src/utils/DeepMap/index.ts +588 -0
  238. package/src/utils/DeepMap/once.ts +16 -0
  239. package/src/utils/DeepMap/sortAscending.ts +1 -0
  240. package/src/utils/DeepMap/tsconfig.deepmap.json +17 -0
  241. package/src/utils/DeepMap/xpackage.json +26 -0
  242. package/src/utils/debug.ts +40 -0
  243. package/src/utils/deepClone.ts +38 -0
  244. package/src/utils/getGlobal.ts +3 -0
  245. package/src/utils/groupAndPivot/defaultToKey.ts +3 -0
  246. package/src/utils/groupAndPivot/getGroupKeysForDataItem.ts +19 -0
  247. package/src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts +361 -0
  248. package/src/utils/groupAndPivot/index.ts +1229 -0
  249. package/src/utils/groupAndPivot/types.ts +10 -0
  250. package/src/utils/join.ts +4 -0
  251. package/src/utils/mathIntersection.ts +21 -0
  252. package/src/utils/minified.d.ts +2 -0
  253. package/src/utils/minified.js +6 -0
  254. package/src/utils/multisort/index.ts +151 -0
  255. package/src/utils/multisort/sortTypes.ts +25 -0
  256. package/src/utils/notes-status.md +92 -0
  257. package/src/utils/pageGeometry/ConvexPoly.ts +34 -0
  258. package/src/utils/pageGeometry/Point.ts +51 -0
  259. package/src/utils/pageGeometry/PolyWithPoints.ts +52 -0
  260. package/src/utils/pageGeometry/Rectangle.ts +98 -0
  261. package/src/utils/pageGeometry/Triangle.ts +16 -0
  262. package/src/utils/pageGeometry/alignment/index.ts +221 -0
  263. package/src/utils/pageGeometry/polyContainsPoint.ts +182 -0
  264. package/src/utils/pageGeometry/types.ts +3 -0
  265. package/src/utils/proxyFnCall.ts +46 -0
  266. package/src/utils/raf.ts +13 -0
  267. package/src/utils/selectParent.ts +18 -0
  268. package/src/utils/shallowEqualObjects.ts +49 -0
  269. package/src/utils/stripVar.ts +3 -0
  270. package/src/utils/toUpperFirst.ts +5 -0
  271. package/todo.md +2 -0
  272. package/tsconfig.build.json +8 -0
  273. package/tsconfig.dev.json +7 -0
  274. package/tsconfig.json +30 -0
  275. package/tsconfig.typebundler.json +13 -0
  276. package/typedoc.json +4 -0
  277. package/README.md +0 -104
  278. package/index.css +0 -857
  279. package/index.d.ts +0 -2111
  280. package/index.esm.css +0 -857
  281. package/index.esm.js +0 -13689
  282. package/index.js +0 -13560
@@ -0,0 +1,364 @@
1
+ import { InfiniteTable_RowInfoBase } from '../../../utils/groupAndPivot';
2
+ import { getGroupKeysForDataItem } from '../../../utils/groupAndPivot/getGroupKeysForDataItem';
3
+
4
+ import {
5
+ DataSourceComponentActions,
6
+ DataSourceState,
7
+ RowSelectionState,
8
+ } from '../../DataSource';
9
+
10
+ import {
11
+ GetRowSelectionStateConfig,
12
+ RowSelectionStateObject,
13
+ } from '../../DataSource/RowSelectionState';
14
+
15
+ type ArrayOfIds = Pick<InfiniteTable_RowInfoBase<any>, 'id'>[];
16
+
17
+ export type InfiniteTableSelectionApi = {
18
+ get allRowsSelected(): boolean;
19
+ isRowSelected(pk: any, groupKeys?: any[]): boolean;
20
+ isRowDeselected(pk: any, groupKeys?: any[]): boolean;
21
+
22
+ selectRow(pk: any, groupKeys?: any[]): void;
23
+ deselectRow(pk: any, groupKeys?: any[]): void;
24
+ toggleRowSelection(pk: any, groupKeys?: any[]): void;
25
+
26
+ selectGroupRow(groupKeys: any[], children?: ArrayOfIds): void;
27
+ deselectGroupRow(groupKeys: any[], children?: ArrayOfIds): void;
28
+ toggleGroupRowSelection(groupKeys: any[], children?: ArrayOfIds): void;
29
+
30
+ getGroupRowSelectionState(groupKeys: any[]): boolean | null;
31
+
32
+ getSelectedPrimaryKeys(
33
+ rowSelection?: RowSelectionStateObject,
34
+ ): (string | number)[];
35
+ selectAll(): void;
36
+ deselectAll(): void;
37
+ };
38
+
39
+ export type GetSelectionApiParam<T> = {
40
+ getDataSourceState: () => DataSourceState<T>;
41
+ dataSourceActions: {
42
+ rowSelection: DataSourceComponentActions<T>['rowSelection'];
43
+ };
44
+ };
45
+
46
+ export function cloneRowSelection<T>(
47
+ rowSelection: RowSelectionState<T> | RowSelectionStateObject,
48
+ stateOrGetDataSourceState: DataSourceState<T> | (() => DataSourceState<T>),
49
+ ) {
50
+ return new RowSelectionState<T>(
51
+ rowSelection,
52
+ rowSelectionStateConfigGetter(stateOrGetDataSourceState),
53
+ );
54
+ }
55
+
56
+ export function rowSelectionStateConfigGetter<T>(
57
+ stateOrStateGetter: DataSourceState<T> | (() => DataSourceState<T>),
58
+ ): GetRowSelectionStateConfig<T> {
59
+ return () => {
60
+ const state =
61
+ typeof stateOrStateGetter === 'function'
62
+ ? stateOrStateGetter()
63
+ : stateOrStateGetter;
64
+
65
+ return {
66
+ lazyLoad: !!state.lazyLoad,
67
+ toPrimaryKey: state.toPrimaryKey,
68
+ onlyUsePrimaryKeys: !state.useGroupKeysForMultiRowSelection,
69
+ groupBy: state.groupBy,
70
+ groupDeepMap: state.groupDeepMap,
71
+ indexer: state.indexer,
72
+ totalCount: state.unfilteredCount,
73
+ };
74
+ };
75
+ }
76
+
77
+ export function getSelectionApi<T>(
78
+ param: GetSelectionApiParam<T>,
79
+ ): InfiniteTableSelectionApi {
80
+ const {
81
+ // getComputed,
82
+ // getState,
83
+ getDataSourceState,
84
+ // componentActions,
85
+ dataSourceActions,
86
+ } = param;
87
+
88
+ const selectionApi = {
89
+ get allRowsSelected() {
90
+ return getDataSourceState().allRowsSelected;
91
+ },
92
+
93
+ selectAll() {
94
+ const { rowSelection, selectionMode } = getDataSourceState();
95
+
96
+ if (selectionMode !== 'multi-row') {
97
+ throw 'Selection mode is not multi-row';
98
+ }
99
+ if (!(rowSelection instanceof RowSelectionState)) {
100
+ throw 'Invalid row selection';
101
+ }
102
+
103
+ const rowSelectionState = new RowSelectionState(
104
+ rowSelection as RowSelectionState<string>,
105
+ rowSelectionStateConfigGetter(getDataSourceState),
106
+ );
107
+
108
+ rowSelectionState.selectAll();
109
+
110
+ dataSourceActions.rowSelection = rowSelectionState;
111
+ },
112
+
113
+ deselectAll() {
114
+ const { rowSelection, selectionMode } = getDataSourceState();
115
+
116
+ if (selectionMode !== 'multi-row') {
117
+ throw 'Selection mode is not multi-row';
118
+ }
119
+ if (!(rowSelection instanceof RowSelectionState)) {
120
+ throw 'Invalid row selection';
121
+ }
122
+
123
+ const rowSelectionState = new RowSelectionState(
124
+ rowSelection as RowSelectionState<string>,
125
+ rowSelectionStateConfigGetter(getDataSourceState),
126
+ );
127
+
128
+ rowSelectionState.deselectAll();
129
+
130
+ dataSourceActions.rowSelection = rowSelectionState;
131
+ },
132
+ isRowSelected(pk: any, groupKeys?: any[]) {
133
+ const { rowSelection, selectionMode, indexer, groupBy } =
134
+ getDataSourceState();
135
+
136
+ if (selectionMode === 'single-row') {
137
+ return rowSelection === pk;
138
+ }
139
+
140
+ if (selectionMode !== 'multi-row') {
141
+ throw 'Selection mode is not multi-row or single-row';
142
+ }
143
+ if (!(rowSelection instanceof RowSelectionState)) {
144
+ throw 'Invalid row selection';
145
+ }
146
+ if (!groupKeys) {
147
+ const data = indexer.getDataForPrimaryKey(pk);
148
+ groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
149
+ }
150
+
151
+ return rowSelection.isRowSelected(pk, groupKeys);
152
+ },
153
+
154
+ isRowDeselected(pk: any, groupKeys?: any[]) {
155
+ return !this.isRowSelected(pk, groupKeys);
156
+ },
157
+
158
+ selectRow(pk: any, groupKeys?: any[]) {
159
+ const { rowSelection, selectionMode, indexer, groupBy } =
160
+ getDataSourceState();
161
+
162
+ if (selectionMode === 'single-row') {
163
+ dataSourceActions.rowSelection = pk;
164
+ return;
165
+ }
166
+
167
+ if (selectionMode !== 'multi-row') {
168
+ throw 'Selection mode is not multi-row or single-row';
169
+ }
170
+ if (!(rowSelection instanceof RowSelectionState)) {
171
+ throw 'Invalid row selection';
172
+ }
173
+
174
+ if (!groupKeys) {
175
+ const data = indexer.getDataForPrimaryKey(pk);
176
+ groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
177
+ }
178
+
179
+ const rowSelectionState = new RowSelectionState(
180
+ rowSelection,
181
+ rowSelectionStateConfigGetter(getDataSourceState),
182
+ );
183
+
184
+ rowSelectionState.selectRow(pk, groupKeys);
185
+ dataSourceActions.rowSelection = rowSelectionState;
186
+ },
187
+
188
+ deselectRow(pk: any, groupKeys?: any[]) {
189
+ const { selectionMode, rowSelection, indexer, groupBy } =
190
+ getDataSourceState();
191
+
192
+ if (selectionMode === 'single-row') {
193
+ dataSourceActions.rowSelection = null;
194
+ return;
195
+ }
196
+
197
+ if (selectionMode !== 'multi-row') {
198
+ throw 'Selection mode is not multi-row or single-row';
199
+ }
200
+ if (!(rowSelection instanceof RowSelectionState)) {
201
+ throw 'Invalid row selection';
202
+ }
203
+
204
+ if (selectionMode === 'multi-row') {
205
+ if (!groupKeys) {
206
+ const data = indexer.getDataForPrimaryKey(pk);
207
+ groupKeys = data ? getGroupKeysForDataItem(data, groupBy) : [];
208
+ }
209
+
210
+ const rowSelectionState = new RowSelectionState(
211
+ rowSelection,
212
+ rowSelectionStateConfigGetter(getDataSourceState),
213
+ );
214
+
215
+ rowSelectionState.deselectRow(pk, groupKeys);
216
+
217
+ dataSourceActions.rowSelection = rowSelectionState;
218
+ }
219
+ },
220
+ toggleRowSelection(pk: any, groupKeys?: any[]) {
221
+ if (this.isRowSelected(pk, groupKeys)) {
222
+ this.deselectRow(pk, groupKeys);
223
+ } else {
224
+ this.selectRow(pk, groupKeys);
225
+ }
226
+ },
227
+
228
+ selectGroupRow(groupKeys: any[]) {
229
+ const { selectionMode, rowSelection, groupBy } = getDataSourceState();
230
+
231
+ if (selectionMode !== 'multi-row') {
232
+ throw 'Selection mode should be "multi-row"';
233
+ }
234
+ if (!groupBy) {
235
+ throw 'No grouping specified';
236
+ }
237
+
238
+ if (!(rowSelection instanceof RowSelectionState)) {
239
+ throw 'Invalid row selection';
240
+ }
241
+
242
+ const rowSelectionState = new RowSelectionState(
243
+ rowSelection,
244
+ rowSelectionStateConfigGetter(getDataSourceState),
245
+ );
246
+
247
+ rowSelectionState.selectGroupRow(groupKeys);
248
+
249
+ dataSourceActions.rowSelection = rowSelectionState;
250
+ },
251
+
252
+ deselectGroupRow(groupKeys: any[]) {
253
+ const { selectionMode, rowSelection, groupBy } = getDataSourceState();
254
+
255
+ if (selectionMode !== 'multi-row') {
256
+ throw 'Selection mode should be "multi-row"';
257
+ }
258
+ if (!groupBy) {
259
+ throw 'No grouping specified';
260
+ }
261
+
262
+ if (!(rowSelection instanceof RowSelectionState)) {
263
+ throw 'Invalid row selection';
264
+ }
265
+
266
+ const rowSelectionState = new RowSelectionState(
267
+ rowSelection,
268
+ rowSelectionStateConfigGetter(getDataSourceState),
269
+ );
270
+
271
+ rowSelectionState.deselectGroupRow(groupKeys);
272
+
273
+ dataSourceActions.rowSelection = rowSelectionState;
274
+ },
275
+
276
+ toggleGroupRowSelection(groupKeys: any[]) {
277
+ const { selectionMode, rowSelection, groupBy } = getDataSourceState();
278
+
279
+ if (selectionMode !== 'multi-row') {
280
+ throw 'Selection mode should be "multi-row"';
281
+ }
282
+ if (!groupBy) {
283
+ throw 'No grouping specified';
284
+ }
285
+
286
+ if (!(rowSelection instanceof RowSelectionState)) {
287
+ throw 'Invalid row selection';
288
+ }
289
+
290
+ const rowSelectionState = new RowSelectionState(
291
+ rowSelection,
292
+ rowSelectionStateConfigGetter(getDataSourceState),
293
+ );
294
+
295
+ rowSelectionState.toggleGroupRowSelection(groupKeys);
296
+
297
+ dataSourceActions.rowSelection = rowSelectionState;
298
+ },
299
+
300
+ getGroupRowSelectionState(
301
+ groupKeys: any[],
302
+ rowSelection?: RowSelectionStateObject | RowSelectionState,
303
+ ) {
304
+ const state = getDataSourceState();
305
+ const { selectionMode, groupBy } = state;
306
+
307
+ const rowSelectionState = rowSelection
308
+ ? new RowSelectionState(
309
+ rowSelection,
310
+ rowSelectionStateConfigGetter(state),
311
+ )
312
+ : (state.rowSelection as RowSelectionState);
313
+
314
+ if (selectionMode !== 'multi-row') {
315
+ throw 'Selection mode should be "multi-row"';
316
+ }
317
+ if (!groupBy) {
318
+ throw 'No grouping specified';
319
+ }
320
+
321
+ if (!(rowSelectionState instanceof RowSelectionState)) {
322
+ throw 'Invalid row selection';
323
+ }
324
+
325
+ return rowSelectionState.getGroupRowSelectionState(groupKeys);
326
+ },
327
+
328
+ getSelectedPrimaryKeys: (
329
+ rowSelection?: RowSelectionStateObject | RowSelectionState,
330
+ ) => {
331
+ const state = getDataSourceState();
332
+ const rowSelectionState = rowSelection
333
+ ? new RowSelectionState(
334
+ rowSelection,
335
+ rowSelectionStateConfigGetter(state),
336
+ )
337
+ : (state.rowSelection as RowSelectionState);
338
+
339
+ const selected: (string | number)[] = [];
340
+
341
+ if (state.lazyLoad) {
342
+ console.error(
343
+ `getSelectedPrimaryKeys should not be called for lazy-loaded datasources as it wont return reliable results`,
344
+ );
345
+ }
346
+
347
+ // we can't iterate over state.dataArray as that has collapsed rows
348
+ // and wont reflect all the rows in the dataset
349
+ state.originalDataArray.forEach((data) => {
350
+ const id = state.toPrimaryKey(data);
351
+ if (rowSelectionState.isRowSelected(id)) {
352
+ selected.push(id);
353
+ }
354
+ });
355
+
356
+ return selected;
357
+ },
358
+ };
359
+
360
+ if (__DEV__) {
361
+ (globalThis as any).selectionApi = selectionApi;
362
+ }
363
+ return selectionApi;
364
+ }
@@ -0,0 +1,11 @@
1
+ import { DataSourceState, DataSourceComponentActions } from '../../DataSource';
2
+ import { InfiniteTableComputedValues, InfiniteTableState } from '../types';
3
+ import { InfiniteTableActions } from '../types/InfiniteTableState';
4
+
5
+ export type GetImperativeApiParam<T> = {
6
+ getComputed: () => InfiniteTableComputedValues<T>;
7
+ getState: () => InfiniteTableState<T>;
8
+ getDataSourceState: () => DataSourceState<T>;
9
+ componentActions: InfiniteTableActions<T>;
10
+ dataSourceActions: DataSourceComponentActions<T>;
11
+ };
@@ -0,0 +1,51 @@
1
+ import { fallbackVar, style, styleVariants } from '@vanilla-extract/css';
2
+
3
+ import { ThemeVars } from '../theme.css';
4
+ import {
5
+ left,
6
+ top,
7
+ pointerEvents,
8
+ position,
9
+ height,
10
+ zIndex,
11
+ } from '../utilities.css';
12
+
13
+ export const ActiveIndicatorWrapperCls = style([
14
+ pointerEvents.none,
15
+ position.sticky,
16
+ left['0'],
17
+ top['0'],
18
+ height['0'],
19
+ zIndex[1_000_000],
20
+ ]);
21
+ export const ActiveCellIndicatorBaseCls = style(
22
+ [
23
+ pointerEvents.none,
24
+ position.sticky,
25
+ left['0'],
26
+ top['0'],
27
+ {
28
+ border: fallbackVar(
29
+ ThemeVars.components.Cell.activeBorder,
30
+
31
+ `${ThemeVars.components.Cell.activeBorderWidth} ${
32
+ ThemeVars.components.Cell.activeBorderStyle
33
+ } ${fallbackVar(
34
+ ThemeVars.components.Cell.activeBorderColor,
35
+ `rgb(${ThemeVars.components.Cell.activeBorderColor_R} ${ThemeVars.components.Cell.activeBorderColor_G} ${ThemeVars.components.Cell.activeBorderColor_B})`,
36
+ )}`,
37
+ ),
38
+
39
+ background: fallbackVar(
40
+ ThemeVars.components.Cell.activeBackground,
41
+ `rgba(${ThemeVars.components.Cell.activeBorderColor_R}, ${ThemeVars.components.Cell.activeBorderColor_G}, ${ThemeVars.components.Cell.activeBorderColor_B}, ${ThemeVars.components.Cell.activeBackgroundAlpha})`,
42
+ ),
43
+ },
44
+ ],
45
+ 'ActiveCellIndicator',
46
+ );
47
+
48
+ export const ActiveCellIndicatorCls = styleVariants({
49
+ visible: [ActiveCellIndicatorBaseCls, { display: 'block' }],
50
+ hidden: [ActiveCellIndicatorBaseCls, { display: 'none' }],
51
+ });
@@ -0,0 +1,116 @@
1
+ import * as React from 'react';
2
+ import { useEffect, useLayoutEffect, useRef, CSSProperties } from 'react';
3
+ import { stripVar } from '../../../utils/stripVar';
4
+ import { useRerender } from '../../hooks/useRerender';
5
+ import { MatrixBrain } from '../../VirtualBrain/MatrixBrain';
6
+
7
+ import { internalProps } from '../internalProps';
8
+ import { InternalVars } from '../theme.css';
9
+ import { setInfiniteVarsOnNode } from '../utils/infiniteDOMUtils';
10
+ import {
11
+ ActiveCellIndicatorCls,
12
+ ActiveIndicatorWrapperCls,
13
+ } from './ActiveCellIndicator.css';
14
+
15
+ const { rootClassName } = internalProps;
16
+
17
+ const baseCls = `${rootClassName}-ActiveCellIndicator`;
18
+
19
+ const columnZIndexAtIndex = stripVar(InternalVars.columnZIndexAtIndex);
20
+
21
+ export type ActiveCellIndicatorInfo = {
22
+ index: [number, number];
23
+ colOffset: number;
24
+ colWidth: number;
25
+ };
26
+ type ActiveCellIndicatorProps = {
27
+ activeCellIndex?: [number, number] | null;
28
+ brain: MatrixBrain;
29
+ };
30
+
31
+ const ActiveStyle: CSSProperties = {
32
+ [stripVar(InternalVars.activeCellOffsetX)]: InternalVars.activeCellColOffset,
33
+ [stripVar(InternalVars.activeCellOffsetY)]: InternalVars.activeCellRowOffset,
34
+
35
+ transform: `translate3d(${InternalVars.activeCellOffsetX}, ${InternalVars.activeCellOffsetY}, 0px)`,
36
+
37
+ width: InternalVars.activeCellColWidth,
38
+ height: InternalVars.activeCellRowHeight,
39
+ };
40
+
41
+ const ActiveCellIndicatorFn = (props: ActiveCellIndicatorProps) => {
42
+ const { brain } = props;
43
+ const [_rerenderId, rerender] = useRerender();
44
+
45
+ const domRef = useRef<HTMLDivElement>(null);
46
+
47
+ const active =
48
+ props.activeCellIndex != null &&
49
+ brain.getRowCount() > props.activeCellIndex[0];
50
+
51
+ useLayoutEffect(() => {
52
+ if (props.activeCellIndex == null) {
53
+ return;
54
+ }
55
+
56
+ const rowIndex = props.activeCellIndex[0];
57
+ const activeCellRowHeight = brain.getRowHeight(rowIndex);
58
+ const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, 'vertical');
59
+
60
+ const node = domRef.current!;
61
+
62
+ setInfiniteVarsOnNode(
63
+ {
64
+ activeCellRowHeight: `${activeCellRowHeight}px`,
65
+ activeCellRowOffset: `${activeCellRowOffset}px`,
66
+ },
67
+ node,
68
+ );
69
+ }, [props.activeCellIndex]);
70
+
71
+ useEffect(() => {
72
+ const removeOnRenderCountChange = brain.onRenderCountChange(() => {
73
+ rerender();
74
+ });
75
+
76
+ // const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
77
+ // rerender();
78
+ // });
79
+
80
+ return () => {
81
+ removeOnRenderCountChange();
82
+ };
83
+ }, [brain]);
84
+
85
+ return (
86
+ // #correct-scroll-size this wrapper is here in order to make the indicator not take up space in the scroll container - to reproduce: remove this and click on a row, you will see that if you scroll at the bottom, there is extra space
87
+ <div
88
+ className={ActiveIndicatorWrapperCls}
89
+ data-name="active-cell"
90
+ style={
91
+ active
92
+ ? {
93
+ zIndex: `var(${columnZIndexAtIndex}-${
94
+ props.activeCellIndex![1]
95
+ })`,
96
+ }
97
+ : undefined
98
+ }
99
+ >
100
+ <div
101
+ ref={domRef}
102
+ data-name="active-cell-indicator"
103
+ className={`${baseCls} ${
104
+ active
105
+ ? ActiveCellIndicatorCls.visible
106
+ : ActiveCellIndicatorCls.hidden
107
+ }`}
108
+ style={active ? ActiveStyle : undefined}
109
+ ></div>
110
+ </div>
111
+ );
112
+ };
113
+
114
+ export const ActiveCellIndicator = React.memo(
115
+ ActiveCellIndicatorFn,
116
+ ) as typeof ActiveCellIndicatorFn;
@@ -0,0 +1,56 @@
1
+ import { fallbackVar, style, styleVariants } from '@vanilla-extract/css';
2
+
3
+ import { ThemeVars } from '../theme.css';
4
+ import { left, top, pointerEvents, position, width } from '../utilities.css';
5
+
6
+ export const ActiveRowIndicatorBaseCls = style(
7
+ [
8
+ pointerEvents.none,
9
+ position.sticky,
10
+ width['100%'],
11
+ top['0'],
12
+ left['0'],
13
+ {
14
+ border: fallbackVar(
15
+ ThemeVars.components.Row.activeBorder,
16
+ `${fallbackVar(
17
+ ThemeVars.components.Row.activeBorderWidth,
18
+ ThemeVars.components.Cell.activeBorderWidth,
19
+ )} ${fallbackVar(
20
+ ThemeVars.components.Row.activeBorderStyle,
21
+ ThemeVars.components.Cell.activeBorderStyle,
22
+ )} ${fallbackVar(
23
+ ThemeVars.components.Row.activeBorderColor,
24
+ `rgb(${ThemeVars.components.Cell.activeBorderColor_R} ${ThemeVars.components.Cell.activeBorderColor_G} ${ThemeVars.components.Cell.activeBorderColor_B})`,
25
+ )}`,
26
+ ),
27
+ background: fallbackVar(
28
+ ThemeVars.components.Row.activeBackground,
29
+ ThemeVars.components.Cell.activeBackground,
30
+ `rgba(${ThemeVars.components.Cell.activeBorderColor_R}, ${
31
+ ThemeVars.components.Cell.activeBorderColor_G
32
+ }, ${ThemeVars.components.Cell.activeBorderColor_B}, ${fallbackVar(
33
+ ThemeVars.components.Row.activeBackgroundAlpha,
34
+ ThemeVars.components.Cell.activeBackgroundAlpha,
35
+ )})`,
36
+ ),
37
+ vars: {
38
+ [ThemeVars.components.Row.activeBorderStyle]: fallbackVar(
39
+ ThemeVars.components.Row.activeBorderStyle,
40
+ ThemeVars.components.Cell.activeBorderStyle,
41
+ ),
42
+ },
43
+ },
44
+ ],
45
+ 'ActiveRowIndicator',
46
+ );
47
+
48
+ export const ActiveRowIndicatorCls = styleVariants({
49
+ visible: [
50
+ ActiveRowIndicatorBaseCls,
51
+ {
52
+ display: 'block',
53
+ },
54
+ ],
55
+ hidden: [ActiveRowIndicatorBaseCls, { display: 'none' }],
56
+ });
@@ -0,0 +1,94 @@
1
+ import * as React from 'react';
2
+ import { CSSProperties, useEffect, useLayoutEffect, useRef } from 'react';
3
+ import { stripVar } from '../../../utils/stripVar';
4
+ import { useRerender } from '../../hooks/useRerender';
5
+ import { MatrixBrain } from '../../VirtualBrain/MatrixBrain';
6
+
7
+ import { internalProps } from '../internalProps';
8
+ import { InternalVars } from '../theme.css';
9
+ import { setInfiniteVarsOnNode } from '../utils/infiniteDOMUtils';
10
+ import { ActiveIndicatorWrapperCls } from './ActiveCellIndicator.css';
11
+ import { ActiveRowIndicatorCls } from './ActiveRowIndicator.css';
12
+
13
+ const { rootClassName } = internalProps;
14
+ const baseCls = `${rootClassName}-ActiveRowIndicator`;
15
+
16
+ type ActiveRowIndicatorProps = {
17
+ activeRowIndex?: number | null;
18
+ brain: MatrixBrain;
19
+ };
20
+
21
+ const ActiveStyle: CSSProperties = {
22
+ [stripVar(InternalVars.activeCellOffsetY)]: InternalVars.activeCellRowOffset,
23
+
24
+ transform: `translate3d(0px, calc( ${
25
+ InternalVars.activeCellOffsetY
26
+ } + var(${stripVar(InternalVars.scrollTopForActiveRow)}, 0px)), 0px)`,
27
+ height: InternalVars.activeCellRowHeight,
28
+ };
29
+
30
+ const ActiveRowIndicatorFn = (props: ActiveRowIndicatorProps) => {
31
+ const { brain } = props;
32
+
33
+ const domRef = useRef<HTMLDivElement>(null);
34
+
35
+ const active =
36
+ props.activeRowIndex != null && brain.getRowCount() > props.activeRowIndex;
37
+
38
+ const [_rerenderId, rerender] = useRerender();
39
+
40
+ useLayoutEffect(() => {
41
+ if (props.activeRowIndex == null) {
42
+ return;
43
+ }
44
+
45
+ const rowIndex = props.activeRowIndex;
46
+ const activeCellRowHeight = brain.getRowHeight(rowIndex);
47
+ const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, 'vertical');
48
+
49
+ const node = domRef.current!;
50
+
51
+ const vars = {
52
+ activeCellRowHeight: `${activeCellRowHeight}px`,
53
+ activeCellRowOffset: `${activeCellRowOffset}px`,
54
+ };
55
+
56
+ setInfiniteVarsOnNode(vars, node);
57
+ }, [props.activeRowIndex]);
58
+
59
+ useEffect(() => {
60
+ const removeOnScroll = brain.onScroll((scrollPosition) => {
61
+ setInfiniteVarsOnNode(
62
+ {
63
+ scrollTopForActiveRow: `${-scrollPosition.scrollTop}px`,
64
+ },
65
+ domRef.current!,
66
+ );
67
+ });
68
+
69
+ const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
70
+
71
+ return () => {
72
+ removeOnRenderCountChange();
73
+ removeOnScroll();
74
+ };
75
+ }, [brain]);
76
+
77
+ return (
78
+ // #correct-scroll-size this wrapper is here in order to make the indicator not take up space in the scroll container - to reproduce: remove this and click on a row, you will see that if you scroll at the bottom, there is extra space
79
+ <div className={ActiveIndicatorWrapperCls} data-name="active-row">
80
+ <div
81
+ ref={domRef}
82
+ data-name="active-row-indicator"
83
+ className={`${baseCls} ${
84
+ active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden
85
+ }`}
86
+ style={active ? ActiveStyle : undefined}
87
+ ></div>
88
+ </div>
89
+ );
90
+ };
91
+
92
+ export const ActiveRowIndicator = React.memo(
93
+ ActiveRowIndicatorFn,
94
+ ) as typeof ActiveRowIndicatorFn;
@@ -0,0 +1,13 @@
1
+ import { style } from '@vanilla-extract/css';
2
+ import { cursor } from '../utilities.css';
3
+
4
+ export const CheckBoxCls = style([
5
+ cursor.pointer,
6
+ {
7
+ selectors: {
8
+ '&[disabled]': {
9
+ opacity: 0.7,
10
+ },
11
+ },
12
+ },
13
+ ]);