@infinite-table/infinite-react 0.4.13 → 0.5.1

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 +102 -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 -13695
  282. package/index.js +0 -13565
@@ -0,0 +1,192 @@
1
+ import { style, styleVariants } from '@vanilla-extract/css';
2
+ import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
+ import { InfiniteClsShiftingColumns } from '../InfiniteCls.css';
4
+
5
+ import { ThemeVars } from '../theme.css';
6
+ import {
7
+ alignItems,
8
+ display,
9
+ flexFlow,
10
+ position,
11
+ userSelect,
12
+ whiteSpace,
13
+ willChange,
14
+ } from '../utilities.css';
15
+
16
+ export const columnAlignCellStyle = styleVariants({
17
+ center: { justifyContent: 'center' },
18
+ start: { justifyContent: 'flex-start' },
19
+ end: { justifyContent: 'flex-start', flexFlow: 'row-reverse' },
20
+ });
21
+
22
+ export const CellBorderObject = {
23
+ borderLeft: `${ThemeVars.components.Cell.borderWidth} solid transparent`,
24
+ borderRight: `${ThemeVars.components.Cell.borderWidth} solid transparent`,
25
+ };
26
+
27
+ export const CellClsVariants = styleVariants({
28
+ shifting: {
29
+ transition: 'left 300ms',
30
+ },
31
+ dragging: {
32
+ transition: 'none',
33
+ },
34
+ });
35
+
36
+ export const CellCls = style([
37
+ display.flex,
38
+ flexFlow.row,
39
+ alignItems.center,
40
+ position.absolute,
41
+ willChange.transform,
42
+ whiteSpace.nowrap,
43
+ userSelect.none,
44
+ {
45
+ padding: ThemeVars.components.Cell.padding,
46
+ ...CellBorderObject,
47
+ },
48
+ ]);
49
+
50
+ export const ColumnCellCls = style([
51
+ CellCls,
52
+ {
53
+ selectors: {
54
+ [`${InfiniteClsShiftingColumns} &`]: {
55
+ // color: 'red',
56
+ transition: `transform ${ThemeVars.components.Cell.reorderEffectDuration}`,
57
+ },
58
+ },
59
+ },
60
+ ]);
61
+
62
+ export const ColumnCellVariantsObject = {
63
+ first: {
64
+ borderTopLeftRadius: ThemeVars.components.Cell.borderRadius,
65
+ borderBottomLeftRadius: ThemeVars.components.Cell.borderRadius,
66
+ },
67
+ last: {
68
+ borderTopRightRadius: ThemeVars.components.Cell.borderRadius,
69
+ borderBottomRightRadius: ThemeVars.components.Cell.borderRadius,
70
+ },
71
+ groupByField: {},
72
+ firstInCategory: {},
73
+ lastInCategory: {},
74
+ pinnedStart: {},
75
+ pinnedEnd: {},
76
+ unpinned: {},
77
+ pinnedStartLastInCategory: {},
78
+ pinnedStartFirstInCategory: {},
79
+ pinnedEndFirstInCategory: {},
80
+ pinnedEndLastInCategory: {},
81
+ };
82
+
83
+ export const SelectionCheckboxCls = style({
84
+ marginInline: ThemeVars.components.SelectionCheckBox.marginInline,
85
+ });
86
+
87
+ export const ColumnCellRecipe = recipe({
88
+ base: [
89
+ {
90
+ color: ThemeVars.components.Cell.color,
91
+ },
92
+ ],
93
+ variants: {
94
+ dragging: { false: {}, true: {} },
95
+ rowActive: {
96
+ false: {},
97
+ true: {},
98
+ },
99
+ zebra: {
100
+ false: {},
101
+ even: {
102
+ background: ThemeVars.components.Row.background,
103
+ },
104
+ odd: {
105
+ background: ThemeVars.components.Row.oddBackground,
106
+ },
107
+ },
108
+ rowSelected: {
109
+ true: {
110
+ background: ThemeVars.components.Row.selectedBackground,
111
+ },
112
+ false: {},
113
+ null: {},
114
+ },
115
+ first: {
116
+ true: {
117
+ borderTopLeftRadius: ThemeVars.components.Cell.borderRadius,
118
+ borderBottomLeftRadius: ThemeVars.components.Cell.borderRadius,
119
+ },
120
+ false: {},
121
+ },
122
+ last: {
123
+ true: {
124
+ borderTopRightRadius: ThemeVars.components.Cell.borderRadius,
125
+ borderBottomRightRadius: ThemeVars.components.Cell.borderRadius,
126
+ },
127
+ false: {},
128
+ },
129
+ groupByField: {
130
+ true: ColumnCellVariantsObject.groupByField,
131
+ false: {},
132
+ },
133
+ firstInCategory: {
134
+ true: ColumnCellVariantsObject.firstInCategory,
135
+ false: {},
136
+ },
137
+ lastInCategory: {
138
+ true: ColumnCellVariantsObject.lastInCategory,
139
+ false: {},
140
+ },
141
+ pinned: {
142
+ start: {
143
+ // vars: {
144
+ // [ThemeVars.components.Cell.reorderEffectDuration]: '0',
145
+ // },
146
+ },
147
+ end: {
148
+ // vars: {
149
+ // [ThemeVars.components.Cell.reorderEffectDuration]: '0',
150
+ // },
151
+ },
152
+ false: {},
153
+ },
154
+ filtered: {
155
+ true: {},
156
+ false: {},
157
+ },
158
+ },
159
+
160
+ compoundVariants: [
161
+ {
162
+ variants: {
163
+ pinned: 'start',
164
+ lastInCategory: true,
165
+ },
166
+ style: ColumnCellVariantsObject.pinnedStartLastInCategory,
167
+ },
168
+ {
169
+ variants: {
170
+ pinned: 'start',
171
+ firstInCategory: true,
172
+ },
173
+ style: ColumnCellVariantsObject.pinnedStartFirstInCategory,
174
+ },
175
+ {
176
+ variants: {
177
+ pinned: 'end',
178
+ firstInCategory: true,
179
+ },
180
+ style: ColumnCellVariantsObject.pinnedEndFirstInCategory,
181
+ },
182
+ {
183
+ variants: {
184
+ pinned: 'end',
185
+ lastInCategory: true,
186
+ },
187
+ style: ColumnCellVariantsObject.pinnedEndLastInCategory,
188
+ },
189
+ ],
190
+ });
191
+
192
+ export type ColumnCellVariantsType = RecipeVariants<typeof ColumnCellRecipe>;
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ import { TableIconProps, Icon } from './Icon';
4
+
5
+ export const ArrowDown = (props: Omit<TableIconProps, 'children'>) => {
6
+ return (
7
+ <Icon {...props}>
8
+ <path
9
+ fill="currentColor"
10
+ d="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z"
11
+ />
12
+ </Icon>
13
+ );
14
+ };
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ import { TableIconProps, Icon } from './Icon';
4
+
5
+ export const ArrowUp = (props: Omit<TableIconProps, 'children'>) => {
6
+ return (
7
+ <Icon {...props}>
8
+ <path
9
+ fill="currentColor"
10
+ d="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z"
11
+ />
12
+ </Icon>
13
+ );
14
+ };
@@ -0,0 +1,31 @@
1
+ import { style } from '@vanilla-extract/css';
2
+ import { recipe } from '@vanilla-extract/recipes';
3
+ import { cursor, fill, flex, transform } from '../../utilities.css';
4
+
5
+ export const ExpanderIconCls = style([
6
+ fill.accentColor,
7
+ flex.none,
8
+ cursor.pointer,
9
+ ]);
10
+
11
+ export const ExpanderIconClsVariants = recipe({
12
+ variants: {
13
+ expanded: {
14
+ true: transform.rotate90,
15
+ false: {},
16
+ },
17
+ direction: {
18
+ end: {},
19
+ start: {},
20
+ },
21
+ },
22
+ compoundVariants: [
23
+ {
24
+ variants: {
25
+ expanded: false,
26
+ direction: 'end',
27
+ },
28
+ style: transform.rotate180,
29
+ },
30
+ ],
31
+ });
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import { useState } from 'react';
3
+
4
+ import { join } from '../../../../utils/join';
5
+ import { isControlled } from '../../../utils/isControlled';
6
+ import { ExpanderIconCls, ExpanderIconClsVariants } from './ExpanderIcon.css';
7
+ import { InfiniteTableIconClassName } from './InfiniteTableIconClassName';
8
+
9
+ type ExpanderIconProps = {
10
+ size?: number;
11
+ expanded?: boolean;
12
+ defaultExpanded?: boolean;
13
+ onChange?: (expanded: boolean) => void;
14
+ style?: React.CSSProperties;
15
+ className?: string;
16
+ direction?: 'end' | 'start';
17
+ };
18
+
19
+ export function ExpanderIcon(props: ExpanderIconProps) {
20
+ const { size = 24, direction = 'start' } = props;
21
+
22
+ const [expanded, setExpanded] = useState(
23
+ props.expanded ?? props.defaultExpanded,
24
+ );
25
+
26
+ const onClick = () => {
27
+ props.onChange?.(!expanded);
28
+ if (!isControlled('expanded', props)) {
29
+ setExpanded(!expanded);
30
+ }
31
+ };
32
+
33
+ React.useEffect(() => {
34
+ if (isControlled('expanded', props)) {
35
+ setExpanded(props.expanded);
36
+ }
37
+ }, [props.expanded]);
38
+ return (
39
+ <svg
40
+ data-name="expander-icon"
41
+ xmlns="http://www.w3.org/2000/svg"
42
+ height={`${size}px`}
43
+ viewBox="0 0 24 24"
44
+ width={`${size}px`}
45
+ style={props.style}
46
+ onClick={onClick}
47
+ className={join(
48
+ props.className,
49
+ ExpanderIconCls,
50
+ ExpanderIconClsVariants({
51
+ direction: direction || 'start',
52
+ expanded,
53
+ }),
54
+ `${InfiniteTableIconClassName}`,
55
+ `${InfiniteTableIconClassName}-expander`,
56
+ `InfiniteIcon-expander--${expanded ? 'expanded' : 'collapsed'}`,
57
+ `InfiniteIcon-expander--${direction === 'end' ? 'end' : 'start'}`,
58
+ )}
59
+ >
60
+ <path d="M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z" />
61
+ </svg>
62
+ );
63
+ }
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+ export type TableIconProps = {
3
+ children: React.ReactNode;
4
+ size?: number;
5
+ style?: React.CSSProperties;
6
+ className?: string;
7
+ };
8
+
9
+ export const Icon = (props: TableIconProps) => {
10
+ const size = props.size ?? `var(--ITableHeaderCell-icon-size)`;
11
+ const style = { flex: 'none', width: size, height: size, ...props.style };
12
+ return (
13
+ //@ts-ignore
14
+ <svg viewBox="0 0 24 24" {...props} style={style}>
15
+ {props.children}
16
+ </svg>
17
+ );
18
+ };
@@ -0,0 +1 @@
1
+ export const InfiniteTableIconClassName = 'InfiniteTableIcon';
@@ -0,0 +1,8 @@
1
+ import { style } from '@vanilla-extract/css';
2
+ import { cursor, stroke, flex } from '../../utilities.css';
3
+
4
+ export const LoadingIconCls = style([
5
+ stroke.accentColor,
6
+ flex.none,
7
+ cursor.pointer,
8
+ ]);
@@ -0,0 +1,45 @@
1
+ import { TableIconProps } from './Icon';
2
+ import * as React from 'react';
3
+ import { join } from '../../../../utils/join';
4
+ import { LoadingIconCls } from './LoadingIcon.css';
5
+
6
+ export const LoadingIcon = (props: Omit<TableIconProps, 'children'>) => {
7
+ return (
8
+ <svg
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ style={{
11
+ margin: 'auto',
12
+ display: 'block',
13
+ shapeRendering: 'auto',
14
+ }}
15
+ width="24px"
16
+ height="24px"
17
+ viewBox="0 0 100 100"
18
+ preserveAspectRatio="xMidYMid"
19
+ className={join(
20
+ props.className,
21
+ LoadingIconCls,
22
+ 'InfiniteIcon',
23
+ 'InfiniteIcon-loading',
24
+ )}
25
+ >
26
+ <circle
27
+ cx="50"
28
+ cy="50"
29
+ fill="none"
30
+ strokeWidth="10"
31
+ r="35"
32
+ strokeDasharray="164.93361431346415 56.97787143782138"
33
+ >
34
+ <animateTransform
35
+ attributeName="transform"
36
+ type="rotate"
37
+ repeatCount="indefinite"
38
+ dur="1s"
39
+ values="0 50 50;360 50 50"
40
+ keyTimes="0;1"
41
+ />
42
+ </circle>
43
+ </svg>
44
+ );
45
+ };
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+
3
+ import { join } from '../../../../utils/join';
4
+ import { ThemeVars } from '../../theme.css';
5
+
6
+ import { HeaderMenuIconCls } from '../InfiniteTableHeader/header.css';
7
+ import { InfiniteTableIconClassName } from './InfiniteTableIconClassName';
8
+
9
+ type MenuIconProps = {
10
+ lineWidth?: number;
11
+ lineStyle?: React.CSSProperties;
12
+ style?: React.CSSProperties;
13
+ className?: string;
14
+ domProps?: React.HTMLAttributes<HTMLDivElement>;
15
+ };
16
+
17
+ const defaultLineStyle: React.CSSProperties = {
18
+ width: '100%',
19
+ pointerEvents: 'none',
20
+ };
21
+
22
+ const lineClassName = `${InfiniteTableIconClassName}-menu`;
23
+
24
+ export function MenuIcon(props: MenuIconProps) {
25
+ const { style, className, domProps } = props;
26
+
27
+ const lineStyle = {
28
+ ...defaultLineStyle,
29
+ borderTop: `${ThemeVars.components.HeaderCell.menuIconLineWidth} solid currentColor`,
30
+ ...props.lineStyle,
31
+ };
32
+
33
+ return (
34
+ <div
35
+ {...domProps}
36
+ style={style}
37
+ onPointerDown={(e) => e.stopPropagation()}
38
+ className={join(
39
+ className,
40
+ HeaderMenuIconCls,
41
+ InfiniteTableIconClassName,
42
+ `${InfiniteTableIconClassName}-menu`,
43
+ )}
44
+ >
45
+ <div className={lineClassName} style={lineStyle}></div>
46
+ <div className={lineClassName} style={lineStyle}></div>
47
+ <div className={lineClassName} style={lineStyle}></div>
48
+ </div>
49
+ );
50
+ }
@@ -0,0 +1,113 @@
1
+ import * as React from 'react';
2
+ import { useEffect, useState } from 'react';
3
+
4
+ import { join } from '../../../../utils/join';
5
+ import { HeaderSortIconIndexCls } from '../InfiniteTableHeader/header.css';
6
+ import { InfiniteTableIconClassName } from './InfiniteTableIconClassName';
7
+
8
+ type SortIconProps = {
9
+ direction: 1 | -1 | 0;
10
+ size?: number;
11
+ lineWidth?: number;
12
+ lineStyle?: React.CSSProperties;
13
+ style?: React.CSSProperties;
14
+ className?: string;
15
+ index?: number;
16
+ };
17
+
18
+ const defaultLineStyle: React.CSSProperties = {
19
+ marginTop: 2,
20
+ marginBottom: 2,
21
+ transition: `width 0.25s, opacity 0.25s`,
22
+ };
23
+
24
+ export function SortIcon(props: SortIconProps) {
25
+ const [rendered, setRendered] = useState(true);
26
+ const [opacity, setOpacity] = useState(0);
27
+
28
+ const { direction, lineWidth = 1, style, className, index } = props;
29
+
30
+ const showIndex = index != null && index > 0;
31
+
32
+ const size = props.size ?? 16;
33
+
34
+ const part = Math.floor(size / 4);
35
+
36
+ const sizes = direction
37
+ ? [size - 3 * part, size - 2 * part, size - part]
38
+ : [0, 0, 0];
39
+
40
+ if (direction === -1) {
41
+ sizes.reverse();
42
+ }
43
+
44
+ const lineStyle = {
45
+ ...defaultLineStyle,
46
+ borderTop: `${lineWidth}px solid currentColor`,
47
+ ...props.lineStyle,
48
+ opacity,
49
+ };
50
+
51
+ useEffect(() => {
52
+ const newOpacity = direction != 0 ? 1 : 0;
53
+
54
+ if (!rendered && newOpacity) {
55
+ setRendered(true);
56
+ }
57
+ if (newOpacity !== opacity) {
58
+ const rafId = requestAnimationFrame(() => {
59
+ setOpacity(newOpacity);
60
+ });
61
+
62
+ return () => {
63
+ cancelAnimationFrame(rafId);
64
+ };
65
+ }
66
+ return () => {};
67
+ }, [direction, rendered]);
68
+
69
+ const onTransitionEnd = () => {
70
+ const hidden = opacity === 0 && direction === 0;
71
+ const newRendered = !hidden;
72
+ if (newRendered !== rendered) {
73
+ setRendered(newRendered);
74
+ }
75
+ };
76
+
77
+ if (!rendered) {
78
+ return null;
79
+ }
80
+
81
+ const indexStyle: React.CSSProperties = {};
82
+
83
+ if (direction === -1) {
84
+ indexStyle.top = '100%';
85
+ }
86
+
87
+ return (
88
+ <div
89
+ style={{ ...style, width: size }}
90
+ className={join(
91
+ className,
92
+ InfiniteTableIconClassName,
93
+ `${InfiniteTableIconClassName}-sort`,
94
+ )}
95
+ >
96
+ {showIndex ? (
97
+ <div
98
+ data-name="index"
99
+ style={indexStyle}
100
+ className={HeaderSortIconIndexCls}
101
+ >
102
+ {index}
103
+ </div>
104
+ ) : null}
105
+ <div
106
+ style={{ width: sizes[0], ...lineStyle }}
107
+ onTransitionEnd={onTransitionEnd}
108
+ ></div>
109
+ <div style={{ width: sizes[1], ...lineStyle }}></div>
110
+ <div style={{ width: sizes[2], ...lineStyle }}></div>
111
+ </div>
112
+ );
113
+ }
@@ -0,0 +1,57 @@
1
+ import {
2
+ DataSourceState,
3
+ DataSourceComponentActions,
4
+ RowSelectionState,
5
+ } from '../../DataSource';
6
+ import { InfiniteTableSelectionApi } from '../api/getSelectionApi';
7
+ import {
8
+ InfiniteTableApi,
9
+ InfiniteTableComputedValues,
10
+ InfiniteTableState,
11
+ } from '../types';
12
+ import { InfiniteTableActions } from '../types/InfiniteTableState';
13
+
14
+ export type InfiniteTableEventHandlerAbstractContext<T> = {
15
+ getComputed: () => InfiniteTableComputedValues<T>;
16
+ getState: () => {
17
+ activeRowIndex: InfiniteTableState<T>['activeRowIndex'];
18
+ activeCellIndex: InfiniteTableState<T>['activeCellIndex'];
19
+ keyboardNavigation: InfiniteTableState<T>['keyboardNavigation'];
20
+ keyboardSelection: InfiniteTableState<T>['keyboardSelection'];
21
+ };
22
+ actions: InfiniteTableActions<T>;
23
+ cloneRowSelection: (
24
+ rowSelection: RowSelectionState<T>,
25
+ ) => RowSelectionState<T>;
26
+ getDataSourceState: () => {
27
+ rowSelection: DataSourceState<T>['rowSelection'];
28
+ groupBy: DataSourceState<T>['groupBy'];
29
+ selectionMode: DataSourceState<T>['selectionMode'];
30
+ dataArray: { id: string; isGroupRow: boolean; groupKeys?: any[] }[];
31
+ };
32
+ dataSourceActions: DataSourceComponentActions<T>;
33
+ api: {
34
+ selectionApi: InfiniteTableSelectionApi;
35
+ };
36
+ };
37
+
38
+ export type InfiniteTableEventHandlerContext<T> = {
39
+ getComputed: () => InfiniteTableComputedValues<T>;
40
+ getState: () => InfiniteTableState<T>;
41
+ actions: InfiniteTableActions<T>;
42
+ cloneRowSelection: (
43
+ rowSelection: RowSelectionState<T>,
44
+ ) => RowSelectionState<T>;
45
+ getDataSourceState: () => DataSourceState<T>;
46
+ dataSourceActions: DataSourceComponentActions<T>;
47
+ api: InfiniteTableApi<T>;
48
+ };
49
+
50
+ export type InfiniteTableKeyboardEventHandlerContext<T> =
51
+ InfiniteTableEventHandlerContext<T>;
52
+
53
+ export type InfiniteTableCellClickEventHandlerContext<T> =
54
+ InfiniteTableEventHandlerContext<T> & {
55
+ rowIndex: number;
56
+ colIndex: number;
57
+ };