@handsontable/react-wrapper 0.0.0-next-21bc714-20260904 → 0.0.0-next-2de1384-20260907

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.
@@ -246,6 +246,17 @@ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component w
246
246
  */
247
247
  var DEFAULT_CLASSNAME = 'hot-wrapper-editor-container';
248
248
 
249
+ /**
250
+ * Classname for the stable host that holds React editor portals.
251
+ * Distinct from `DEFAULT_CLASSNAME` so page CSS and `querySelector` do not hit both nodes.
252
+ */
253
+ var EDITOR_PORTAL_HOST_CLASSNAME = 'hot-wrapper-editor-portal-host';
254
+
255
+ /**
256
+ * Warning when the editor portal host cannot be moved into `rootPortalElement`.
257
+ */
258
+ var MISSING_ROOT_PORTAL_WARNING = 'The React editor portal host could not be attached to `rootPortalElement`. The editor stays on `document.body` and clicks on it may fail to commit.';
259
+
249
260
  /**
250
261
  * Logs warn to the console if the `console` object is exposed.
251
262
  *
@@ -374,16 +385,17 @@ function resolveEditorSetting(editor, hotEditor) {
374
385
  *
375
386
  * @param {Document} doc Document to be used.
376
387
  * @param {ComponentType} Editor Editor component or render function.
388
+ * @param {HTMLElement} portalHost Host element to portal into. Required – do not fall back to `doc.body`.
377
389
  * @returns {ReactPortal} The portal for the editor.
378
390
  */
379
- function createEditorPortal(doc, Editor) {
380
- if (!doc || !Editor || typeof Editor === 'boolean') {
391
+ function createEditorPortal(doc, Editor, portalHost) {
392
+ if (!doc || !Editor || typeof Editor === 'boolean' || !portalHost) {
381
393
  return null;
382
394
  }
383
395
  var editorElement = /*#__PURE__*/React__default["default"].createElement(Editor, null);
384
396
  var containerProps = getContainerAttributesProps({}, false);
385
397
  containerProps.className = "".concat(DEFAULT_CLASSNAME, " ").concat(containerProps.className);
386
- return /*#__PURE__*/ReactDOM__default["default"].createPortal(/*#__PURE__*/React__default["default"].createElement("div", containerProps, editorElement), doc.body);
398
+ return /*#__PURE__*/ReactDOM__default["default"].createPortal(/*#__PURE__*/React__default["default"].createElement("div", containerProps, editorElement), portalHost);
387
399
  }
388
400
 
389
401
  /**
@@ -766,13 +778,15 @@ var HotColumnContext = /*#__PURE__*/React.createContext(undefined);
766
778
  var HotColumnContextProvider = function HotColumnContextProvider(_ref) {
767
779
  var columnIndex = _ref.columnIndex,
768
780
  getOwnerDocument = _ref.getOwnerDocument,
781
+ getEditorPortalHost = _ref.getEditorPortalHost,
769
782
  children = _ref.children;
770
783
  var contextImpl = React.useMemo(function () {
771
784
  return {
772
785
  columnIndex: columnIndex,
773
- getOwnerDocument: getOwnerDocument
786
+ getOwnerDocument: getOwnerDocument,
787
+ getEditorPortalHost: getEditorPortalHost
774
788
  };
775
- }, [columnIndex, getOwnerDocument]);
789
+ }, [columnIndex, getOwnerDocument, getEditorPortalHost]);
776
790
  return /*#__PURE__*/React__default["default"].createElement(HotColumnContext.Provider, {
777
791
  value: contextImpl
778
792
  }, children);
@@ -945,9 +959,6 @@ function useHotEditor(overriddenHooks, deps) {
945
959
  _useState4 = _slicedToArray(_useState3, 2),
946
960
  editorValue = _useState4[0],
947
961
  setEditorValue = _useState4[1];
948
-
949
- // return a deferred value that allows for optimizing performance by delaying the update of a value until the next render.
950
- var deferredValue = React.useDeferredValue(editorValue);
951
962
  React.useImperativeHandle(hooksRef, function () {
952
963
  return _objectSpread2(_objectSpread2({}, overriddenHooks), {}, {
953
964
  onOpen: function onOpen() {
@@ -963,7 +974,7 @@ function useHotEditor(overriddenHooks, deps) {
963
974
  return React.useMemo(function () {
964
975
  return {
965
976
  get value() {
966
- return deferredValue;
977
+ return editorValue;
967
978
  },
968
979
  setValue: function setValue(newValue) {
969
980
  var _hotCustomEditorInsta2;
@@ -989,7 +1000,7 @@ function useHotEditor(overriddenHooks, deps) {
989
1000
  return col !== null && col !== void 0 ? col : undefined;
990
1001
  }
991
1002
  };
992
- }, [rerenderTrigger, hotCustomEditorInstanceRef, deferredValue]);
1003
+ }, [rerenderTrigger, hotCustomEditorInstanceRef, editorValue]);
993
1004
  }
994
1005
 
995
1006
  // Render prop function type
@@ -1149,7 +1160,8 @@ var HotColumn = function HotColumn(props) {
1149
1160
  getRendererWrapper = _useHotTableContext.getRendererWrapper;
1150
1161
  var _useHotColumnContext = useHotColumnContext(),
1151
1162
  columnIndex = _useHotColumnContext.columnIndex,
1152
- getOwnerDocument = _useHotColumnContext.getOwnerDocument;
1163
+ getOwnerDocument = _useHotColumnContext.getOwnerDocument,
1164
+ getEditorPortalHost = _useHotColumnContext.getEditorPortalHost;
1153
1165
 
1154
1166
  /**
1155
1167
  * Reference to component-based editor overridden hooks object.
@@ -1210,7 +1222,7 @@ var HotColumn = function HotColumn(props) {
1210
1222
  displayAnyChildrenWarning(props.children);
1211
1223
  }
1212
1224
  });
1213
- var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
1225
+ var editorPortal = createEditorPortal(getOwnerDocument(), props.editor, getEditorPortalHost());
1214
1226
 
1215
1227
  /**
1216
1228
  * Render the portals of the editors, if there are any.
@@ -1223,7 +1235,7 @@ var HotColumn = function HotColumn(props) {
1223
1235
  }, editorPortal);
1224
1236
  };
1225
1237
 
1226
- var version="0.0.0-next-21bc714-20260904";
1238
+ var version="0.0.0-next-2de1384-20260907";
1227
1239
 
1228
1240
  /**
1229
1241
  * Component used to manage the renderer component portals.
@@ -2383,6 +2395,12 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
2383
2395
  */
2384
2396
  var globalEditorClassInstance = React.useRef(null);
2385
2397
 
2398
+ /**
2399
+ * Stable host for React editor portals. Appended to `rootPortalElement` after init
2400
+ * so core treats editor UI as inside the grid (see `#isPathWithinGrid`).
2401
+ */
2402
+ var editorPortalHostRef = React.useRef(null);
2403
+
2386
2404
  /**
2387
2405
  * Reference to the previous props object.
2388
2406
  */
@@ -2429,6 +2447,27 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
2429
2447
  return null;
2430
2448
  }, [hotElementRef]);
2431
2449
 
2450
+ /**
2451
+ * Get or create the stable editor portal host.
2452
+ *
2453
+ * @returns {HTMLElement | null} The host element, or `null` before a document is available.
2454
+ */
2455
+ var getEditorPortalHost = React.useCallback(function () {
2456
+ var doc = getOwnerDocument();
2457
+ if (!doc) {
2458
+ return null;
2459
+ }
2460
+ if (!editorPortalHostRef.current) {
2461
+ var host = doc.createElement('div');
2462
+ host.className = EDITOR_PORTAL_HOST_CLASSNAME;
2463
+ doc.body.appendChild(host);
2464
+ editorPortalHostRef.current = host;
2465
+ } else if (!editorPortalHostRef.current.isConnected) {
2466
+ doc.body.appendChild(editorPortalHostRef.current);
2467
+ }
2468
+ return editorPortalHostRef.current;
2469
+ }, [getOwnerDocument]);
2470
+
2432
2471
  /**
2433
2472
  * Create a new settings object containing the column settings and global editors and renderers.
2434
2473
  *
@@ -2509,6 +2548,15 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
2509
2548
  context.pushCellPortalsIntoPortalManager();
2510
2549
  });
2511
2550
  __hotInstance.current.init();
2551
+ var portalHost = editorPortalHostRef.current;
2552
+ var rootPortalElement = __hotInstance.current.rootPortalElement;
2553
+ if (portalHost && rootPortalElement) {
2554
+ if (portalHost.parentNode !== rootPortalElement) {
2555
+ rootPortalElement.appendChild(portalHost);
2556
+ }
2557
+ } else if (portalHost && !rootPortalElement) {
2558
+ warn(MISSING_ROOT_PORTAL_WARNING);
2559
+ }
2512
2560
  displayAutoSizeWarning(__hotInstance.current);
2513
2561
  if (!displayObsoleteRenderersEditorsWarning(props.children)) {
2514
2562
  displayChildrenOfTypeWarning(props.children, HotColumn);
@@ -2518,7 +2566,8 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
2518
2566
  * Destroy the Handsontable instance when the parent component unmounts.
2519
2567
  */
2520
2568
  return function () {
2521
- var _getHotInstance2;
2569
+ var _editorPortalHostRef$, _getHotInstance2;
2570
+ (_editorPortalHostRef$ = editorPortalHostRef.current) === null || _editorPortalHostRef$ === void 0 || _editorPortalHostRef$.remove();
2522
2571
  clearCache();
2523
2572
  (_getHotInstance2 = getHotInstance()) === null || _getHotInstance2 === void 0 || _getHotInstance2.destroy();
2524
2573
  };
@@ -2567,11 +2616,12 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
2567
2616
  return /*#__PURE__*/React__default["default"].createElement(HotColumnContextProvider, {
2568
2617
  columnIndex: columnIndex,
2569
2618
  getOwnerDocument: getOwnerDocument,
2619
+ getEditorPortalHost: getEditorPortalHost,
2570
2620
  key: columnIndex
2571
2621
  }, childNode);
2572
2622
  });
2573
2623
  var containerProps = getContainerAttributesProps(props);
2574
- var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
2624
+ var editorPortal = createEditorPortal(getOwnerDocument(), props.editor, getEditorPortalHost());
2575
2625
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", _extends({
2576
2626
  ref: hotElementRef
2577
2627
  }, containerProps, {
@@ -25,7 +25,7 @@
25
25
  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
26
  * USE OR INABILITY TO USE THIS SOFTWARE.
27
27
  *
28
- * Version: 0.0.0-next-21bc714-20260904 (built at Fri Sep 04 2026 08:50:38 GMT+0000 (Coordinated Universal Time))
28
+ * Version: 0.0.0-next-2de1384-20260907 (built at Mon Sep 07 2026 08:34:29 GMT+0000 (Coordinated Universal Time))
29
29
  */
30
30
  (function (global, factory) {
31
31
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('handsontable/base'), require('handsontable/renderers/registry'), require('handsontable/editors/registry')) :
@@ -271,6 +271,17 @@ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component w
271
271
  */
272
272
  var DEFAULT_CLASSNAME = 'hot-wrapper-editor-container';
273
273
 
274
+ /**
275
+ * Classname for the stable host that holds React editor portals.
276
+ * Distinct from `DEFAULT_CLASSNAME` so page CSS and `querySelector` do not hit both nodes.
277
+ */
278
+ var EDITOR_PORTAL_HOST_CLASSNAME = 'hot-wrapper-editor-portal-host';
279
+
280
+ /**
281
+ * Warning when the editor portal host cannot be moved into `rootPortalElement`.
282
+ */
283
+ var MISSING_ROOT_PORTAL_WARNING = 'The React editor portal host could not be attached to `rootPortalElement`. The editor stays on `document.body` and clicks on it may fail to commit.';
284
+
274
285
  /**
275
286
  * Logs warn to the console if the `console` object is exposed.
276
287
  *
@@ -399,16 +410,17 @@ function resolveEditorSetting(editor, hotEditor) {
399
410
  *
400
411
  * @param {Document} doc Document to be used.
401
412
  * @param {ComponentType} Editor Editor component or render function.
413
+ * @param {HTMLElement} portalHost Host element to portal into. Required – do not fall back to `doc.body`.
402
414
  * @returns {ReactPortal} The portal for the editor.
403
415
  */
404
- function createEditorPortal(doc, Editor) {
405
- if (!doc || !Editor || typeof Editor === 'boolean') {
416
+ function createEditorPortal(doc, Editor, portalHost) {
417
+ if (!doc || !Editor || typeof Editor === 'boolean' || !portalHost) {
406
418
  return null;
407
419
  }
408
420
  var editorElement = /*#__PURE__*/React__default["default"].createElement(Editor, null);
409
421
  var containerProps = getContainerAttributesProps({}, false);
410
422
  containerProps.className = "".concat(DEFAULT_CLASSNAME, " ").concat(containerProps.className);
411
- return /*#__PURE__*/ReactDOM__default["default"].createPortal(/*#__PURE__*/React__default["default"].createElement("div", containerProps, editorElement), doc.body);
423
+ return /*#__PURE__*/ReactDOM__default["default"].createPortal(/*#__PURE__*/React__default["default"].createElement("div", containerProps, editorElement), portalHost);
412
424
  }
413
425
 
414
426
  /**
@@ -791,13 +803,15 @@ var HotColumnContext = /*#__PURE__*/React.createContext(undefined);
791
803
  var HotColumnContextProvider = function HotColumnContextProvider(_ref) {
792
804
  var columnIndex = _ref.columnIndex,
793
805
  getOwnerDocument = _ref.getOwnerDocument,
806
+ getEditorPortalHost = _ref.getEditorPortalHost,
794
807
  children = _ref.children;
795
808
  var contextImpl = React.useMemo(function () {
796
809
  return {
797
810
  columnIndex: columnIndex,
798
- getOwnerDocument: getOwnerDocument
811
+ getOwnerDocument: getOwnerDocument,
812
+ getEditorPortalHost: getEditorPortalHost
799
813
  };
800
- }, [columnIndex, getOwnerDocument]);
814
+ }, [columnIndex, getOwnerDocument, getEditorPortalHost]);
801
815
  return /*#__PURE__*/React__default["default"].createElement(HotColumnContext.Provider, {
802
816
  value: contextImpl
803
817
  }, children);
@@ -970,9 +984,6 @@ function useHotEditor(overriddenHooks, deps) {
970
984
  _useState4 = _slicedToArray(_useState3, 2),
971
985
  editorValue = _useState4[0],
972
986
  setEditorValue = _useState4[1];
973
-
974
- // return a deferred value that allows for optimizing performance by delaying the update of a value until the next render.
975
- var deferredValue = React.useDeferredValue(editorValue);
976
987
  React.useImperativeHandle(hooksRef, function () {
977
988
  return _objectSpread2(_objectSpread2({}, overriddenHooks), {}, {
978
989
  onOpen: function onOpen() {
@@ -988,7 +999,7 @@ function useHotEditor(overriddenHooks, deps) {
988
999
  return React.useMemo(function () {
989
1000
  return {
990
1001
  get value() {
991
- return deferredValue;
1002
+ return editorValue;
992
1003
  },
993
1004
  setValue: function setValue(newValue) {
994
1005
  var _hotCustomEditorInsta2;
@@ -1014,7 +1025,7 @@ function useHotEditor(overriddenHooks, deps) {
1014
1025
  return col !== null && col !== void 0 ? col : undefined;
1015
1026
  }
1016
1027
  };
1017
- }, [rerenderTrigger, hotCustomEditorInstanceRef, deferredValue]);
1028
+ }, [rerenderTrigger, hotCustomEditorInstanceRef, editorValue]);
1018
1029
  }
1019
1030
 
1020
1031
  // Render prop function type
@@ -1174,7 +1185,8 @@ var HotColumn = function HotColumn(props) {
1174
1185
  getRendererWrapper = _useHotTableContext.getRendererWrapper;
1175
1186
  var _useHotColumnContext = useHotColumnContext(),
1176
1187
  columnIndex = _useHotColumnContext.columnIndex,
1177
- getOwnerDocument = _useHotColumnContext.getOwnerDocument;
1188
+ getOwnerDocument = _useHotColumnContext.getOwnerDocument,
1189
+ getEditorPortalHost = _useHotColumnContext.getEditorPortalHost;
1178
1190
 
1179
1191
  /**
1180
1192
  * Reference to component-based editor overridden hooks object.
@@ -1235,7 +1247,7 @@ var HotColumn = function HotColumn(props) {
1235
1247
  displayAnyChildrenWarning(props.children);
1236
1248
  }
1237
1249
  });
1238
- var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
1250
+ var editorPortal = createEditorPortal(getOwnerDocument(), props.editor, getEditorPortalHost());
1239
1251
 
1240
1252
  /**
1241
1253
  * Render the portals of the editors, if there are any.
@@ -1248,7 +1260,7 @@ var HotColumn = function HotColumn(props) {
1248
1260
  }, editorPortal);
1249
1261
  };
1250
1262
 
1251
- var version="0.0.0-next-21bc714-20260904";
1263
+ var version="0.0.0-next-2de1384-20260907";
1252
1264
 
1253
1265
  /**
1254
1266
  * Component used to manage the renderer component portals.
@@ -1381,6 +1393,12 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
1381
1393
  */
1382
1394
  var globalEditorClassInstance = React.useRef(null);
1383
1395
 
1396
+ /**
1397
+ * Stable host for React editor portals. Appended to `rootPortalElement` after init
1398
+ * so core treats editor UI as inside the grid (see `#isPathWithinGrid`).
1399
+ */
1400
+ var editorPortalHostRef = React.useRef(null);
1401
+
1384
1402
  /**
1385
1403
  * Reference to the previous props object.
1386
1404
  */
@@ -1427,6 +1445,27 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
1427
1445
  return null;
1428
1446
  }, [hotElementRef]);
1429
1447
 
1448
+ /**
1449
+ * Get or create the stable editor portal host.
1450
+ *
1451
+ * @returns {HTMLElement | null} The host element, or `null` before a document is available.
1452
+ */
1453
+ var getEditorPortalHost = React.useCallback(function () {
1454
+ var doc = getOwnerDocument();
1455
+ if (!doc) {
1456
+ return null;
1457
+ }
1458
+ if (!editorPortalHostRef.current) {
1459
+ var host = doc.createElement('div');
1460
+ host.className = EDITOR_PORTAL_HOST_CLASSNAME;
1461
+ doc.body.appendChild(host);
1462
+ editorPortalHostRef.current = host;
1463
+ } else if (!editorPortalHostRef.current.isConnected) {
1464
+ doc.body.appendChild(editorPortalHostRef.current);
1465
+ }
1466
+ return editorPortalHostRef.current;
1467
+ }, [getOwnerDocument]);
1468
+
1430
1469
  /**
1431
1470
  * Create a new settings object containing the column settings and global editors and renderers.
1432
1471
  *
@@ -1507,6 +1546,15 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
1507
1546
  context.pushCellPortalsIntoPortalManager();
1508
1547
  });
1509
1548
  __hotInstance.current.init();
1549
+ var portalHost = editorPortalHostRef.current;
1550
+ var rootPortalElement = __hotInstance.current.rootPortalElement;
1551
+ if (portalHost && rootPortalElement) {
1552
+ if (portalHost.parentNode !== rootPortalElement) {
1553
+ rootPortalElement.appendChild(portalHost);
1554
+ }
1555
+ } else if (portalHost && !rootPortalElement) {
1556
+ warn(MISSING_ROOT_PORTAL_WARNING);
1557
+ }
1510
1558
  displayAutoSizeWarning(__hotInstance.current);
1511
1559
  if (!displayObsoleteRenderersEditorsWarning(props.children)) {
1512
1560
  displayChildrenOfTypeWarning(props.children, HotColumn);
@@ -1516,7 +1564,8 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
1516
1564
  * Destroy the Handsontable instance when the parent component unmounts.
1517
1565
  */
1518
1566
  return function () {
1519
- var _getHotInstance2;
1567
+ var _editorPortalHostRef$, _getHotInstance2;
1568
+ (_editorPortalHostRef$ = editorPortalHostRef.current) === null || _editorPortalHostRef$ === void 0 || _editorPortalHostRef$.remove();
1520
1569
  clearCache();
1521
1570
  (_getHotInstance2 = getHotInstance()) === null || _getHotInstance2 === void 0 || _getHotInstance2.destroy();
1522
1571
  };
@@ -1565,11 +1614,12 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
1565
1614
  return /*#__PURE__*/React__default["default"].createElement(HotColumnContextProvider, {
1566
1615
  columnIndex: columnIndex,
1567
1616
  getOwnerDocument: getOwnerDocument,
1617
+ getEditorPortalHost: getEditorPortalHost,
1568
1618
  key: columnIndex
1569
1619
  }, childNode);
1570
1620
  });
1571
1621
  var containerProps = getContainerAttributesProps(props);
1572
- var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
1622
+ var editorPortal = createEditorPortal(getOwnerDocument(), props.editor, getEditorPortalHost());
1573
1623
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", _extends({
1574
1624
  ref: hotElementRef
1575
1625
  }, containerProps, {