@handsontable/react-wrapper 0.0.0-next-0e9b178-20260922 → 0.0.0-next-e344f62-20260922

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.
@@ -204,17 +204,17 @@ var bulkComponentContainer = null;
204
204
  /**
205
205
  * Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
206
206
  */
207
- var AUTOSIZE_WARNING = 'Your `HotTable` configuration includes `autoRowSize`/`autoColumnSize` options, which are not compatible with ' + ' the component-based renderers`. Disable `autoRowSize` and `autoColumnSize` to prevent row and column misalignment.';
207
+ var AUTOSIZE_WARNING = 'Your `HotTable` configuration includes `autoRowSize`/`autoColumnSize` options, ' + 'which are not compatible with the component-based renderers. Disable `autoRowSize` and `autoColumnSize` to ' + 'prevent row and column misalignment.';
208
208
 
209
209
  /**
210
210
  * Warning message for the `hot-renderer` obsolete renderer passing method.
211
211
  */
212
- var OBSOLETE_HOTRENDERER_WARNING = 'Providing a component-based renderer using `hot-renderer`-annotated component is no longer supported. ' + 'Pass your component using `renderer` prop of the `HotTable` or `HotColumn` component instead.';
212
+ var OBSOLETE_HOTRENDERER_WARNING = 'Providing a component-based renderer using `hot-renderer`-annotated ' + 'component is no longer supported. Pass your component using `renderer` prop of the `HotTable` or `HotColumn` ' + 'component instead.';
213
213
 
214
214
  /**
215
215
  * Warning message for the `hot-editor` obsolete editor passing method.
216
216
  */
217
- var OBSOLETE_HOTEDITOR_WARNING = 'Providing a component-based editor using `hot-editor`-annotated component is no longer supported. ' + 'Pass your component using `editor` prop of the `HotTable` or `HotColumn` component instead.';
217
+ var OBSOLETE_HOTEDITOR_WARNING = 'Providing a component-based editor using `hot-editor`-annotated ' + 'component is no longer supported. Pass your component using `editor` prop of the `HotTable` or `HotColumn` ' + 'component instead.';
218
218
 
219
219
  /**
220
220
  * Warning message for the unexpected children of HotTable component.
@@ -245,7 +245,7 @@ var EDITOR_PORTAL_HOST_CLASSNAME = 'hot-wrapper-editor-portal-host';
245
245
  /**
246
246
  * Warning when the editor portal host cannot be moved into `rootPortalElement`.
247
247
  */
248
- 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.';
248
+ 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.';
249
249
 
250
250
  /**
251
251
  * Logs warn to the console if the `console` object is exposed.
@@ -262,6 +262,7 @@ function warn() {
262
262
  /**
263
263
  * Detect if `hot-renderer` or `hot-editor` is defined, and if so, throw an incompatibility warning.
264
264
  *
265
+ * @param {ReactNode} children Component children nodes.
265
266
  * @returns {boolean} 'true' if the warning was issued
266
267
  */
267
268
  function displayObsoleteRenderersEditorsWarning(children) {
@@ -313,7 +314,7 @@ function displayAnyChildrenWarning(children) {
313
314
  * Check the existence of elements of the provided `type` from the `HotColumn` component's children.
314
315
  *
315
316
  * @param {ReactNode} children HotTable children array.
316
- * @param {String} type Either `'hot-renderer'` or `'hot-editor'`.
317
+ * @param {string} type Either `'hot-renderer'` or `'hot-editor'`.
317
318
  * @returns {boolean} `true` if the child of that type was found, `false` otherwise.
318
319
  */
319
320
  function hasChildElementOfType(children, type) {
@@ -393,9 +394,10 @@ function createEditorPortal(doc, Editor, portalHost) {
393
394
  *
394
395
  * @param {React.ReactElement} rElement React element to be used as a base for the component.
395
396
  * @param {Document} [ownerDocument] The owner document to set the portal up into.
396
- * @param {String} portalKey The key to be used for the portal.
397
+ * @param {string} portalKey The key to be used for the portal.
397
398
  * @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
398
- * @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
399
+ * @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its
400
+ * container.
399
401
  */
400
402
  function createPortal(rElement) {
401
403
  var ownerDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
@@ -427,14 +429,15 @@ function createPortal(rElement) {
427
429
  * component.
428
430
  *
429
431
  * @param {HotTableProps} props Object containing the React element props.
430
- * @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
431
- * @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
432
- * component.
432
+ * @param {boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was
433
+ * present in the `prop` object.
434
+ * @returns {{id?: string, className: string, style: CSSProperties}} An object containing the `id`, `className`
435
+ * and `style` keys, representing the corresponding props passed to the component.
433
436
  */
434
437
  function getContainerAttributesProps(props) {
435
438
  var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
436
439
  return {
437
- id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : undefined),
440
+ id: props.id || (randomizeId ? "hot-".concat(Math.random().toString(36).substring(5)) : undefined),
438
441
  className: props.className || '',
439
442
  style: props.style || {}
440
443
  };
@@ -443,14 +446,28 @@ function getContainerAttributesProps(props) {
443
446
  /**
444
447
  * Checks if the environment that the code runs in is a browser.
445
448
  *
446
- * @returns {boolean}
449
+ * @returns {boolean} `true` when running in a browser environment.
447
450
  */
448
451
  function isCSR() {
449
452
  return typeof window !== 'undefined';
450
453
  }
454
+
455
+ /**
456
+ * Checks whether the value is an object or `null`.
457
+ *
458
+ * @param {unknown} value Value to check.
459
+ * @returns {boolean} `true` when the value is an object.
460
+ */
451
461
  function isObjectLike(value) {
452
462
  return _typeof(value) === 'object' && value !== null;
453
463
  }
464
+
465
+ /**
466
+ * Checks whether the value is a plain object (an object literal or one created with `Object.create(null)`).
467
+ *
468
+ * @param {unknown} value Value to check.
469
+ * @returns {boolean} `true` when the value is a plain object.
470
+ */
454
471
  function isPlainObject(value) {
455
472
  if (!isObjectLike(value)) {
456
473
  return false;
@@ -458,6 +475,13 @@ function isPlainObject(value) {
458
475
  var prototype = Object.getPrototypeOf(value);
459
476
  return prototype === Object.prototype || prototype === null;
460
477
  }
478
+
479
+ /**
480
+ * Checks whether the value is an array.
481
+ *
482
+ * @param {unknown} value Value to check.
483
+ * @returns {boolean} `true` when the value is an array.
484
+ */
461
485
  function isArray(value) {
462
486
  return Array.isArray(value);
463
487
  }
@@ -504,23 +528,16 @@ function areEquivalentSettingsValue(previousValue, currentValue) {
504
528
  if (previousKeys.length !== currentKeys.length) {
505
529
  return false;
506
530
  }
507
- for (var _i = 0, _previousKeys = previousKeys; _i < _previousKeys.length; _i++) {
508
- var key = _previousKeys[_i];
509
- if (!Object.prototype.hasOwnProperty.call(currentValue, key)) {
510
- return false;
511
- }
512
- if (!areEquivalentSettingsValue(previousValue[key], currentValue[key])) {
513
- return false;
514
- }
515
- }
516
- return true;
531
+ return previousKeys.every(function (key) {
532
+ return Object.prototype.hasOwnProperty.call(currentValue, key) && areEquivalentSettingsValue(previousValue[key], currentValue[key]);
533
+ });
517
534
  }
518
535
 
519
536
  /**
520
537
  * A variant of useEffect hook that does not trigger on initial mount, only updates
521
538
  *
522
- * @param effect Effect function
523
- * @param deps Effect dependencies
539
+ * @param {EffectCallback} effect Effect function
540
+ * @param {DependencyList} [deps] Effect dependencies
524
541
  */
525
542
  function useUpdateEffect(effect, deps) {
526
543
  var notInitialRender = React.useRef(false);
@@ -564,11 +581,13 @@ var SettingsMapper = /*#__PURE__*/function () {
564
581
  /**
565
582
  * Parse component settings into Handsontable-compatible settings.
566
583
  *
567
- * @param {Object} properties Object containing properties from the HotTable object.
568
- * @param {Object} additionalSettings Additional settings.
584
+ * @param {object} properties Object containing properties from the HotTable object.
585
+ * @param {object} additionalSettings Additional settings.
569
586
  * @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
570
587
  * @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
571
- * @returns {Object} Handsontable-compatible settings object.
588
+ * @param {HotTableProps} additionalSettings.prevProps The component's props before the current update.
589
+ * @param {Handsontable.GridSettings} additionalSettings.currentSettings The grid's current live settings.
590
+ * @returns {object} Handsontable-compatible settings object.
572
591
  */
573
592
  function getSettings(properties) {
574
593
  var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
@@ -597,11 +616,11 @@ var SettingsMapper = /*#__PURE__*/function () {
597
616
  return false;
598
617
  };
599
618
  var newSettings = {};
600
- for (var key in properties) {
601
- if (key !== 'children' && !shouldSkipProp(key) && properties.hasOwnProperty(key)) {
619
+ Object.keys(properties).forEach(function (key) {
620
+ if (key !== 'children' && !shouldSkipProp(key)) {
602
621
  newSettings[key] = properties[key];
603
622
  }
604
- }
623
+ });
605
624
  return newSettings;
606
625
  }
607
626
  }]);
@@ -647,7 +666,7 @@ var HotTableContextProvider = function HotTableContextProvider(_ref) {
647
666
  * overlay tables get separate portal containers for the same cell.
648
667
  *
649
668
  * @param {HTMLTableCellElement} TD The cell being rendered.
650
- * @returns {Number} The id of the table the cell belongs to.
669
+ * @returns {number} The id of the table the cell belongs to.
651
670
  */
652
671
  var getTableId = useCallback(function (TD) {
653
672
  var _TD$parentElement$par, _TD$parentElement;
@@ -758,7 +777,7 @@ var HotTableContextProvider = function HotTableContextProvider(_ref) {
758
777
  /**
759
778
  * Exposes the table context object to components
760
779
  *
761
- * @returns HotTableContext
780
+ * @returns {HotTableContextImpl} HotTableContext
762
781
  */
763
782
  function useHotTableContext() {
764
783
  return useContext(HotTableContext);
@@ -863,8 +882,11 @@ var EditorContext = /*#__PURE__*/createContext(undefined);
863
882
  * Provider of the context that exposes Handsontable-native editor instance and passes hooks object
864
883
  * for custom editor components.
865
884
  *
866
- * @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
867
- * @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
885
+ * @param {object} root0 The provider props.
886
+ * @param {Ref} root0.hooksRef Reference for component-based editor overridden hooks object.
887
+ * @param {RefObject} root0.hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
888
+ * @param {ReactNode} root0.children The provider's children.
889
+ * @returns {ReactElement} The provider component.
868
890
  */
869
891
  var EditorContextProvider = function EditorContextProvider(_ref3) {
870
892
  var hooksRef = _ref3.hooksRef,
@@ -879,7 +901,13 @@ var EditorContextProvider = function EditorContextProvider(_ref3) {
879
901
  };
880
902
  /**
881
903
  * Applies editor overlay position/dimensions to an element.
882
- * @returns true if position was applied, false if editor should close (e.g. cell no longer available).
904
+ *
905
+ * @param {HTMLElement} el The editor's main element.
906
+ * @param {EditorWithPosition} editor The editor instance.
907
+ * @param {Handsontable.Core} hot The Handsontable instance.
908
+ * @param {Element | null | undefined} td The edited cell's TD element.
909
+ * @returns {boolean} `true` if position was applied, `false` if editor should close (e.g. cell no longer
910
+ * available).
883
911
  */
884
912
  function applyEditorPosition(el, editor, hot, td) {
885
913
  var _rootWindow$pageXOffs, _rootWindow$pageYOffs;
@@ -997,6 +1025,20 @@ function useHotEditor(overriddenHooks, deps) {
997
1025
 
998
1026
  // EditorComponent props - children typed to work with JSX syntax
999
1027
 
1028
+ /**
1029
+ * Component-based editor. Renders the `children` render prop inside the editor's positioned overlay
1030
+ * and wires up its shortcuts and scroll-repositioning.
1031
+ *
1032
+ * @param {object} root0 The component props.
1033
+ * @param {Function} [root0.onPrepare] Called when the editor is prepared for a cell.
1034
+ * @param {Function} [root0.onClose] Called when the editor closes.
1035
+ * @param {Function} [root0.onOpen] Called when the editor opens.
1036
+ * @param {Function} [root0.onFocus] Called when the editor is focused.
1037
+ * @param {EditorRenderProp} [root0.children] Render prop returning the editor's UI.
1038
+ * @param {string} [root0.shortcutsGroup] The shortcuts group name to register under.
1039
+ * @param {Array} [root0.shortcuts] The editor's keyboard shortcuts.
1040
+ * @returns {React.ReactElement} The editor overlay element.
1041
+ */
1000
1042
  function EditorComponent(_ref5) {
1001
1043
  var _onPrepare = _ref5.onPrepare,
1002
1044
  _onClose = _ref5.onClose,
@@ -1004,7 +1046,7 @@ function EditorComponent(_ref5) {
1004
1046
  _onFocus = _ref5.onFocus,
1005
1047
  children = _ref5.children,
1006
1048
  _ref5$shortcutsGroup = _ref5.shortcutsGroup,
1007
- shortcutsGroup = _ref5$shortcutsGroup === void 0 ? "custom-editor" : _ref5$shortcutsGroup,
1049
+ shortcutsGroup = _ref5$shortcutsGroup === void 0 ? 'custom-editor' : _ref5$shortcutsGroup,
1008
1050
  shortcuts = _ref5.shortcuts;
1009
1051
  var mainElementRef = useRef(null);
1010
1052
  var currentValue = useRef(undefined);
@@ -1016,8 +1058,10 @@ function EditorComponent(_ref5) {
1016
1058
  hotCustomEditorInstanceRef = _ref6.hotCustomEditorInstanceRef;
1017
1059
  var registerShortcuts = useCallback(function () {
1018
1060
  var _hotCustomEditorInsta8, _hotCustomEditorInsta9, _hotCustomEditorInsta0;
1019
- if (!((_hotCustomEditorInsta8 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta8 !== void 0 && _hotCustomEditorInsta8.hot)) return;
1020
- (_hotCustomEditorInsta9 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta9 === void 0 || (_hotCustomEditorInsta9 = _hotCustomEditorInsta9.hot) === null || _hotCustomEditorInsta9 === void 0 || _hotCustomEditorInsta9.getShortcutManager().setActiveContextName("editor");
1061
+ if (!((_hotCustomEditorInsta8 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta8 !== void 0 && _hotCustomEditorInsta8.hot)) {
1062
+ return;
1063
+ }
1064
+ (_hotCustomEditorInsta9 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta9 === void 0 || (_hotCustomEditorInsta9 = _hotCustomEditorInsta9.hot) === null || _hotCustomEditorInsta9 === void 0 || _hotCustomEditorInsta9.getShortcutManager().setActiveContextName('editor');
1021
1065
  var shortcutManager = (_hotCustomEditorInsta0 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta0 === void 0 || (_hotCustomEditorInsta0 = _hotCustomEditorInsta0.hot) === null || _hotCustomEditorInsta0 === void 0 ? void 0 : _hotCustomEditorInsta0.getShortcutManager();
1022
1066
  var editorContext = shortcutManager.getContext('editor');
1023
1067
  var contextConfig = {
@@ -1037,25 +1081,31 @@ function EditorComponent(_ref5) {
1037
1081
  }, event);
1038
1082
  }
1039
1083
  });
1040
- }),
1041
- //@ts-ignore
1042
- contextConfig);
1084
+ }), contextConfig);
1043
1085
  }
1044
1086
  }, [shortcuts]);
1045
1087
  var unRegisterShortcuts = useCallback(function () {
1046
1088
  var _hotCustomEditorInsta1, _hotCustomEditorInsta10;
1047
- if (!((_hotCustomEditorInsta1 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta1 !== void 0 && _hotCustomEditorInsta1.hot)) return;
1089
+ if (!((_hotCustomEditorInsta1 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta1 !== void 0 && _hotCustomEditorInsta1.hot)) {
1090
+ return;
1091
+ }
1048
1092
  var shortcutManager = (_hotCustomEditorInsta10 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta10 === void 0 || (_hotCustomEditorInsta10 = _hotCustomEditorInsta10.hot) === null || _hotCustomEditorInsta10 === void 0 ? void 0 : _hotCustomEditorInsta10.getShortcutManager();
1049
- var editorContext = shortcutManager.getContext("editor");
1093
+ var editorContext = shortcutManager.getContext('editor');
1050
1094
  editorContext.removeShortcutsByGroup(shortcutsGroup);
1051
1095
  }, [shortcuts]);
1052
1096
  var refreshDimensions = useCallback(function () {
1053
1097
  var editor = hotCustomEditorInstanceRef.current;
1054
1098
  var el = mainElementRef.current;
1055
- if (!editor || !el) return;
1099
+ if (!editor || !el) {
1100
+ return;
1101
+ }
1056
1102
  var hot = editor.hot;
1057
- if (!hot) return;
1058
- if (typeof editor.isOpened !== 'function' || !editor.isOpened()) return;
1103
+ if (!hot) {
1104
+ return;
1105
+ }
1106
+ if (typeof editor.isOpened !== 'function' || !editor.isOpened()) {
1107
+ return;
1108
+ }
1059
1109
  if (!applyEditorPosition(el, editor, hot) && typeof editor.close === 'function') {
1060
1110
  editor.close();
1061
1111
  }
@@ -1063,23 +1113,31 @@ function EditorComponent(_ref5) {
1063
1113
  var unRegisterScrollHooks = useCallback(function () {
1064
1114
  var editor = hotCustomEditorInstanceRef.current;
1065
1115
  var hot = editor === null || editor === void 0 ? void 0 : editor.hot;
1066
- if (!hot || typeof hot.removeHook !== 'function') return;
1116
+ if (!hot || typeof hot.removeHook !== 'function') {
1117
+ return;
1118
+ }
1067
1119
  hot.removeHook('afterScrollHorizontally', refreshDimensions);
1068
1120
  hot.removeHook('afterScrollVertically', refreshDimensions);
1069
1121
  }, [refreshDimensions]);
1070
1122
  var registerScrollHooks = useCallback(function () {
1071
1123
  var editor = hotCustomEditorInstanceRef.current;
1072
1124
  var hot = editor === null || editor === void 0 ? void 0 : editor.hot;
1073
- if (!hot || typeof hot.addHook !== 'function') return;
1125
+ if (!hot || typeof hot.addHook !== 'function') {
1126
+ return;
1127
+ }
1074
1128
  hot.addHook('afterScrollHorizontally', refreshDimensions);
1075
1129
  hot.addHook('afterScrollVertically', refreshDimensions);
1076
1130
  }, [refreshDimensions]);
1077
1131
  var _useHotEditor = useHotEditor({
1078
1132
  onOpen: function onOpen() {
1079
1133
  var _hotCustomEditorInsta11;
1080
- if (!mainElementRef.current) return;
1134
+ if (!mainElementRef.current) {
1135
+ return;
1136
+ }
1081
1137
  var themeName = (_hotCustomEditorInsta11 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta11 === void 0 ? void 0 : _hotCustomEditorInsta11.hot.getCurrentThemeName();
1082
- if (themeName) setThemeClassName(themeName);
1138
+ if (themeName) {
1139
+ setThemeClassName(themeName);
1140
+ }
1083
1141
  mainElementRef.current.style.display = 'block';
1084
1142
  _onOpen === null || _onOpen === void 0 || _onOpen();
1085
1143
  var el = mainElementRef.current;
@@ -1091,7 +1149,9 @@ function EditorComponent(_ref5) {
1091
1149
  registerScrollHooks();
1092
1150
  },
1093
1151
  onClose: function onClose() {
1094
- if (!mainElementRef.current) return;
1152
+ if (!mainElementRef.current) {
1153
+ return;
1154
+ }
1095
1155
  mainElementRef.current.style.display = 'none';
1096
1156
  _onClose === null || _onClose === void 0 || _onClose();
1097
1157
  unRegisterShortcuts();
@@ -1170,7 +1230,7 @@ var HotColumn = function HotColumn(props) {
1170
1230
  /**
1171
1231
  * Filter out all the internal properties and return an object with just the Handsontable-related props.
1172
1232
  *
1173
- * @returns {Object}
1233
+ * @returns {object}
1174
1234
  */
1175
1235
  var getSettingsProps = function getSettingsProps() {
1176
1236
  return Object.keys(props).filter(function (key) {
@@ -1183,6 +1243,8 @@ var HotColumn = function HotColumn(props) {
1183
1243
 
1184
1244
  /**
1185
1245
  * Create the column settings based on the data provided to the `HotColumn` component and its child components.
1246
+ *
1247
+ * @returns {object} The column settings object.
1186
1248
  */
1187
1249
  var createColumnSettings = function createColumnSettings() {
1188
1250
  var columnSettings = SettingsMapper.getSettings(getSettingsProps());
@@ -1225,21 +1287,7 @@ var HotColumn = function HotColumn(props) {
1225
1287
  }, editorPortal);
1226
1288
  };
1227
1289
 
1228
- var version="0.0.0-next-0e9b178-20260922";
1229
-
1230
- /**
1231
- * Component used to manage the renderer component portals.
1232
- */
1233
- var RenderersPortalManager = /*#__PURE__*/forwardRef(function (_, ref) {
1234
- var _useState = useState([]),
1235
- _useState2 = _slicedToArray(_useState, 2),
1236
- portals = _useState2[0],
1237
- setPortals = _useState2[1];
1238
- useImperativeHandle(ref, function () {
1239
- return setPortals;
1240
- });
1241
- return /*#__PURE__*/React.createElement(Fragment, null, portals);
1242
- });
1290
+ var version="0.0.0-next-e344f62-20260922";
1243
1291
 
1244
1292
  function getDefaultExportFromCjs (x) {
1245
1293
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -2364,6 +2412,20 @@ if (process.env.NODE_ENV !== 'production') {
2364
2412
  var propTypesExports = propTypes.exports;
2365
2413
  var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
2366
2414
 
2415
+ /**
2416
+ * Component used to manage the renderer component portals.
2417
+ */
2418
+ var RenderersPortalManager = /*#__PURE__*/forwardRef(function (_, ref) {
2419
+ var _useState = useState([]),
2420
+ _useState2 = _slicedToArray(_useState, 2),
2421
+ portals = _useState2[0],
2422
+ setPortals = _useState2[1];
2423
+ useImperativeHandle(ref, function () {
2424
+ return setPortals;
2425
+ });
2426
+ return /*#__PURE__*/React.createElement(Fragment, null, portals);
2427
+ });
2428
+
2367
2429
  var HotTableInner = /*#__PURE__*/forwardRef(function (props, ref) {
2368
2430
  /**
2369
2431
  * Reference to the Handsontable instance.
@@ -2461,16 +2523,18 @@ var HotTableInner = /*#__PURE__*/forwardRef(function (props, ref) {
2461
2523
  /**
2462
2524
  * Create a new settings object containing the column settings and global editors and renderers.
2463
2525
  *
2526
+ * @param {boolean} init `true` when called during the initial mount.
2527
+ * @param {HotTableProps} previousProps The component's props before the current update.
2464
2528
  * @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
2465
2529
  */
2466
2530
  var createNewGlobalSettings = function createNewGlobalSettings() {
2467
2531
  var _getHotInstance;
2468
2532
  var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2469
- var prevProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2533
+ var previousProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2470
2534
  var liveSettings = !isHotInstanceDestroyed() ? (_getHotInstance = getHotInstance()) === null || _getHotInstance === void 0 ? void 0 : _getHotInstance.getSettings() : undefined;
2471
2535
  var initOnlySettingKeys = (liveSettings === null || liveSettings === void 0 ? void 0 : liveSettings._initOnlySettings) || [];
2472
2536
  var newSettings = SettingsMapper.getSettings(props, {
2473
- prevProps: prevProps,
2537
+ prevProps: previousProps,
2474
2538
  isInit: init,
2475
2539
  initOnlySettingKeys: initOnlySettingKeys,
2476
2540
  currentSettings: liveSettings
@@ -2497,6 +2561,8 @@ var HotTableInner = /*#__PURE__*/forwardRef(function (props, ref) {
2497
2561
 
2498
2562
  /**
2499
2563
  * Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
2564
+ *
2565
+ * @param {Handsontable | null} hotInstance The Handsontable instance to check.
2500
2566
  */
2501
2567
  var displayAutoSizeWarning = function displayAutoSizeWarning(hotInstance) {
2502
2568
  var _hotInstance$getPlugi, _hotInstance$getPlugi2;
package/helpers.d.ts CHANGED
@@ -37,7 +37,7 @@ export declare const EDITOR_PORTAL_HOST_CLASSNAME = "hot-wrapper-editor-portal-h
37
37
  /**
38
38
  * Warning when the editor portal host cannot be moved into `rootPortalElement`.
39
39
  */
40
- export declare const 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.";
40
+ export declare const MISSING_ROOT_PORTAL_WARNING: string;
41
41
  /**
42
42
  * Logs warn to the console if the `console` object is exposed.
43
43
  *
@@ -47,6 +47,7 @@ export declare function warn(...args: any[]): void;
47
47
  /**
48
48
  * Detect if `hot-renderer` or `hot-editor` is defined, and if so, throw an incompatibility warning.
49
49
  *
50
+ * @param {ReactNode} children Component children nodes.
50
51
  * @returns {boolean} 'true' if the warning was issued
51
52
  */
52
53
  export declare function displayObsoleteRenderersEditorsWarning(children: ReactNode): boolean;
@@ -111,9 +112,10 @@ export declare function createEditorPortal(doc: Document | null, Editor: HotTabl
111
112
  *
112
113
  * @param {React.ReactElement} rElement React element to be used as a base for the component.
113
114
  * @param {Document} [ownerDocument] The owner document to set the portal up into.
114
- * @param {String} portalKey The key to be used for the portal.
115
+ * @param {string} portalKey The key to be used for the portal.
115
116
  * @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
116
- * @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
117
+ * @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its
118
+ * container.
117
119
  */
118
120
  export declare function createPortal(rElement: React.ReactElement, ownerDocument: Document | null | undefined, portalKey: string, cachedContainer?: HTMLElement): {
119
121
  portal: ReactPortal;
@@ -124,9 +126,10 @@ export declare function createPortal(rElement: React.ReactElement, ownerDocument
124
126
  * component.
125
127
  *
126
128
  * @param {HotTableProps} props Object containing the React element props.
127
- * @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
128
- * @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
129
- * component.
129
+ * @param {boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was
130
+ * present in the `prop` object.
131
+ * @returns {{id?: string, className: string, style: CSSProperties}} An object containing the `id`, `className`
132
+ * and `style` keys, representing the corresponding props passed to the component.
130
133
  */
131
134
  export declare function getContainerAttributesProps(props: HotTableProps, randomizeId?: boolean): {
132
135
  id?: string;
@@ -136,7 +139,7 @@ export declare function getContainerAttributesProps(props: HotTableProps, random
136
139
  /**
137
140
  * Checks if the environment that the code runs in is a browser.
138
141
  *
139
- * @returns {boolean}
142
+ * @returns {boolean} `true` when running in a browser environment.
140
143
  */
141
144
  export declare function isCSR(): boolean;
142
145
  /**
@@ -150,7 +153,7 @@ export declare function areEquivalentSettingsValue(previousValue: unknown, curre
150
153
  /**
151
154
  * A variant of useEffect hook that does not trigger on initial mount, only updates
152
155
  *
153
- * @param effect Effect function
154
- * @param deps Effect dependencies
156
+ * @param {EffectCallback} effect Effect function
157
+ * @param {DependencyList} [deps] Effect dependencies
155
158
  */
156
159
  export declare function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void;
package/hotEditor.d.ts CHANGED
@@ -26,8 +26,11 @@ interface EditorContextProviderProps {
26
26
  * Provider of the context that exposes Handsontable-native editor instance and passes hooks object
27
27
  * for custom editor components.
28
28
  *
29
- * @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
30
- * @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
29
+ * @param {object} root0 The provider props.
30
+ * @param {Ref} root0.hooksRef Reference for component-based editor overridden hooks object.
31
+ * @param {RefObject} root0.hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
32
+ * @param {ReactNode} root0.children The provider's children.
33
+ * @returns {ReactElement} The provider component.
31
34
  */
32
35
  export declare const EditorContextProvider: FC<EditorContextProviderProps>;
33
36
  /**
@@ -63,10 +66,24 @@ declare type EditorComponentProps = {
63
66
  preventDefault?: boolean;
64
67
  stopPropagation?: boolean;
65
68
  relativeToGroup?: string;
66
- position?: "before" | "after";
69
+ position?: 'before' | 'after';
67
70
  forwardToContext?: any;
68
71
  }[];
69
72
  };
73
+ /**
74
+ * Component-based editor. Renders the `children` render prop inside the editor's positioned overlay
75
+ * and wires up its shortcuts and scroll-repositioning.
76
+ *
77
+ * @param {object} root0 The component props.
78
+ * @param {Function} [root0.onPrepare] Called when the editor is prepared for a cell.
79
+ * @param {Function} [root0.onClose] Called when the editor closes.
80
+ * @param {Function} [root0.onOpen] Called when the editor opens.
81
+ * @param {Function} [root0.onFocus] Called when the editor is focused.
82
+ * @param {EditorRenderProp} [root0.children] Render prop returning the editor's UI.
83
+ * @param {string} [root0.shortcutsGroup] The shortcuts group name to register under.
84
+ * @param {Array} [root0.shortcuts] The editor's keyboard shortcuts.
85
+ * @returns {React.ReactElement} The editor overlay element.
86
+ */
70
87
  export declare function EditorComponent<T = any>({ onPrepare, onClose, onOpen, onFocus, children, shortcutsGroup, shortcuts, }: EditorComponentProps & {
71
88
  children?: EditorRenderProp<T>;
72
89
  }): React.ReactElement;
@@ -16,14 +16,14 @@ export interface HotTableContextImpl {
16
16
  * Sets the column settings based on information received from HotColumn.
17
17
  *
18
18
  * @param {HotTableProps} columnSettings Column settings object.
19
- * @param {Number} columnIndex Column index.
19
+ * @param {number} columnIndex Column index.
20
20
  */
21
21
  readonly emitColumnSettings: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
22
22
  /**
23
23
  * Trim the column settings array to the given length. Used to drop slots
24
24
  * left over from HotColumn children that have unmounted.
25
25
  *
26
- * @param {Number} length Target length for the column settings array.
26
+ * @param {number} length Target length for the column settings array.
27
27
  */
28
28
  readonly trimColumnSettings: (length: number) => void;
29
29
  /**
@@ -64,7 +64,7 @@ declare const HotTableContextProvider: FC<PropsWithChildren>;
64
64
  /**
65
65
  * Exposes the table context object to components
66
66
  *
67
- * @returns HotTableContext
67
+ * @returns {HotTableContextImpl} HotTableContext
68
68
  */
69
69
  declare function useHotTableContext(): HotTableContextImpl;
70
70
  export { HotTableContextProvider, useHotTableContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsontable/react-wrapper",
3
- "version": "0.0.0-next-0e9b178-20260922",
3
+ "version": "0.0.0-next-e344f62-20260922",
4
4
  "description": "Best Data Grid for React with Spreadsheet Look and Feel.",
5
5
  "author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
6
6
  "homepage": "https://handsontable.com",
@@ -72,8 +72,12 @@
72
72
  "@types/react": "^18.2.0",
73
73
  "@types/react-dom": "^18.2.0",
74
74
  "@types/react-redux": "^7.1.7",
75
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
76
+ "@typescript-eslint/parser": "^5.4.0",
75
77
  "cross-env": "^7.0.3",
76
- "handsontable": "0.0.0-next-0e9b178-20260922",
78
+ "eslint": "^8.57.1",
79
+ "eslint-plugin-react-hooks": "^4.6.0",
80
+ "handsontable": "0.0.0-next-e344f62-20260922",
77
81
  "jest": "^27.5.1",
78
82
  "jest-environment-jsdom": "^27.5.1",
79
83
  "prop-types": "^15.7.2",
@@ -88,7 +92,7 @@
88
92
  "uglify-js": "^3.4.9"
89
93
  },
90
94
  "peerDependencies": {
91
- "handsontable": "0.0.0-next-0e9b178-20260922"
95
+ "handsontable": "0.0.0-next-e344f62-20260922"
92
96
  },
93
97
  "scripts": {
94
98
  "build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min && npm run prepare:types",
@@ -98,6 +102,7 @@
98
102
  "build:min": "cross-env NODE_ENV=min rollup -c --bundleConfigAsCjs",
99
103
  "prepare:types": "node scripts/prepare-types.mjs",
100
104
  "clean": "node scripts/clean.mjs",
105
+ "lint": "eslint --ext .js,.ts,.tsx src test",
101
106
  "publish-package": "npm publish",
102
107
  "create-package": "npm pack",
103
108
  "test": "jest",
@@ -4,11 +4,13 @@ export declare class SettingsMapper {
4
4
  /**
5
5
  * Parse component settings into Handsontable-compatible settings.
6
6
  *
7
- * @param {Object} properties Object containing properties from the HotTable object.
8
- * @param {Object} additionalSettings Additional settings.
7
+ * @param {object} properties Object containing properties from the HotTable object.
8
+ * @param {object} additionalSettings Additional settings.
9
9
  * @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
10
10
  * @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
11
- * @returns {Object} Handsontable-compatible settings object.
11
+ * @param {HotTableProps} additionalSettings.prevProps The component's props before the current update.
12
+ * @param {Handsontable.GridSettings} additionalSettings.currentSettings The grid's current live settings.
13
+ * @returns {object} Handsontable-compatible settings object.
12
14
  */
13
15
  static getSettings(properties: HotTableProps, { prevProps, isInit, initOnlySettingKeys, currentSettings }?: {
14
16
  prevProps?: HotTableProps;