beautiful-grid 1.0.0-rc.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 (258) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +6 -0
  3. package/README.md +977 -0
  4. package/TRADEMARK.md +17 -0
  5. package/cjs/BGrid.js +503 -0
  6. package/cjs/components/CellEditorIcon.js +209 -0
  7. package/cjs/components/CellNavigationDomSync.js +117 -0
  8. package/cjs/components/CellTextEditorGateway.js +393 -0
  9. package/cjs/components/ColResizer.js +144 -0
  10. package/cjs/components/EditorPortalRoot.js +96 -0
  11. package/cjs/components/GridOptionalSurfaces.js +47 -0
  12. package/cjs/components/GripVertical.js +48 -0
  13. package/cjs/components/Loading.js +76 -0
  14. package/cjs/components/Pagination.js +93 -0
  15. package/cjs/components/PluginCellEditor.js +258 -0
  16. package/cjs/components/RowSelector.js +74 -0
  17. package/cjs/components/Table.js +2572 -0
  18. package/cjs/components/TableBody.js +446 -0
  19. package/cjs/components/TableBodyCell.js +112 -0
  20. package/cjs/components/TableBodyFrozen.js +44 -0
  21. package/cjs/components/TableColGroup.js +48 -0
  22. package/cjs/components/TableColGroupFrozen.js +57 -0
  23. package/cjs/components/TableFooter.js +70 -0
  24. package/cjs/components/TableHead.js +195 -0
  25. package/cjs/components/TableHeadColumn.js +124 -0
  26. package/cjs/components/TableHeadFrozen.js +165 -0
  27. package/cjs/components/TableSummary.js +133 -0
  28. package/cjs/components/TableSummaryFronzen.js +105 -0
  29. package/cjs/components/columnSortableRuntime.js +46 -0
  30. package/cjs/components/context-menu/GridContextMenu.js +174 -0
  31. package/cjs/components/context-menu/index.js +17 -0
  32. package/cjs/components/scrollbar/CustomScrollbar.js +58 -0
  33. package/cjs/components/scrollbar/ScrollbarButton.js +69 -0
  34. package/cjs/components/scrollbar/ScrollbarTrack.js +106 -0
  35. package/cjs/components/scrollbar/index.js +20 -0
  36. package/cjs/components/scrollbar/useScrollbarMetrics.js +103 -0
  37. package/cjs/components/search/GridSearchController.js +170 -0
  38. package/cjs/components/search/GridSearchPopover.js +163 -0
  39. package/cjs/components/search/index.js +18 -0
  40. package/cjs/components/selection/CellSelectionOverlay.js +52 -0
  41. package/cjs/components/selection/CellSelectionOverlayLayer.js +65 -0
  42. package/cjs/components/selection/index.js +18 -0
  43. package/cjs/components/toolbox/TableHeadToolbox.js +308 -0
  44. package/cjs/components/toolbox/ToolboxCustomSection.js +55 -0
  45. package/cjs/components/toolbox/ToolboxNumberFilterSection.js +151 -0
  46. package/cjs/components/toolbox/ToolboxSortSection.js +68 -0
  47. package/cjs/components/toolbox/ToolboxTextFilterSection.js +114 -0
  48. package/cjs/components/toolbox/ToolboxValueFilterSection.js +250 -0
  49. package/cjs/components/toolbox/index.js +22 -0
  50. package/cjs/components/useColumnSortable.js +70 -0
  51. package/cjs/editors/createDateEditorPlugin.js +88 -0
  52. package/cjs/editors/createSelectEditorPlugin.js +98 -0
  53. package/cjs/editors/defineEditorPlugin.js +17 -0
  54. package/cjs/editors/index.js +19 -0
  55. package/cjs/index.js +19 -0
  56. package/cjs/store/createAppStore.js +1645 -0
  57. package/cjs/store/index.js +17 -0
  58. package/cjs/types.js +14 -0
  59. package/cjs/utils/buildHeaderMatrix.js +265 -0
  60. package/cjs/utils/cellEditState.js +71 -0
  61. package/cjs/utils/cellEditTransaction.js +138 -0
  62. package/cjs/utils/cellSelectionGeometry.js +179 -0
  63. package/cjs/utils/common.js +154 -0
  64. package/cjs/utils/coordinate.js +125 -0
  65. package/cjs/utils/createPivotData.js +271 -0
  66. package/cjs/utils/delay.js +7 -0
  67. package/cjs/utils/filterData.js +182 -0
  68. package/cjs/utils/getCellSelectionAxisState.js +39 -0
  69. package/cjs/utils/getCellValue.js +21 -0
  70. package/cjs/utils/getColumnId.js +60 -0
  71. package/cjs/utils/getFrozenColumnsWidth.js +21 -0
  72. package/cjs/utils/getLineNumber.js +7 -0
  73. package/cjs/utils/getVisibleScrollableRowRange.js +24 -0
  74. package/cjs/utils/gridSearch.js +135 -0
  75. package/cjs/utils/index.js +39 -0
  76. package/cjs/utils/mergedCells.js +76 -0
  77. package/cjs/utils/mouseEventSubscribe.js +119 -0
  78. package/cjs/utils/number/index.js +19 -0
  79. package/cjs/utils/number/toFixed.js +6 -0
  80. package/cjs/utils/number/toMoney.js +13 -0
  81. package/cjs/utils/number/toNumber.js +12 -0
  82. package/cjs/utils/processDataQuery.js +126 -0
  83. package/cjs/utils/rowReorder.js +131 -0
  84. package/cjs/utils/scrollbar.js +62 -0
  85. package/cjs/utils/updateDataQuery.js +147 -0
  86. package/cjs/utils/useBodyData.js +277 -0
  87. package/cjs/utils/useForceUpdate.js +57 -0
  88. package/cjs/utils/useRowReorderController.js +666 -0
  89. package/esm/BGrid.js +466 -0
  90. package/esm/components/CellEditorIcon.js +115 -0
  91. package/esm/components/CellNavigationDomSync.js +80 -0
  92. package/esm/components/CellTextEditorGateway.js +275 -0
  93. package/esm/components/ColResizer.js +60 -0
  94. package/esm/components/EditorPortalRoot.js +57 -0
  95. package/esm/components/GridOptionalSurfaces.js +10 -0
  96. package/esm/components/GripVertical.js +11 -0
  97. package/esm/components/Loading.js +24 -0
  98. package/esm/components/Pagination.js +44 -0
  99. package/esm/components/PluginCellEditor.js +110 -0
  100. package/esm/components/RowSelector.js +38 -0
  101. package/esm/components/Table.js +2347 -0
  102. package/esm/components/TableBody.js +315 -0
  103. package/esm/components/TableBodyCell.js +73 -0
  104. package/esm/components/TableBodyFrozen.js +6 -0
  105. package/esm/components/TableColGroup.js +10 -0
  106. package/esm/components/TableColGroupFrozen.js +19 -0
  107. package/esm/components/TableFooter.js +30 -0
  108. package/esm/components/TableHead.js +114 -0
  109. package/esm/components/TableHeadColumn.js +86 -0
  110. package/esm/components/TableHeadFrozen.js +102 -0
  111. package/esm/components/TableSummary.js +66 -0
  112. package/esm/components/TableSummaryFronzen.js +62 -0
  113. package/esm/components/columnSortableRuntime.js +38 -0
  114. package/esm/components/context-menu/GridContextMenu.js +115 -0
  115. package/esm/components/context-menu/index.js +1 -0
  116. package/esm/components/scrollbar/CustomScrollbar.js +21 -0
  117. package/esm/components/scrollbar/ScrollbarButton.js +32 -0
  118. package/esm/components/scrollbar/ScrollbarTrack.js +66 -0
  119. package/esm/components/scrollbar/index.js +4 -0
  120. package/esm/components/scrollbar/useScrollbarMetrics.js +74 -0
  121. package/esm/components/search/GridSearchController.js +98 -0
  122. package/esm/components/search/GridSearchPopover.js +109 -0
  123. package/esm/components/search/index.js +2 -0
  124. package/esm/components/selection/CellSelectionOverlay.js +5 -0
  125. package/esm/components/selection/CellSelectionOverlayLayer.js +28 -0
  126. package/esm/components/selection/index.js +2 -0
  127. package/esm/components/toolbox/TableHeadToolbox.js +223 -0
  128. package/esm/components/toolbox/ToolboxCustomSection.js +18 -0
  129. package/esm/components/toolbox/ToolboxNumberFilterSection.js +98 -0
  130. package/esm/components/toolbox/ToolboxSortSection.js +31 -0
  131. package/esm/components/toolbox/ToolboxTextFilterSection.js +61 -0
  132. package/esm/components/toolbox/ToolboxValueFilterSection.js +195 -0
  133. package/esm/components/toolbox/index.js +6 -0
  134. package/esm/components/useColumnSortable.js +33 -0
  135. package/esm/editors/createDateEditorPlugin.js +48 -0
  136. package/esm/editors/createSelectEditorPlugin.js +60 -0
  137. package/esm/editors/defineEditorPlugin.js +6 -0
  138. package/esm/editors/index.js +3 -0
  139. package/esm/index.js +3 -0
  140. package/esm/store/createAppStore.js +1483 -0
  141. package/esm/store/index.js +1 -0
  142. package/esm/types.js +11 -0
  143. package/esm/utils/buildHeaderMatrix.js +231 -0
  144. package/esm/utils/cellEditState.js +32 -0
  145. package/esm/utils/cellEditTransaction.js +96 -0
  146. package/esm/utils/cellSelectionGeometry.js +166 -0
  147. package/esm/utils/common.js +145 -0
  148. package/esm/utils/coordinate.js +112 -0
  149. package/esm/utils/createPivotData.js +226 -0
  150. package/esm/utils/delay.js +1 -0
  151. package/esm/utils/filterData.js +176 -0
  152. package/esm/utils/getCellSelectionAxisState.js +34 -0
  153. package/esm/utils/getCellValue.js +18 -0
  154. package/esm/utils/getColumnId.js +52 -0
  155. package/esm/utils/getFrozenColumnsWidth.js +16 -0
  156. package/esm/utils/getLineNumber.js +3 -0
  157. package/esm/utils/getVisibleScrollableRowRange.js +20 -0
  158. package/esm/utils/gridSearch.js +127 -0
  159. package/esm/utils/index.js +23 -0
  160. package/esm/utils/mergedCells.js +70 -0
  161. package/esm/utils/mouseEventSubscribe.js +113 -0
  162. package/esm/utils/number/index.js +3 -0
  163. package/esm/utils/number/toFixed.js +3 -0
  164. package/esm/utils/number/toMoney.js +10 -0
  165. package/esm/utils/number/toNumber.js +9 -0
  166. package/esm/utils/processDataQuery.js +119 -0
  167. package/esm/utils/rowReorder.js +85 -0
  168. package/esm/utils/scrollbar.js +51 -0
  169. package/esm/utils/updateDataQuery.js +130 -0
  170. package/esm/utils/useBodyData.js +153 -0
  171. package/esm/utils/useForceUpdate.js +5 -0
  172. package/esm/utils/useRowReorderController.js +603 -0
  173. package/package.json +54 -0
  174. package/style.css +2508 -0
  175. package/types/BGrid.d.ts +3 -0
  176. package/types/components/CellEditorIcon.d.ts +13 -0
  177. package/types/components/CellNavigationDomSync.d.ts +17 -0
  178. package/types/components/CellTextEditorGateway.d.ts +20 -0
  179. package/types/components/ColResizer.d.ts +12 -0
  180. package/types/components/EditorPortalRoot.d.ts +8 -0
  181. package/types/components/GridOptionalSurfaces.d.ts +10 -0
  182. package/types/components/GripVertical.d.ts +6 -0
  183. package/types/components/Loading.d.ts +7 -0
  184. package/types/components/Pagination.d.ts +5 -0
  185. package/types/components/PluginCellEditor.d.ts +13 -0
  186. package/types/components/RowSelector.d.ts +10 -0
  187. package/types/components/Table.d.ts +61 -0
  188. package/types/components/TableBody.d.ts +39 -0
  189. package/types/components/TableBodyCell.d.ts +20 -0
  190. package/types/components/TableBodyFrozen.d.ts +15 -0
  191. package/types/components/TableColGroup.d.ts +3 -0
  192. package/types/components/TableColGroupFrozen.d.ts +5 -0
  193. package/types/components/TableFooter.d.ts +9 -0
  194. package/types/components/TableHead.d.ts +21 -0
  195. package/types/components/TableHeadColumn.d.ts +8 -0
  196. package/types/components/TableHeadFrozen.d.ts +7 -0
  197. package/types/components/TableSummary.d.ts +13 -0
  198. package/types/components/TableSummaryFronzen.d.ts +7 -0
  199. package/types/components/columnSortableRuntime.d.ts +12 -0
  200. package/types/components/context-menu/GridContextMenu.d.ts +6 -0
  201. package/types/components/context-menu/index.d.ts +1 -0
  202. package/types/components/scrollbar/CustomScrollbar.d.ts +11 -0
  203. package/types/components/scrollbar/ScrollbarButton.d.ts +9 -0
  204. package/types/components/scrollbar/ScrollbarTrack.d.ts +11 -0
  205. package/types/components/scrollbar/index.d.ts +4 -0
  206. package/types/components/scrollbar/useScrollbarMetrics.d.ts +12 -0
  207. package/types/components/search/GridSearchController.d.ts +1 -0
  208. package/types/components/search/GridSearchPopover.d.ts +6 -0
  209. package/types/components/search/index.d.ts +2 -0
  210. package/types/components/selection/CellSelectionOverlay.d.ts +17 -0
  211. package/types/components/selection/CellSelectionOverlayLayer.d.ts +18 -0
  212. package/types/components/selection/index.d.ts +2 -0
  213. package/types/components/toolbox/TableHeadToolbox.d.ts +13 -0
  214. package/types/components/toolbox/ToolboxCustomSection.d.ts +11 -0
  215. package/types/components/toolbox/ToolboxNumberFilterSection.d.ts +8 -0
  216. package/types/components/toolbox/ToolboxSortSection.d.ts +8 -0
  217. package/types/components/toolbox/ToolboxTextFilterSection.d.ts +8 -0
  218. package/types/components/toolbox/ToolboxValueFilterSection.d.ts +8 -0
  219. package/types/components/toolbox/index.d.ts +6 -0
  220. package/types/components/useColumnSortable.d.ts +13 -0
  221. package/types/editors/createDateEditorPlugin.d.ts +8 -0
  222. package/types/editors/createSelectEditorPlugin.d.ts +15 -0
  223. package/types/editors/defineEditorPlugin.d.ts +2 -0
  224. package/types/editors/index.d.ts +3 -0
  225. package/types/index.d.ts +3 -0
  226. package/types/store/createAppStore.d.ts +13 -0
  227. package/types/store/index.d.ts +1 -0
  228. package/types/types.d.ts +864 -0
  229. package/types/utils/buildHeaderMatrix.d.ts +32 -0
  230. package/types/utils/cellEditState.d.ts +12 -0
  231. package/types/utils/cellEditTransaction.d.ts +14 -0
  232. package/types/utils/cellSelectionGeometry.d.ts +34 -0
  233. package/types/utils/common.d.ts +3 -0
  234. package/types/utils/coordinate.d.ts +29 -0
  235. package/types/utils/createPivotData.d.ts +12 -0
  236. package/types/utils/delay.d.ts +1 -0
  237. package/types/utils/filterData.d.ts +18 -0
  238. package/types/utils/getCellSelectionAxisState.d.ts +12 -0
  239. package/types/utils/getCellValue.d.ts +2 -0
  240. package/types/utils/getColumnId.d.ts +19 -0
  241. package/types/utils/getFrozenColumnsWidth.d.ts +12 -0
  242. package/types/utils/getLineNumber.d.ts +6 -0
  243. package/types/utils/getVisibleScrollableRowRange.d.ts +20 -0
  244. package/types/utils/gridSearch.d.ts +18 -0
  245. package/types/utils/index.d.ts +23 -0
  246. package/types/utils/mergedCells.d.ts +14 -0
  247. package/types/utils/mouseEventSubscribe.d.ts +18 -0
  248. package/types/utils/number/index.d.ts +3 -0
  249. package/types/utils/number/toFixed.d.ts +1 -0
  250. package/types/utils/number/toMoney.d.ts +1 -0
  251. package/types/utils/number/toNumber.d.ts +1 -0
  252. package/types/utils/processDataQuery.d.ts +19 -0
  253. package/types/utils/rowReorder.d.ts +24 -0
  254. package/types/utils/scrollbar.d.ts +13 -0
  255. package/types/utils/updateDataQuery.d.ts +28 -0
  256. package/types/utils/useBodyData.d.ts +9 -0
  257. package/types/utils/useForceUpdate.d.ts +1 -0
  258. package/types/utils/useRowReorderController.d.ts +19 -0
@@ -0,0 +1,2572 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
47
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
48
+ return new (P || (P = Promise))(function (resolve, reject) {
49
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
50
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
51
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
52
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
53
+ });
54
+ };
55
+ var __generator = (this && this.__generator) || function (thisArg, body) {
56
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
57
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
58
+ function verb(n) { return function (v) { return step([n, v]); }; }
59
+ function step(op) {
60
+ if (f) throw new TypeError("Generator is already executing.");
61
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
62
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
63
+ if (y = 0, t) op = [op[0] & 2, t.value];
64
+ switch (op[0]) {
65
+ case 0: case 1: t = op; break;
66
+ case 4: _.label++; return { value: op[1], done: false };
67
+ case 5: _.label++; y = op[1]; op = [0]; continue;
68
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
69
+ default:
70
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
71
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
72
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
73
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
74
+ if (t[2]) _.ops.pop();
75
+ _.trys.pop(); continue;
76
+ }
77
+ op = body.call(thisArg, _);
78
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
79
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
80
+ }
81
+ };
82
+ var __rest = (this && this.__rest) || function (s, e) {
83
+ var t = {};
84
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
85
+ t[p] = s[p];
86
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
87
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
88
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
89
+ t[p[i]] = s[p[i]];
90
+ }
91
+ return t;
92
+ };
93
+ var __read = (this && this.__read) || function (o, n) {
94
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
95
+ if (!m) return o;
96
+ var i = m.call(o), r, ar = [], e;
97
+ try {
98
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
99
+ }
100
+ catch (error) { e = { error: error }; }
101
+ finally {
102
+ try {
103
+ if (r && !r.done && (m = i["return"])) m.call(i);
104
+ }
105
+ finally { if (e) throw e.error; }
106
+ }
107
+ return ar;
108
+ };
109
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
110
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
111
+ if (ar || !(i in from)) {
112
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
113
+ ar[i] = from[i];
114
+ }
115
+ }
116
+ return to.concat(ar || Array.prototype.slice.call(from));
117
+ };
118
+ var __values = (this && this.__values) || function(o) {
119
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
120
+ if (m) return m.call(o);
121
+ if (o && typeof o.length === "number") return {
122
+ next: function () {
123
+ if (o && i >= o.length) o = void 0;
124
+ return { value: o && o[i++], done: !o };
125
+ }
126
+ };
127
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
128
+ };
129
+ var __importDefault = (this && this.__importDefault) || function (mod) {
130
+ return (mod && mod.__esModule) ? mod : { "default": mod };
131
+ };
132
+ Object.defineProperty(exports, "__esModule", { value: true });
133
+ var React = __importStar(require("react"));
134
+ var react_1 = require("react");
135
+ var shallow_1 = require("zustand/react/shallow");
136
+ var store_1 = require("../store");
137
+ var types_1 = require("../types");
138
+ var utils_1 = require("../utils");
139
+ var coordinate_1 = require("../utils/coordinate");
140
+ var Loading_1 = __importDefault(require("./Loading"));
141
+ var TableBody_1 = __importDefault(require("./TableBody"));
142
+ var TableBodyFrozen_1 = __importDefault(require("./TableBodyFrozen"));
143
+ var TableFooter_1 = __importDefault(require("./TableFooter"));
144
+ var scrollbar_1 = require("./scrollbar");
145
+ var TableHead_1 = __importDefault(require("./TableHead"));
146
+ var TableHeadFrozen_1 = __importDefault(require("./TableHeadFrozen"));
147
+ var TableSummary_1 = require("./TableSummary");
148
+ var TableSummaryFronzen_1 = require("./TableSummaryFronzen");
149
+ var CellTextEditorGateway_1 = require("./CellTextEditorGateway");
150
+ var EditorPortalRoot_1 = require("./EditorPortalRoot");
151
+ var useRowReorderController_1 = require("../utils/useRowReorderController");
152
+ var cellSelectionGeometry_1 = require("../utils/cellSelectionGeometry");
153
+ var selection_1 = require("./selection");
154
+ var CellNavigationDomSync_1 = require("./CellNavigationDomSync");
155
+ var DEFAULT_MAX_CLIPBOARD_CELLS = 100000;
156
+ var DEFAULT_MAX_CLIPBOARD_TEXT_LENGTH = 8 * 1024 * 1024;
157
+ var KEYBOARD_NAVIGATION_ROW_WINDOW_SIZE = 8;
158
+ var DEFAULT_KEYBOARD_NAVIGATION_REPEAT_INTERVAL = 16;
159
+ var SCROLL_IDLE_DELAY = 120;
160
+ var LazyGridOptionalSurfaces = React.lazy(function () {
161
+ return Promise.resolve().then(function () { return __importStar(require('./GridOptionalSurfaces')); }).then(function (module) { return ({
162
+ default: module.GridOptionalSurfaces,
163
+ }); });
164
+ });
165
+ function Table(props) {
166
+ var _this = this;
167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
168
+ var cellSelectionOptions = props.cellSelectionOptions, onChangeData = props.onChangeData, sourceIndexByVisibleIndex = props.sourceIndexByVisibleIndex;
169
+ var cellSelectionEnabled = (_a = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.enabled) !== null && _a !== void 0 ? _a : true;
170
+ // [Selector Group 1] Layout & Dimensions - 레이아웃 차원
171
+ var _5 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
172
+ width: s.width,
173
+ height: s.height,
174
+ containerBorderWidth: s.containerBorderWidth,
175
+ className: s.className,
176
+ style: s.style,
177
+ itemHeight: s.itemHeight,
178
+ itemPadding: s.itemPadding,
179
+ }); })), width = _5.width, height = _5.height, containerBorderWidth = _5.containerBorderWidth, className = _5.className, style = _5.style, itemHeight = _5.itemHeight, itemPadding = _5.itemPadding;
180
+ // [Selector Group 2] Header, Footer, Summary - 헤더/푸터/요약
181
+ var _6 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
182
+ headerHeight: s.headerHeight,
183
+ footerHeight: s.footerHeight,
184
+ bottomBarHeight: s.bottomBarHeight,
185
+ summaryHeight: s.summaryHeight,
186
+ }); })), headerHeight = _6.headerHeight, footerHeight = _6.footerHeight, bottomBarHeight = _6.bottomBarHeight, summaryHeight = _6.summaryHeight;
187
+ // [Selector Group 3] Scroll State - 스크롤 상태
188
+ var _7 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
189
+ scrollLeft: s.scrollLeft,
190
+ scrollTop: s.scrollTop,
191
+ }); })), scrollLeft = _7.scrollLeft, scrollTop = _7.scrollTop;
192
+ // [Selector Group 4] Content, Columns, Data - 컨텐츠 관련
193
+ var _8 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
194
+ contentBodyHeight: s.contentBodyHeight,
195
+ columns: s.columns,
196
+ data: s.data,
197
+ frozenColumnsWidth: s.frozenColumnsWidth,
198
+ frozenRowCount: s.frozenRowCount,
199
+ frozenRowsHeight: s.frozenRowsHeight,
200
+ }); })), contentBodyHeight = _8.contentBodyHeight, columns = _8.columns, data = _8.data, frozenColumnsWidth = _8.frozenColumnsWidth, frozenRowCount = _8.frozenRowCount, frozenRowsHeight = _8.frozenRowsHeight;
201
+ // [Selector Group 4-1] Cell selection & navigation - 셀 선택 및 내비게이션
202
+ var _9 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
203
+ cellSelectionRange: s.cellSelectionRange,
204
+ cellSelectionRanges: s.cellSelectionRanges,
205
+ activeCell: s.activeCell,
206
+ activeCellHost: s.activeCellHost,
207
+ cellNavigationOptions: s.cellNavigationOptions,
208
+ editItemIndex: s.editItemIndex,
209
+ editable: s.editable,
210
+ handleClick: s.handleClick,
211
+ }); })), cellSelectionRange = _9.cellSelectionRange, cellSelectionRanges = _9.cellSelectionRanges, activeCell = _9.activeCell, activeCellHost = _9.activeCellHost, cellNavigationOptions = _9.cellNavigationOptions, editItemIndex = _9.editItemIndex, editable = _9.editable, handleClick = _9.handleClick;
212
+ // [Selector Group 5] State - 상태
213
+ var _10 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
214
+ rowChecked: s.rowChecked,
215
+ page: s.page,
216
+ loading: s.loading,
217
+ spinning: s.spinning,
218
+ showLineNumber: s.showLineNumber,
219
+ summary: s.summary,
220
+ scrollbar: s.scrollbar,
221
+ status: s.status,
222
+ pagination: s.pagination,
223
+ }); })), rowChecked = _10.rowChecked, page = _10.page, loading = _10.loading, spinning = _10.spinning, showLineNumber = _10.showLineNumber, summary = _10.summary, scrollbar = _10.scrollbar, status = _10.status, pagination = _10.pagination;
224
+ var _11 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
225
+ searchOpen: s.searchOpen,
226
+ searchOptions: s.searchOptions,
227
+ contextMenuOptions: s.contextMenuOptions,
228
+ activeSearchMatchIndex: s.activeSearchMatchIndex,
229
+ searchMatches: s.searchMatches,
230
+ storeSourceIndexByVisibleIndex: s.sourceIndexByVisibleIndex,
231
+ storeRowKey: s.rowKey,
232
+ cellInteractionSession: s.cellInteractionSession,
233
+ }); })), searchOpen = _11.searchOpen, searchOptions = _11.searchOptions, contextMenuOptions = _11.contextMenuOptions, activeSearchMatchIndex = _11.activeSearchMatchIndex, searchMatches = _11.searchMatches, storeSourceIndexByVisibleIndex = _11.storeSourceIndexByVisibleIndex, storeRowKey = _11.storeRowKey, cellInteractionSession = _11.cellInteractionSession;
234
+ // [Selector Group 6] State Setters - 차원 설정자
235
+ var _12 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
236
+ setHeight: s.setHeight,
237
+ setWidth: s.setWidth,
238
+ setContentBodyHeight: s.setContentBodyHeight,
239
+ setDisplayItemCount: s.setDisplayItemCount,
240
+ setHeaderHeight: s.setHeaderHeight,
241
+ setFooterHeight: s.setFooterHeight,
242
+ setBottomBarHeight: s.setBottomBarHeight,
243
+ setSummaryHeight: s.setSummaryHeight,
244
+ setItemHeight: s.setItemHeight,
245
+ setItemPadding: s.setItemPadding,
246
+ setLoading: s.setLoading,
247
+ setSpinning: s.setSpinning,
248
+ }); })), setHeight = _12.setHeight, setWidth = _12.setWidth, setContentBodyHeight = _12.setContentBodyHeight, setDisplayItemCount = _12.setDisplayItemCount, setHeaderHeight = _12.setHeaderHeight, setFooterHeight = _12.setFooterHeight, setBottomBarHeight = _12.setBottomBarHeight, setSummaryHeight = _12.setSummaryHeight, setItemHeight = _12.setItemHeight, setItemPadding = _12.setItemPadding, setLoading = _12.setLoading, setSpinning = _12.setSpinning;
249
+ // [Selector Group 7] Data & Column Setters - 데이터/열 설정자
250
+ var _13 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
251
+ setData: s.setData,
252
+ setSourceData: s.setSourceData,
253
+ setProcessedData: s.setProcessedData,
254
+ setColumns: s.setColumns,
255
+ setColumnsGroup: s.setColumnsGroup,
256
+ setColumnGroups: s.setColumnGroups,
257
+ setFrozenColumnsWidth: s.setFrozenColumnsWidth,
258
+ setFrozenColumnIndex: s.setFrozenColumnIndex,
259
+ setFrozenRowCount: s.setFrozenRowCount,
260
+ setFrozenRowsHeight: s.setFrozenRowsHeight,
261
+ }); })), setData = _13.setData, setSourceData = _13.setSourceData, setProcessedData = _13.setProcessedData, setColumns = _13.setColumns, setColumnsGroup = _13.setColumnsGroup, setColumnGroups = _13.setColumnGroups, setFrozenColumnsWidth = _13.setFrozenColumnsWidth, setFrozenColumnIndex = _13.setFrozenColumnIndex, setFrozenRowCount = _13.setFrozenRowCount, setFrozenRowsHeight = _13.setFrozenRowsHeight;
262
+ // [Selector Group 8] Row & Sort Setters - 행/정렬 설정자
263
+ var _14 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
264
+ setRowChecked: s.setRowChecked,
265
+ setCheckedIndexesMap: s.setCheckedIndexesMap,
266
+ setSort: s.setSort,
267
+ setSortParams: s.setSortParams,
268
+ setDataQuery: s.setDataQuery,
269
+ setDataControl: s.setDataControl,
270
+ setIcons: s.setIcons,
271
+ setActiveToolbox: s.setActiveToolbox,
272
+ setRowKey: s.setRowKey,
273
+ setFocusedRowKey: s.setSelectedRowKey,
274
+ setEditItem: s.setEditItem,
275
+ setSearchOptions: s.setSearchOptions,
276
+ setContextMenuOptions: s.setContextMenuOptions,
277
+ requestSearchOpen: s.requestSearchOpen,
278
+ openContextMenu: s.openContextMenu,
279
+ }); })), setRowChecked = _14.setRowChecked, setCheckedIndexesMap = _14.setCheckedIndexesMap, setSort = _14.setSort, setSortParams = _14.setSortParams, setDataQuery = _14.setDataQuery, setDataControl = _14.setDataControl, setIcons = _14.setIcons, setActiveToolbox = _14.setActiveToolbox, setRowKey = _14.setRowKey, setFocusedRowKey = _14.setFocusedRowKey, setEditItem = _14.setEditItem, setSearchOptions = _14.setSearchOptions, setContextMenuOptions = _14.setContextMenuOptions, requestSearchOpen = _14.requestSearchOpen, openContextMenu = _14.openContextMenu;
280
+ // [Selector Group 9] Pagination & Display Setters - 페이지/표시 설정자
281
+ var _15 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
282
+ setPage: s.setPage,
283
+ setDisplayPaginationLength: s.setDisplayPaginationLength,
284
+ setShowLineNumber: s.setShowLineNumber,
285
+ setMsg: s.setMsg,
286
+ setRowClassName: s.setRowClassName,
287
+ setCellMergeOptions: s.setCellMergeOptions,
288
+ setVariant: s.setVariant,
289
+ setSummary: s.setSummary,
290
+ setColumnSortable: s.setColumnSortable,
291
+ setReorder: s.setReorder,
292
+ setClassName: s.setClassName,
293
+ setStyle: s.setStyle,
294
+ setScrollbar: s.setScrollbar,
295
+ setStatus: s.setStatus,
296
+ setPagination: s.setPagination,
297
+ }); })), setPage = _15.setPage, setDisplayPaginationLength = _15.setDisplayPaginationLength, setShowLineNumber = _15.setShowLineNumber, setMsg = _15.setMsg, setRowClassName = _15.setRowClassName, setCellMergeOptions = _15.setCellMergeOptions, setVariant = _15.setVariant, setSummary = _15.setSummary, setColumnSortable = _15.setColumnSortable, setReorder = _15.setReorder, setClassName = _15.setClassName, setStyle = _15.setStyle, setScrollbar = _15.setScrollbar, setStatus = _15.setStatus, setPagination = _15.setPagination;
298
+ // [Selector Group 10] Edit & Event Setters - 편집/이벤트 설정자
299
+ var _16 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
300
+ setEditable: s.setEditable,
301
+ setEditTrigger: s.setEditTrigger,
302
+ setOnClick: s.setOnClick,
303
+ setOnChangeColumns: s.setOnChangeColumns,
304
+ setOnChangeData: s.setOnChangeData,
305
+ setOnLoadMore: s.setOnLoadMore,
306
+ setScroll: s.setScroll,
307
+ setInitialized: s.setInitialized,
308
+ }); })), setEditable = _16.setEditable, setEditTrigger = _16.setEditTrigger, setOnClick = _16.setOnClick, setOnChangeColumns = _16.setOnChangeColumns, setOnChangeData = _16.setOnChangeData, setOnLoadMore = _16.setOnLoadMore, setScroll = _16.setScroll, setInitialized = _16.setInitialized;
309
+ var _17 = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({
310
+ setCellSelectionRanges: s.setCellSelectionRanges,
311
+ setCellSelecting: s.setCellSelecting,
312
+ clearCellSelection: s.clearCellSelection,
313
+ setActiveCell: s.setActiveCell,
314
+ moveActiveCell: s.moveActiveCell,
315
+ setCellNavigationOptions: s.setCellNavigationOptions,
316
+ syncActiveCellToBounds: s.syncActiveCellToBounds,
317
+ }); })), setCellSelectionRanges = _17.setCellSelectionRanges, setCellSelecting = _17.setCellSelecting, clearCellSelection = _17.clearCellSelection, setActiveCell = _17.setActiveCell, moveActiveCell = _17.moveActiveCell, setCellNavigationOptions = _17.setCellNavigationOptions, syncActiveCellToBounds = _17.syncActiveCellToBounds;
318
+ var trHeight = itemHeight + itemPadding * 2;
319
+ var scrollableBodyHeight = Math.max(contentBodyHeight - frozenRowsHeight, 0);
320
+ var mainViewportWidth = Math.max(width - (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0), 0);
321
+ var hasMultiCellSelection = React.useMemo(function () {
322
+ return cellSelectionRanges.length > 1 ||
323
+ cellSelectionRanges.some(function (range) {
324
+ var normalized = (0, cellSelectionGeometry_1.normalizeCellSelectionRange)(range);
325
+ return (normalized.startRowIndex !== normalized.endRowIndex ||
326
+ normalized.startColumnIndex !== normalized.endColumnIndex);
327
+ });
328
+ }, [cellSelectionRanges]);
329
+ var activeLogicalCell = React.useMemo(function () { return (activeCell ? (0, utils_1.resolveLogicalCell)(data, props.cellMergeOptions, activeCell) : undefined); }, [activeCell, data, props.cellMergeOptions]);
330
+ var activeCellSelected = React.useMemo(function () {
331
+ if (!activeLogicalCell)
332
+ return false;
333
+ return cellSelectionRanges.some(function (range) {
334
+ var normalized = (0, cellSelectionGeometry_1.normalizeCellSelectionRange)(range);
335
+ return (activeLogicalCell.cell.rowIndex >= normalized.startRowIndex &&
336
+ activeLogicalCell.cell.rowIndex <= normalized.endRowIndex &&
337
+ activeLogicalCell.cell.columnIndex >= normalized.startColumnIndex &&
338
+ activeLogicalCell.cell.columnIndex <= normalized.endColumnIndex);
339
+ });
340
+ }, [activeLogicalCell, cellSelectionRanges]);
341
+ var activeCellRanges = React.useMemo(function () {
342
+ var _a;
343
+ if (!activeLogicalCell)
344
+ return [];
345
+ var startRowIndex = activeLogicalCell.rowRange.startRowIndex;
346
+ var endRowIndex = activeLogicalCell.rowRange.endRowIndex;
347
+ var hostCell = (_a = cellInteractionSession === null || cellInteractionSession === void 0 ? void 0 : cellInteractionSession.hostCell) !== null && _a !== void 0 ? _a : activeCellHost;
348
+ // A merged cell crossing the frozen-row boundary is rendered as two
349
+ // physical cells. During editing, draw focus only around the fragment
350
+ // that owns the editor while keeping the logical edit scope unchanged.
351
+ if (hostCell &&
352
+ activeLogicalCell.rowRange.startRowIndex < frozenRowCount &&
353
+ activeLogicalCell.rowRange.endRowIndex >= frozenRowCount) {
354
+ if (hostCell.rowIndex < frozenRowCount) {
355
+ endRowIndex = frozenRowCount - 1;
356
+ }
357
+ else {
358
+ startRowIndex = frozenRowCount;
359
+ }
360
+ }
361
+ return [
362
+ {
363
+ startRowIndex: startRowIndex,
364
+ endRowIndex: endRowIndex,
365
+ startColumnIndex: activeLogicalCell.cell.columnIndex,
366
+ endColumnIndex: activeLogicalCell.cell.columnIndex,
367
+ },
368
+ ];
369
+ }, [activeCellHost, activeLogicalCell, cellInteractionSession === null || cellInteractionSession === void 0 ? void 0 : cellInteractionSession.hostCell, frozenRowCount]);
370
+ var selectionFragments = React.useMemo(function () {
371
+ var _a;
372
+ return (0, cellSelectionGeometry_1.getCellSelectionFragments)({
373
+ ranges: cellSelectionRanges,
374
+ columns: columns,
375
+ rowCount: data.length,
376
+ rowHeight: trHeight,
377
+ frozenColumnCount: (_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0,
378
+ frozenRowCount: frozenRowCount,
379
+ frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
380
+ });
381
+ }, [
382
+ cellSelectionRanges,
383
+ columns,
384
+ data.length,
385
+ frozenColumnsWidth,
386
+ frozenRowCount,
387
+ props.frozenColumnIndex,
388
+ trHeight,
389
+ ]);
390
+ var activeFragments = React.useMemo(function () {
391
+ var _a;
392
+ return (0, cellSelectionGeometry_1.getCellSelectionFragments)({
393
+ ranges: activeCellRanges,
394
+ columns: columns,
395
+ rowCount: data.length,
396
+ rowHeight: trHeight,
397
+ frozenColumnCount: (_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0,
398
+ frozenRowCount: frozenRowCount,
399
+ frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
400
+ });
401
+ }, [
402
+ activeCellRanges,
403
+ columns,
404
+ data.length,
405
+ frozenColumnsWidth,
406
+ frozenRowCount,
407
+ props.frozenColumnIndex,
408
+ trHeight,
409
+ ]);
410
+ var activeOverlayFill = activeCellSelected;
411
+ var activeOverlayRing = !!activeCell && !hasMultiCellSelection;
412
+ var renderSelectionOverlay = function (quadrant) {
413
+ var topQuadrant = quadrant === 'top-left' || quadrant === 'top-main';
414
+ var leftQuadrant = quadrant === 'top-left' || quadrant === 'body-left';
415
+ return (React.createElement(selection_1.CellSelectionOverlay, { quadrant: quadrant, selectionFragments: selectionFragments, activeFragments: activeFragments, activeFill: activeOverlayFill, activeRing: activeOverlayRing, viewport: {
416
+ left: leftQuadrant ? 0 : scrollLeft,
417
+ top: topQuadrant ? 0 : scrollTop,
418
+ width: leftQuadrant ? frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0 : mainViewportWidth,
419
+ height: topQuadrant ? frozenRowsHeight : scrollableBodyHeight,
420
+ } }));
421
+ };
422
+ var visibleScrollableRows = React.useMemo(function () {
423
+ var _a;
424
+ return (0, utils_1.getVisibleScrollableRowRange)({
425
+ scrollTop: scrollTop,
426
+ viewportHeight: scrollableBodyHeight,
427
+ rowHeight: trHeight,
428
+ frozenRowCount: frozenRowCount,
429
+ totalRowCount: data.length,
430
+ windowSize: ((_a = props.reorder) === null || _a === void 0 ? void 0 : _a.enabled) ? 1 : KEYBOARD_NAVIGATION_ROW_WINDOW_SIZE,
431
+ });
432
+ }, [data.length, frozenRowCount, (_b = props.reorder) === null || _b === void 0 ? void 0 : _b.enabled, scrollTop, scrollableBodyHeight, trHeight]);
433
+ var frozenRowRange = React.useMemo(function () { return ({ startRowIndex: 0, endRowIndex: frozenRowCount }); }, [frozenRowCount]);
434
+ var scrollableRowRange = React.useMemo(function () { return ({
435
+ startRowIndex: visibleScrollableRows.startRowIndex,
436
+ endRowIndex: visibleScrollableRows.endRowIndex,
437
+ }); }, [visibleScrollableRows.endRowIndex, visibleScrollableRows.startRowIndex]);
438
+ var frozenScrollableBodyStyle = React.useMemo(function () { return ({ top: visibleScrollableRows.paddingTop }); }, [visibleScrollableRows.paddingTop]);
439
+ var containerRef = (0, react_1.useRef)(null);
440
+ var searchPopoverRef = (0, react_1.useRef)(null);
441
+ var warnedContextMenuIdsRef = (0, react_1.useRef)(new Set());
442
+ var warnedContextMenuFactoryRef = (0, react_1.useRef)(false);
443
+ var editorPortalRef = (0, react_1.useRef)(null);
444
+ var editorPortalContext = React.useMemo(function () { return ({ gridRef: containerRef, portalRef: editorPortalRef }); }, []);
445
+ var bodyContainerRef = (0, react_1.useRef)(null);
446
+ var scrollContainerRef = (0, react_1.useRef)(null);
447
+ var rowReorderController = (0, useRowReorderController_1.useRowReorderController)({
448
+ containerRef: containerRef,
449
+ bodyContainerRef: bodyContainerRef,
450
+ scrollContainerRef: scrollContainerRef,
451
+ rowHeight: trHeight,
452
+ });
453
+ var searchSurfaceEnabled = !!searchOptions && searchOptions.enabled !== false;
454
+ var contextMenuSurfaceEnabled = (!!contextMenuOptions && contextMenuOptions.enabled !== false) ||
455
+ (searchSurfaceEnabled && searchOptions.contextMenu !== false);
456
+ var openCellContextMenu = React.useCallback(function (cell, clientX, clientY, keyboard) {
457
+ var _a, _b, _c, _d, _e, _f, _g;
458
+ var logical = (0, utils_1.resolveLogicalCell)(data, props.cellMergeOptions, cell);
459
+ var visibleIndex = logical.cell.rowIndex;
460
+ var columnIndex = logical.cell.columnIndex;
461
+ var item = data[visibleIndex];
462
+ var column = columns[columnIndex];
463
+ if (!item || !column)
464
+ return false;
465
+ if (!keyboard) {
466
+ var navigationEnabled = (_a = cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled) !== null && _a !== void 0 ? _a : true;
467
+ (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
468
+ if (navigationEnabled || cellSelectionEnabled) {
469
+ setActiveCell(logical.cell, cell);
470
+ }
471
+ if (cellSelectionEnabled) {
472
+ setCellSelectionRanges([
473
+ {
474
+ startRowIndex: logical.cell.rowIndex,
475
+ startColumnIndex: logical.cell.columnIndex,
476
+ endRowIndex: (_c = logical.rowIndexes[logical.rowIndexes.length - 1]) !== null && _c !== void 0 ? _c : logical.cell.rowIndex,
477
+ endColumnIndex: logical.cell.columnIndex,
478
+ },
479
+ ]);
480
+ }
481
+ }
482
+ var sourceIndex = (_d = storeSourceIndexByVisibleIndex[visibleIndex]) !== null && _d !== void 0 ? _d : visibleIndex;
483
+ var target = {
484
+ cell: logical.cell,
485
+ visibleIndex: visibleIndex,
486
+ sourceIndex: sourceIndex,
487
+ rowKey: storeRowKey ? (0, utils_1.getCellValueByRowKey)(storeRowKey, item.values) : undefined,
488
+ columnIndex: columnIndex,
489
+ columnId: column.columnId,
490
+ column: column,
491
+ item: item,
492
+ values: item.values,
493
+ value: (0, utils_1.getCellValueByRowKey)(column.key, item.values),
494
+ };
495
+ var customItemsEnabled = !!contextMenuOptions && contextMenuOptions.enabled !== false;
496
+ var customItems = [];
497
+ if (customItemsEnabled && (contextMenuOptions === null || contextMenuOptions === void 0 ? void 0 : contextMenuOptions.items)) {
498
+ try {
499
+ customItems = contextMenuOptions.items(target);
500
+ }
501
+ catch (error) {
502
+ if (process.env.NODE_ENV !== 'production' && !warnedContextMenuFactoryRef.current) {
503
+ warnedContextMenuFactoryRef.current = true;
504
+ console.warn('[BGrid] contextMenuOptions.items failed. Built-in items remain available.', error);
505
+ }
506
+ }
507
+ }
508
+ var builtInSearchEnabled = !!searchOptions && searchOptions.enabled !== false && searchOptions.contextMenu !== false;
509
+ var combined = [];
510
+ if (builtInSearchEnabled) {
511
+ combined.push({
512
+ id: 'bgrid-search',
513
+ label: (_f = (_e = searchOptions.labels) === null || _e === void 0 ? void 0 : _e.contextMenuItem) !== null && _f !== void 0 ? _f : '검색',
514
+ icon: (_g = searchOptions.icons) === null || _g === void 0 ? void 0 : _g.search,
515
+ shortcut: 'Ctrl/⌘ F',
516
+ onSelect: function () { return requestSearchOpen(true, 'contextMenu'); },
517
+ });
518
+ }
519
+ if (builtInSearchEnabled && customItems.length > 0) {
520
+ combined.push({ type: 'separator', id: 'bgrid-search-separator' });
521
+ }
522
+ combined.push.apply(combined, __spreadArray([], __read(customItems), false));
523
+ var normalized = normalizeContextMenuItems(combined, function (duplicateId) {
524
+ if (process.env.NODE_ENV === 'production' || warnedContextMenuIdsRef.current.has(duplicateId))
525
+ return;
526
+ warnedContextMenuIdsRef.current.add(duplicateId);
527
+ console.warn("[BGrid] Duplicate context menu item id \"".concat(duplicateId, "\" was ignored."));
528
+ });
529
+ if (!normalized.some(function (menuItem) { return menuItem.type !== 'separator' && !menuItem.disabled; }))
530
+ return false;
531
+ openContextMenu({ target: target, items: normalized, clientX: clientX, clientY: clientY, keyboard: keyboard });
532
+ return true;
533
+ }, [
534
+ cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled,
535
+ cellSelectionEnabled,
536
+ columns,
537
+ contextMenuOptions,
538
+ data,
539
+ openContextMenu,
540
+ props.cellMergeOptions,
541
+ requestSearchOpen,
542
+ searchOptions,
543
+ setActiveCell,
544
+ setCellSelectionRanges,
545
+ storeRowKey,
546
+ storeSourceIndexByVisibleIndex,
547
+ ]);
548
+ var scrollableColumnsWidth = React.useMemo(function () {
549
+ var _a;
550
+ return columns
551
+ .slice((_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0)
552
+ .reduce(function (totalWidth, column) { var _a; return totalWidth + ((_a = column.width) !== null && _a !== void 0 ? _a : 100); }, 0);
553
+ }, [columns, props.frozenColumnIndex]);
554
+ var stickyTopHeight = headerHeight + ((summary === null || summary === void 0 ? void 0 : summary.position) === 'top' ? summaryHeight : 0);
555
+ var stickyBottomHeight = (summary === null || summary === void 0 ? void 0 : summary.position) === 'bottom' ? summaryHeight : 0;
556
+ var stickyFixedHeight = stickyTopHeight + stickyBottomHeight;
557
+ var scrollViewportHeight = contentBodyHeight + stickyFixedHeight;
558
+ var scrollPlaneHeight = stickyFixedHeight + frozenRowsHeight + visibleScrollableRows.scrollContentHeight;
559
+ var scrollPlaneContentWidth = (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) + scrollableColumnsWidth;
560
+ var scrollPlaneWidth = Math.max(width, scrollPlaneContentWidth);
561
+ var customVerticalScrollbarGutter = scrollbar.vertical.visible && scrollbar.variant === 'classic'
562
+ ? 'var(--bgrid-scrollbar-classic-gutter-size)'
563
+ : scrollbar.vertical.visible && scrollbar.variant === 'modern'
564
+ ? 'var(--bgrid-scrollbar-modern-gutter-size)'
565
+ : undefined;
566
+ var scrollPlaneMinWidth = customVerticalScrollbarGutter
567
+ ? "max(100%, calc(".concat(scrollPlaneContentWidth, "px + ").concat(customVerticalScrollbarGutter, "))")
568
+ : scrollPlaneWidth;
569
+ var scrollbarMetrics = (0, scrollbar_1.useScrollbarMetrics)(scrollContainerRef, [data.length, itemHeight, itemPadding, contentBodyHeight, width], scrollPlaneContentWidth, stickyFixedHeight);
570
+ var measuredVerticalScrollbarGutter = customVerticalScrollbarGutter && scrollbarMetrics.horizontal.hasOverflow
571
+ ? Math.max(scrollbarMetrics.horizontal.contentSize - scrollPlaneContentWidth, 0)
572
+ : 0;
573
+ var keyboardViewportInsets = {
574
+ right: (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) + measuredVerticalScrollbarGutter,
575
+ bottom: stickyFixedHeight + frozenRowsHeight,
576
+ };
577
+ var showBottomBar = (0, utils_1.shouldRenderBottomBar)({
578
+ hasPage: !!page,
579
+ hasHorizontalOverflow: scrollbarMetrics.horizontal.hasOverflow,
580
+ scrollbar: scrollbar,
581
+ status: status,
582
+ pagination: pagination,
583
+ });
584
+ var handleScrollLeftChange = (0, react_1.useCallback)(function (offset) {
585
+ if (scrollContainerRef.current) {
586
+ scrollContainerRef.current.scrollLeft = offset;
587
+ }
588
+ }, []);
589
+ var handleScrollTopChange = (0, react_1.useCallback)(function (offset) {
590
+ if (scrollContainerRef.current) {
591
+ scrollContainerRef.current.scrollTop = offset;
592
+ }
593
+ }, []);
594
+ var latestScrollRef = (0, react_1.useRef)({ top: scrollTop, left: scrollLeft });
595
+ var latestCommittedScrollRef = (0, react_1.useRef)({ top: scrollTop, left: scrollLeft });
596
+ var scrollRafRef = (0, react_1.useRef)(null);
597
+ var scrollIdleTimerRef = (0, react_1.useRef)(null);
598
+ var selectionAutoScrollRafRef = (0, react_1.useRef)(null);
599
+ var latestPointerRef = (0, react_1.useRef)(null);
600
+ var hoveredRowIndexesRef = (0, react_1.useRef)([]);
601
+ var cellSelectionDragRef = (0, react_1.useRef)(null);
602
+ var axisSelectionDragRef = (0, react_1.useRef)(null);
603
+ var selectionMetricsRef = (0, react_1.useRef)({
604
+ columns: columns,
605
+ dataLength: data.length,
606
+ frozenColumnIndex: (_c = props.frozenColumnIndex) !== null && _c !== void 0 ? _c : 0,
607
+ frozenRowCount: frozenRowCount,
608
+ frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
609
+ frozenRowsHeight: frozenRowsHeight,
610
+ trHeight: trHeight,
611
+ });
612
+ (0, react_1.useEffect)(function () {
613
+ var _a;
614
+ selectionMetricsRef.current = {
615
+ columns: columns,
616
+ dataLength: data.length,
617
+ frozenColumnIndex: (_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0,
618
+ frozenRowCount: frozenRowCount,
619
+ frozenColumnsWidth: frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0,
620
+ frozenRowsHeight: frozenRowsHeight,
621
+ trHeight: trHeight,
622
+ };
623
+ }, [columns, data.length, props.frozenColumnIndex, frozenColumnsWidth, frozenRowCount, frozenRowsHeight, trHeight]);
624
+ var markScrollActive = (0, react_1.useCallback)(function () {
625
+ var _a;
626
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute('data-bgrid-scrolling', 'true');
627
+ if (scrollIdleTimerRef.current !== null)
628
+ window.clearTimeout(scrollIdleTimerRef.current);
629
+ scrollIdleTimerRef.current = window.setTimeout(function () {
630
+ var _a;
631
+ scrollIdleTimerRef.current = null;
632
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.removeAttribute('data-bgrid-scrolling');
633
+ }, SCROLL_IDLE_DELAY);
634
+ }, []);
635
+ var scheduleScrollFrame = (0, react_1.useCallback)(function () {
636
+ if (scrollRafRef.current !== null)
637
+ return;
638
+ var pollNativeScrollPosition = function () {
639
+ var _a;
640
+ scrollRafRef.current = null;
641
+ var scrollContainer = scrollContainerRef.current;
642
+ if (!scrollContainer)
643
+ return;
644
+ var scrollTop = scrollContainer.scrollTop, scrollLeft = scrollContainer.scrollLeft;
645
+ latestScrollRef.current = { top: scrollTop, left: scrollLeft };
646
+ var _b = latestCommittedScrollRef.current, committedTop = _b.top, committedLeft = _b.left;
647
+ if (committedTop !== scrollTop || committedLeft !== scrollLeft) {
648
+ latestCommittedScrollRef.current = { top: scrollTop, left: scrollLeft };
649
+ setScroll(scrollTop, scrollLeft);
650
+ }
651
+ if ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.hasAttribute('data-bgrid-scrolling')) {
652
+ scrollRafRef.current = requestAnimationFrame(pollNativeScrollPosition);
653
+ }
654
+ };
655
+ scrollRafRef.current = requestAnimationFrame(pollNativeScrollPosition);
656
+ }, [setScroll]);
657
+ var onScroll = (0, react_1.useCallback)(function () {
658
+ if (scrollContainerRef.current) {
659
+ var _a = scrollContainerRef.current, scrollTop_1 = _a.scrollTop, scrollLeft_1 = _a.scrollLeft;
660
+ latestScrollRef.current = { top: scrollTop_1, left: scrollLeft_1 };
661
+ markScrollActive();
662
+ scheduleScrollFrame();
663
+ }
664
+ }, [markScrollActive, scheduleScrollFrame]);
665
+ var onWheel = (0, react_1.useCallback)(function (evt) {
666
+ var scrollContainer = scrollContainerRef.current;
667
+ if (!scrollContainer)
668
+ return;
669
+ var delta = { x: 0, y: 0 };
670
+ if (evt.detail) {
671
+ delta.y = evt.detail * 10;
672
+ }
673
+ else if (typeof evt.deltaY === 'undefined') {
674
+ delta.y = -evt.wheelDelta;
675
+ delta.x = 0;
676
+ }
677
+ else {
678
+ delta.y = evt.deltaY;
679
+ delta.x = evt.deltaX;
680
+ }
681
+ if (evt.deltaMode === 1) {
682
+ delta.y = delta.y * 16;
683
+ delta.x = delta.x * 16;
684
+ }
685
+ else if (evt.deltaMode === 2) {
686
+ delta.y = delta.y * scrollContainer.clientHeight;
687
+ delta.x = delta.x * scrollContainer.clientWidth;
688
+ }
689
+ var maxScrollTop = Math.max(scrollContainer.scrollHeight - scrollContainer.clientHeight, 0);
690
+ var maxScrollLeft = Math.max(scrollContainer.scrollWidth - scrollContainer.clientWidth, 0);
691
+ var nextScrollTop = Math.min(maxScrollTop, Math.max(0, scrollContainer.scrollTop + delta.y));
692
+ var nextScrollLeft = Math.min(maxScrollLeft, Math.max(0, scrollContainer.scrollLeft + delta.x));
693
+ var didScrollTop = nextScrollTop !== scrollContainer.scrollTop;
694
+ var didScrollLeft = nextScrollLeft !== scrollContainer.scrollLeft;
695
+ if (!didScrollTop && !didScrollLeft) {
696
+ return;
697
+ }
698
+ evt.preventDefault();
699
+ if (didScrollTop)
700
+ scrollContainer.scrollTop = nextScrollTop;
701
+ if (didScrollLeft)
702
+ scrollContainer.scrollLeft = nextScrollLeft;
703
+ }, []);
704
+ var resetScrollPosition = (0, react_1.useCallback)(function (type) {
705
+ var _a, _b;
706
+ if (type === 'all' || type === 'left')
707
+ (_a = scrollContainerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ left: 0 });
708
+ if (type === 'all' || type === 'top')
709
+ (_b = scrollContainerRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({ top: 0 });
710
+ }, []);
711
+ var commitScroll = (0, react_1.useCallback)(function (top, left) {
712
+ var scrollContainer = scrollContainerRef.current;
713
+ if (!scrollContainer)
714
+ return;
715
+ if (scrollContainer.scrollTop !== top)
716
+ scrollContainer.scrollTop = top;
717
+ if (scrollContainer.scrollLeft !== left)
718
+ scrollContainer.scrollLeft = left;
719
+ latestScrollRef.current = { top: top, left: left };
720
+ latestCommittedScrollRef.current = { top: top, left: left };
721
+ setScroll(top, left);
722
+ }, [setScroll]);
723
+ (0, react_1.useEffect)(function () {
724
+ var _a, _b;
725
+ if (!searchOpen || activeSearchMatchIndex === undefined)
726
+ return;
727
+ var match = searchMatches[activeSearchMatchIndex];
728
+ var scrollContainer = scrollContainerRef.current;
729
+ if (!match || !scrollContainer)
730
+ return;
731
+ var scrollRect = scrollContainer.getBoundingClientRect();
732
+ var searchRect = (_a = searchPopoverRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
733
+ var viewportInsets = searchRect
734
+ ? {
735
+ top: Math.max(0, Math.min(scrollContainer.clientHeight, searchRect.bottom - scrollRect.top + 8)),
736
+ right: Math.max(0, Math.min(scrollContainer.clientWidth, scrollRect.right - searchRect.left + 8)),
737
+ bottom: Math.max(0, Math.min(scrollContainer.clientHeight, stickyFixedHeight + frozenRowsHeight)),
738
+ }
739
+ : undefined;
740
+ var result = (0, coordinate_1.ensureCellVisible)({
741
+ cell: match.cell,
742
+ scrollContainer: scrollContainer,
743
+ frozenColumnCount: (_b = props.frozenColumnIndex) !== null && _b !== void 0 ? _b : 0,
744
+ frozenRowCount: frozenRowCount,
745
+ columns: columns,
746
+ rowHeight: trHeight,
747
+ viewportInsets: viewportInsets,
748
+ });
749
+ if (result.didScroll)
750
+ commitScroll(result.scrollTop, result.scrollLeft);
751
+ }, [
752
+ activeSearchMatchIndex,
753
+ columns,
754
+ commitScroll,
755
+ frozenRowCount,
756
+ props.frozenColumnIndex,
757
+ searchMatches,
758
+ searchOpen,
759
+ stickyFixedHeight,
760
+ frozenRowsHeight,
761
+ trHeight,
762
+ ]);
763
+ var clearHoveredRow = (0, react_1.useCallback)(function () {
764
+ if (!containerRef.current || hoveredRowIndexesRef.current.length === 0)
765
+ return;
766
+ hoveredRowIndexesRef.current.forEach(function (hoveredIndex) {
767
+ var _a;
768
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll("tr[data-ri=\"".concat(hoveredIndex, "\"]")).forEach(function (el) {
769
+ el.classList.remove('bgrid-row-hover');
770
+ });
771
+ });
772
+ hoveredRowIndexesRef.current = [];
773
+ }, []);
774
+ var setHoveredRows = (0, react_1.useCallback)(function (rowIndexes) {
775
+ if (!containerRef.current)
776
+ return;
777
+ var prev = hoveredRowIndexesRef.current;
778
+ if (prev.length === rowIndexes.length && prev.every(function (value, index) { return value === rowIndexes[index]; })) {
779
+ return;
780
+ }
781
+ clearHoveredRow();
782
+ rowIndexes.forEach(function (rowIndex) {
783
+ var _a;
784
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll("tr[data-ri=\"".concat(rowIndex, "\"]")).forEach(function (el) {
785
+ el.classList.add('bgrid-row-hover');
786
+ });
787
+ });
788
+ hoveredRowIndexesRef.current = rowIndexes;
789
+ }, [clearHoveredRow]);
790
+ var toLogicalCellPosition = (0, react_1.useCallback)(function (cellPosition) {
791
+ var logicalCell = (0, utils_1.resolveLogicalCell)(data, props.cellMergeOptions, cellPosition);
792
+ return __assign(__assign({}, logicalCell.cell), { rowSpan: logicalCell.rowIndexes.length });
793
+ }, [data, props.cellMergeOptions]);
794
+ var updateAxisSelectionByTarget = (0, react_1.useCallback)(function (target) {
795
+ var dragState = axisSelectionDragRef.current;
796
+ if (!dragState)
797
+ return false;
798
+ var axisTarget = getAxisSelectionTarget(target, containerRef.current);
799
+ if (!axisTarget || axisTarget.axis !== dragState.axis)
800
+ return false;
801
+ setCellSelectionRanges(updateAxisSelectionDragRange(dragState, getAxisSelectionRange({
802
+ axis: dragState.axis,
803
+ startIndex: dragState.startIndex,
804
+ endIndex: axisTarget.startIndex < dragState.startIndex ? axisTarget.startIndex : axisTarget.endIndex,
805
+ rowCount: data.length,
806
+ columnCount: columns.length,
807
+ })));
808
+ return true;
809
+ }, [columns.length, data.length, setCellSelectionRanges]);
810
+ var onBodyPointerOverCapture = (0, react_1.useCallback)(function (evt) {
811
+ var _a;
812
+ var target = evt.target;
813
+ updateAxisSelectionByTarget(target);
814
+ var physicalCellPosition = getCellPosition(target, containerRef.current);
815
+ var cellPosition = physicalCellPosition ? toLogicalCellPosition(physicalCellPosition) : undefined;
816
+ if (cellSelectionEnabled && cellSelectionDragRef.current && cellPosition) {
817
+ setCellSelectionRanges(updateSelectionDragRange(cellSelectionDragRef.current, getRangeFromDrag(cellSelectionDragRef.current, cellPosition)));
818
+ }
819
+ var tr = target === null || target === void 0 ? void 0 : target.closest('tr[data-ri]');
820
+ if (!tr || !((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(tr))) {
821
+ clearHoveredRow();
822
+ return;
823
+ }
824
+ var rowIndex = Number(tr.getAttribute('data-ri'));
825
+ if (Number.isNaN(rowIndex)) {
826
+ clearHoveredRow();
827
+ return;
828
+ }
829
+ var rowIndexes = cellPosition
830
+ ? Array.from({ length: cellPosition.rowSpan }, function (_, index) { return cellPosition.rowIndex + index; })
831
+ : [rowIndex];
832
+ setHoveredRows(rowIndexes);
833
+ }, [
834
+ cellSelectionEnabled,
835
+ clearHoveredRow,
836
+ setCellSelectionRanges,
837
+ setHoveredRows,
838
+ toLogicalCellPosition,
839
+ updateAxisSelectionByTarget,
840
+ ]);
841
+ var onBodyPointerDownCapture = (0, react_1.useCallback)(function (evt) {
842
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
843
+ var navEnabled = (_a = cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled) !== null && _a !== void 0 ? _a : true;
844
+ if (!cellSelectionEnabled && !navEnabled)
845
+ return;
846
+ if (evt.button !== 0 || isInteractiveTarget(evt.target))
847
+ return;
848
+ var axisTarget = cellSelectionEnabled
849
+ ? getAxisSelectionTarget(evt.target, containerRef.current)
850
+ : undefined;
851
+ if (axisTarget && data.length > 0 && columns.length > 0) {
852
+ evt.preventDefault();
853
+ (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
854
+ var isAdditiveSelection = evt.metaKey || evt.ctrlKey;
855
+ var isRangeExtension = evt.shiftKey && (cellSelectionRange || activeCell);
856
+ var activeRangeStart = axisTarget.axis === 'row'
857
+ ? (_c = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startRowIndex) !== null && _c !== void 0 ? _c : activeCell === null || activeCell === void 0 ? void 0 : activeCell.rowIndex
858
+ : (_d = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startColumnIndex) !== null && _d !== void 0 ? _d : activeCell === null || activeCell === void 0 ? void 0 : activeCell.columnIndex;
859
+ var startIndex = isRangeExtension ? activeRangeStart !== null && activeRangeStart !== void 0 ? activeRangeStart : axisTarget.startIndex : axisTarget.startIndex;
860
+ var endIndex = axisTarget.startIndex < startIndex ? axisTarget.startIndex : axisTarget.endIndex;
861
+ var baseRanges = isAdditiveSelection
862
+ ? cellSelectionRanges
863
+ : isRangeExtension
864
+ ? cellSelectionRanges.slice(0, -1)
865
+ : [];
866
+ var activeRange = getAxisSelectionRange({
867
+ axis: axisTarget.axis,
868
+ startIndex: startIndex,
869
+ endIndex: endIndex,
870
+ rowCount: data.length,
871
+ columnCount: columns.length,
872
+ });
873
+ cellSelectionDragRef.current = null;
874
+ axisSelectionDragRef.current = {
875
+ axis: axisTarget.axis,
876
+ startIndex: startIndex,
877
+ baseRanges: baseRanges,
878
+ activeRangeIndex: baseRanges.length,
879
+ };
880
+ setActiveCell(axisTarget.axis === 'row'
881
+ ? { rowIndex: axisTarget.startIndex, columnIndex: 0 }
882
+ : { rowIndex: 0, columnIndex: axisTarget.startIndex });
883
+ setCellSelecting(true);
884
+ setCellSelectionRanges(__spreadArray(__spreadArray([], __read(baseRanges), false), [activeRange], false));
885
+ return;
886
+ }
887
+ var physicalCellPosition = getCellPosition(evt.target, containerRef.current);
888
+ if (!physicalCellPosition) {
889
+ return;
890
+ }
891
+ var cellPosition = toLogicalCellPosition(physicalCellPosition);
892
+ evt.preventDefault();
893
+ (_e = containerRef.current) === null || _e === void 0 ? void 0 : _e.focus({ preventScroll: true });
894
+ var clickedCell = {
895
+ rowIndex: cellPosition.rowIndex,
896
+ columnIndex: cellPosition.columnIndex,
897
+ };
898
+ setActiveCell(clickedCell, {
899
+ rowIndex: physicalCellPosition.rowIndex,
900
+ columnIndex: physicalCellPosition.columnIndex,
901
+ });
902
+ if (cellSelectionEnabled) {
903
+ var isAdditiveSelection = evt.metaKey || evt.ctrlKey;
904
+ var isRangeExtension = evt.shiftKey && (cellSelectionRange || activeCell);
905
+ var startRowIndex = isRangeExtension
906
+ ? (_g = (_f = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startRowIndex) !== null && _f !== void 0 ? _f : activeCell === null || activeCell === void 0 ? void 0 : activeCell.rowIndex) !== null && _g !== void 0 ? _g : cellPosition.rowIndex
907
+ : cellPosition.rowIndex;
908
+ var startColumnIndex = isRangeExtension
909
+ ? (_j = (_h = cellSelectionRange === null || cellSelectionRange === void 0 ? void 0 : cellSelectionRange.startColumnIndex) !== null && _h !== void 0 ? _h : activeCell === null || activeCell === void 0 ? void 0 : activeCell.columnIndex) !== null && _j !== void 0 ? _j : cellPosition.columnIndex
910
+ : cellPosition.columnIndex;
911
+ var startRowSpan = isRangeExtension
912
+ ? Math.abs(cellPosition.rowIndex - startRowIndex) + 1
913
+ : cellPosition.rowSpan;
914
+ var activeRange = {
915
+ startRowIndex: startRowIndex,
916
+ startColumnIndex: startColumnIndex,
917
+ endRowIndex: getSelectionEndRowIndex(startRowIndex, cellPosition),
918
+ endColumnIndex: cellPosition.columnIndex,
919
+ };
920
+ var baseRanges = isAdditiveSelection
921
+ ? cellSelectionRanges
922
+ : isRangeExtension
923
+ ? cellSelectionRanges.slice(0, -1)
924
+ : [];
925
+ cellSelectionDragRef.current = {
926
+ startRowIndex: startRowIndex,
927
+ startColumnIndex: startColumnIndex,
928
+ startRowSpan: startRowSpan,
929
+ baseRanges: baseRanges,
930
+ activeRangeIndex: baseRanges.length,
931
+ };
932
+ latestPointerRef.current = { clientX: evt.clientX, clientY: evt.clientY };
933
+ setCellSelecting(true);
934
+ setCellSelectionRanges(__spreadArray(__spreadArray([], __read(baseRanges), false), [activeRange], false));
935
+ }
936
+ }, [
937
+ activeCell,
938
+ cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled,
939
+ cellSelectionEnabled,
940
+ cellSelectionRange,
941
+ cellSelectionRanges,
942
+ columns.length,
943
+ data.length,
944
+ setActiveCell,
945
+ setCellSelecting,
946
+ setCellSelectionRanges,
947
+ toLogicalCellPosition,
948
+ ]);
949
+ var endCellSelectionDrag = (0, react_1.useCallback)(function () {
950
+ if (!cellSelectionDragRef.current && !axisSelectionDragRef.current)
951
+ return;
952
+ cellSelectionDragRef.current = null;
953
+ axisSelectionDragRef.current = null;
954
+ latestPointerRef.current = null;
955
+ if (selectionAutoScrollRafRef.current !== null) {
956
+ cancelAnimationFrame(selectionAutoScrollRafRef.current);
957
+ selectionAutoScrollRafRef.current = null;
958
+ }
959
+ setCellSelecting(false);
960
+ }, [setCellSelecting]);
961
+ var updateSelectionByPointer = (0, react_1.useCallback)(function (clientX, clientY) {
962
+ var _a, _b, _c;
963
+ var dragState = cellSelectionDragRef.current;
964
+ if (!dragState)
965
+ return;
966
+ var target = ((_b = (_a = document.elementFromPoint) === null || _a === void 0 ? void 0 : _a.call(document, clientX, clientY)) !== null && _b !== void 0 ? _b : null);
967
+ var cellPosition = (_c = getCellPosition(target, containerRef.current)) !== null && _c !== void 0 ? _c : getCellPositionFromPointer({
968
+ clientX: clientX,
969
+ clientY: clientY,
970
+ bodyContainer: bodyContainerRef.current,
971
+ scrollContainer: scrollContainerRef.current,
972
+ metrics: selectionMetricsRef.current,
973
+ });
974
+ if (!cellPosition)
975
+ return;
976
+ var logicalCellPosition = toLogicalCellPosition(cellPosition);
977
+ setCellSelectionRanges(updateSelectionDragRange(dragState, getRangeFromDrag(dragState, logicalCellPosition)));
978
+ }, [setCellSelectionRanges, toLogicalCellPosition]);
979
+ var runSelectionAutoScroll = (0, react_1.useCallback)(function () {
980
+ selectionAutoScrollRafRef.current = null;
981
+ var dragState = cellSelectionDragRef.current;
982
+ var pointer = latestPointerRef.current;
983
+ var scrollContainer = scrollContainerRef.current;
984
+ var bodyContainer = bodyContainerRef.current;
985
+ if (!dragState || !pointer || !scrollContainer || !bodyContainer)
986
+ return;
987
+ var delta = getSelectionAutoScrollDelta(pointer.clientX, pointer.clientY, bodyContainer, scrollContainer);
988
+ var maxScrollTop = Math.max(scrollContainer.scrollHeight - scrollContainer.clientHeight, 0);
989
+ var maxScrollLeft = Math.max(scrollContainer.scrollWidth - scrollContainer.clientWidth, 0);
990
+ var nextScrollTop = (0, coordinate_1.clamp)(scrollContainer.scrollTop + delta.y, 0, maxScrollTop);
991
+ var nextScrollLeft = (0, coordinate_1.clamp)(scrollContainer.scrollLeft + delta.x, 0, maxScrollLeft);
992
+ if (nextScrollTop !== scrollContainer.scrollTop || nextScrollLeft !== scrollContainer.scrollLeft) {
993
+ commitScroll(nextScrollTop, nextScrollLeft);
994
+ }
995
+ updateSelectionByPointer(pointer.clientX, pointer.clientY);
996
+ if (cellSelectionDragRef.current && (delta.x !== 0 || delta.y !== 0)) {
997
+ selectionAutoScrollRafRef.current = requestAnimationFrame(runSelectionAutoScroll);
998
+ }
999
+ }, [commitScroll, updateSelectionByPointer]);
1000
+ var selectAllCells = (0, react_1.useCallback)(function () {
1001
+ if (!cellSelectionEnabled)
1002
+ return false;
1003
+ if (data.length === 0 || columns.length === 0)
1004
+ return false;
1005
+ endCellSelectionDrag();
1006
+ setCellSelectionRanges([
1007
+ {
1008
+ startRowIndex: 0,
1009
+ startColumnIndex: 0,
1010
+ endRowIndex: data.length - 1,
1011
+ endColumnIndex: columns.length - 1,
1012
+ },
1013
+ ]);
1014
+ return true;
1015
+ }, [cellSelectionEnabled, columns.length, data.length, endCellSelectionDrag, setCellSelectionRanges]);
1016
+ var copySelectedCells = (0, react_1.useCallback)(function (evt) { return __awaiter(_this, void 0, void 0, function () {
1017
+ var maxClipboardCells, maxClipboardTextLength, onCopyError, selectedCellCount, notifyCopyError, selectedCells, rows, textLength, copiedRowCount, _loop_1, _a, _b, ri, state_1, text, error_1;
1018
+ var e_1, _c;
1019
+ var _d, _e, _f, _g;
1020
+ return __generator(this, function (_h) {
1021
+ switch (_h.label) {
1022
+ case 0:
1023
+ if (!cellSelectionEnabled)
1024
+ return [2 /*return*/];
1025
+ if (cellSelectionRanges.length === 0)
1026
+ return [2 /*return*/];
1027
+ maxClipboardCells = (_d = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardCells) !== null && _d !== void 0 ? _d : DEFAULT_MAX_CLIPBOARD_CELLS;
1028
+ maxClipboardTextLength = (_e = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardTextLength) !== null && _e !== void 0 ? _e : DEFAULT_MAX_CLIPBOARD_TEXT_LENGTH;
1029
+ onCopyError = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.onCopyError;
1030
+ selectedCellCount = getSelectionCellCount(cellSelectionRanges, data.length, columns.length);
1031
+ notifyCopyError = function (params) {
1032
+ warnClipboardLimitExceeded(params.reason, params.actual, params.limit);
1033
+ onCopyError === null || onCopyError === void 0 ? void 0 : onCopyError({
1034
+ reason: params.reason,
1035
+ actual: params.actual,
1036
+ limit: params.limit,
1037
+ selectedCellCount: selectedCellCount,
1038
+ maxClipboardCells: maxClipboardCells,
1039
+ maxClipboardTextLength: maxClipboardTextLength,
1040
+ error: params.error,
1041
+ });
1042
+ };
1043
+ if (selectedCellCount === 0 || selectedCellCount > maxClipboardCells) {
1044
+ if (selectedCellCount > maxClipboardCells) {
1045
+ notifyCopyError({
1046
+ reason: 'maxClipboardCells',
1047
+ actual: selectedCellCount,
1048
+ limit: maxClipboardCells,
1049
+ });
1050
+ }
1051
+ return [2 /*return*/];
1052
+ }
1053
+ selectedCells = getSelectedCellMap(cellSelectionRanges, data.length, columns.length);
1054
+ rows = [];
1055
+ textLength = 0;
1056
+ copiedRowCount = 0;
1057
+ _loop_1 = function (ri) {
1058
+ var item = data[ri];
1059
+ if (!item)
1060
+ return "continue";
1061
+ var values = [];
1062
+ var columnIndexes = Array.from((_f = selectedCells.get(ri)) !== null && _f !== void 0 ? _f : []).sort(function (a, b) { return a - b; });
1063
+ columnIndexes.forEach(function (ci) {
1064
+ var column = columns[ci];
1065
+ if (!column)
1066
+ return;
1067
+ var value = (0, utils_1.getCellValueByRowKey)(column.key, item.values);
1068
+ var clipboardValue = column.getClipboardText
1069
+ ? column.getClipboardText({
1070
+ column: column,
1071
+ index: ri,
1072
+ columnIndex: ci,
1073
+ item: item,
1074
+ values: item.values,
1075
+ value: value,
1076
+ })
1077
+ : value;
1078
+ values.push(toClipboardText(clipboardValue));
1079
+ });
1080
+ var rowText = values.join('\t');
1081
+ var nextTextLength = textLength + rowText.length + (copiedRowCount > 0 ? 1 : 0);
1082
+ if (nextTextLength > maxClipboardTextLength) {
1083
+ notifyCopyError({
1084
+ reason: 'maxClipboardTextLength',
1085
+ actual: nextTextLength,
1086
+ limit: maxClipboardTextLength,
1087
+ });
1088
+ return { value: void 0 };
1089
+ }
1090
+ rows.push(rowText);
1091
+ textLength = nextTextLength;
1092
+ copiedRowCount += 1;
1093
+ };
1094
+ try {
1095
+ for (_a = __values(Array.from(selectedCells.keys()).sort(function (a, b) { return a - b; })), _b = _a.next(); !_b.done; _b = _a.next()) {
1096
+ ri = _b.value;
1097
+ state_1 = _loop_1(ri);
1098
+ if (typeof state_1 === "object")
1099
+ return [2 /*return*/, state_1.value];
1100
+ }
1101
+ }
1102
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1103
+ finally {
1104
+ try {
1105
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1106
+ }
1107
+ finally { if (e_1) throw e_1.error; }
1108
+ }
1109
+ text = rows.join('\r');
1110
+ if (!text)
1111
+ return [2 /*return*/];
1112
+ if (evt === null || evt === void 0 ? void 0 : evt.clipboardData) {
1113
+ evt.clipboardData.setData('text/plain', text);
1114
+ return [2 /*return*/];
1115
+ }
1116
+ if (!((_g = navigator.clipboard) === null || _g === void 0 ? void 0 : _g.writeText)) return [3 /*break*/, 5];
1117
+ _h.label = 1;
1118
+ case 1:
1119
+ _h.trys.push([1, 3, , 4]);
1120
+ return [4 /*yield*/, navigator.clipboard.writeText(text)];
1121
+ case 2:
1122
+ _h.sent();
1123
+ return [2 /*return*/];
1124
+ case 3:
1125
+ error_1 = _h.sent();
1126
+ if (copyTextFallback(text)) {
1127
+ return [2 /*return*/];
1128
+ }
1129
+ notifyCopyError({
1130
+ reason: 'clipboardWriteFailed',
1131
+ actual: text.length,
1132
+ error: error_1,
1133
+ });
1134
+ return [3 /*break*/, 4];
1135
+ case 4: return [2 /*return*/];
1136
+ case 5:
1137
+ copyTextFallback(text);
1138
+ return [2 /*return*/];
1139
+ }
1140
+ });
1141
+ }); }, [
1142
+ cellSelectionEnabled,
1143
+ cellSelectionRanges,
1144
+ columns,
1145
+ data,
1146
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardCells,
1147
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardTextLength,
1148
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.onCopyError,
1149
+ ]);
1150
+ var pasteClipboardText = (0, react_1.useCallback)(function (text) {
1151
+ var _a, _b;
1152
+ if (!cellSelectionEnabled || !editable || !activeCell || data.length === 0 || columns.length === 0) {
1153
+ return false;
1154
+ }
1155
+ var maxClipboardCells = (_a = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardCells) !== null && _a !== void 0 ? _a : DEFAULT_MAX_CLIPBOARD_CELLS;
1156
+ var maxClipboardTextLength = (_b = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardTextLength) !== null && _b !== void 0 ? _b : DEFAULT_MAX_CLIPBOARD_TEXT_LENGTH;
1157
+ var matrix = parseClipboardText(text);
1158
+ var clipboardCellCount = matrix.reduce(function (count, row) { return count + row.length; }, 0);
1159
+ var onPasteError = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.onPasteError;
1160
+ var notifyPasteError = function (params) {
1161
+ warnClipboardPasteFailed(params.reason, params.actual, params.limit);
1162
+ onPasteError === null || onPasteError === void 0 ? void 0 : onPasteError(__assign(__assign({}, params), { clipboardTextLength: text.length, clipboardCellCount: clipboardCellCount, maxClipboardCells: maxClipboardCells, maxClipboardTextLength: maxClipboardTextLength }));
1163
+ };
1164
+ if (text.length > maxClipboardTextLength) {
1165
+ notifyPasteError({
1166
+ reason: 'maxClipboardTextLength',
1167
+ actual: text.length,
1168
+ limit: maxClipboardTextLength,
1169
+ });
1170
+ return true;
1171
+ }
1172
+ if (clipboardCellCount > maxClipboardCells) {
1173
+ notifyPasteError({
1174
+ reason: 'maxClipboardCells',
1175
+ actual: clipboardCellCount,
1176
+ limit: maxClipboardCells,
1177
+ });
1178
+ return true;
1179
+ }
1180
+ var startRowIndex = activeCell.rowIndex;
1181
+ var startColumnIndex = activeCell.columnIndex;
1182
+ var nextData = __spreadArray([], __read(data), false);
1183
+ var appendedRows = [];
1184
+ var changes = [];
1185
+ var createRowOnPaste = cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.createRowOnPaste;
1186
+ if (createRowOnPaste) {
1187
+ var requiredRowCount = startRowIndex + matrix.length;
1188
+ while (nextData.length < requiredRowCount) {
1189
+ var rowIndex = nextData.length;
1190
+ var clipboardRow = matrix[rowIndex - startRowIndex];
1191
+ if (!clipboardRow)
1192
+ break;
1193
+ var createdItem = void 0;
1194
+ try {
1195
+ createdItem = createRowOnPaste({ rowIndex: rowIndex, clipboardRow: __spreadArray([], __read(clipboardRow), false), columns: columns });
1196
+ }
1197
+ catch (error) {
1198
+ notifyPasteError({ reason: 'createRowFailed', rowIndex: rowIndex, error: error });
1199
+ break;
1200
+ }
1201
+ if (!createdItem)
1202
+ break;
1203
+ var newItem = __assign(__assign({}, createdItem), { status: types_1.BGridDataItemStatus.new });
1204
+ nextData.push(newItem);
1205
+ appendedRows.push({ rowIndex: rowIndex, item: newItem });
1206
+ }
1207
+ }
1208
+ matrix.forEach(function (clipboardRow, rowOffset) {
1209
+ var rowIndex = startRowIndex + rowOffset;
1210
+ var item = nextData[rowIndex];
1211
+ if (!item || item.status === types_1.BGridDataItemStatus.remove)
1212
+ return;
1213
+ clipboardRow.forEach(function (clipboardValue, columnOffset) {
1214
+ var _a;
1215
+ var columnIndex = startColumnIndex + columnOffset;
1216
+ var column = columns[columnIndex];
1217
+ if (!column || column.editable === false)
1218
+ return;
1219
+ var nextValue = clipboardValue;
1220
+ if (((_a = column.editor) === null || _a === void 0 ? void 0 : _a.type) === 'text' && column.editor.parseValue) {
1221
+ try {
1222
+ nextValue = column.editor.parseValue(clipboardValue, {
1223
+ index: rowIndex,
1224
+ columnIndex: columnIndex,
1225
+ item: item,
1226
+ values: item.values,
1227
+ column: column,
1228
+ });
1229
+ }
1230
+ catch (error) {
1231
+ notifyPasteError({
1232
+ reason: 'parseValueFailed',
1233
+ rowIndex: rowIndex,
1234
+ columnIndex: columnIndex,
1235
+ error: error,
1236
+ });
1237
+ return;
1238
+ }
1239
+ }
1240
+ var currentValue = (0, utils_1.getCellValueByRowKey)(column.key, item.values);
1241
+ if (Object.is(currentValue, nextValue))
1242
+ return;
1243
+ setCellValueByRowKey(column.key, item.values, nextValue);
1244
+ (0, utils_1.markCellEdited)(item, column);
1245
+ (0, utils_1.markCellValueChanged)(item, column);
1246
+ if (item.status !== types_1.BGridDataItemStatus.new) {
1247
+ item.status = types_1.BGridDataItemStatus.edit;
1248
+ }
1249
+ changes.push({ rowIndex: rowIndex, columnIndex: columnIndex, item: item });
1250
+ });
1251
+ });
1252
+ var pastedRowCount = Math.min(matrix.length, Math.max(nextData.length - startRowIndex, 0));
1253
+ var pastedColumnCount = Math.min(matrix.reduce(function (max, row) { return Math.max(max, row.length); }, 0), Math.max(columns.length - startColumnIndex, 0));
1254
+ if (pastedRowCount > 0 && pastedColumnCount > 0) {
1255
+ setCellSelectionRanges([
1256
+ {
1257
+ startRowIndex: startRowIndex,
1258
+ startColumnIndex: startColumnIndex,
1259
+ endRowIndex: startRowIndex + pastedRowCount - 1,
1260
+ endColumnIndex: startColumnIndex + pastedColumnCount - 1,
1261
+ },
1262
+ ]);
1263
+ }
1264
+ if (changes.length > 0 || appendedRows.length > 0) {
1265
+ setData(nextData);
1266
+ appendedRows.forEach(function (_a) {
1267
+ var rowIndex = _a.rowIndex, item = _a.item;
1268
+ onChangeData === null || onChangeData === void 0 ? void 0 : onChangeData(rowIndex, null, item.values, null);
1269
+ });
1270
+ changes.forEach(function (_a) {
1271
+ var _b;
1272
+ var rowIndex = _a.rowIndex, columnIndex = _a.columnIndex, item = _a.item;
1273
+ var sourceIndex = (_b = sourceIndexByVisibleIndex === null || sourceIndexByVisibleIndex === void 0 ? void 0 : sourceIndexByVisibleIndex[rowIndex]) !== null && _b !== void 0 ? _b : rowIndex;
1274
+ onChangeData === null || onChangeData === void 0 ? void 0 : onChangeData(sourceIndex, columnIndex, item.values, columns[columnIndex]);
1275
+ });
1276
+ }
1277
+ return true;
1278
+ }, [
1279
+ activeCell,
1280
+ cellSelectionEnabled,
1281
+ columns,
1282
+ data,
1283
+ editable,
1284
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardCells,
1285
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.maxClipboardTextLength,
1286
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.onPasteError,
1287
+ cellSelectionOptions === null || cellSelectionOptions === void 0 ? void 0 : cellSelectionOptions.createRowOnPaste,
1288
+ onChangeData,
1289
+ sourceIndexByVisibleIndex,
1290
+ setCellSelectionRanges,
1291
+ setData,
1292
+ ]);
1293
+ var onBodyPointerLeave = (0, react_1.useCallback)(function () {
1294
+ clearHoveredRow();
1295
+ }, [clearHoveredRow]);
1296
+ // [Group 1] Layout dimensions
1297
+ (0, react_1.useEffect)(function () {
1298
+ if (props.width !== undefined)
1299
+ setWidth(Math.max(props.width, 100));
1300
+ if (props.headerHeight !== undefined)
1301
+ setHeaderHeight(Math.max(props.headerHeight, 22));
1302
+ if (props.footerHeight !== undefined)
1303
+ setFooterHeight(props.footerHeight);
1304
+ if (props.summaryHeight !== undefined)
1305
+ setSummaryHeight(props.summaryHeight);
1306
+ if (props.itemHeight !== undefined)
1307
+ setItemHeight(props.itemHeight);
1308
+ if (props.itemPadding !== undefined)
1309
+ setItemPadding(props.itemPadding);
1310
+ }, [
1311
+ props.width,
1312
+ props.headerHeight,
1313
+ props.footerHeight,
1314
+ props.summaryHeight,
1315
+ props.itemHeight,
1316
+ props.itemPadding,
1317
+ setWidth,
1318
+ setHeaderHeight,
1319
+ setFooterHeight,
1320
+ setSummaryHeight,
1321
+ setItemHeight,
1322
+ setItemPadding,
1323
+ ]);
1324
+ (0, react_1.useEffect)(function () {
1325
+ if (props.bottomBarHeight !== undefined)
1326
+ setBottomBarHeight(props.bottomBarHeight);
1327
+ }, [props.bottomBarHeight, setBottomBarHeight]);
1328
+ (0, react_1.useEffect)(function () {
1329
+ if (props.scrollbar !== undefined)
1330
+ setScrollbar(props.scrollbar);
1331
+ }, [props.scrollbar, setScrollbar]);
1332
+ (0, react_1.useEffect)(function () {
1333
+ if (props.status !== undefined)
1334
+ setStatus(props.status);
1335
+ }, [props.status, setStatus]);
1336
+ (0, react_1.useEffect)(function () {
1337
+ if (props.pagination !== undefined)
1338
+ setPagination(props.pagination);
1339
+ }, [props.pagination, setPagination]);
1340
+ // [Group 2] Content body height (depends on layout dimensions → separate effect)
1341
+ (0, react_1.useEffect)(function () {
1342
+ if (props.height !== undefined) {
1343
+ var propsHeight = Math.max(props.height, 100);
1344
+ setHeight(propsHeight);
1345
+ var contentBodyHeight_1 = Math.max(propsHeight -
1346
+ headerHeight -
1347
+ (showBottomBar ? bottomBarHeight : 0) -
1348
+ (summary ? summaryHeight : 0) -
1349
+ containerBorderWidth * 2, 0);
1350
+ var displayItemCount = contentBodyHeight_1 > 0 ? Math.ceil(contentBodyHeight_1 / (itemHeight + itemPadding * 2)) : 0;
1351
+ setContentBodyHeight(contentBodyHeight_1);
1352
+ setDisplayItemCount(displayItemCount);
1353
+ }
1354
+ }, [
1355
+ props.height,
1356
+ height,
1357
+ headerHeight,
1358
+ showBottomBar,
1359
+ bottomBarHeight,
1360
+ containerBorderWidth,
1361
+ itemHeight,
1362
+ itemPadding,
1363
+ summary,
1364
+ summaryHeight,
1365
+ setHeight,
1366
+ setContentBodyHeight,
1367
+ setDisplayItemCount,
1368
+ ]);
1369
+ // [Group 3] Loading / spinner states
1370
+ (0, react_1.useEffect)(function () {
1371
+ if (props.loading !== undefined)
1372
+ setLoading(props.loading);
1373
+ if (props.spinning !== undefined)
1374
+ setSpinning(props.spinning);
1375
+ }, [props.loading, props.spinning, setLoading, setSpinning]);
1376
+ // [Group 4] Frozen columns
1377
+ (0, react_1.useEffect)(function () {
1378
+ var _a, _b, _c, _d;
1379
+ var frozenColumnsWidth = (0, utils_1.getFrozenColumnsWidth)({
1380
+ showLineNumber: showLineNumber,
1381
+ rowChecked: rowChecked,
1382
+ itemHeight: itemHeight,
1383
+ frozenColumnIndex: (_a = props.frozenColumnIndex) !== null && _a !== void 0 ? _a : 0,
1384
+ columns: columns,
1385
+ dataLength: data.length,
1386
+ reorderable: (_c = (_b = props.reorder) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : false,
1387
+ });
1388
+ setFrozenColumnsWidth(frozenColumnsWidth);
1389
+ setFrozenColumnIndex((_d = props.frozenColumnIndex) !== null && _d !== void 0 ? _d : 0);
1390
+ }, [
1391
+ props.frozenColumnIndex,
1392
+ (_d = props.reorder) === null || _d === void 0 ? void 0 : _d.enabled,
1393
+ showLineNumber,
1394
+ rowChecked,
1395
+ itemHeight,
1396
+ columns,
1397
+ data.length,
1398
+ setFrozenColumnsWidth,
1399
+ setFrozenColumnIndex,
1400
+ ]);
1401
+ // [Group 4-1] Frozen rows. A top summary remains a separate band above this body area.
1402
+ (0, react_1.useEffect)(function () {
1403
+ var _a, _b, _c;
1404
+ var rowCount = (_b = (_a = props.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : data.length;
1405
+ var nextFrozenRowCount = Math.min(Math.max(Math.floor((_c = props.frozenRowCount) !== null && _c !== void 0 ? _c : 0), 0), rowCount);
1406
+ setFrozenRowCount(nextFrozenRowCount);
1407
+ setFrozenRowsHeight(nextFrozenRowCount * trHeight);
1408
+ }, [data.length, (_e = props.data) === null || _e === void 0 ? void 0 : _e.length, props.frozenRowCount, setFrozenRowCount, setFrozenRowsHeight, trHeight]);
1409
+ // [Group 5] Data & columns
1410
+ (0, react_1.useEffect)(function () {
1411
+ if (props.data !== undefined &&
1412
+ props.sourceData !== undefined &&
1413
+ props.sourceIndexByVisibleIndex !== undefined &&
1414
+ props.visibleIndexBySourceIndex !== undefined) {
1415
+ setProcessedData({
1416
+ data: props.data,
1417
+ sourceData: props.sourceData,
1418
+ sourceIndexByVisibleIndex: props.sourceIndexByVisibleIndex,
1419
+ visibleIndexBySourceIndex: props.visibleIndexBySourceIndex,
1420
+ });
1421
+ }
1422
+ else if (props.data !== undefined) {
1423
+ setData(props.data);
1424
+ if (props.sourceData !== undefined) {
1425
+ setSourceData(props.sourceData);
1426
+ }
1427
+ }
1428
+ }, [
1429
+ props.data,
1430
+ props.sourceData,
1431
+ props.sourceIndexByVisibleIndex,
1432
+ props.visibleIndexBySourceIndex,
1433
+ setData,
1434
+ setProcessedData,
1435
+ setSourceData,
1436
+ ]);
1437
+ (0, react_1.useEffect)(function () {
1438
+ if (props.columns !== undefined)
1439
+ setColumns(props.columns);
1440
+ if (props.columnsGroup !== undefined)
1441
+ setColumnsGroup(props.columnsGroup);
1442
+ if (props.columnGroups !== undefined)
1443
+ setColumnGroups(props.columnGroups);
1444
+ }, [props.columnGroups, props.columns, props.columnsGroup, setColumnGroups, setColumns, setColumnsGroup]);
1445
+ // [Group 6] Row check, sort & query state
1446
+ (0, react_1.useEffect)(function () {
1447
+ if (props.checkedIndexesMap !== undefined)
1448
+ setCheckedIndexesMap(props.checkedIndexesMap);
1449
+ }, [props.checkedIndexesMap, setCheckedIndexesMap]);
1450
+ (0, react_1.useEffect)(function () {
1451
+ setRowChecked(props.rowChecked);
1452
+ setSort(props.sort);
1453
+ setSortParams(props.sortParams);
1454
+ setDataControl(props.dataControl);
1455
+ setIcons(props.icons);
1456
+ setSearchOptions(props.searchOptions);
1457
+ setContextMenuOptions(props.contextMenuOptions);
1458
+ }, [
1459
+ props.rowChecked,
1460
+ props.sort,
1461
+ props.sortParams,
1462
+ props.dataControl,
1463
+ props.icons,
1464
+ props.searchOptions,
1465
+ props.contextMenuOptions,
1466
+ setRowChecked,
1467
+ setSort,
1468
+ setSortParams,
1469
+ setDataControl,
1470
+ setIcons,
1471
+ setSearchOptions,
1472
+ setContextMenuOptions,
1473
+ ]);
1474
+ var prevDataQueryRef = (0, react_1.useRef)(props.dataQuery);
1475
+ (0, react_1.useEffect)(function () {
1476
+ var _a, _b;
1477
+ if (props.dataQuery !== undefined) {
1478
+ setDataQuery(props.dataQuery);
1479
+ var dataQueryChanged = !areDataQueriesEqual(prevDataQueryRef.current, props.dataQuery);
1480
+ if (dataQueryChanged) {
1481
+ setActiveToolbox(null);
1482
+ clearCellSelection();
1483
+ setEditItem(-1, -1);
1484
+ commitScroll(0, (_b = (_a = scrollContainerRef.current) === null || _a === void 0 ? void 0 : _a.scrollLeft) !== null && _b !== void 0 ? _b : 0);
1485
+ }
1486
+ prevDataQueryRef.current = props.dataQuery;
1487
+ }
1488
+ }, [clearCellSelection, commitScroll, props.dataQuery, setActiveToolbox, setDataQuery, setEditItem]);
1489
+ // [Group 7] Pagination
1490
+ (0, react_1.useEffect)(function () {
1491
+ var _a, _b;
1492
+ if (props.page !== undefined) {
1493
+ setPage(__assign({}, props.page));
1494
+ setDisplayPaginationLength((_b = (_a = props.page) === null || _a === void 0 ? void 0 : _a.displayPaginationLength) !== null && _b !== void 0 ? _b : 5);
1495
+ }
1496
+ }, [
1497
+ props.page,
1498
+ (_f = props.page) === null || _f === void 0 ? void 0 : _f.currentPage,
1499
+ (_g = props.page) === null || _g === void 0 ? void 0 : _g.loading,
1500
+ (_h = props.page) === null || _h === void 0 ? void 0 : _h.pageSize,
1501
+ (_j = props.page) === null || _j === void 0 ? void 0 : _j.totalPages,
1502
+ (_k = props.page) === null || _k === void 0 ? void 0 : _k.totalElements,
1503
+ (_l = props.page) === null || _l === void 0 ? void 0 : _l.onChange,
1504
+ (_m = props.page) === null || _m === void 0 ? void 0 : _m.displayPaginationLength,
1505
+ setPage,
1506
+ setDisplayPaginationLength,
1507
+ ]);
1508
+ (0, react_1.useEffect)(function () {
1509
+ resetScrollPosition('top');
1510
+ }, [resetScrollPosition, (_o = props.page) === null || _o === void 0 ? void 0 : _o.currentPage]);
1511
+ // [Group 8] Row key & selection
1512
+ (0, react_1.useEffect)(function () {
1513
+ setRowKey(props.rowKey);
1514
+ setFocusedRowKey(props.selectedRowKey);
1515
+ }, [props.rowKey, props.selectedRowKey, setRowKey, setFocusedRowKey]);
1516
+ // [Group 9] Edit options
1517
+ (0, react_1.useEffect)(function () {
1518
+ if (props.editable !== undefined)
1519
+ setEditable(props.editable);
1520
+ if (props.editTrigger !== undefined)
1521
+ setEditTrigger(props.editTrigger);
1522
+ }, [props.editable, props.editTrigger, setEditable, setEditTrigger]);
1523
+ // [Group 10] Event callbacks
1524
+ (0, react_1.useEffect)(function () {
1525
+ setOnClick(props.onClick);
1526
+ setOnChangeColumns(props.onChangeColumns);
1527
+ setOnChangeData(props.onChangeData);
1528
+ setOnLoadMore(props.onLoadMore);
1529
+ }, [
1530
+ props.onClick,
1531
+ props.onChangeColumns,
1532
+ props.onChangeData,
1533
+ props.onLoadMore,
1534
+ setOnClick,
1535
+ setOnChangeColumns,
1536
+ setOnChangeData,
1537
+ setOnLoadMore,
1538
+ ]);
1539
+ // [Group 11] Display / rendering options
1540
+ (0, react_1.useEffect)(function () {
1541
+ setShowLineNumber(props.showLineNumber);
1542
+ setMsg(props.msg);
1543
+ setRowClassName(props.getRowClassName);
1544
+ setCellMergeOptions(props.cellMergeOptions);
1545
+ setVariant(props.variant);
1546
+ setSummary(props.summary);
1547
+ setColumnSortable(props.columnSortable);
1548
+ setReorder(props.reorder);
1549
+ setClassName(props.className);
1550
+ setStyle(props.style);
1551
+ }, [
1552
+ props.showLineNumber,
1553
+ props.msg,
1554
+ props.getRowClassName,
1555
+ props.cellMergeOptions,
1556
+ props.variant,
1557
+ props.summary,
1558
+ props.columnSortable,
1559
+ props.reorder,
1560
+ props.className,
1561
+ props.style,
1562
+ setShowLineNumber,
1563
+ setMsg,
1564
+ setRowClassName,
1565
+ setCellMergeOptions,
1566
+ setVariant,
1567
+ setSummary,
1568
+ setColumnSortable,
1569
+ setReorder,
1570
+ setClassName,
1571
+ setStyle,
1572
+ ]);
1573
+ // [Group 11-1] Cell Navigation Options
1574
+ (0, react_1.useEffect)(function () {
1575
+ setCellNavigationOptions(props.cellNavigationOptions);
1576
+ }, [props.cellNavigationOptions, setCellNavigationOptions]);
1577
+ (0, react_1.useEffect)(function () {
1578
+ syncActiveCellToBounds();
1579
+ }, [
1580
+ columns.length,
1581
+ data.length,
1582
+ (_q = (_p = props.cellNavigationOptions) === null || _p === void 0 ? void 0 : _p.activeCell) === null || _q === void 0 ? void 0 : _q.columnIndex,
1583
+ (_s = (_r = props.cellNavigationOptions) === null || _r === void 0 ? void 0 : _r.activeCell) === null || _s === void 0 ? void 0 : _s.rowIndex,
1584
+ (_u = (_t = props.cellNavigationOptions) === null || _t === void 0 ? void 0 : _t.defaultActiveCell) === null || _u === void 0 ? void 0 : _u.columnIndex,
1585
+ (_w = (_v = props.cellNavigationOptions) === null || _v === void 0 ? void 0 : _v.defaultActiveCell) === null || _w === void 0 ? void 0 : _w.rowIndex,
1586
+ syncActiveCellToBounds,
1587
+ ]);
1588
+ // setInitialized + DOM event bindings
1589
+ (0, react_1.useEffect)(function () {
1590
+ setInitialized(true);
1591
+ var containerRefCurrent = containerRef.current;
1592
+ var scrollContainerRefCurrent = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current;
1593
+ if (scrollContainerRefCurrent) {
1594
+ scrollContainerRefCurrent.removeEventListener('scroll', onScroll);
1595
+ scrollContainerRefCurrent.addEventListener('scroll', onScroll, { passive: true, capture: true });
1596
+ scrollContainerRefCurrent.removeEventListener('wheel', onWheel);
1597
+ scrollContainerRefCurrent.addEventListener('wheel', onWheel, { passive: false, capture: true });
1598
+ }
1599
+ return function () {
1600
+ if (scrollRafRef.current !== null) {
1601
+ cancelAnimationFrame(scrollRafRef.current);
1602
+ scrollRafRef.current = null;
1603
+ }
1604
+ if (scrollIdleTimerRef.current !== null) {
1605
+ window.clearTimeout(scrollIdleTimerRef.current);
1606
+ scrollIdleTimerRef.current = null;
1607
+ }
1608
+ containerRefCurrent === null || containerRefCurrent === void 0 ? void 0 : containerRefCurrent.removeAttribute('data-bgrid-scrolling');
1609
+ scrollContainerRefCurrent === null || scrollContainerRefCurrent === void 0 ? void 0 : scrollContainerRefCurrent.removeEventListener('scroll', onScroll);
1610
+ scrollContainerRefCurrent === null || scrollContainerRefCurrent === void 0 ? void 0 : scrollContainerRefCurrent.removeEventListener('wheel', onWheel);
1611
+ };
1612
+ }, [onScroll, onWheel, setInitialized]);
1613
+ React.useLayoutEffect(function () {
1614
+ if (!scrollContainerRef.current)
1615
+ return;
1616
+ if (props.scrollLeft !== undefined) {
1617
+ scrollContainerRef.current.scrollLeft = props.scrollLeft;
1618
+ }
1619
+ if (props.scrollTop !== undefined) {
1620
+ scrollContainerRef.current.scrollTop = props.scrollTop;
1621
+ }
1622
+ }, [props.scrollLeft, props.scrollTop]);
1623
+ (0, react_1.useEffect)(function () {
1624
+ latestCommittedScrollRef.current = { top: scrollTop, left: scrollLeft };
1625
+ }, [scrollTop, scrollLeft]);
1626
+ (0, react_1.useEffect)(function () {
1627
+ return function () {
1628
+ clearHoveredRow();
1629
+ };
1630
+ }, [clearHoveredRow]);
1631
+ (0, react_1.useEffect)(function () {
1632
+ if (!cellSelectionEnabled)
1633
+ return;
1634
+ var handlePointerUp = function () {
1635
+ endCellSelectionDrag();
1636
+ };
1637
+ var handlePointerMove = function (evt) {
1638
+ var _a, _b;
1639
+ if (axisSelectionDragRef.current) {
1640
+ var target = ((_b = (_a = document.elementFromPoint) === null || _a === void 0 ? void 0 : _a.call(document, evt.clientX, evt.clientY)) !== null && _b !== void 0 ? _b : null);
1641
+ updateAxisSelectionByTarget(target);
1642
+ return;
1643
+ }
1644
+ if (!cellSelectionDragRef.current)
1645
+ return;
1646
+ latestPointerRef.current = { clientX: evt.clientX, clientY: evt.clientY };
1647
+ updateSelectionByPointer(evt.clientX, evt.clientY);
1648
+ if (selectionAutoScrollRafRef.current === null) {
1649
+ selectionAutoScrollRafRef.current = requestAnimationFrame(runSelectionAutoScroll);
1650
+ }
1651
+ };
1652
+ document.addEventListener('pointermove', handlePointerMove);
1653
+ document.addEventListener('pointerup', handlePointerUp);
1654
+ document.addEventListener('pointercancel', handlePointerUp);
1655
+ return function () {
1656
+ document.removeEventListener('pointermove', handlePointerMove);
1657
+ document.removeEventListener('pointerup', handlePointerUp);
1658
+ document.removeEventListener('pointercancel', handlePointerUp);
1659
+ };
1660
+ }, [
1661
+ cellSelectionEnabled,
1662
+ endCellSelectionDrag,
1663
+ runSelectionAutoScroll,
1664
+ updateAxisSelectionByTarget,
1665
+ updateSelectionByPointer,
1666
+ ]);
1667
+ (0, react_1.useEffect)(function () {
1668
+ if (cellSelectionEnabled)
1669
+ return;
1670
+ endCellSelectionDrag();
1671
+ clearCellSelection();
1672
+ }, [cellSelectionEnabled, clearCellSelection, endCellSelectionDrag]);
1673
+ var clearCellSelectionOnEscape = (_y = (_x = props.cellSelectionOptions) === null || _x === void 0 ? void 0 : _x.clearOnEscape) !== null && _y !== void 0 ? _y : true;
1674
+ var clearCellSelectionOnOutsideClick = (_0 = (_z = props.cellSelectionOptions) === null || _z === void 0 ? void 0 : _z.clearOnOutsideClick) !== null && _0 !== void 0 ? _0 : true;
1675
+ var keyboardRuntimeRef = (0, react_1.useRef)({
1676
+ activeCell: activeCell,
1677
+ cellInteractionSession: cellInteractionSession,
1678
+ cellNavigationOptions: cellNavigationOptions,
1679
+ cellSelectionEnabled: cellSelectionEnabled,
1680
+ clearCellSelection: clearCellSelection,
1681
+ clearCellSelectionOnEscape: clearCellSelectionOnEscape,
1682
+ clearCellSelectionOnOutsideClick: clearCellSelectionOnOutsideClick,
1683
+ columns: columns,
1684
+ commitScroll: commitScroll,
1685
+ copySelectedCells: copySelectedCells,
1686
+ dataLength: data.length,
1687
+ editable: editable,
1688
+ editItemIndex: editItemIndex,
1689
+ endCellSelectionDrag: endCellSelectionDrag,
1690
+ frozenColumnIndex: (_1 = props.frozenColumnIndex) !== null && _1 !== void 0 ? _1 : 0,
1691
+ frozenRowCount: frozenRowCount,
1692
+ height: height,
1693
+ handleClick: handleClick,
1694
+ moveActiveCell: moveActiveCell,
1695
+ openCellContextMenu: openCellContextMenu,
1696
+ pasteClipboardText: pasteClipboardText,
1697
+ selectAllCells: selectAllCells,
1698
+ setEditItem: setEditItem,
1699
+ requestSearchOpen: requestSearchOpen,
1700
+ searchOpen: searchOpen,
1701
+ searchOptions: searchOptions,
1702
+ trHeight: trHeight,
1703
+ viewportInsets: keyboardViewportInsets,
1704
+ });
1705
+ keyboardRuntimeRef.current = {
1706
+ activeCell: activeCell,
1707
+ cellInteractionSession: cellInteractionSession,
1708
+ cellNavigationOptions: cellNavigationOptions,
1709
+ cellSelectionEnabled: cellSelectionEnabled,
1710
+ clearCellSelection: clearCellSelection,
1711
+ clearCellSelectionOnEscape: clearCellSelectionOnEscape,
1712
+ clearCellSelectionOnOutsideClick: clearCellSelectionOnOutsideClick,
1713
+ columns: columns,
1714
+ commitScroll: commitScroll,
1715
+ copySelectedCells: copySelectedCells,
1716
+ dataLength: data.length,
1717
+ editable: editable,
1718
+ editItemIndex: editItemIndex,
1719
+ endCellSelectionDrag: endCellSelectionDrag,
1720
+ frozenColumnIndex: (_2 = props.frozenColumnIndex) !== null && _2 !== void 0 ? _2 : 0,
1721
+ frozenRowCount: frozenRowCount,
1722
+ height: height,
1723
+ handleClick: handleClick,
1724
+ moveActiveCell: moveActiveCell,
1725
+ openCellContextMenu: openCellContextMenu,
1726
+ pasteClipboardText: pasteClipboardText,
1727
+ selectAllCells: selectAllCells,
1728
+ setEditItem: setEditItem,
1729
+ requestSearchOpen: requestSearchOpen,
1730
+ searchOpen: searchOpen,
1731
+ searchOptions: searchOptions,
1732
+ trHeight: trHeight,
1733
+ viewportInsets: keyboardViewportInsets,
1734
+ };
1735
+ (0, react_1.useEffect)(function () {
1736
+ var repeatingArrowKey;
1737
+ var repeatingArrowShiftKey = false;
1738
+ var arrowRepeatFrame;
1739
+ var lastArrowRepeatTime = 0;
1740
+ var stopArrowRepeat = function () {
1741
+ repeatingArrowKey = undefined;
1742
+ if (arrowRepeatFrame !== undefined) {
1743
+ cancelAnimationFrame(arrowRepeatFrame);
1744
+ arrowRepeatFrame = undefined;
1745
+ }
1746
+ };
1747
+ var moveWithArrowKey = function (key, extendSelection, toBoundary) {
1748
+ if (toBoundary === void 0) { toBoundary = false; }
1749
+ var _a = keyboardRuntimeRef.current, activeCell = _a.activeCell, cellInteractionSession = _a.cellInteractionSession, cellNavigationOptions = _a.cellNavigationOptions, cellSelectionEnabled = _a.cellSelectionEnabled, columns = _a.columns, commitScroll = _a.commitScroll, dataLength = _a.dataLength, frozenColumnIndex = _a.frozenColumnIndex, frozenRowCount = _a.frozenRowCount, moveActiveCell = _a.moveActiveCell, trHeight = _a.trHeight, viewportInsets = _a.viewportInsets;
1750
+ var container = containerRef.current;
1751
+ var activeElement = document.activeElement;
1752
+ if (!container ||
1753
+ (activeElement !== container && !container.contains(activeElement)) ||
1754
+ cellInteractionSession ||
1755
+ (cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled) === false ||
1756
+ dataLength === 0 ||
1757
+ columns.length === 0) {
1758
+ return false;
1759
+ }
1760
+ var directionByKey = {
1761
+ ArrowUp: 'up',
1762
+ ArrowDown: 'down',
1763
+ ArrowLeft: 'left',
1764
+ ArrowRight: 'right',
1765
+ };
1766
+ var direction = directionByKey[key];
1767
+ if (!direction)
1768
+ return false;
1769
+ var nextCell = moveActiveCell(direction, {
1770
+ extendSelection: extendSelection,
1771
+ toBoundary: toBoundary,
1772
+ selectionEnabled: cellSelectionEnabled,
1773
+ });
1774
+ if (!nextCell)
1775
+ return false;
1776
+ var result = (0, coordinate_1.ensureCellVisible)({
1777
+ cell: nextCell,
1778
+ scrollContainer: scrollContainerRef.current,
1779
+ frozenColumnCount: frozenColumnIndex,
1780
+ frozenRowCount: frozenRowCount,
1781
+ columns: columns,
1782
+ rowHeight: trHeight,
1783
+ viewportInsets: viewportInsets,
1784
+ });
1785
+ if (result.didScroll) {
1786
+ commitScroll(result.scrollTop, result.scrollLeft);
1787
+ }
1788
+ return (activeCell === null || activeCell === void 0 ? void 0 : activeCell.rowIndex) !== nextCell.rowIndex || (activeCell === null || activeCell === void 0 ? void 0 : activeCell.columnIndex) !== nextCell.columnIndex;
1789
+ };
1790
+ var runArrowRepeatFrame = function (time) {
1791
+ var _a, _b;
1792
+ if (!repeatingArrowKey)
1793
+ return;
1794
+ var configuredInterval = (_b = (_a = keyboardRuntimeRef.current.cellNavigationOptions) === null || _a === void 0 ? void 0 : _a.keyRepeat) === null || _b === void 0 ? void 0 : _b.interval;
1795
+ var repeatInterval = Math.max(8, Number.isFinite(configuredInterval) ? configuredInterval : DEFAULT_KEYBOARD_NAVIGATION_REPEAT_INTERVAL);
1796
+ if (time - lastArrowRepeatTime >= repeatInterval) {
1797
+ lastArrowRepeatTime = time;
1798
+ if (!moveWithArrowKey(repeatingArrowKey, repeatingArrowShiftKey)) {
1799
+ stopArrowRepeat();
1800
+ return;
1801
+ }
1802
+ }
1803
+ arrowRepeatFrame = requestAnimationFrame(runArrowRepeatFrame);
1804
+ };
1805
+ var startArrowRepeat = function (key, extendSelection) {
1806
+ if (repeatingArrowKey === key && repeatingArrowShiftKey === extendSelection)
1807
+ return;
1808
+ stopArrowRepeat();
1809
+ repeatingArrowKey = key;
1810
+ repeatingArrowShiftKey = extendSelection;
1811
+ lastArrowRepeatTime = performance.now();
1812
+ arrowRepeatFrame = requestAnimationFrame(runArrowRepeatFrame);
1813
+ };
1814
+ var handleKeyDown = function (evt) {
1815
+ var _a, _b, _c, _d, _e;
1816
+ var _f = keyboardRuntimeRef.current, activeCell = _f.activeCell, cellInteractionSession = _f.cellInteractionSession, cellNavigationOptions = _f.cellNavigationOptions, cellSelectionEnabled = _f.cellSelectionEnabled, clearCellSelection = _f.clearCellSelection, clearCellSelectionOnEscape = _f.clearCellSelectionOnEscape, columns = _f.columns, commitScroll = _f.commitScroll, copySelectedCells = _f.copySelectedCells, dataLength = _f.dataLength, editable = _f.editable, editItemIndex = _f.editItemIndex, endCellSelectionDrag = _f.endCellSelectionDrag, frozenColumnIndex = _f.frozenColumnIndex, frozenRowCount = _f.frozenRowCount, height = _f.height, handleClick = _f.handleClick, moveActiveCell = _f.moveActiveCell, openCellContextMenu = _f.openCellContextMenu, selectAllCells = _f.selectAllCells, setEditItem = _f.setEditItem, requestSearchOpen = _f.requestSearchOpen, searchOpen = _f.searchOpen, searchOptions = _f.searchOptions, trHeight = _f.trHeight, viewportInsets = _f.viewportInsets;
1817
+ var container = containerRef.current;
1818
+ var activeElement = document.activeElement;
1819
+ if (!container || (activeElement !== container && !container.contains(activeElement)))
1820
+ return;
1821
+ var isCtrlOrMeta = evt.ctrlKey || evt.metaKey;
1822
+ var isFindShortcut = isCtrlOrMeta && evt.key.toLowerCase() === 'f';
1823
+ if (isFindShortcut && searchOptions && searchOptions.enabled !== false && searchOptions.shortcut !== false) {
1824
+ var targetInsideSearch = evt.target instanceof HTMLElement && !!evt.target.closest('.bgrid-search-popover');
1825
+ if (!cellInteractionSession && (targetInsideSearch || !isInteractiveTarget(evt.target))) {
1826
+ evt.preventDefault();
1827
+ evt.stopPropagation();
1828
+ requestSearchOpen(true, 'shortcut');
1829
+ setTimeout(function () {
1830
+ var input = container.querySelector('.bgrid-search-input');
1831
+ input === null || input === void 0 ? void 0 : input.focus({ preventScroll: true });
1832
+ input === null || input === void 0 ? void 0 : input.select();
1833
+ }, searchOpen ? 0 : 1);
1834
+ return;
1835
+ }
1836
+ }
1837
+ if (isInteractiveTarget(evt.target))
1838
+ return;
1839
+ var isShift = evt.shiftKey;
1840
+ if (!cellInteractionSession && activeCell && (evt.key === 'ContextMenu' || (isShift && evt.key === 'F10'))) {
1841
+ var targetCell = container.querySelector("td[data-bgrid-cell=\"true\"][data-row-index=\"".concat(activeCell.rowIndex, "\"][data-column-index=\"").concat(activeCell.columnIndex, "\"]"));
1842
+ var rect = targetCell === null || targetCell === void 0 ? void 0 : targetCell.getBoundingClientRect();
1843
+ if (rect && openCellContextMenu(activeCell, rect.left + 8, rect.top + Math.min(rect.height, 20), true)) {
1844
+ evt.preventDefault();
1845
+ evt.stopPropagation();
1846
+ return;
1847
+ }
1848
+ }
1849
+ // Escape key
1850
+ if (evt.key === 'Escape' || evt.key === 'Esc') {
1851
+ if (editItemIndex !== undefined && editItemIndex >= 0) {
1852
+ evt.preventDefault();
1853
+ setEditItem(-1, -1);
1854
+ return;
1855
+ }
1856
+ if (clearCellSelectionOnEscape) {
1857
+ evt.preventDefault();
1858
+ endCellSelectionDrag();
1859
+ clearCellSelection();
1860
+ return;
1861
+ }
1862
+ }
1863
+ // Ctrl/Cmd + A, Ctrl/Cmd + C
1864
+ if (isCtrlOrMeta) {
1865
+ var key = evt.key.toLowerCase();
1866
+ if (key === 'a') {
1867
+ if (!selectAllCells())
1868
+ return;
1869
+ evt.preventDefault();
1870
+ return;
1871
+ }
1872
+ if (key === 'c') {
1873
+ evt.preventDefault();
1874
+ void copySelectedCells();
1875
+ return;
1876
+ }
1877
+ }
1878
+ // Cell Navigation
1879
+ var navEnabled = (_a = cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.enabled) !== null && _a !== void 0 ? _a : true;
1880
+ if (navEnabled && dataLength > 0 && columns.length > 0) {
1881
+ var curCell = activeCell !== null && activeCell !== void 0 ? activeCell : { rowIndex: 0, columnIndex: 0 };
1882
+ // F2: Start editing
1883
+ if (evt.key === 'F2') {
1884
+ var col = columns[curCell.columnIndex];
1885
+ if (editable && (col === null || col === void 0 ? void 0 : col.editable) !== false) {
1886
+ evt.preventDefault();
1887
+ setEditItem(curCell.rowIndex, curCell.columnIndex);
1888
+ return;
1889
+ }
1890
+ }
1891
+ // Enter edits an editable cell; otherwise it activates the cell.
1892
+ if (evt.key === 'Enter') {
1893
+ var col = columns[curCell.columnIndex];
1894
+ var editOnEnter = (_b = cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.editOnEnter) !== null && _b !== void 0 ? _b : true;
1895
+ if (editOnEnter &&
1896
+ editable &&
1897
+ (col === null || col === void 0 ? void 0 : col.editable) !== false &&
1898
+ (editItemIndex === undefined || editItemIndex < 0)) {
1899
+ evt.preventDefault();
1900
+ setEditItem(curCell.rowIndex, curCell.columnIndex);
1901
+ return;
1902
+ }
1903
+ evt.preventDefault();
1904
+ handleClick(curCell.rowIndex, curCell.columnIndex);
1905
+ return;
1906
+ }
1907
+ // Space activates the current cell without changing focus or edit state.
1908
+ if (evt.key === ' ' || evt.key === 'Spacebar') {
1909
+ evt.preventDefault();
1910
+ handleClick(curCell.rowIndex, curCell.columnIndex);
1911
+ return;
1912
+ }
1913
+ // Tab / Shift+Tab
1914
+ if (evt.key === 'Tab') {
1915
+ evt.preventDefault();
1916
+ var nextCell = moveActiveCell(isShift ? 'prev' : 'next', {
1917
+ extendSelection: false,
1918
+ selectionEnabled: cellSelectionEnabled,
1919
+ });
1920
+ if (nextCell) {
1921
+ var result = (0, coordinate_1.ensureCellVisible)({
1922
+ cell: nextCell,
1923
+ scrollContainer: scrollContainerRef.current,
1924
+ frozenColumnCount: frozenColumnIndex,
1925
+ frozenRowCount: frozenRowCount,
1926
+ columns: columns,
1927
+ rowHeight: trHeight,
1928
+ viewportInsets: viewportInsets,
1929
+ });
1930
+ if (result.didScroll) {
1931
+ commitScroll(result.scrollTop, result.scrollLeft);
1932
+ }
1933
+ }
1934
+ return;
1935
+ }
1936
+ // Arrow keys
1937
+ if (evt.key === 'ArrowUp' || evt.key === 'ArrowDown' || evt.key === 'ArrowLeft' || evt.key === 'ArrowRight') {
1938
+ evt.preventDefault();
1939
+ var customRepeatEnabled = (_d = (_c = cellNavigationOptions === null || cellNavigationOptions === void 0 ? void 0 : cellNavigationOptions.keyRepeat) === null || _c === void 0 ? void 0 : _c.enabled) !== null && _d !== void 0 ? _d : true;
1940
+ if (evt.repeat && customRepeatEnabled && !isCtrlOrMeta) {
1941
+ if (!repeatingArrowKey) {
1942
+ moveWithArrowKey(evt.key, isShift);
1943
+ startArrowRepeat(evt.key, isShift);
1944
+ }
1945
+ else if (repeatingArrowKey === evt.key) {
1946
+ repeatingArrowShiftKey = isShift;
1947
+ }
1948
+ return;
1949
+ }
1950
+ stopArrowRepeat();
1951
+ moveWithArrowKey(evt.key, isShift, isCtrlOrMeta);
1952
+ return;
1953
+ }
1954
+ // Home / End
1955
+ if (evt.key === 'Home' || evt.key === 'End') {
1956
+ evt.preventDefault();
1957
+ var direction = evt.key === 'Home' ? 'home' : 'end';
1958
+ var nextCell = moveActiveCell(direction, {
1959
+ extendSelection: isShift,
1960
+ toBoundary: isCtrlOrMeta,
1961
+ selectionEnabled: cellSelectionEnabled,
1962
+ });
1963
+ if (nextCell) {
1964
+ var result = (0, coordinate_1.ensureCellVisible)({
1965
+ cell: nextCell,
1966
+ scrollContainer: scrollContainerRef.current,
1967
+ frozenColumnCount: frozenColumnIndex,
1968
+ frozenRowCount: frozenRowCount,
1969
+ columns: columns,
1970
+ rowHeight: trHeight,
1971
+ viewportInsets: viewportInsets,
1972
+ });
1973
+ if (result.didScroll) {
1974
+ commitScroll(result.scrollTop, result.scrollLeft);
1975
+ }
1976
+ }
1977
+ return;
1978
+ }
1979
+ // PageUp / PageDown
1980
+ if (evt.key === 'PageUp' || evt.key === 'PageDown') {
1981
+ evt.preventDefault();
1982
+ var direction = evt.key === 'PageUp' ? 'pageUp' : 'pageDown';
1983
+ var visibleBodyHeight = Math.max(0, (((_e = scrollContainerRef.current) === null || _e === void 0 ? void 0 : _e.clientHeight) || height) - viewportInsets.bottom);
1984
+ var pageSize = Math.max(1, Math.floor(visibleBodyHeight / trHeight));
1985
+ var nextCell = moveActiveCell(direction, {
1986
+ extendSelection: isShift,
1987
+ pageSize: pageSize,
1988
+ selectionEnabled: cellSelectionEnabled,
1989
+ });
1990
+ if (nextCell) {
1991
+ var result = (0, coordinate_1.ensureCellVisible)({
1992
+ cell: nextCell,
1993
+ scrollContainer: scrollContainerRef.current,
1994
+ frozenColumnCount: frozenColumnIndex,
1995
+ frozenRowCount: frozenRowCount,
1996
+ columns: columns,
1997
+ rowHeight: trHeight,
1998
+ viewportInsets: viewportInsets,
1999
+ });
2000
+ if (result.didScroll) {
2001
+ commitScroll(result.scrollTop, result.scrollLeft);
2002
+ }
2003
+ }
2004
+ return;
2005
+ }
2006
+ }
2007
+ };
2008
+ var handleKeyUp = function (evt) {
2009
+ if (evt.key === repeatingArrowKey)
2010
+ stopArrowRepeat();
2011
+ };
2012
+ var handleVisibilityChange = function () {
2013
+ if (document.visibilityState !== 'visible')
2014
+ stopArrowRepeat();
2015
+ };
2016
+ var handleCopy = function (evt) {
2017
+ var container = containerRef.current;
2018
+ var activeElement = document.activeElement;
2019
+ if (!container || (activeElement !== container && !container.contains(activeElement)))
2020
+ return;
2021
+ if (isInteractiveTarget(evt.target))
2022
+ return;
2023
+ evt.preventDefault();
2024
+ void keyboardRuntimeRef.current.copySelectedCells(evt);
2025
+ };
2026
+ var handlePaste = function (evt) {
2027
+ var _a;
2028
+ var container = containerRef.current;
2029
+ var activeElement = document.activeElement;
2030
+ if (!container || (activeElement !== container && !container.contains(activeElement)))
2031
+ return;
2032
+ if (keyboardRuntimeRef.current.editItemIndex !== undefined && keyboardRuntimeRef.current.editItemIndex >= 0) {
2033
+ return;
2034
+ }
2035
+ if (isInteractiveTarget(evt.target))
2036
+ return;
2037
+ var text = (_a = evt.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/plain');
2038
+ if (text === undefined)
2039
+ return;
2040
+ if (keyboardRuntimeRef.current.pasteClipboardText(text)) {
2041
+ evt.preventDefault();
2042
+ }
2043
+ };
2044
+ var handlePointerDown = function (evt) {
2045
+ var _a = keyboardRuntimeRef.current, clearCellSelection = _a.clearCellSelection, clearCellSelectionOnOutsideClick = _a.clearCellSelectionOnOutsideClick, endCellSelectionDrag = _a.endCellSelectionDrag;
2046
+ if (!clearCellSelectionOnOutsideClick)
2047
+ return;
2048
+ var container = containerRef.current;
2049
+ var target = evt.target;
2050
+ if (!container ||
2051
+ (target instanceof Node && container.contains(target)) ||
2052
+ isPointInsideElement(container, evt.clientX, evt.clientY)) {
2053
+ return;
2054
+ }
2055
+ endCellSelectionDrag();
2056
+ clearCellSelection();
2057
+ };
2058
+ document.addEventListener('keydown', handleKeyDown);
2059
+ document.addEventListener('keyup', handleKeyUp);
2060
+ document.addEventListener('copy', handleCopy);
2061
+ document.addEventListener('paste', handlePaste);
2062
+ document.addEventListener('pointerdown', handlePointerDown, true);
2063
+ document.addEventListener('visibilitychange', handleVisibilityChange);
2064
+ window.addEventListener('blur', stopArrowRepeat);
2065
+ return function () {
2066
+ stopArrowRepeat();
2067
+ document.removeEventListener('keydown', handleKeyDown);
2068
+ document.removeEventListener('keyup', handleKeyUp);
2069
+ document.removeEventListener('copy', handleCopy);
2070
+ document.removeEventListener('paste', handlePaste);
2071
+ document.removeEventListener('pointerdown', handlePointerDown, true);
2072
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
2073
+ window.removeEventListener('blur', stopArrowRepeat);
2074
+ };
2075
+ }, []);
2076
+ return (React.createElement(EditorPortalRoot_1.EditorPortalContext.Provider, { value: editorPortalContext },
2077
+ React.createElement(Container, { ref: containerRef, role: 'grid', style: __assign(__assign({}, style), { width: width, height: height, borderWidth: "".concat(containerBorderWidth, "px") }), className: className, tabIndex: 0, onFocus: function (event) {
2078
+ if (event.target !== event.currentTarget)
2079
+ return;
2080
+ var gateway = event.currentTarget.querySelector('[data-bgrid-text-editor-gateway="true"]');
2081
+ if (gateway instanceof HTMLInputElement) {
2082
+ gateway.focus({ preventScroll: true });
2083
+ }
2084
+ }, "data-scroll-variant": scrollbar.variant, "data-vertical-scrollbar": scrollbar.variant !== 'native' && scrollbar.vertical.visible ? 'visible' : 'hidden', "data-bgrid-cell-selection-enabled": cellSelectionEnabled ? 'true' : 'false', "data-bgrid-frozen-columns": ((_3 = props.frozenColumnIndex) !== null && _3 !== void 0 ? _3 : 0) > 0 ? 'true' : 'false' },
2085
+ scrollbar.variant !== 'native' && scrollbar.vertical.visible && (React.createElement("div", { className: 'bgrid-vertical-scrollbar-gutter', "aria-hidden": 'true' })),
2086
+ scrollbar.variant !== 'native' && scrollbar.vertical.visible && (React.createElement("div", { className: 'bgrid-vertical-scrollbar-area', style: {
2087
+ top: 0,
2088
+ bottom: showBottomBar ? bottomBarHeight : 0,
2089
+ } },
2090
+ React.createElement(scrollbar_1.CustomScrollbar, { orientation: 'vertical', variant: scrollbar.variant, metrics: scrollbarMetrics.vertical, scrollOffset: scrollTop, onScrollChange: handleScrollTopChange }))),
2091
+ React.createElement(ScrollContainer, { ref: scrollContainerRef, role: 'rfdg-scroll-container', "data-bgrid-scroll-plane": 'sticky', style: { height: scrollViewportHeight }, onPointerDownCapture: onBodyPointerDownCapture, onPointerOverCapture: onBodyPointerOverCapture, onPointerLeave: onBodyPointerLeave, onContextMenuCapture: function (event) {
2092
+ if (isInteractiveTarget(event.target))
2093
+ return;
2094
+ var cell = getCellPosition(event.target, containerRef.current);
2095
+ if (!cell)
2096
+ return;
2097
+ if (openCellContextMenu(cell, event.clientX, event.clientY, false)) {
2098
+ event.preventDefault();
2099
+ event.stopPropagation();
2100
+ }
2101
+ } },
2102
+ React.createElement(ScrollPlane, { style: { height: scrollPlaneHeight, minWidth: scrollPlaneMinWidth } },
2103
+ React.createElement(HeaderContainer, { style: { height: headerHeight, top: 0 }, role: 'rfdg-header-container' },
2104
+ (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenHeader, { style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-header' },
2105
+ React.createElement(TableHeadFrozen_1.default, { container: containerRef }))),
2106
+ React.createElement(Header, { style: { left: frozenColumnsWidth }, role: 'rfdg-header' },
2107
+ React.createElement(TableHead_1.default, { container: containerRef }))),
2108
+ summary && summary.position === 'top' && (React.createElement(SummaryContainer, { position: 'top', style: { height: summaryHeight, top: headerHeight }, role: 'rfdg-summary-container' },
2109
+ (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenSummary, { style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-summary' },
2110
+ React.createElement(TableSummaryFronzen_1.TableSummaryFrozen, { position: 'top' }))),
2111
+ React.createElement(Summary, { style: { left: frozenColumnsWidth }, role: 'rfdg-summary' },
2112
+ React.createElement(TableSummary_1.TableSummary, { position: 'top' })))),
2113
+ React.createElement("div", { className: 'bgrid-body-scroll-content', style: { height: frozenRowsHeight + visibleScrollableRows.scrollContentHeight } },
2114
+ frozenRowCount > 0 && (React.createElement("div", { className: 'bgrid-frozen-rows-layer', style: { height: frozenRowsHeight, top: stickyTopHeight }, "data-bgrid-row-band": 'frozen' },
2115
+ (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement("div", { className: 'bgrid-frozen-rows-left bgrid-frozen-column-boundary', style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-rows-left' },
2116
+ React.createElement(TableBodyFrozen_1.default, { scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top-frozen', quadrant: 'top-left', allowRowReorder: false }),
2117
+ renderSelectionOverlay('top-left'))),
2118
+ React.createElement("div", { className: 'bgrid-frozen-rows-main', style: { left: frozenColumnsWidth }, role: 'rfdg-frozen-rows-main' },
2119
+ React.createElement(TableBody_1.default, { scrollContainerRef: scrollContainerRef, rowRange: frozenRowRange, role: 'rfdg-body-top', quadrant: 'top-main', allowRowReorder: false }),
2120
+ renderSelectionOverlay('top-main')))),
2121
+ React.createElement("div", { className: 'bgrid-scrollable-rows-layer', style: { height: visibleScrollableRows.scrollContentHeight }, "data-bgrid-row-band": 'scrollable' },
2122
+ (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenScrollContent, { style: {
2123
+ width: frozenColumnsWidth,
2124
+ height: visibleScrollableRows.scrollContentHeight,
2125
+ }, role: 'rfdg-frozen-scroll-container' },
2126
+ React.createElement(TableBodyFrozen_1.default, { scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, style: frozenScrollableBodyStyle, quadrant: 'body-left', onRowReorderPointerDown: rowReorderController.onPointerDown, onRowReorderKeyDown: rowReorderController.onKeyDown }),
2127
+ renderSelectionOverlay('body-left'))),
2128
+ React.createElement(ScrollContent, { style: {
2129
+ left: frozenColumnsWidth,
2130
+ paddingTop: visibleScrollableRows.paddingTop,
2131
+ height: visibleScrollableRows.scrollContentHeight,
2132
+ } },
2133
+ React.createElement(TableBody_1.default, { scrollContainerRef: scrollContainerRef, rowRange: scrollableRowRange, quadrant: 'body-main' }),
2134
+ renderSelectionOverlay('body-main')))),
2135
+ summary && summary.position === 'bottom' && (React.createElement(SummaryContainer, { position: 'bottom', style: { height: summaryHeight, bottom: 0 }, role: 'rfdg-summary-container' },
2136
+ (frozenColumnsWidth !== null && frozenColumnsWidth !== void 0 ? frozenColumnsWidth : 0) > 0 && (React.createElement(FrozenSummary, { style: { width: frozenColumnsWidth }, role: 'rfdg-frozen-summary' },
2137
+ React.createElement(TableSummaryFronzen_1.TableSummaryFrozen, { position: 'bottom' }))),
2138
+ React.createElement(Summary, { style: { left: frozenColumnsWidth }, role: 'rfdg-summary' },
2139
+ React.createElement(TableSummary_1.TableSummary, { position: 'bottom' })))))),
2140
+ React.createElement(BodyViewport, { ref: bodyContainerRef, style: { top: stickyTopHeight, height: contentBodyHeight }, "data-last": !page ? 'true' : undefined },
2141
+ ((_4 = rowReorderController.preview) === null || _4 === void 0 ? void 0 : _4.visible) && (React.createElement("div", { className: 'bgrid-row-reorder-preview', "data-bgrid-row-reorder-phase": rowReorderController.preview.phase, "aria-hidden": 'true' }, rowReorderController.preview.text)),
2142
+ React.createElement(Loading_1.default, { active: !!spinning, size: 'small' })),
2143
+ React.createElement("div", { className: 'bgrid-visually-hidden', role: 'status', "aria-live": 'polite', "aria-atomic": 'true' }, rowReorderController.announcement),
2144
+ React.createElement(CellTextEditorGateway_1.CellTextEditorGateway, { containerRef: containerRef }),
2145
+ React.createElement(CellNavigationDomSync_1.CellNavigationDomSync, { containerRef: containerRef, activeCell: activeLogicalCell === null || activeLogicalCell === void 0 ? void 0 : activeLogicalCell.cell, cellSelectionRanges: cellSelectionRanges, hasMultiCellSelection: hasMultiCellSelection, rowCount: data.length, columnCount: columns.length }),
2146
+ (searchSurfaceEnabled || contextMenuSurfaceEnabled) && (React.createElement(React.Suspense, { fallback: null },
2147
+ React.createElement(LazyGridOptionalSurfaces, { gridRef: containerRef, searchPopoverRef: searchPopoverRef, searchEnabled: searchSurfaceEnabled, contextMenuEnabled: contextMenuSurfaceEnabled }))),
2148
+ React.createElement(EditorPortalRoot_1.EditorPortalRoot, { gridRef: containerRef, portalRef: editorPortalRef }),
2149
+ showBottomBar && (React.createElement(FooterContainer, { style: { height: bottomBarHeight }, role: 'rfdg-footer-container' },
2150
+ React.createElement(TableFooter_1.default, { horizontalMetrics: scrollbarMetrics.horizontal, scrollLeft: scrollLeft, onScrollLeftChange: handleScrollLeftChange }))),
2151
+ React.createElement(Loading_1.default, { active: loading }))));
2152
+ }
2153
+ function getAxisSelectionTarget(target, container) {
2154
+ if (!target || !container)
2155
+ return undefined;
2156
+ var lineNumberCell = target.closest('.bgrid-line-number-cell[data-row-index]');
2157
+ if (lineNumberCell instanceof HTMLElement && container.contains(lineNumberCell)) {
2158
+ var rowIndex = Number(lineNumberCell.dataset.rowIndex);
2159
+ if (Number.isFinite(rowIndex)) {
2160
+ return { axis: 'row', startIndex: rowIndex, endIndex: rowIndex };
2161
+ }
2162
+ }
2163
+ var headerCell = target.closest('[data-header-cell-type][data-column-index][data-bgrid-axis-selectable="true"]');
2164
+ if (!(headerCell instanceof HTMLTableCellElement) || !container.contains(headerCell))
2165
+ return undefined;
2166
+ if (target.closest('.bgrid-col-resizer, .bgrid-toolbox-trigger-btn'))
2167
+ return undefined;
2168
+ if (headerCell.classList.contains('drag-item') && target.closest('.bgrid-column-drag-handle'))
2169
+ return undefined;
2170
+ var columnIndex = Number(headerCell.dataset.columnIndex);
2171
+ if (!Number.isFinite(columnIndex))
2172
+ return undefined;
2173
+ var columnSpan = headerCell.dataset.headerCellType === 'group' ? Math.max(headerCell.colSpan || 1, 1) : 1;
2174
+ return {
2175
+ axis: 'column',
2176
+ startIndex: columnIndex,
2177
+ endIndex: columnIndex + columnSpan - 1,
2178
+ };
2179
+ }
2180
+ function getAxisSelectionRange(_a) {
2181
+ var axis = _a.axis, startIndex = _a.startIndex, endIndex = _a.endIndex, rowCount = _a.rowCount, columnCount = _a.columnCount;
2182
+ if (axis === 'row') {
2183
+ return {
2184
+ startRowIndex: startIndex,
2185
+ endRowIndex: endIndex,
2186
+ startColumnIndex: 0,
2187
+ endColumnIndex: Math.max(columnCount - 1, 0),
2188
+ };
2189
+ }
2190
+ return {
2191
+ startRowIndex: 0,
2192
+ endRowIndex: Math.max(rowCount - 1, 0),
2193
+ startColumnIndex: startIndex,
2194
+ endColumnIndex: endIndex,
2195
+ };
2196
+ }
2197
+ function updateAxisSelectionDragRange(dragState, activeRange) {
2198
+ var nextRanges = __spreadArray([], __read(dragState.baseRanges), false);
2199
+ nextRanges[dragState.activeRangeIndex] = activeRange;
2200
+ return nextRanges;
2201
+ }
2202
+ function getCellPosition(target, container) {
2203
+ var cell = target === null || target === void 0 ? void 0 : target.closest('td[data-bgrid-cell="true"]');
2204
+ if (!(cell instanceof HTMLElement) || !(container === null || container === void 0 ? void 0 : container.contains(cell)))
2205
+ return undefined;
2206
+ var rowIndex = Number(cell.dataset.rowIndex);
2207
+ var columnIndex = Number(cell.dataset.columnIndex);
2208
+ if (Number.isNaN(rowIndex) || Number.isNaN(columnIndex))
2209
+ return undefined;
2210
+ var rowSpan = cell instanceof HTMLTableCellElement ? Math.max(cell.rowSpan || 1, 1) : 1;
2211
+ return { rowIndex: rowIndex, columnIndex: columnIndex, rowSpan: rowSpan };
2212
+ }
2213
+ function getCellPositionFromPointer(_a) {
2214
+ var clientX = _a.clientX, clientY = _a.clientY, bodyContainer = _a.bodyContainer, scrollContainer = _a.scrollContainer, metrics = _a.metrics;
2215
+ if (!bodyContainer || !scrollContainer || metrics.columns.length === 0 || metrics.dataLength === 0)
2216
+ return undefined;
2217
+ var scrollRect = scrollContainer.getBoundingClientRect();
2218
+ var bodyRect = bodyContainer.getBoundingClientRect();
2219
+ var frozenRowsBottom = bodyRect.top + metrics.frozenRowsHeight;
2220
+ var rowIndex = metrics.frozenRowCount > 0 && clientY < frozenRowsBottom
2221
+ ? (0, coordinate_1.clamp)(Math.floor((clientY - bodyRect.top) / metrics.trHeight), 0, metrics.frozenRowCount - 1)
2222
+ : (0, coordinate_1.clamp)(metrics.frozenRowCount +
2223
+ Math.floor((scrollContainer.scrollTop +
2224
+ (0, coordinate_1.clamp)(clientY - scrollRect.top, 0, Math.max(scrollContainer.clientHeight - 1, 0))) /
2225
+ metrics.trHeight), 0, metrics.dataLength - 1);
2226
+ var columnIndex = getColumnIndexFromPointer({
2227
+ clientX: clientX,
2228
+ bodyContainer: bodyContainer,
2229
+ scrollContainer: scrollContainer,
2230
+ metrics: metrics,
2231
+ });
2232
+ if (columnIndex === undefined)
2233
+ return undefined;
2234
+ return {
2235
+ rowIndex: rowIndex,
2236
+ columnIndex: columnIndex,
2237
+ rowSpan: 1,
2238
+ };
2239
+ }
2240
+ function getColumnIndexFromPointer(_a) {
2241
+ var _b, _c, _d, _e;
2242
+ var clientX = _a.clientX, bodyContainer = _a.bodyContainer, scrollContainer = _a.scrollContainer, metrics = _a.metrics;
2243
+ var scrollRect = scrollContainer.getBoundingClientRect();
2244
+ if (clientX < scrollRect.left && metrics.frozenColumnIndex > 0) {
2245
+ var bodyRect = bodyContainer.getBoundingClientRect();
2246
+ var frozenX = (0, coordinate_1.clamp)(clientX - bodyRect.left, 0, Math.max(metrics.frozenColumnsWidth - 1, 0));
2247
+ var left = 0;
2248
+ for (var ci = 0; ci < metrics.frozenColumnIndex; ci++) {
2249
+ var width = (_c = (_b = metrics.columns[ci]) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 100;
2250
+ if (frozenX < left + width)
2251
+ return ci;
2252
+ left += width;
2253
+ }
2254
+ return Math.min(metrics.frozenColumnIndex - 1, metrics.columns.length - 1);
2255
+ }
2256
+ var normalX = scrollContainer.scrollLeft + (0, coordinate_1.clamp)(clientX - scrollRect.left, 0, Math.max(scrollContainer.clientWidth - 1, 0));
2257
+ for (var ci = metrics.frozenColumnIndex; ci < metrics.columns.length; ci++) {
2258
+ var column = metrics.columns[ci];
2259
+ var left = (_d = column.left) !== null && _d !== void 0 ? _d : 0;
2260
+ var width = (_e = column.width) !== null && _e !== void 0 ? _e : 100;
2261
+ if (normalX < left + width)
2262
+ return ci;
2263
+ }
2264
+ return metrics.columns.length - 1;
2265
+ }
2266
+ function updateSelectionDragRange(dragState, activeRange) {
2267
+ var nextRanges = __spreadArray([], __read(dragState.baseRanges), false);
2268
+ nextRanges[dragState.activeRangeIndex] = activeRange;
2269
+ return nextRanges;
2270
+ }
2271
+ function getRangeFromDrag(dragState, cellPosition) {
2272
+ var isDraggingUp = cellPosition.rowIndex < dragState.startRowIndex;
2273
+ return {
2274
+ startRowIndex: isDraggingUp ? dragState.startRowIndex + dragState.startRowSpan - 1 : dragState.startRowIndex,
2275
+ startColumnIndex: dragState.startColumnIndex,
2276
+ endRowIndex: getSelectionEndRowIndex(dragState.startRowIndex, cellPosition),
2277
+ endColumnIndex: cellPosition.columnIndex,
2278
+ };
2279
+ }
2280
+ function getSelectionEndRowIndex(startRowIndex, cellPosition) {
2281
+ if (cellPosition.rowIndex < startRowIndex)
2282
+ return cellPosition.rowIndex;
2283
+ return cellPosition.rowIndex + cellPosition.rowSpan - 1;
2284
+ }
2285
+ function getSelectedCellMap(ranges, rowCount, columnCount) {
2286
+ var selectedCells = new Map();
2287
+ ranges.forEach(function (range) {
2288
+ var _a;
2289
+ var normalizedRange = (0, cellSelectionGeometry_1.normalizeCellSelectionRange)(range);
2290
+ var startRowIndex = rowCount === undefined ? normalizedRange.startRowIndex : (0, coordinate_1.clamp)(normalizedRange.startRowIndex, 0, rowCount - 1);
2291
+ var endRowIndex = rowCount === undefined ? normalizedRange.endRowIndex : (0, coordinate_1.clamp)(normalizedRange.endRowIndex, 0, rowCount - 1);
2292
+ var startColumnIndex = columnCount === undefined
2293
+ ? normalizedRange.startColumnIndex
2294
+ : (0, coordinate_1.clamp)(normalizedRange.startColumnIndex, 0, columnCount - 1);
2295
+ var endColumnIndex = columnCount === undefined
2296
+ ? normalizedRange.endColumnIndex
2297
+ : (0, coordinate_1.clamp)(normalizedRange.endColumnIndex, 0, columnCount - 1);
2298
+ if (startRowIndex > endRowIndex || startColumnIndex > endColumnIndex)
2299
+ return;
2300
+ for (var ri = startRowIndex; ri <= endRowIndex; ri++) {
2301
+ var columnIndexes = (_a = selectedCells.get(ri)) !== null && _a !== void 0 ? _a : new Set();
2302
+ for (var ci = startColumnIndex; ci <= endColumnIndex; ci++) {
2303
+ columnIndexes.add(ci);
2304
+ }
2305
+ selectedCells.set(ri, columnIndexes);
2306
+ }
2307
+ });
2308
+ return selectedCells;
2309
+ }
2310
+ function getSelectionCellCount(ranges, rowCount, columnCount) {
2311
+ if (rowCount <= 0 || columnCount <= 0)
2312
+ return 0;
2313
+ return ranges.reduce(function (count, range) {
2314
+ var normalizedRange = (0, cellSelectionGeometry_1.normalizeCellSelectionRange)(range);
2315
+ var startRowIndex = (0, coordinate_1.clamp)(normalizedRange.startRowIndex, 0, rowCount - 1);
2316
+ var endRowIndex = (0, coordinate_1.clamp)(normalizedRange.endRowIndex, 0, rowCount - 1);
2317
+ var startColumnIndex = (0, coordinate_1.clamp)(normalizedRange.startColumnIndex, 0, columnCount - 1);
2318
+ var endColumnIndex = (0, coordinate_1.clamp)(normalizedRange.endColumnIndex, 0, columnCount - 1);
2319
+ if (startRowIndex > endRowIndex || startColumnIndex > endColumnIndex)
2320
+ return count;
2321
+ return count + (endRowIndex - startRowIndex + 1) * (endColumnIndex - startColumnIndex + 1);
2322
+ }, 0);
2323
+ }
2324
+ function warnClipboardLimitExceeded(reason, actual, limit) {
2325
+ if (typeof console === 'undefined')
2326
+ return;
2327
+ if (limit === undefined || actual === undefined) {
2328
+ console.warn("[BGrid] Clipboard copy failed. reason: ".concat(reason));
2329
+ return;
2330
+ }
2331
+ console.warn("[BGrid] Clipboard copy skipped because ".concat(reason, " (").concat(actual.toLocaleString(), ") exceeds the configured limit (").concat(limit.toLocaleString(), ")."));
2332
+ }
2333
+ function warnClipboardPasteFailed(reason, actual, limit) {
2334
+ if (typeof console === 'undefined')
2335
+ return;
2336
+ if (limit === undefined || actual === undefined) {
2337
+ console.warn("[BGrid] Clipboard paste skipped. reason: ".concat(reason));
2338
+ return;
2339
+ }
2340
+ console.warn("[BGrid] Clipboard paste skipped because ".concat(reason, " (").concat(actual.toLocaleString(), ") exceeds the configured limit (").concat(limit.toLocaleString(), ")."));
2341
+ }
2342
+ function parseClipboardText(text) {
2343
+ var normalizedText = text.replace(/\r\n?/g, '\n');
2344
+ var withoutTrailingLineBreak = normalizedText.endsWith('\n') ? normalizedText.slice(0, -1) : normalizedText;
2345
+ return withoutTrailingLineBreak.split('\n').map(function (row) { return row.split('\t'); });
2346
+ }
2347
+ function setCellValueByRowKey(key, values, value) {
2348
+ if (!Array.isArray(key)) {
2349
+ values[key] = value;
2350
+ return;
2351
+ }
2352
+ var target = values;
2353
+ key.forEach(function (path, index) {
2354
+ if (index === key.length - 1) {
2355
+ target[path] = value;
2356
+ return;
2357
+ }
2358
+ if (target[path] === undefined || target[path] === null || typeof target[path] !== 'object') {
2359
+ target[path] = {};
2360
+ }
2361
+ target = target[path];
2362
+ });
2363
+ }
2364
+ function getSelectionAutoScrollDelta(clientX, clientY, bodyContainer, scrollContainer) {
2365
+ var threshold = 36;
2366
+ var maxStep = 28;
2367
+ var bodyRect = bodyContainer.getBoundingClientRect();
2368
+ var scrollRect = scrollContainer.getBoundingClientRect();
2369
+ return {
2370
+ x: getAutoScrollStep(clientX, scrollRect.left, scrollRect.right, threshold, maxStep),
2371
+ y: getAutoScrollStep(clientY, bodyRect.top, bodyRect.bottom, threshold, maxStep),
2372
+ };
2373
+ }
2374
+ function getAutoScrollStep(position, min, max, threshold, maxStep) {
2375
+ if (position < min + threshold) {
2376
+ return -Math.ceil(((0, coordinate_1.clamp)(min + threshold - position, 0, threshold * 2) / (threshold * 2)) * maxStep);
2377
+ }
2378
+ if (position > max - threshold) {
2379
+ return Math.ceil(((0, coordinate_1.clamp)(position - (max - threshold), 0, threshold * 2) / (threshold * 2)) * maxStep);
2380
+ }
2381
+ return 0;
2382
+ }
2383
+ function isInteractiveTarget(target) {
2384
+ if (!(target instanceof HTMLElement))
2385
+ return false;
2386
+ if (target.closest('[data-bgrid-text-editor-gateway="true"]'))
2387
+ return false;
2388
+ return !!target.closest('input, textarea, select, button, [contenteditable="true"], [contenteditable=""]');
2389
+ }
2390
+ function normalizeContextMenuItems(items, onDuplicateId) {
2391
+ var _a;
2392
+ var seen = new Set();
2393
+ var unique = items.filter(function (item) {
2394
+ if (seen.has(item.id)) {
2395
+ onDuplicateId(item.id);
2396
+ return false;
2397
+ }
2398
+ seen.add(item.id);
2399
+ return true;
2400
+ });
2401
+ var normalized = [];
2402
+ unique.forEach(function (item) {
2403
+ var _a;
2404
+ if (item.type === 'separator') {
2405
+ if (normalized.length === 0 || ((_a = normalized[normalized.length - 1]) === null || _a === void 0 ? void 0 : _a.type) === 'separator')
2406
+ return;
2407
+ }
2408
+ normalized.push(item);
2409
+ });
2410
+ if (((_a = normalized[normalized.length - 1]) === null || _a === void 0 ? void 0 : _a.type) === 'separator')
2411
+ normalized.pop();
2412
+ return normalized;
2413
+ }
2414
+ function areDataQueriesEqual(previous, next) {
2415
+ if (previous === next)
2416
+ return true;
2417
+ if (!previous || !next || previous.sortParams.length !== next.sortParams.length)
2418
+ return false;
2419
+ var sortParamsEqual = previous.sortParams.every(function (sort, index) {
2420
+ var candidate = next.sortParams[index];
2421
+ return (!!candidate &&
2422
+ sort.columnId === candidate.columnId &&
2423
+ sort.key === candidate.key &&
2424
+ sort.index === candidate.index &&
2425
+ sort.orderBy === candidate.orderBy);
2426
+ });
2427
+ return sortParamsEqual && areFilterParamsEqual(previous.filterParams, next.filterParams);
2428
+ }
2429
+ function areFilterParamsEqual(previous, next) {
2430
+ if (previous === next)
2431
+ return true;
2432
+ if (!previous || !next || previous.length !== next.length)
2433
+ return false;
2434
+ return previous.every(function (filter, index) {
2435
+ var candidate = next[index];
2436
+ if (!candidate || filter.columnId !== candidate.columnId || filter.type !== candidate.type)
2437
+ return false;
2438
+ if (!areColumnKeysEqual(filter.key, candidate.key))
2439
+ return false;
2440
+ if (filter.type === 'values' && candidate.type === 'values') {
2441
+ return (filter.values.length === candidate.values.length &&
2442
+ filter.values.every(function (value, valueIndex) { return Object.is(value, candidate.values[valueIndex]); }));
2443
+ }
2444
+ if (filter.type === 'text' && candidate.type === 'text') {
2445
+ return filter.operator === candidate.operator && filter.value === candidate.value;
2446
+ }
2447
+ if (filter.type === 'number' && candidate.type === 'number') {
2448
+ return (filter.operator === candidate.operator &&
2449
+ Object.is(filter.value, candidate.value) &&
2450
+ Object.is(filter.min, candidate.min) &&
2451
+ Object.is(filter.max, candidate.max));
2452
+ }
2453
+ return false;
2454
+ });
2455
+ }
2456
+ function areColumnKeysEqual(previous, next) {
2457
+ if (previous === next)
2458
+ return true;
2459
+ if (!Array.isArray(previous) || !Array.isArray(next) || previous.length !== next.length)
2460
+ return false;
2461
+ return previous.every(function (key, index) { return key === next[index]; });
2462
+ }
2463
+ function isPointInsideElement(element, clientX, clientY) {
2464
+ var rect = element.getBoundingClientRect();
2465
+ if (rect.width <= 0 || rect.height <= 0)
2466
+ return false;
2467
+ return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
2468
+ }
2469
+ function toClipboardText(value) {
2470
+ if (value === null || value === undefined)
2471
+ return '';
2472
+ if (typeof value === 'string')
2473
+ return value;
2474
+ if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint')
2475
+ return String(value);
2476
+ if (value instanceof Date)
2477
+ return value.toISOString();
2478
+ try {
2479
+ return JSON.stringify(value);
2480
+ }
2481
+ catch (_a) {
2482
+ return String(value);
2483
+ }
2484
+ }
2485
+ function copyTextFallback(text) {
2486
+ if (typeof document.execCommand !== 'function')
2487
+ return false;
2488
+ var textarea = document.createElement('textarea');
2489
+ textarea.value = text;
2490
+ textarea.setAttribute('readonly', 'true');
2491
+ textarea.style.position = 'fixed';
2492
+ textarea.style.left = '-9999px';
2493
+ textarea.style.top = '-9999px';
2494
+ document.body.appendChild(textarea);
2495
+ textarea.select();
2496
+ var copied = document.execCommand('copy');
2497
+ document.body.removeChild(textarea);
2498
+ return copied;
2499
+ }
2500
+ var Container = React.forwardRef(function (props, ref) {
2501
+ var _a;
2502
+ return React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-root', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') }));
2503
+ });
2504
+ function HeaderContainer(props) {
2505
+ var _a;
2506
+ return React.createElement("div", __assign({}, props, { className: ['bgrid-header-container', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') }));
2507
+ }
2508
+ var Header = React.forwardRef(function (props, ref) {
2509
+ var _a;
2510
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-header-scroll-content', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') })));
2511
+ });
2512
+ function FrozenHeader(props) {
2513
+ var _a;
2514
+ return (React.createElement("div", __assign({}, props, { className: ['bgrid-header-frozen', 'bgrid-frozen-column-boundary', (_a = props.className) !== null && _a !== void 0 ? _a : '']
2515
+ .filter(Boolean)
2516
+ .join(' ') })));
2517
+ }
2518
+ var BodyViewport = React.forwardRef(function (props, ref) {
2519
+ var _a;
2520
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-body-container', 'bgrid-body-viewport', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') })));
2521
+ });
2522
+ var ScrollContainer = React.forwardRef(function (props, ref) {
2523
+ var _a;
2524
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-scroll-container', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') })));
2525
+ });
2526
+ var ScrollPlane = React.forwardRef(function (props, ref) {
2527
+ var _a;
2528
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-scroll-plane', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') })));
2529
+ });
2530
+ var ScrollContent = React.forwardRef(function (props, ref) {
2531
+ var _a;
2532
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-scroll-content', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') })));
2533
+ });
2534
+ var FrozenScrollContent = React.forwardRef(function (props, ref) {
2535
+ var _a;
2536
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: [
2537
+ 'bgrid-frozen-body-boundary',
2538
+ 'bgrid-frozen-column-boundary',
2539
+ 'bgrid-frozen-scroll-content',
2540
+ (_a = props.className) !== null && _a !== void 0 ? _a : '',
2541
+ ]
2542
+ .filter(Boolean)
2543
+ .join(' ') })));
2544
+ });
2545
+ function FooterContainer(props) {
2546
+ var _a;
2547
+ return React.createElement("div", __assign({}, props, { className: ['bgrid-footer-container', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') }));
2548
+ }
2549
+ function SummaryContainer(_a) {
2550
+ var position = _a.position, className = _a.className, rest = __rest(_a, ["position", "className"]);
2551
+ void position;
2552
+ return React.createElement("div", __assign({}, rest, { className: ['bgrid-summary-container', className !== null && className !== void 0 ? className : ''].filter(Boolean).join(' ') }));
2553
+ }
2554
+ var Summary = React.forwardRef(function (props, ref) {
2555
+ var _a;
2556
+ return (React.createElement("div", __assign({ ref: ref }, props, { className: ['bgrid-summary-scroll-content', (_a = props.className) !== null && _a !== void 0 ? _a : ''].filter(Boolean).join(' ') })));
2557
+ });
2558
+ function FrozenSummary(props) {
2559
+ var _a;
2560
+ return (React.createElement("div", __assign({}, props, { className: ['bgrid-summary-frozen', 'bgrid-frozen-column-boundary', (_a = props.className) !== null && _a !== void 0 ? _a : '']
2561
+ .filter(Boolean)
2562
+ .join(' ') })));
2563
+ }
2564
+ ScrollContainer.displayName = 'ScrollContainer';
2565
+ ScrollPlane.displayName = 'ScrollPlane';
2566
+ ScrollContent.displayName = 'ScrollContent';
2567
+ FrozenScrollContent.displayName = 'FrozenScrollContent';
2568
+ Container.displayName = 'Container';
2569
+ BodyViewport.displayName = 'BodyViewport';
2570
+ Summary.displayName = 'Summary';
2571
+ Header.displayName = 'Header';
2572
+ exports.default = Table;