linkmore-design 1.1.28 → 1.1.30

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 (266) hide show
  1. package/dist/Form/FormItem/index.d.ts +1 -0
  2. package/dist/LmEditTable/DndContainer.d.ts +6 -3
  3. package/dist/LmEditTable/EditTable.d.ts +16 -5
  4. package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
  5. package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
  6. package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  7. package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  8. package/dist/LmEditTable/components/index.d.ts +17 -0
  9. package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
  10. package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  11. package/dist/LmEditTable/sortableItem.d.ts +3 -2
  12. package/dist/LmEditTable/util.d.ts +10 -0
  13. package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  14. package/dist/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  15. package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  16. package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  17. package/dist/LmEditTable/virtual/context.d.ts +13 -0
  18. package/dist/LmEditTable/virtual/index.d.ts +4 -0
  19. package/dist/LmTable/common/index.d.ts +10 -0
  20. package/dist/LmTable/components/CalcExpression.d.ts +9 -0
  21. package/dist/LmTable/components/Container/Container.d.ts +20 -0
  22. package/dist/LmTable/components/Container/index.d.ts +2 -0
  23. package/dist/LmTable/components/DndContainer.d.ts +37 -5
  24. package/dist/LmTable/components/HeaderCol.d.ts +1 -0
  25. package/dist/LmTable/components/Item/Item.d.ts +37 -0
  26. package/dist/LmTable/components/Item/components/Action/Action.d.ts +10 -0
  27. package/dist/LmTable/components/Item/components/Action/index.d.ts +2 -0
  28. package/dist/LmTable/components/Item/components/Handle/index.d.ts +4 -0
  29. package/dist/LmTable/components/Item/components/Remove/index.d.ts +2 -0
  30. package/dist/LmTable/components/Item/components/index.d.ts +3 -0
  31. package/dist/LmTable/components/Item/index.d.ts +2 -0
  32. package/dist/LmTable/components/{sortableBoxCol.d.ts → SortableBox.d.ts} +0 -0
  33. package/dist/LmTable/demos/{excelGroup.d.ts → draggable.d.ts} +0 -0
  34. package/dist/LmTable/demos/resize.d.ts +2 -0
  35. package/dist/LmTable/expression.d.ts +2 -1
  36. package/dist/LmTable/hooks/useDndItems.d.ts +13 -0
  37. package/dist/LmTable/hooks/useGroupDataSource.d.ts +1 -2
  38. package/dist/LmTable/hooks/useResizeObserver.d.ts +13 -0
  39. package/dist/LmTable/multipleContainersKeyboardCoordinates.d.ts +3 -0
  40. package/dist/LmTable/testDemos/group.d.ts +2 -0
  41. package/dist/LmTable/util.d.ts +1 -1
  42. package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
  43. package/dist/index.d.ts +1 -2
  44. package/dist/index.umd.css +367 -0
  45. package/dist/index.umd.js +4362 -52840
  46. package/dist/index.umd.min.css +1 -1
  47. package/dist/index.umd.min.js +23 -47
  48. package/dist/variables.css +129 -6
  49. package/es/CardTable/style/index.css +3 -2
  50. package/es/CardTable/style/variables.css +3 -2
  51. package/es/CustomTableOption/columnsSort.js +41 -19
  52. package/es/CustomTableOption/filterSort.js +14 -6
  53. package/es/CustomTableOption/style/index.css +3 -0
  54. package/es/CustomTableOption/style/variables.css +3 -0
  55. package/es/Dropdown/style/index.css +1 -1
  56. package/es/Dropdown/style/variables.css +1 -1
  57. package/es/Empty/index.js +0 -1
  58. package/es/Form/FormItem/index.d.ts +1 -0
  59. package/es/Form/FormItem/index.js +31 -17
  60. package/es/Form/style/index.css +4 -0
  61. package/es/Form/style/variables.css +4 -0
  62. package/es/InputNumber/index.js +7 -9
  63. package/es/LmEditTable/DndContainer.d.ts +6 -3
  64. package/es/LmEditTable/DndContainer.js +70 -10
  65. package/es/LmEditTable/DragHandle.js +1 -1
  66. package/es/LmEditTable/EditTable.d.ts +16 -5
  67. package/es/LmEditTable/EditTable.js +855 -436
  68. package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
  69. package/es/LmEditTable/components/DraggableContainer.js +39 -0
  70. package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
  71. package/es/LmEditTable/components/QuickOpetate.js +82 -0
  72. package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  73. package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
  74. package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  75. package/es/LmEditTable/components/customRenderEmpty.js +20 -0
  76. package/es/LmEditTable/components/index.d.ts +17 -0
  77. package/es/LmEditTable/components/index.js +8 -0
  78. package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
  79. package/es/LmEditTable/hooks/useForkRef.js +22 -0
  80. package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  81. package/es/LmEditTable/rowSort/DndContainerRow.js +83 -0
  82. package/es/LmEditTable/sortableItem.d.ts +3 -2
  83. package/es/LmEditTable/sortableItem.js +16 -4
  84. package/es/LmEditTable/sortableItemCol.js +40 -10
  85. package/es/LmEditTable/style/index.css +105 -1
  86. package/es/LmEditTable/style/variables.css +105 -1
  87. package/es/LmEditTable/util.d.ts +10 -0
  88. package/es/LmEditTable/util.js +162 -9
  89. package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  90. package/es/LmEditTable/virtual/VirtualRow.js +148 -0
  91. package/es/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  92. package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
  93. package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  94. package/es/LmEditTable/virtual/VirtualTable.js +64 -0
  95. package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  96. package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
  97. package/es/LmEditTable/virtual/context.d.ts +13 -0
  98. package/es/LmEditTable/virtual/context.js +66 -0
  99. package/es/LmEditTable/virtual/index.d.ts +4 -0
  100. package/es/LmEditTable/virtual/index.js +4 -0
  101. package/es/LmTable/Table.js +269 -163
  102. package/es/LmTable/common/index.d.ts +10 -0
  103. package/es/LmTable/common/index.js +38 -0
  104. package/es/LmTable/components/CalcExpression.d.ts +9 -0
  105. package/es/LmTable/components/CalcExpression.js +150 -0
  106. package/es/LmTable/components/Container/Container.css +94 -0
  107. package/es/LmTable/components/Container/Container.d.ts +20 -0
  108. package/es/LmTable/components/Container/Container.js +52 -0
  109. package/es/LmTable/components/Container/index.d.ts +2 -0
  110. package/es/LmTable/components/Container/index.js +1 -0
  111. package/es/LmTable/components/DndContainer.d.ts +37 -5
  112. package/es/LmTable/components/DndContainer.js +704 -24
  113. package/es/LmTable/components/HeaderCol.js +61 -0
  114. package/es/LmTable/components/Item/Item.css +113 -0
  115. package/es/LmTable/components/Item/Item.d.ts +37 -0
  116. package/es/LmTable/components/Item/Item.js +88 -0
  117. package/es/LmTable/components/Item/components/Action/Action.css +41 -0
  118. package/es/LmTable/components/Item/components/Action/Action.d.ts +10 -0
  119. package/es/LmTable/components/Item/components/Action/Action.js +35 -0
  120. package/es/LmTable/components/Item/components/Action/index.d.ts +2 -0
  121. package/es/LmTable/components/Item/components/Action/index.js +1 -0
  122. package/es/LmTable/components/Item/components/Handle/index.d.ts +4 -0
  123. package/es/LmTable/components/Item/components/Handle/index.js +15 -0
  124. package/es/LmTable/components/Item/components/Remove/index.d.ts +2 -0
  125. package/es/LmTable/components/Item/components/Remove/index.js +16 -0
  126. package/es/LmTable/components/Item/components/index.d.ts +3 -0
  127. package/es/LmTable/components/Item/components/index.js +3 -0
  128. package/es/LmTable/components/Item/index.d.ts +2 -0
  129. package/es/LmTable/components/Item/index.js +2 -0
  130. package/es/LmTable/components/{sortableBoxCol.js → SortableBox.js} +0 -0
  131. package/es/LmTable/expression.d.ts +2 -1
  132. package/es/LmTable/expression.js +92 -16
  133. package/es/LmTable/hooks/useDndItems.d.ts +13 -0
  134. package/es/LmTable/hooks/useDndItems.js +234 -0
  135. package/es/LmTable/hooks/useGroupDataSource.js +2 -24
  136. package/es/LmTable/hooks/useResizeObserver.d.ts +13 -0
  137. package/es/LmTable/hooks/useResizeObserver.js +49 -0
  138. package/es/LmTable/multipleContainersKeyboardCoordinates.d.ts +3 -0
  139. package/es/LmTable/multipleContainersKeyboardCoordinates.js +117 -0
  140. package/es/LmTable/style/index.css +13 -2
  141. package/es/LmTable/style/variables.css +13 -2
  142. package/es/LmTable/testDemos/group.js +131 -0
  143. package/es/LmTable/util.js +22 -2
  144. package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
  145. package/es/LmTable/virTual/VirtualRow.js +82 -48
  146. package/es/LmTable/virTual/VirtualTable.js +43 -11
  147. package/es/LmTable/virTual/context.js +14 -2
  148. package/es/LmUpload/fns/index.js +1 -1
  149. package/es/Modal/index.js +10 -3
  150. package/es/Radio/index.js +9 -1
  151. package/es/Switch/index.js +7 -2
  152. package/es/hooks/useEvent/index.js +1 -1
  153. package/es/index.d.ts +1 -2
  154. package/es/locale-provider/index.js +1 -1
  155. package/es/styles/variables.css +129 -6
  156. package/lib/CardTable/style/index.css +3 -2
  157. package/lib/CardTable/style/variables.css +3 -2
  158. package/lib/CustomTableOption/columnsSort.js +48 -23
  159. package/lib/CustomTableOption/filterSort.js +19 -10
  160. package/lib/CustomTableOption/style/index.css +3 -0
  161. package/lib/CustomTableOption/style/variables.css +3 -0
  162. package/lib/Dropdown/style/index.css +1 -1
  163. package/lib/Dropdown/style/variables.css +1 -1
  164. package/lib/Empty/index.js +0 -1
  165. package/lib/Form/FormItem/index.d.ts +1 -0
  166. package/lib/Form/FormItem/index.js +32 -17
  167. package/lib/Form/style/index.css +4 -0
  168. package/lib/Form/style/variables.css +4 -0
  169. package/lib/InputNumber/index.js +9 -9
  170. package/lib/LmEditTable/DndContainer.d.ts +6 -3
  171. package/lib/LmEditTable/DndContainer.js +74 -9
  172. package/lib/LmEditTable/DragHandle.js +1 -1
  173. package/lib/LmEditTable/EditTable.d.ts +16 -5
  174. package/lib/LmEditTable/EditTable.js +853 -433
  175. package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
  176. package/lib/LmEditTable/components/DraggableContainer.js +52 -0
  177. package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
  178. package/lib/LmEditTable/components/QuickOpetate.js +96 -0
  179. package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  180. package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
  181. package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  182. package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
  183. package/lib/LmEditTable/components/index.d.ts +17 -0
  184. package/lib/LmEditTable/components/index.js +45 -0
  185. package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
  186. package/lib/LmEditTable/hooks/useForkRef.js +29 -0
  187. package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  188. package/lib/LmEditTable/rowSort/DndContainerRow.js +100 -0
  189. package/lib/LmEditTable/sortableItem.d.ts +3 -2
  190. package/lib/LmEditTable/sortableItem.js +19 -5
  191. package/lib/LmEditTable/sortableItemCol.js +37 -8
  192. package/lib/LmEditTable/style/index.css +105 -1
  193. package/lib/LmEditTable/style/variables.css +105 -1
  194. package/lib/LmEditTable/util.d.ts +10 -0
  195. package/lib/LmEditTable/util.js +171 -8
  196. package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  197. package/lib/LmEditTable/virtual/VirtualRow.js +164 -0
  198. package/lib/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  199. package/lib/LmEditTable/virtual/VirtualRow2.js +78 -0
  200. package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  201. package/lib/LmEditTable/virtual/VirtualTable.js +81 -0
  202. package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  203. package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
  204. package/lib/LmEditTable/virtual/context.d.ts +13 -0
  205. package/lib/LmEditTable/virtual/context.js +76 -0
  206. package/lib/LmEditTable/virtual/index.d.ts +4 -0
  207. package/lib/LmEditTable/virtual/index.js +31 -0
  208. package/lib/LmTable/Table.js +269 -163
  209. package/lib/LmTable/common/index.d.ts +10 -0
  210. package/lib/LmTable/common/index.js +48 -0
  211. package/lib/LmTable/components/CalcExpression.d.ts +9 -0
  212. package/lib/LmTable/components/CalcExpression.js +166 -0
  213. package/lib/LmTable/components/Container/Container.css +94 -0
  214. package/lib/LmTable/components/Container/Container.d.ts +20 -0
  215. package/lib/LmTable/components/Container/Container.js +66 -0
  216. package/lib/LmTable/components/Container/index.d.ts +2 -0
  217. package/lib/LmTable/components/Container/index.js +13 -0
  218. package/lib/LmTable/components/DndContainer.d.ts +37 -5
  219. package/lib/LmTable/components/DndContainer.js +714 -26
  220. package/lib/LmTable/components/HeaderCol.js +61 -0
  221. package/lib/LmTable/components/Item/Item.css +113 -0
  222. package/lib/LmTable/components/Item/Item.d.ts +37 -0
  223. package/lib/LmTable/components/Item/Item.js +104 -0
  224. package/lib/LmTable/components/Item/components/Action/Action.css +41 -0
  225. package/lib/LmTable/components/Item/components/Action/Action.d.ts +10 -0
  226. package/lib/LmTable/components/Item/components/Action/Action.js +50 -0
  227. package/lib/LmTable/components/Item/components/Action/index.d.ts +2 -0
  228. package/lib/LmTable/components/Item/components/Action/index.js +13 -0
  229. package/lib/LmTable/components/Item/components/Handle/index.d.ts +4 -0
  230. package/lib/LmTable/components/Item/components/Handle/index.js +27 -0
  231. package/lib/LmTable/components/Item/components/Remove/index.d.ts +2 -0
  232. package/lib/LmTable/components/Item/components/Remove/index.js +27 -0
  233. package/lib/LmTable/components/Item/components/index.d.ts +3 -0
  234. package/lib/LmTable/components/Item/components/index.js +31 -0
  235. package/lib/LmTable/components/Item/index.d.ts +2 -0
  236. package/lib/LmTable/components/Item/index.js +33 -0
  237. package/lib/LmTable/components/{sortableBoxCol.js → SortableBox.js} +0 -0
  238. package/lib/LmTable/expression.d.ts +2 -1
  239. package/lib/LmTable/expression.js +96 -17
  240. package/lib/LmTable/hooks/useDndItems.d.ts +13 -0
  241. package/lib/LmTable/hooks/useDndItems.js +247 -0
  242. package/lib/LmTable/hooks/useGroupDataSource.js +2 -24
  243. package/lib/LmTable/hooks/useResizeObserver.d.ts +13 -0
  244. package/lib/LmTable/hooks/useResizeObserver.js +61 -0
  245. package/lib/LmTable/multipleContainersKeyboardCoordinates.d.ts +3 -0
  246. package/lib/LmTable/multipleContainersKeyboardCoordinates.js +126 -0
  247. package/lib/LmTable/style/index.css +13 -2
  248. package/lib/LmTable/style/variables.css +13 -2
  249. package/lib/LmTable/testDemos/group.js +131 -0
  250. package/lib/LmTable/util.js +22 -2
  251. package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
  252. package/lib/LmTable/virTual/VirtualRow.js +81 -48
  253. package/lib/LmTable/virTual/VirtualTable.js +43 -10
  254. package/lib/LmTable/virTual/context.js +14 -2
  255. package/lib/LmUpload/fns/index.js +1 -1
  256. package/lib/Modal/index.js +10 -3
  257. package/lib/Radio/index.js +9 -1
  258. package/lib/Switch/index.js +9 -2
  259. package/lib/hooks/useEvent/index.js +1 -1
  260. package/lib/index.d.ts +1 -2
  261. package/lib/locale-provider/index.js +1 -1
  262. package/lib/styles/variables.css +129 -6
  263. package/package.json +3 -5
  264. package/dist/LmTable/components/sortableItemCol.d.ts +0 -1
  265. package/es/LmTable/components/sortableItemCol.js +0 -56
  266. package/lib/LmTable/components/sortableItemCol.js +0 -56
@@ -0,0 +1,64 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useCallback, useRef } from 'react';
3
+ import { useVirtual } from 'react-virtual';
4
+ import { TableContext, useRealive } from './context';
5
+ var VirtualTable = /*#__PURE__*/React.memo(function (tableProps) {
6
+ var _a, _b, _c, _d;
7
+
8
+ var fn = tableProps.fn;
9
+ var bodyRef = useRef(null);
10
+
11
+ var _useRealive = useRealive(),
12
+ _useRealive2 = _slicedToArray(_useRealive, 2),
13
+ state = _useRealive2[0],
14
+ dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
15
+
16
+
17
+ var rowVirtual = useVirtual({
18
+ size: state.totalLen,
19
+ // 绑定父节点
20
+ parentRef: {
21
+ current: (_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _a === void 0 ? void 0 : _a.parentNode
22
+ },
23
+ estimateSize: React.useCallback(function () {
24
+ return state.rowHeight;
25
+ }, [state.rowHeight]),
26
+ overscan: 5
27
+ });
28
+ fn.current = rowVirtual.scrollToIndex; // 列动态宽度
29
+
30
+ var columnEstimateSize = useCallback(function (i) {
31
+ var _a, _b;
32
+
33
+ var colWidths = (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths;
34
+ var leftColumnsLen = state.sliceColumns.leftColumns.length;
35
+ var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
36
+
37
+ var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
38
+ return virList[i] || 0;
39
+ }, [(_c = (_b = tableProps.children[0]) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.colWidths, state.sliceColumns.leftColumns.length, state.sliceColumns.centerColumns.length]); // 列虚拟化
40
+
41
+ var columnVirtual = useVirtual({
42
+ horizontal: true,
43
+ size: state.columnsLen,
44
+ parentRef: {
45
+ current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
46
+ },
47
+ estimateSize: columnEstimateSize,
48
+ overscan: 5
49
+ });
50
+ var instance = {
51
+ rowVirtual: rowVirtual,
52
+ columnVirtual: columnVirtual
53
+ };
54
+ return /*#__PURE__*/React.createElement(TableContext.Provider, {
55
+ value: {
56
+ state: state,
57
+ dispatch: dispatch,
58
+ instance: instance
59
+ }
60
+ }, /*#__PURE__*/React.createElement("table", Object.assign({
61
+ ref: bodyRef
62
+ }, tableProps)));
63
+ });
64
+ export default VirtualTable;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const VirtualWrapper: React.MemoExoticComponent<(wrapperProps: React.PropsWithChildren<any>) => JSX.Element>;
3
+ export default VirtualWrapper;
@@ -0,0 +1,60 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+
4
+ for (var p in s) {
5
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ }
7
+
8
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+
14
+ import React, { useEffect, useMemo } from 'react';
15
+ import { useStore } from './context';
16
+ var VirtualWrapper = /*#__PURE__*/React.memo(function (wrapperProps) {
17
+ var _a, _b;
18
+
19
+ var children = wrapperProps.children,
20
+ resetProps = __rest(wrapperProps, ["children"]);
21
+
22
+ var _useStore = useStore(),
23
+ state = _useStore.state,
24
+ dispatch = _useStore.dispatch,
25
+ instance = _useStore.instance;
26
+
27
+ var _instance$rowVirtual = instance.rowVirtual,
28
+ virtualItems = _instance$rowVirtual.virtualItems,
29
+ totalSize = _instance$rowVirtual.totalSize;
30
+ var contents = useMemo(function () {
31
+ return children[1];
32
+ }, [children]);
33
+ var contentsLen = useMemo(function () {
34
+ var _a;
35
+
36
+ return (_a = contents === null || contents === void 0 ? void 0 : contents.length) !== null && _a !== void 0 ? _a : 0;
37
+ }, [contents]);
38
+ useEffect(function () {
39
+ if (state.totalLen !== contentsLen) {
40
+ dispatch({
41
+ type: 'changeTotalLen',
42
+ totalLen: contentsLen !== null && contentsLen !== void 0 ? contentsLen : 0
43
+ });
44
+ }
45
+ }, [contentsLen, dispatch, state.totalLen]);
46
+ var paddingTop = virtualItems.length > 0 ? ((_a = virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems[0]) === null || _a === void 0 ? void 0 : _a.start) || 0 : 0;
47
+ var paddingBottom = virtualItems.length > 0 ? totalSize - (((_b = virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems[virtualItems.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0) : 0;
48
+ return /*#__PURE__*/React.createElement("tbody", Object.assign({}, resetProps), paddingTop > 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
49
+ style: {
50
+ height: "".concat(paddingTop, "px")
51
+ }
52
+ })), children[0], virtualItems.map(function (virtualRow) {
53
+ return contents[virtualRow.index];
54
+ }), paddingBottom > 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
55
+ style: {
56
+ height: "".concat(paddingBottom, "px")
57
+ }
58
+ })));
59
+ });
60
+ export default VirtualWrapper;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ declare const TableContext: import("react").Context<{
3
+ state: any;
4
+ dispatch: any;
5
+ instance: any;
6
+ }>;
7
+ declare const useStore: () => {
8
+ state: any;
9
+ dispatch: any;
10
+ instance: any;
11
+ };
12
+ declare const useRealive: () => [any, import("react").Dispatch<any>];
13
+ export { TableContext, useStore, useRealive };
@@ -0,0 +1,66 @@
1
+ import { createContext, useContext, useReducer } from 'react'; // =============== context ============== //
2
+
3
+ var TableContext = /*#__PURE__*/createContext({
4
+ state: null,
5
+ dispatch: null,
6
+ instance: {}
7
+ });
8
+
9
+ var useStore = function useStore() {
10
+ return useContext(TableContext);
11
+ };
12
+
13
+ var initialState = {
14
+ // 行高度
15
+ rowHeight: 0,
16
+ columnsLen: 0,
17
+ // 总行数
18
+ totalLen: 0,
19
+ // 分割后的列数组
20
+ sliceColumns: {
21
+ leftColumns: [],
22
+ centerColumns: [],
23
+ rightColumns: []
24
+ }
25
+ };
26
+
27
+ var reducer = function reducer(state, action) {
28
+ var totalLen = action.totalLen,
29
+ columnsLen = action.columnsLen,
30
+ rowHeight = action.rowHeight,
31
+ sliceColumns = action.sliceColumns;
32
+
33
+ switch (action.type) {
34
+ // 数据数量
35
+ case 'changeTotalLen':
36
+ return Object.assign(Object.assign({}, state), {
37
+ totalLen: totalLen
38
+ });
39
+ // 列数量
40
+
41
+ case 'changeColumnsLen':
42
+ return Object.assign(Object.assign({}, state), {
43
+ columnsLen: columnsLen
44
+ });
45
+ // 初始化行高度
46
+
47
+ case 'initHeight':
48
+ return Object.assign(Object.assign({}, state), {
49
+ rowHeight: rowHeight
50
+ });
51
+
52
+ case 'changeSliceColumns':
53
+ return Object.assign(Object.assign({}, state), {
54
+ sliceColumns: sliceColumns
55
+ });
56
+
57
+ default:
58
+ throw new Error();
59
+ }
60
+ };
61
+
62
+ var useRealive = function useRealive() {
63
+ return useReducer(reducer, initialState);
64
+ };
65
+
66
+ export { TableContext, useStore, useRealive };
@@ -0,0 +1,4 @@
1
+ import VirtualTable from './VirtualTable';
2
+ import VirtualWrapper from './VirtualWrapper';
3
+ import VirtualRow from './VirtualRow';
4
+ export { VirtualTable, VirtualWrapper, VirtualRow };
@@ -0,0 +1,4 @@
1
+ import VirtualTable from './VirtualTable';
2
+ import VirtualWrapper from './VirtualWrapper';
3
+ import VirtualRow from './VirtualRow';
4
+ export { VirtualTable, VirtualWrapper, VirtualRow };